Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | 2x 2x 2x 2x 9x 13x 7x 7x 13x 10x 7x 2x 2x 2x 12x 12x 12x 24x 22x 22x 22x 22x 22x 12x | import { createRequire } from "node:module";
import { McpServer } from "@modelcontextprotocol/server";
import type { IsAgentReadyClient } from "./client.js";
import { registerScanTools } from "./tools/scans.js";
import { registerRankingTools } from "./tools/rankings.js";
const require = createRequire(import.meta.url);
const { version } = require("../package.json") as { version: string };
export type Toolset = "scans" | "rankings";
const ALL_TOOLSETS: Toolset[] = ["scans", "rankings"];
export const parseToolsets = (env?: string): Set<Toolset> => {
if (!env) return new Set(ALL_TOOLSETS);
const requested = env.split(",").map((s) => s.trim().toLowerCase());
const valid = new Set<Toolset>();
for (const name of requested) {
if (ALL_TOOLSETS.includes(name as Toolset)) {
valid.add(name as Toolset);
}
}
return valid.size > 0 ? valid : new Set(ALL_TOOLSETS);
};
const INSTRUCTIONS = [
"Scan public websites for AI agent readiness with the IsAgentReady API.",
"To check a site, call scan_website with the full URL. A new scan takes 15 to 30 seconds.",
"Then call get_scan_results with the domain until the status is completed.",
"Use get_rankings to compare a site with other scanned sites.",
].join("\n");
type ToolRegisterer = (server: McpServer, client: IsAgentReadyClient) => void;
const toolsetRegistry: Record<Toolset, ToolRegisterer[]> = {
scans: [registerScanTools],
rankings: [registerRankingTools],
};
export const createServer = (
client: IsAgentReadyClient,
toolsets?: Set<Toolset>,
): McpServer => {
const server = new McpServer(
{
name: "isagentready-mcp",
title: "IsAgentReady",
version,
websiteUrl: "https://isagentready.com",
},
{ instructions: INSTRUCTIONS },
);
const enabled = toolsets ?? new Set(ALL_TOOLSETS);
const registered = new Set<ToolRegisterer>();
// Iterate the fixed list, not the user input, so tools/list has one stable order.
for (const toolset of ALL_TOOLSETS.filter((t) => enabled.has(t))) {
const registerers = toolsetRegistry[toolset];
for (const register of registerers) {
Eif (!registered.has(register)) {
registered.add(register);
register(server, client);
}
}
}
return server;
};
|