@visualsentinel/mcp-server 0.1.0 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/api-client.ts","../src/tools.ts"],"sourcesContent":["/**\n * Visual Sentinel MCP server (stdio transport).\n *\n * Run via:\n * VS_API_KEY=vs_live_... npx @visualsentinel/mcp-server\n *\n * The server registers all tools defined in `./tools.ts` with the MCP SDK\n * and answers tools/list and tools/call requests. Public tools (health,\n * DNS check, SSL check, speed test, website check) work without an API key;\n * everything else returns a clear error if VS_API_KEY is not set.\n */\n\nimport { Server } from '@modelcontextprotocol/sdk/server/index.js';\nimport { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';\nimport {\n CallToolRequestSchema,\n ListToolsRequestSchema,\n} from '@modelcontextprotocol/sdk/types.js';\n\nimport { ApiClient, VsApiError } from './api-client.js';\nimport { TOOLS, findTool } from './tools.js';\n\nconst SERVER_NAME = 'visualsentinel';\nconst SERVER_VERSION = '0.1.0';\n\nfunction toMcpToolDescriptor(tool: (typeof TOOLS)[number]) {\n return {\n name: tool.name,\n description: tool.description,\n inputSchema: tool.inputSchema,\n };\n}\n\nasync function main(): Promise<void> {\n const client = new ApiClient();\n const server = new Server(\n { name: SERVER_NAME, version: SERVER_VERSION },\n { capabilities: { tools: {} } },\n );\n\n server.setRequestHandler(ListToolsRequestSchema, async () => ({\n tools: TOOLS.map(toMcpToolDescriptor),\n }));\n\n server.setRequestHandler(CallToolRequestSchema, async (req) => {\n const tool = findTool(req.params.name);\n if (!tool) {\n return {\n isError: true,\n content: [{ type: 'text', text: `Unknown tool: ${req.params.name}` }],\n };\n }\n\n try {\n const result = await tool.handler(req.params.arguments ?? {}, client);\n return {\n content: [\n {\n type: 'text',\n text: JSON.stringify(result, null, 2),\n },\n ],\n };\n } catch (err) {\n const message = err instanceof VsApiError\n ? `Visual Sentinel API error (${err.status}): ${err.message}\\n${\n typeof err.body === 'string' ? err.body : JSON.stringify(err.body, null, 2)\n }`\n : err instanceof Error\n ? err.message\n : String(err);\n return {\n isError: true,\n content: [{ type: 'text', text: message }],\n };\n }\n });\n\n const transport = new StdioServerTransport();\n await server.connect(transport);\n}\n\nmain().catch((err) => {\n // eslint-disable-next-line no-console\n console.error('[visualsentinel-mcp-server] fatal:', err);\n process.exit(1);\n});\n","/**\n * Tiny HTTP client for the Visual Sentinel public API.\n *\n * Reads the API key from `VS_API_KEY` (or `VISUALSENTINEL_API_KEY`) once at\n * construction time. All requests are routed at `https://visualsentinel.com`\n * unless `VS_API_BASE` overrides it (useful for testing against a local\n * dev instance).\n */\n\nconst DEFAULT_BASE = 'https://visualsentinel.com';\n\nexport interface ApiClientOptions {\n apiKey?: string | undefined;\n baseUrl?: string | undefined;\n userAgent?: string;\n}\n\nexport class VsApiError extends Error {\n constructor(\n message: string,\n public readonly status: number,\n public readonly body: unknown,\n ) {\n super(message);\n this.name = 'VsApiError';\n }\n}\n\nexport class ApiClient {\n private readonly apiKey: string | undefined;\n private readonly baseUrl: string;\n private readonly userAgent: string;\n\n constructor(opts: ApiClientOptions = {}) {\n this.apiKey =\n opts.apiKey ??\n process.env.VS_API_KEY ??\n process.env.VISUALSENTINEL_API_KEY ??\n undefined;\n this.baseUrl = (opts.baseUrl ?? process.env.VS_API_BASE ?? DEFAULT_BASE).replace(\n /\\/+$/,\n '',\n );\n this.userAgent = opts.userAgent ?? '@visualsentinel/mcp-server';\n }\n\n hasApiKey(): boolean {\n return typeof this.apiKey === 'string' && this.apiKey.length > 0;\n }\n\n async request<T = unknown>(\n method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE',\n path: string,\n options: { query?: Record<string, string | number | boolean | undefined>; body?: unknown; auth?: boolean } = {},\n ): Promise<T> {\n const auth = options.auth ?? true;\n if (auth && !this.hasApiKey()) {\n throw new VsApiError(\n 'Visual Sentinel API key required. Set VS_API_KEY (https://visualsentinel.com/settings/api-keys).',\n 401,\n null,\n );\n }\n\n const url = new URL(path.startsWith('/') ? path : `/${path}`, this.baseUrl);\n if (options.query) {\n for (const [k, v] of Object.entries(options.query)) {\n if (v !== undefined && v !== null) url.searchParams.set(k, String(v));\n }\n }\n\n const headers: Record<string, string> = {\n Accept: 'application/json',\n 'User-Agent': this.userAgent,\n };\n if (auth && this.apiKey) headers['X-API-Key'] = this.apiKey;\n if (options.body !== undefined) headers['Content-Type'] = 'application/json';\n\n const res = await fetch(url, {\n method,\n headers,\n body: options.body !== undefined ? JSON.stringify(options.body) : undefined,\n });\n\n const text = await res.text();\n let parsed: unknown = null;\n if (text.length > 0) {\n try {\n parsed = JSON.parse(text);\n } catch {\n parsed = text;\n }\n }\n\n if (!res.ok) {\n throw new VsApiError(\n `Visual Sentinel API ${method} ${path} returned ${res.status}`,\n res.status,\n parsed,\n );\n }\n\n return parsed as T;\n }\n}\n","/**\n * Tool registry for the Visual Sentinel MCP server.\n *\n * Each tool wraps a single Visual Sentinel REST endpoint with a JSON Schema\n * input and a structured handler. Public-tool handlers (DNS check, SSL check,\n * speed test, website check, health) run without authentication; everything\n * else requires `VS_API_KEY`.\n */\n\nimport { ApiClient } from './api-client.js';\n\ninterface ToolInput {\n type: 'object';\n properties: Record<string, unknown>;\n required?: string[];\n additionalProperties?: boolean;\n}\n\nexport interface ToolDefinition {\n name: string;\n description: string;\n inputSchema: ToolInput;\n requiresAuth: boolean;\n handler: (args: Record<string, unknown>, client: ApiClient) => Promise<unknown>;\n}\n\nconst STR = { type: 'string' as const };\nconst NUM = { type: 'number' as const };\nconst INT = { type: 'integer' as const };\nconst BOOL = { type: 'boolean' as const };\n\nfunction pickString(args: Record<string, unknown>, key: string): string | undefined {\n const v = args[key];\n return typeof v === 'string' && v.length > 0 ? v : undefined;\n}\n\nfunction pickNumber(args: Record<string, unknown>, key: string): number | undefined {\n const v = args[key];\n return typeof v === 'number' && Number.isFinite(v) ? v : undefined;\n}\n\nfunction requireString(args: Record<string, unknown>, key: string): string {\n const v = pickString(args, key);\n if (!v) throw new Error(`Argument \"${key}\" (string) is required.`);\n return v;\n}\n\nexport const TOOLS: ToolDefinition[] = [\n // -------------------------------------------------------------------------\n // Public tools (no auth)\n // -------------------------------------------------------------------------\n {\n name: 'vs_health',\n description:\n 'Check whether Visual Sentinel itself is up. Returns the service health status. No authentication required.',\n inputSchema: {\n type: 'object',\n properties: {},\n additionalProperties: false,\n },\n requiresAuth: false,\n handler: async (_args, client) => client.request('GET', '/api/health', { auth: false }),\n },\n\n {\n name: 'vs_dns_check',\n description:\n 'Resolve DNS records (A, AAAA, MX, NS, TXT, CNAME) for a domain using Visual Sentinel\\'s public DNS lookup tool. No authentication required.',\n inputSchema: {\n type: 'object',\n properties: {\n domain: { ...STR, description: 'Domain to resolve, e.g. example.com (without protocol).' },\n recordType: {\n ...STR,\n description: 'Optional: limit to one record type. One of: A, AAAA, MX, NS, TXT, CNAME, SOA. Default: all.',\n },\n },\n required: ['domain'],\n additionalProperties: false,\n },\n requiresAuth: false,\n handler: async (args, client) =>\n client.request('GET', '/api/tools/dns-check', {\n auth: false,\n query: {\n domain: requireString(args, 'domain'),\n recordType: pickString(args, 'recordType'),\n },\n }),\n },\n\n {\n name: 'vs_ssl_check',\n description:\n 'Inspect a TLS/SSL certificate for a hostname: issuer, subject, validity dates, SAN list, key algorithm, and certificate chain. No authentication required.',\n inputSchema: {\n type: 'object',\n properties: {\n host: { ...STR, description: 'Hostname to inspect, e.g. example.com (without protocol).' },\n port: { ...INT, description: 'TCP port. Default 443.' },\n },\n required: ['host'],\n additionalProperties: false,\n },\n requiresAuth: false,\n handler: async (args, client) =>\n client.request('GET', '/api/tools/ssl-check', {\n auth: false,\n query: { host: requireString(args, 'host'), port: pickNumber(args, 'port') },\n }),\n },\n\n {\n name: 'vs_speed_test',\n description:\n 'Run a one-shot performance check against a URL: TTFB, total load time, transfer size, status code, and redirect chain. No authentication required.',\n inputSchema: {\n type: 'object',\n properties: {\n url: { ...STR, description: 'Full URL to test, including protocol (https://...).' },\n },\n required: ['url'],\n additionalProperties: false,\n },\n requiresAuth: false,\n handler: async (args, client) =>\n client.request('GET', '/api/tools/speed-test', {\n auth: false,\n query: { url: requireString(args, 'url') },\n }),\n },\n\n {\n name: 'vs_website_check',\n description:\n 'Quick health check for a URL: HTTP status, response time, server header, content snippet, and basic SSL state. No authentication required.',\n inputSchema: {\n type: 'object',\n properties: {\n url: { ...STR, description: 'Full URL to test, including protocol (https://...).' },\n },\n required: ['url'],\n additionalProperties: false,\n },\n requiresAuth: false,\n handler: async (args, client) =>\n client.request('GET', '/api/tools/website-check', {\n auth: false,\n query: { url: requireString(args, 'url') },\n }),\n },\n\n // -------------------------------------------------------------------------\n // Authenticated tools (require VS_API_KEY)\n // -------------------------------------------------------------------------\n {\n name: 'vs_monitors_list',\n description:\n 'List monitors in the authenticated organization. Optional filters narrow by status, type, or paginate.',\n inputSchema: {\n type: 'object',\n properties: {\n status: { ...STR, description: 'Filter: UP, DOWN, PAUSED, MAINTENANCE.' },\n type: {\n ...STR,\n description:\n 'Filter by monitor type: HTTP, HTTPS, KEYWORD, PING, PORT, DNS, SSL, VISUAL, CONTENT, API, GRAPHQL, WEBSOCKET.',\n },\n page: { ...INT, description: 'Page number (default 1).' },\n limit: { ...INT, description: 'Items per page (default 50, max 200).' },\n },\n additionalProperties: false,\n },\n requiresAuth: true,\n handler: async (args, client) =>\n client.request('GET', '/api/monitors', {\n query: {\n status: pickString(args, 'status'),\n type: pickString(args, 'type'),\n page: pickNumber(args, 'page'),\n limit: pickNumber(args, 'limit'),\n },\n }),\n },\n\n {\n name: 'vs_monitors_get',\n description:\n 'Fetch a single monitor by id, including its current status, last check, and configuration.',\n inputSchema: {\n type: 'object',\n properties: {\n id: { ...STR, description: 'Monitor id (cuid).' },\n },\n required: ['id'],\n additionalProperties: false,\n },\n requiresAuth: true,\n handler: async (args, client) =>\n client.request('GET', `/api/monitors/${encodeURIComponent(requireString(args, 'id'))}`),\n },\n\n {\n name: 'vs_monitors_create',\n description:\n 'Create a new monitor. Provide at least name, url, and type. Returns the created monitor including its assigned id.',\n inputSchema: {\n type: 'object',\n properties: {\n name: { ...STR, description: 'Display name for the monitor.' },\n url: { ...STR, description: 'Full URL to monitor (or hostname for PING/PORT/DNS/SSL).' },\n type: {\n ...STR,\n description:\n 'Monitor type: HTTP, HTTPS, KEYWORD, PING, PORT, DNS, SSL, VISUAL, CONTENT, API, GRAPHQL, WEBSOCKET.',\n },\n interval: { ...INT, description: 'Check interval in seconds (60, 300, 600, 1800, 3600).' },\n timeout: { ...INT, description: 'Per-check timeout in seconds (default 30).' },\n method: { ...STR, description: 'HTTP method for HTTP/HTTPS monitors (default GET).' },\n keyword: { ...STR, description: 'Keyword to assert for KEYWORD monitors.' },\n port: { ...INT, description: 'TCP port for PORT monitors.' },\n },\n required: ['name', 'url', 'type'],\n additionalProperties: false,\n },\n requiresAuth: true,\n handler: async (args, client) =>\n client.request('POST', '/api/monitors', {\n body: {\n name: requireString(args, 'name'),\n url: requireString(args, 'url'),\n type: requireString(args, 'type'),\n interval: pickNumber(args, 'interval'),\n timeout: pickNumber(args, 'timeout'),\n method: pickString(args, 'method'),\n keyword: pickString(args, 'keyword'),\n port: pickNumber(args, 'port'),\n },\n }),\n },\n\n {\n name: 'vs_monitors_check_now',\n description:\n 'Trigger an immediate check for a monitor (in addition to its scheduled cadence). Returns the freshly-collected check result.',\n inputSchema: {\n type: 'object',\n properties: {\n id: { ...STR, description: 'Monitor id.' },\n },\n required: ['id'],\n additionalProperties: false,\n },\n requiresAuth: true,\n handler: async (args, client) =>\n client.request('POST', `/api/monitors/${encodeURIComponent(requireString(args, 'id'))}/check`),\n },\n\n {\n name: 'vs_monitors_uptime',\n description:\n 'Fetch the uptime percentage and outage breakdown for a monitor over a window (default last 30 days).',\n inputSchema: {\n type: 'object',\n properties: {\n id: { ...STR, description: 'Monitor id.' },\n window: {\n ...STR,\n description: 'Window: 24h, 7d, 30d, 90d, 365d. Default 30d.',\n },\n },\n required: ['id'],\n additionalProperties: false,\n },\n requiresAuth: true,\n handler: async (args, client) =>\n client.request('GET', `/api/monitors/${encodeURIComponent(requireString(args, 'id'))}/uptime`, {\n query: { window: pickString(args, 'window') },\n }),\n },\n\n {\n name: 'vs_incidents_list',\n description:\n 'List incidents for the authenticated organization. Filter by status (OPEN/RESOLVED), monitor id, or paginate.',\n inputSchema: {\n type: 'object',\n properties: {\n status: { ...STR, description: 'OPEN or RESOLVED.' },\n monitorId: { ...STR, description: 'Filter to one monitor.' },\n page: { ...INT },\n limit: { ...INT, description: 'Default 50, max 200.' },\n },\n additionalProperties: false,\n },\n requiresAuth: true,\n handler: async (args, client) =>\n client.request('GET', '/api/incidents', {\n query: {\n status: pickString(args, 'status'),\n monitorId: pickString(args, 'monitorId'),\n page: pickNumber(args, 'page'),\n limit: pickNumber(args, 'limit'),\n },\n }),\n },\n\n {\n name: 'vs_incidents_get',\n description: 'Fetch a single incident with its full check history and root-cause hints.',\n inputSchema: {\n type: 'object',\n properties: {\n id: { ...STR, description: 'Incident id.' },\n },\n required: ['id'],\n additionalProperties: false,\n },\n requiresAuth: true,\n handler: async (args, client) =>\n client.request('GET', `/api/incidents/${encodeURIComponent(requireString(args, 'id'))}`),\n },\n\n {\n name: 'vs_alerts_list',\n description:\n 'List alerts for the authenticated organization. Filter by status (UNACKNOWLEDGED/ACKNOWLEDGED/RESOLVED) or paginate.',\n inputSchema: {\n type: 'object',\n properties: {\n status: { ...STR, description: 'UNACKNOWLEDGED, ACKNOWLEDGED, or RESOLVED.' },\n page: { ...INT },\n limit: { ...INT, description: 'Default 50, max 200.' },\n },\n additionalProperties: false,\n },\n requiresAuth: true,\n handler: async (args, client) =>\n client.request('GET', '/api/alerts', {\n query: {\n status: pickString(args, 'status'),\n page: pickNumber(args, 'page'),\n limit: pickNumber(args, 'limit'),\n },\n }),\n },\n\n {\n name: 'vs_alerts_acknowledge',\n description: 'Acknowledge an alert by id. Acknowledgement is recorded with the calling API key\\'s user.',\n inputSchema: {\n type: 'object',\n properties: {\n id: { ...STR, description: 'Alert id.' },\n note: { ...STR, description: 'Optional acknowledgement note (visible in alert history).' },\n },\n required: ['id'],\n additionalProperties: false,\n },\n requiresAuth: true,\n handler: async (args, client) =>\n client.request('POST', `/api/alerts/${encodeURIComponent(requireString(args, 'id'))}/acknowledge`, {\n body: { note: pickString(args, 'note') },\n }),\n },\n\n {\n name: 'vs_status_pages_list',\n description: 'List public-facing status pages owned by the authenticated organization.',\n inputSchema: {\n type: 'object',\n properties: {},\n additionalProperties: false,\n },\n requiresAuth: true,\n handler: async (_args, client) => client.request('GET', '/api/status-pages'),\n },\n\n {\n name: 'vs_servers_list',\n description: 'List servers (origins) registered in the authenticated organization.',\n inputSchema: {\n type: 'object',\n properties: {\n page: { ...INT },\n limit: { ...INT, description: 'Default 50.' },\n },\n additionalProperties: false,\n },\n requiresAuth: true,\n handler: async (args, client) =>\n client.request('GET', '/api/servers', {\n query: { page: pickNumber(args, 'page'), limit: pickNumber(args, 'limit') },\n }),\n },\n];\n\nexport function findTool(name: string): ToolDefinition | undefined {\n return TOOLS.find((t) => t.name === name);\n}\n\n// Suppress unused-warning suppression: BOOL/NUM are reserved for future tools.\nvoid BOOL;\nvoid NUM;\n"],"mappings":";;;AAYA,SAAS,cAAc;AACvB,SAAS,4BAA4B;AACrC;AAAA,EACE;AAAA,EACA;AAAA,OACK;;;ACRP,IAAM,eAAe;AAQd,IAAM,aAAN,cAAyB,MAAM;AAAA,EACpC,YACE,SACgB,QACA,MAChB;AACA,UAAM,OAAO;AAHG;AACA;AAGhB,SAAK,OAAO;AAAA,EACd;AAAA,EALkB;AAAA,EACA;AAKpB;AAEO,IAAM,YAAN,MAAgB;AAAA,EACJ;AAAA,EACA;AAAA,EACA;AAAA,EAEjB,YAAY,OAAyB,CAAC,GAAG;AACvC,SAAK,SACH,KAAK,UACL,QAAQ,IAAI,cACZ,QAAQ,IAAI,0BACZ;AACF,SAAK,WAAW,KAAK,W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EAChC;AAEA,SAAO,kBAAkB,wBAAwB,aAAa;AAAA,IAC5D,OAAO,MAAM,IAAI,mBAAmB;AAAA,EACtC,EAAE;AAEF,SAAO,kBAAkB,uBAAuB,OAAO,QAAQ;AAC7D,UAAM,OAAO,SAAS,IAAI,OAAO,IAAI;AACrC,QAAI,CAAC,MAAM;AACT,aAAO;AAAA,QACL,SAAS;AAAA,QACT,SAAS,CAAC,EAAE,MAAM,QAAQ,MAAM,iBAAiB,IAAI,OAAO,IAAI,GAAG,CAAC;AAAA,MACtE;AAAA,IACF;AAEA,QAAI;AACF,YAAM,SAAS,MAAM,KAAK,QAAQ,IAAI,OAAO,aAAa,CAAC,GAAG,MAAM;AACpE,aAAO;AAAA,QACL,SAAS;AAAA,UACP;AAAA,YACE,MAAM;AAAA,YACN,MAAM,KAAK,UAAU,QAAQ,MAAM,CAAC;AAAA,UACtC;AAAA,QACF;AAAA,MACF;AAAA,IACF,SAAS,KAAK;AACZ,YAAM,UAAU,eAAe,aAC3B,8BAA8B,IAAI,MAAM,MAAM,IAAI,OAAO;AAAA,EACvD,OAAO,IAAI,SAAS,WAAW,IAAI,OAAO,KAAK,UAAU,IAAI,MAAM,MAAM,CAAC,CAC5E,KACA,eAAe,QACb,IAAI,UACJ,OAAO,GAAG;AAChB,aAAO;AAAA,QACL,SAAS;AAAA,QACT,SAAS,CAAC,EAAE,MAAM,QAAQ,MAAM,QAAQ,CAAC;AAAA,MAC3C;AAAA,IACF;AAAA,EACF,CAAC;AAED,QAAM,YAAY,IAAI,qBAAqB;AAC3C,QAAM,OAAO,QAAQ,SAAS;AAChC;AAEA,KAAK,EAAE,MAAM,CAAC,QAAQ;AAEpB,UAAQ,MAAM,sCAAsC,GAAG;AACvD,UAAQ,KAAK,CAAC;AAChB,CAAC;","names":[]}
1
+ {"version":3,"sources":["../src/index.ts","../src/api-client.ts","../src/tools.ts","../src/prompts.ts","../src/version.ts","../src/resources.ts"],"sourcesContent":["/**\n * Visual Sentinel MCP server (stdio transport).\n *\n * Run via:\n * VS_API_KEY=vs_live_... npx @visualsentinel/mcp-server\n *\n * The server registers all tools defined in `./tools.ts` with the MCP SDK\n * and answers tools/list and tools/call requests. Public tools (health,\n * DNS check, SSL check, speed test, website check) work without an API key;\n * everything else returns a clear error if VS_API_KEY is not set.\n */\n\nimport { Server } from '@modelcontextprotocol/sdk/server/index.js';\nimport { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';\nimport {\n CallToolRequestSchema,\n GetPromptRequestSchema,\n ListPromptsRequestSchema,\n ListResourcesRequestSchema,\n ListToolsRequestSchema,\n McpError,\n ErrorCode,\n ReadResourceRequestSchema,\n} from '@modelcontextprotocol/sdk/types.js';\n\nimport { ApiClient, VsApiError } from './api-client.js';\nimport { TOOLS, findTool } from './tools.js';\nimport { PROMPTS, findPrompt } from './prompts.js';\nimport { SERVER_VERSION } from './version.js';\nimport { RESOURCES, findResource } from './resources.js';\n\nconst SERVER_NAME = 'visualsentinel';\n\nfunction toMcpToolDescriptor(tool: (typeof TOOLS)[number]) {\n return {\n name: tool.name,\n title: tool.title,\n description: tool.description,\n annotations: tool.annotations,\n inputSchema: tool.inputSchema,\n };\n}\n\nasync function main(): Promise<void> {\n const client = new ApiClient();\n const server = new Server(\n { name: SERVER_NAME, version: SERVER_VERSION },\n { capabilities: { tools: {}, prompts: {}, resources: {} } },\n );\n\n server.setRequestHandler(ListToolsRequestSchema, async () => ({\n tools: TOOLS.map(toMcpToolDescriptor),\n }));\n\n server.setRequestHandler(ListPromptsRequestSchema, async () => ({\n prompts: PROMPTS.map((p) => ({\n name: p.name,\n title: p.title,\n description: p.description,\n arguments: p.arguments,\n })),\n }));\n\n server.setRequestHandler(GetPromptRequestSchema, async (req) => {\n const prompt = findPrompt(req.params.name);\n if (!prompt) throw new McpError(ErrorCode.InvalidParams, `Unknown prompt: ${req.params.name}`);\n let text: string;\n try {\n text = prompt.build(req.params.arguments ?? {});\n } catch (err) {\n throw new McpError(ErrorCode.InvalidParams, err instanceof Error ? err.message : String(err));\n }\n return {\n description: prompt.description,\n messages: [{ role: 'user' as const, content: { type: 'text' as const, text } }],\n };\n });\n\n server.setRequestHandler(ListResourcesRequestSchema, async () => ({\n resources: RESOURCES.map((r) => ({\n uri: r.uri,\n name: r.name,\n title: r.title,\n description: r.description,\n mimeType: r.mimeType,\n })),\n }));\n\n server.setRequestHandler(ReadResourceRequestSchema, async (req) => {\n const resource = findResource(req.params.uri);\n if (!resource) throw new McpError(ErrorCode.InvalidParams, `Unknown resource: ${req.params.uri}`);\n return { contents: [{ uri: resource.uri, mimeType: resource.mimeType, text: resource.read() }] };\n });\n\n server.setRequestHandler(CallToolRequestSchema, async (req) => {\n const tool = findTool(req.params.name);\n if (!tool) {\n return {\n isError: true,\n content: [{ type: 'text', text: `Unknown tool: ${req.params.name}` }],\n };\n }\n\n try {\n const result = await tool.handler(req.params.arguments ?? {}, client);\n return {\n content: [\n {\n type: 'text',\n text: JSON.stringify(result, null, 2),\n },\n ],\n };\n } catch (err) {\n const message = err instanceof VsApiError\n ? `Visual Sentinel API error (${err.status}): ${err.message}\\n${\n typeof err.body === 'string' ? err.body : JSON.stringify(err.body, null, 2)\n }`\n : err instanceof Error\n ? err.message\n : String(err);\n return {\n isError: true,\n content: [{ type: 'text', text: message }],\n };\n }\n });\n\n const transport = new StdioServerTransport();\n await server.connect(transport);\n}\n\nmain().catch((err) => {\n // eslint-disable-next-line no-console\n console.error('[visualsentinel-mcp-server] fatal:', err);\n process.exit(1);\n});\n","/**\n * Tiny HTTP client for the Visual Sentinel public API.\n *\n * Reads the API key from `VS_API_KEY` (or `VISUALSENTINEL_API_KEY`) once at\n * construction time. All requests are routed at `https://visualsentinel.com`\n * unless `VS_API_BASE` overrides it (useful for testing against a local\n * dev instance).\n */\n\nconst DEFAULT_BASE = 'https://visualsentinel.com';\n\nexport interface ApiClientOptions {\n apiKey?: string | undefined;\n baseUrl?: string | undefined;\n userAgent?: string;\n}\n\nexport class VsApiError extends Error {\n constructor(\n message: string,\n public readonly status: number,\n public readonly body: unknown,\n ) {\n super(message);\n this.name = 'VsApiError';\n }\n}\n\nexport class ApiClient {\n private readonly apiKey: string | undefined;\n private readonly baseUrl: string;\n private readonly userAgent: string;\n\n constructor(opts: ApiClientOptions = {}) {\n this.apiKey =\n opts.apiKey ??\n process.env.VS_API_KEY ??\n process.env.VISUALSENTINEL_API_KEY ??\n undefined;\n this.baseUrl = (opts.baseUrl ?? process.env.VS_API_BASE ?? DEFAULT_BASE).replace(\n /\\/+$/,\n '',\n );\n this.userAgent = opts.userAgent ?? '@visualsentinel/mcp-server';\n }\n\n hasApiKey(): boolean {\n return typeof this.apiKey === 'string' && this.apiKey.length > 0;\n }\n\n async request<T = unknown>(\n method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE',\n path: string,\n options: { query?: Record<string, string | number | boolean | undefined>; body?: unknown; auth?: boolean } = {},\n ): Promise<T> {\n const auth = options.auth ?? true;\n if (auth && !this.hasApiKey()) {\n throw new VsApiError(\n 'This tool needs a Visual Sentinel API key, which is available on the Business and Agency plans. Create one at https://visualsentinel.com/settings/api-keys and set it as VS_API_KEY. The DNS, SSL, speed, website-check and health tools work without a key.',\n 401,\n null,\n );\n }\n\n const url = new URL(path.startsWith('/') ? path : `/${path}`, this.baseUrl);\n if (options.query) {\n for (const [k, v] of Object.entries(options.query)) {\n if (v !== undefined && v !== null) url.searchParams.set(k, String(v));\n }\n }\n\n const headers: Record<string, string> = {\n Accept: 'application/json',\n 'User-Agent': this.userAgent,\n };\n if (auth && this.apiKey) headers['X-API-Key'] = this.apiKey;\n if (options.body !== undefined) headers['Content-Type'] = 'application/json';\n\n const res = await fetch(url, {\n method,\n headers,\n body: options.body !== undefined ? JSON.stringify(options.body) : undefined,\n });\n\n const text = await res.text();\n let parsed: unknown = null;\n if (text.length > 0) {\n try {\n parsed = JSON.parse(text);\n } catch {\n parsed = text;\n }\n }\n\n if (!res.ok) {\n throw new VsApiError(\n `Visual Sentinel API ${method} ${path} returned ${res.status}`,\n res.status,\n parsed,\n );\n }\n\n return parsed as T;\n }\n}\n","/**\n * Tool registry for the Visual Sentinel MCP server.\n *\n * Each tool wraps a single Visual Sentinel REST endpoint with a JSON Schema\n * input and a structured handler. Public-tool handlers (DNS check, SSL check,\n * speed test, website check, health) run without authentication; everything\n * else requires `VS_API_KEY`.\n */\n\nimport { ApiClient } from './api-client.js';\n\ninterface ToolInput {\n type: 'object';\n properties: Record<string, unknown>;\n required?: string[];\n additionalProperties?: boolean;\n}\n\nexport interface ToolAnnotations {\n title: string;\n readOnlyHint: boolean;\n destructiveHint: boolean;\n idempotentHint: boolean;\n openWorldHint: boolean;\n}\n\nexport interface ToolDefinition {\n name: string;\n /** Human-readable title shown by MCP clients. */\n title: string;\n description: string;\n annotations: ToolAnnotations;\n inputSchema: ToolInput;\n requiresAuth: boolean;\n handler: (args: Record<string, unknown>, client: ApiClient) => Promise<unknown>;\n}\n\nconst STR = { type: 'string' as const };\nconst NUM = { type: 'number' as const };\nconst INT = { type: 'integer' as const };\nconst BOOL = { type: 'boolean' as const };\n\nfunction pickString(args: Record<string, unknown>, key: string): string | undefined {\n const v = args[key];\n return typeof v === 'string' && v.length > 0 ? v : undefined;\n}\n\nfunction pickNumber(args: Record<string, unknown>, key: string): number | undefined {\n const v = args[key];\n return typeof v === 'number' && Number.isFinite(v) ? v : undefined;\n}\n\nfunction requireString(args: Record<string, unknown>, key: string): string {\n const v = pickString(args, key);\n if (!v) throw new Error(`Argument \"${key}\" (string) is required.`);\n return v;\n}\n\nexport const TOOLS: ToolDefinition[] = [\n // -------------------------------------------------------------------------\n // Public tools (no auth)\n // -------------------------------------------------------------------------\n {\n name: 'vs_health',\n title: 'Check Visual Sentinel service health',\n annotations: {\n title: 'Check Visual Sentinel service health',\n readOnlyHint: true,\n destructiveHint: false,\n idempotentHint: true,\n openWorldHint: true,\n },\n description:\n 'Check whether Visual Sentinel itself is up. Returns the service health status. No authentication required.',\n inputSchema: {\n type: 'object',\n properties: {},\n additionalProperties: false,\n },\n requiresAuth: false,\n handler: async (_args, client) => client.request('GET', '/api/health', { auth: false }),\n },\n\n {\n name: 'vs_dns_check',\n title: 'Look up DNS records',\n annotations: {\n title: 'Look up DNS records',\n readOnlyHint: true,\n destructiveHint: false,\n idempotentHint: true,\n openWorldHint: true,\n },\n description:\n 'Resolve DNS records (A, AAAA, MX, NS, TXT, CNAME) for a domain using Visual Sentinel\\'s public DNS lookup tool. No authentication required.',\n inputSchema: {\n type: 'object',\n properties: {\n domain: { ...STR, description: 'Domain to resolve, e.g. example.com (without protocol).' },\n recordType: {\n ...STR,\n description: 'Optional: limit to one record type. One of: A, AAAA, MX, NS, TXT, CNAME, SOA. Default: all.',\n },\n },\n required: ['domain'],\n additionalProperties: false,\n },\n requiresAuth: false,\n handler: async (args, client) =>\n client.request('GET', '/api/tools/dns-check', {\n auth: false,\n query: {\n domain: requireString(args, 'domain'),\n // The API reads ?type= (not recordType).\n type: pickString(args, 'recordType'),\n },\n }),\n },\n\n {\n name: 'vs_ssl_check',\n title: 'Inspect an SSL certificate',\n annotations: {\n title: 'Inspect an SSL certificate',\n readOnlyHint: true,\n destructiveHint: false,\n idempotentHint: true,\n openWorldHint: true,\n },\n description:\n 'Inspect a TLS/SSL certificate for a hostname: issuer, subject, validity dates, SAN list, key algorithm, and certificate chain. No authentication required.',\n inputSchema: {\n type: 'object',\n properties: {\n domain: { ...STR, description: 'Hostname to inspect, e.g. example.com (without protocol).' },\n },\n required: ['domain'],\n additionalProperties: false,\n },\n requiresAuth: false,\n handler: async (args, client) =>\n client.request('GET', '/api/tools/ssl-check', {\n auth: false,\n // The API reads ?domain=. `host` stays as an input alias for 0.1.x callers.\n query: { domain: pickString(args, 'domain') ?? requireString(args, 'host') },\n }),\n },\n\n {\n name: 'vs_speed_test',\n title: 'Run a one-shot speed test',\n annotations: {\n title: 'Run a one-shot speed test',\n readOnlyHint: true,\n destructiveHint: false,\n idempotentHint: true,\n openWorldHint: true,\n },\n description:\n 'Run a one-shot Lighthouse lab test on a URL. Returns the performance score (0 to 100) plus Largest Contentful Paint, First Contentful Paint, Cumulative Layout Shift, Time to First Byte, Total Blocking Time and Speed Index (times in milliseconds). No account needed.',\n inputSchema: {\n type: 'object',\n properties: {\n url: { ...STR, description: 'Full URL to test, including protocol (https://...).' },\n },\n required: ['url'],\n additionalProperties: false,\n },\n requiresAuth: false,\n handler: async (args, client) =>\n client.request('GET', '/api/tools/speed-test', {\n auth: false,\n query: { url: requireString(args, 'url') },\n }),\n },\n\n {\n name: 'vs_website_check',\n title: 'Check a website',\n annotations: {\n title: 'Check a website',\n readOnlyHint: true,\n destructiveHint: false,\n idempotentHint: true,\n openWorldHint: true,\n },\n description:\n 'Quick health check for a URL: HTTP status, response time, server header, content snippet, and basic SSL state. No authentication required.',\n inputSchema: {\n type: 'object',\n properties: {\n url: { ...STR, description: 'Full URL to test, including protocol (https://...).' },\n },\n required: ['url'],\n additionalProperties: false,\n },\n requiresAuth: false,\n handler: async (args, client) =>\n client.request('GET', '/api/tools/website-check', {\n auth: false,\n query: { url: requireString(args, 'url') },\n }),\n },\n\n // -------------------------------------------------------------------------\n // Authenticated tools (require VS_API_KEY)\n // -------------------------------------------------------------------------\n {\n name: 'vs_monitors_list',\n title: 'List monitors',\n annotations: {\n title: 'List monitors',\n readOnlyHint: true,\n destructiveHint: false,\n idempotentHint: true,\n openWorldHint: false,\n },\n description:\n 'List monitors in the authenticated organization. Optional filters narrow by status, type, or paginate.',\n inputSchema: {\n type: 'object',\n properties: {\n status: { ...STR, description: 'Filter: UP, DOWN, PAUSED, MAINTENANCE.' },\n type: {\n ...STR,\n description:\n 'Filter by monitor type: HTTP, HTTPS, KEYWORD, PING, PORT, DNS, SSL, VISUAL, CONTENT, API, GRAPHQL, WEBSOCKET.',\n },\n page: { ...INT, description: 'Page number (default 1).' },\n limit: { ...INT, description: 'Items per page (default 50, max 200).' },\n },\n additionalProperties: false,\n },\n requiresAuth: true,\n handler: async (args, client) =>\n client.request('GET', '/api/monitors', {\n query: {\n status: pickString(args, 'status'),\n type: pickString(args, 'type'),\n page: pickNumber(args, 'page'),\n limit: pickNumber(args, 'limit'),\n },\n }),\n },\n\n {\n name: 'vs_monitors_get',\n title: 'Get a monitor',\n annotations: {\n title: 'Get a monitor',\n readOnlyHint: true,\n destructiveHint: false,\n idempotentHint: true,\n openWorldHint: false,\n },\n description:\n 'Fetch a single monitor by id, including its current status, last check, and configuration.',\n inputSchema: {\n type: 'object',\n properties: {\n id: { ...STR, description: 'Monitor id (cuid).' },\n },\n required: ['id'],\n additionalProperties: false,\n },\n requiresAuth: true,\n handler: async (args, client) =>\n client.request('GET', `/api/monitors/${encodeURIComponent(requireString(args, 'id'))}`),\n },\n\n {\n name: 'vs_monitors_create',\n title: 'Create a monitor',\n annotations: {\n title: 'Create a monitor',\n readOnlyHint: false,\n destructiveHint: false,\n idempotentHint: false,\n openWorldHint: false,\n },\n description:\n 'Create a new monitor. Provide at least name, url, and type. Returns the created monitor including its assigned id.',\n inputSchema: {\n type: 'object',\n properties: {\n name: { ...STR, description: 'Display name for the monitor.' },\n url: { ...STR, description: 'Full URL to monitor (or hostname for PING/PORT/DNS/SSL).' },\n type: {\n ...STR,\n description:\n 'Monitor type: HTTP, HTTPS, KEYWORD, PING, PORT, DNS, SSL, VISUAL, CONTENT, API, GRAPHQL, WEBSOCKET.',\n },\n interval: { ...INT, description: 'Check interval in seconds (60, 300, 600, 1800, 3600).' },\n timeout: { ...INT, description: 'Per-check timeout in seconds (default 30).' },\n method: { ...STR, description: 'HTTP method for HTTP/HTTPS monitors (default GET).' },\n keyword: { ...STR, description: 'Keyword to assert for KEYWORD monitors.' },\n port: { ...INT, description: 'TCP port for PORT monitors.' },\n },\n required: ['name', 'url', 'type'],\n additionalProperties: false,\n },\n requiresAuth: true,\n handler: async (args, client) =>\n client.request('POST', '/api/monitors', {\n body: {\n name: requireString(args, 'name'),\n url: requireString(args, 'url'),\n type: requireString(args, 'type'),\n interval: pickNumber(args, 'interval'),\n timeout: pickNumber(args, 'timeout'),\n method: pickString(args, 'method'),\n keyword: pickString(args, 'keyword'),\n port: pickNumber(args, 'port'),\n },\n }),\n },\n\n {\n name: 'vs_monitors_check_now',\n title: 'Run a monitor check now',\n annotations: {\n title: 'Run a monitor check now',\n readOnlyHint: false,\n destructiveHint: false,\n idempotentHint: false,\n openWorldHint: false,\n },\n description:\n 'Trigger an immediate check for a monitor (in addition to its scheduled cadence). Returns the freshly-collected check result.',\n inputSchema: {\n type: 'object',\n properties: {\n id: { ...STR, description: 'Monitor id.' },\n },\n required: ['id'],\n additionalProperties: false,\n },\n requiresAuth: true,\n handler: async (args, client) =>\n client.request('POST', `/api/monitors/${encodeURIComponent(requireString(args, 'id'))}/check`),\n },\n\n {\n name: 'vs_monitors_uptime',\n title: 'Get monitor uptime',\n annotations: {\n title: 'Get monitor uptime',\n readOnlyHint: true,\n destructiveHint: false,\n idempotentHint: true,\n openWorldHint: false,\n },\n description:\n 'Fetch the uptime percentage and time-series breakdown for a monitor. Use `window` for a preset window (24h, 7d, 30d, 90d, 365d; default 30d), supply both `from` and `to` (ISO 8601) for a custom date range, or set `all: true` for the full available history.',\n inputSchema: {\n type: 'object',\n properties: {\n id: { ...STR, description: 'Monitor id.' },\n window: {\n ...STR,\n description: 'Preset window: 1h, 6h, 24h, 7d, 30d, 90d, 365d. Default 30d. Ignored when from+to or all are supplied.',\n },\n from: {\n ...STR,\n description: 'ISO 8601 start of a custom range (e.g. 2026-01-01T00:00:00Z). Must be supplied with `to`.',\n },\n to: {\n ...STR,\n description: 'ISO 8601 end of a custom range. Must be supplied with `from`.',\n },\n all: {\n type: 'boolean',\n description: 'Return the full available history from the earliest stored data. Takes precedence over from/to and window.',\n },\n },\n required: ['id'],\n additionalProperties: false,\n },\n requiresAuth: true,\n handler: async (args, client) => {\n const from = pickString(args, 'from');\n const to = pickString(args, 'to');\n // Precedence mirrors the API: all > from/to > window/period.\n const query = args['all'] === true\n ? { all: true }\n : (from && to)\n ? { from, to }\n : { period: pickString(args, 'window') ?? '30d' };\n return client.request(\n 'GET',\n `/api/monitors/${encodeURIComponent(requireString(args, 'id'))}/uptime`,\n { query },\n );\n },\n },\n\n {\n name: 'vs_monitors_metrics_bulk',\n title: 'Get bulk monitor metrics',\n annotations: {\n title: 'Get bulk monitor metrics',\n readOnlyHint: true,\n destructiveHint: false,\n idempotentHint: true,\n openWorldHint: false,\n },\n description:\n 'Fetch uptime or response-time metrics for up to 100 monitors in a single request. Use `window` for a preset window (1h, 6h, 24h, 7d, 30d, 90d, 365d; default 30d), supply both `from` and `to` (ISO 8601) for a custom date range, or set `all: true` for the full available history. Returns a `monitors` object keyed by monitor id.',\n inputSchema: {\n type: 'object',\n properties: {\n monitorIds: {\n type: 'array',\n items: { type: 'string' },\n description: 'List of monitor IDs to fetch metrics for (max 100).',\n },\n metric: {\n ...STR,\n description: 'Metric to return: \"uptime\" or \"response-time\".',\n },\n window: {\n ...STR,\n description: 'Preset window: 1h, 6h, 24h, 7d, 30d, 90d, 365d. Default 30d. Ignored when from+to or all are supplied.',\n },\n from: {\n ...STR,\n description: 'ISO 8601 start of a custom range (e.g. 2026-01-01T00:00:00Z). Must be supplied with `to`.',\n },\n to: {\n ...STR,\n description: 'ISO 8601 end of a custom range. Must be supplied with `from`.',\n },\n all: {\n type: 'boolean',\n description: 'Return the full available history from the earliest stored data. Takes precedence over from/to and window.',\n },\n },\n required: ['monitorIds', 'metric'],\n additionalProperties: false,\n },\n requiresAuth: true,\n handler: async (args, client) => {\n const monitorIds = args['monitorIds'];\n if (!Array.isArray(monitorIds) || monitorIds.length === 0) {\n throw new Error('Argument \"monitorIds\" must be a non-empty array.');\n }\n const from = pickString(args, 'from');\n const to = pickString(args, 'to');\n const body: Record<string, unknown> = {\n monitorIds,\n metric: requireString(args, 'metric'),\n };\n // Precedence mirrors the API: all > from/to > window/period.\n if (args['all'] === true) {\n body['all'] = true;\n } else if (from && to) {\n body['from'] = from;\n body['to'] = to;\n } else {\n body['period'] = pickString(args, 'window') ?? '30d';\n }\n return client.request('POST', '/api/monitors/metrics', { body });\n },\n },\n\n {\n name: 'vs_incidents_list',\n title: 'List incidents',\n annotations: {\n title: 'List incidents',\n readOnlyHint: true,\n destructiveHint: false,\n idempotentHint: true,\n openWorldHint: false,\n },\n description:\n 'List incidents for the authenticated organization. Filter by status (OPEN/RESOLVED), monitor id, or paginate.',\n inputSchema: {\n type: 'object',\n properties: {\n status: { ...STR, description: 'OPEN or RESOLVED.' },\n monitorId: { ...STR, description: 'Filter to one monitor.' },\n page: { ...INT },\n limit: { ...INT, description: 'Default 50, max 200.' },\n },\n additionalProperties: false,\n },\n requiresAuth: true,\n handler: async (args, client) =>\n client.request('GET', '/api/incidents', {\n query: {\n status: pickString(args, 'status'),\n monitorId: pickString(args, 'monitorId'),\n page: pickNumber(args, 'page'),\n limit: pickNumber(args, 'limit'),\n },\n }),\n },\n\n {\n name: 'vs_incidents_get',\n title: 'Get an incident',\n annotations: {\n title: 'Get an incident',\n readOnlyHint: true,\n destructiveHint: false,\n idempotentHint: true,\n openWorldHint: false,\n },\n description: 'Fetch a single incident with its full check history and root-cause hints.',\n inputSchema: {\n type: 'object',\n properties: {\n id: { ...STR, description: 'Incident id.' },\n },\n required: ['id'],\n additionalProperties: false,\n },\n requiresAuth: true,\n handler: async (args, client) =>\n client.request('GET', `/api/incidents/${encodeURIComponent(requireString(args, 'id'))}`),\n },\n\n {\n name: 'vs_alerts_list',\n title: 'List alerts',\n annotations: {\n title: 'List alerts',\n readOnlyHint: true,\n destructiveHint: false,\n idempotentHint: true,\n openWorldHint: false,\n },\n description:\n 'List alerts for the authenticated organization. Filter by status (UNACKNOWLEDGED/ACKNOWLEDGED/RESOLVED) or paginate.',\n inputSchema: {\n type: 'object',\n properties: {\n status: { ...STR, description: 'UNACKNOWLEDGED, ACKNOWLEDGED, or RESOLVED.' },\n page: { ...INT },\n limit: { ...INT, description: 'Default 50, max 200.' },\n },\n additionalProperties: false,\n },\n requiresAuth: true,\n handler: async (args, client) =>\n client.request('GET', '/api/alerts', {\n query: {\n status: pickString(args, 'status'),\n page: pickNumber(args, 'page'),\n limit: pickNumber(args, 'limit'),\n },\n }),\n },\n\n {\n name: 'vs_alerts_acknowledge',\n title: 'Acknowledge an alert',\n annotations: {\n title: 'Acknowledge an alert',\n readOnlyHint: false,\n destructiveHint: false,\n idempotentHint: true,\n openWorldHint: false,\n },\n description: 'Acknowledge an alert by id. The acknowledgement is recorded against the account that authorised this connection.',\n inputSchema: {\n type: 'object',\n properties: {\n id: { ...STR, description: 'Alert id.' },\n note: { ...STR, description: 'Optional acknowledgement note (visible in alert history).' },\n },\n required: ['id'],\n additionalProperties: false,\n },\n requiresAuth: true,\n handler: async (args, client) =>\n client.request('POST', `/api/alerts/${encodeURIComponent(requireString(args, 'id'))}/acknowledge`, {\n body: { note: pickString(args, 'note') },\n }),\n },\n\n {\n name: 'vs_status_pages_list',\n title: 'List status pages',\n annotations: {\n title: 'List status pages',\n readOnlyHint: true,\n destructiveHint: false,\n idempotentHint: true,\n openWorldHint: false,\n },\n description: 'List public-facing status pages owned by the authenticated organization.',\n inputSchema: {\n type: 'object',\n properties: {},\n additionalProperties: false,\n },\n requiresAuth: true,\n handler: async (_args, client) => client.request('GET', '/api/status-pages'),\n },\n\n {\n name: 'vs_servers_list',\n title: 'List servers',\n annotations: {\n title: 'List servers',\n readOnlyHint: true,\n destructiveHint: false,\n idempotentHint: true,\n openWorldHint: false,\n },\n description: 'List servers (origins) registered in the authenticated organization.',\n inputSchema: {\n type: 'object',\n properties: {\n page: { ...INT },\n limit: { ...INT, description: 'Default 50.' },\n },\n additionalProperties: false,\n },\n requiresAuth: true,\n handler: async (args, client) =>\n client.request('GET', '/api/servers', {\n query: { page: pickNumber(args, 'page'), limit: pickNumber(args, 'limit') },\n }),\n },\n];\n\nexport function findTool(name: string): ToolDefinition | undefined {\n return TOOLS.find((t) => t.name === name);\n}\n\n// Suppress unused-warning suppression: BOOL/NUM are reserved for future tools.\nvoid BOOL;\nvoid NUM;\n","/**\n * MCP prompts: ready-made workflows built on the Visual Sentinel tools.\n * Each prompt returns one user message that tells the assistant which tools to\n * call and how to report back. They work without an API key unless noted.\n */\n\nexport interface PromptArgument {\n name: string;\n description: string;\n required: boolean;\n}\n\nexport interface PromptDefinition {\n name: string;\n title: string;\n description: string;\n arguments: PromptArgument[];\n /** Builds the user message for the given arguments. */\n build: (args: Record<string, string | undefined>) => string;\n}\n\nfunction need(args: Record<string, string | undefined>, key: string): string {\n const v = args[key]?.trim();\n if (!v) throw new Error(`Argument \"${key}\" is required.`);\n return v;\n}\n\nfunction hostOf(value: string): string {\n return value.replace(/^https?:\\/\\//i, '').replace(/\\/.*$/, '');\n}\n\nexport const PROMPTS: PromptDefinition[] = [\n {\n name: 'check_website_health',\n title: 'Check a website\\'s health',\n description:\n 'Run uptime, SSL, DNS and speed checks on one site and summarise what needs attention. No account or API key needed.',\n arguments: [\n { name: 'url', description: 'Site to check, e.g. https://example.com', required: true },\n ],\n build: (args) => {\n const url = need(args, 'url');\n const host = hostOf(url);\n return [\n `Check the health of ${url} with the Visual Sentinel tools and report back in plain language.`,\n '',\n `1. vs_website_check with url \"${url}\": HTTP status, response time, server header.`,\n `2. vs_ssl_check with domain \"${host}\": certificate validity, expiry date and chain.`,\n `3. vs_dns_check with domain \"${host}\": A, AAAA, MX, NS and TXT records.`,\n `4. vs_speed_test with url \"${url}\": time to first byte, total load time, transfer size, redirects.`,\n '',\n 'Then give: a one-line verdict, a short list of anything that looks wrong (non-200 status, certificate close to expiry, missing or odd DNS records, slow response, long redirect chain), and the one fix to do first. Say which checks succeeded and which returned an error. Do not guess at anything a tool did not return.',\n ].join('\\n');\n },\n },\n {\n name: 'investigate_broken_site',\n title: 'Investigate why my site looks broken',\n description:\n 'Work out why a site is down, slow or looking wrong by checking each layer in order. With an API key it also reads open incidents and recent alerts.',\n arguments: [\n { name: 'url', description: 'The affected page, e.g. https://example.com/pricing', required: true },\n { name: 'symptom', description: 'What you see, e.g. \"blank page\", \"images missing\", \"very slow\"', required: false },\n ],\n build: (args) => {\n const url = need(args, 'url');\n const host = hostOf(url);\n const symptom = args.symptom?.trim();\n return [\n `${symptom ? `The page ${url} shows this problem: ${symptom}.` : `Something looks wrong on ${url}.`} Find the most likely layer at fault, using the Visual Sentinel tools in this order and stopping to report as soon as you find a clear cause:`,\n '',\n `1. DNS: vs_dns_check for \"${host}\". Do the records resolve, and do they point where they should?`,\n `2. TLS: vs_ssl_check for \"${host}\". Is the certificate valid, unexpired and issued for this hostname?`,\n `3. Server response: vs_website_check for \"${url}\". Status code, response time, content snippet.`,\n `4. Speed: vs_speed_test for \"${url}\". Is time to first byte or load time unusually high, and is there a redirect chain?`,\n '5. If a Visual Sentinel API key is configured: vs_monitors_list to find a monitor for this site, then vs_incidents_list and vs_alerts_list for it, and vs_monitors_uptime for the last 24 hours. If no key is set, say that account data was not checked.',\n '',\n 'A page can return HTTP 200 and still look broken (missing styles, empty content, a failed script). If every check above is healthy, say so and suggest comparing the page against an earlier screenshot, which is what Visual Sentinel visual monitoring does.',\n 'Report: the evidence from each step, the most likely cause, and the next action.',\n ].join('\\n');\n },\n },\n {\n name: 'pre_launch_checklist',\n title: 'Pre-launch checklist for a site',\n description:\n 'Check a new or migrated site before it goes live: DNS, certificate, response and speed, then a short list of fixes. No API key needed.',\n arguments: [\n { name: 'domain', description: 'The domain being launched, e.g. example.com', required: true },\n ],\n build: (args) => {\n const domain = hostOf(need(args, 'domain'));\n return [\n `Run a pre-launch check on ${domain} with the Visual Sentinel tools and return a checklist with Pass, Warn or Fail for each line.`,\n '',\n `- DNS: vs_dns_check for \"${domain}\" and for \"www.${domain}\". Both resolve, and the records point to the intended host. Check MX and TXT (SPF) records if the domain sends email.`,\n `- Certificate: vs_ssl_check for \"${domain}\" and for \"www.${domain}\". Valid, issued for the hostname, and more than 30 days from expiry.`,\n `- Response: vs_website_check for \"https://${domain}\" and \"https://www.${domain}\". Both return 200 or one cleanly redirects to the other.`,\n `- Speed: vs_speed_test for \"https://${domain}\". Report time to first byte, total load time and redirect count.`,\n '',\n 'Finish with the Fail items first, each with a concrete fix, then the Warn items. Add one line suggesting monitors to create after launch (uptime on the home page, certificate expiry, DNS records), and say that creating them needs a Visual Sentinel account with an API key. Do not create anything unless asked.',\n ].join('\\n');\n },\n },\n {\n name: 'triage_open_incidents',\n title: 'Triage open incidents',\n description:\n 'Review open incidents and unacknowledged alerts on your account and rank what to look at first. Needs a Visual Sentinel API key (Business and Agency plans).',\n arguments: [],\n build: () =>\n [\n 'Review my Visual Sentinel account and tell me what needs attention first.',\n '',\n '1. vs_incidents_list with status OPEN, then vs_incidents_get for each one (up to 5, most recent first).',\n '2. vs_alerts_list with status UNACKNOWLEDGED.',\n '3. For each affected monitor, vs_monitors_get and vs_monitors_uptime for the last 24 hours.',\n '',\n 'Rank the incidents by customer impact (production sites and checkout pages before staging), group alerts that belong to the same incident, and give one suggested next step for each. If the tools return an \"API key required\" error, tell me that account tools need an API key from the Business or Agency plan, and stop. Ask before acknowledging any alert.',\n ].join('\\n'),\n },\n];\n\nexport function findPrompt(name: string): PromptDefinition | undefined {\n return PROMPTS.find((p) => p.name === name);\n}\n","/** Keep in sync with package.json (a test checks it). */\nexport const SERVER_VERSION = '0.2.2';\n","/**\n * MCP resources: read-only reference material the assistant can attach as\n * context. Static on purpose, so they work without an API key and never touch\n * account data. Plan limits come from the public pricing page; check\n * https://visualsentinel.com/pricing for current prices.\n */\n\nimport { TOOLS } from './tools.js';\n\nexport interface ResourceDefinition {\n uri: string;\n name: string;\n title: string;\n description: string;\n mimeType: string;\n read: () => string;\n}\n\nconst PLANS_AS_OF = '2026-10-16';\n\nconst PLANS = `# Visual Sentinel plans and limits (as of ${PLANS_AS_OF})\n\nPrices and the current list are always at https://visualsentinel.com/pricing. There is no free plan for new accounts: a new workspace gets a first check of its site, then a 7-day trial (card required) or a paid plan.\n\n| Plan | Monitors | Fastest uptime check | Visual pages | Status pages | API keys and MCP account tools |\n|---|---|---|---|---|---|\n| Solo | 10 | every 5 minutes | 1 site, every 30 minutes | 1 | no |\n| Starter | 15 | every 5 minutes | 5, every 15 minutes | 1 | no |\n| Business | 60 | every 1 minute | 60, every 15 minutes | 5 | yes |\n| Agency | 300 | every 1 minute | 300, every 15 minutes | 50 | yes |\n\n- The five public tools (vs_health, vs_dns_check, vs_ssl_check, vs_speed_test, vs_website_check) need no account.\n- The twelve account tools need an API key, which is available on the Business and Agency plans. Create one at https://visualsentinel.com/settings/api-keys.\n- Checks run from Europe and the US. Alert channels on every plan: email, Slack, Discord, Microsoft Teams, Telegram, PagerDuty, Opsgenie, webhooks, WhatsApp, Prometheus, and push notifications in the mobile app.\n`;\n\nconst HELP = `# Using the Visual Sentinel MCP server\n\nVisual Sentinel catches pages that look broken even when the site is up. It watches uptime, performance, SSL certificates, DNS, visual changes and content changes.\n\n## Start without an account\nAsk for a DNS lookup, an SSL certificate check, a speed test or a website check on any public site. These five tools need no account or key.\n\n## Connect your account\n1. Get an API key (Business and Agency plans): https://visualsentinel.com/settings/api-keys\n2. Set it as VS_API_KEY (or VISUALSENTINEL_API_KEY) in your MCP client's environment for this server.\n3. Restart the client. Monitor, uptime, incident, alert, status-page and server tools now work.\n\n## Ready-made prompts\ncheck_website_health, investigate_broken_site, pre_launch_checklist and triage_open_incidents.\n\n## Links\n- Docs and install: https://visualsentinel.com/mcp\n- API reference: https://visualsentinel.com/docs\n- Pricing: https://visualsentinel.com/pricing\n- Source: https://github.com/VisualSentinel/mcp-server\n- Support: https://visualsentinel.com/contact\n`;\n\nfunction toolsReference(): string {\n const rows = TOOLS.map(\n (t) => `| ${t.name} | ${t.requiresAuth ? 'API key (Business and Agency)' : 'none'} | ${t.annotations.readOnlyHint ? 'read-only' : 'changes data'} | ${(t.description.split('. ')[0] ?? '').replace(/\\.$/, '')} |`,\n );\n return [\n '# Visual Sentinel tools',\n '',\n '| Tool | Needs | Type | What it does |',\n '|---|---|---|---|',\n ...rows,\n '',\n ].join('\\n');\n}\n\nexport const RESOURCES: ResourceDefinition[] = [\n {\n uri: 'visualsentinel://plans',\n name: 'plans',\n title: 'Plans and limits',\n description: 'Monitor counts, check frequencies and which plans include API keys and the MCP account tools.',\n mimeType: 'text/markdown',\n read: () => PLANS,\n },\n {\n uri: 'visualsentinel://help',\n name: 'help',\n title: 'Help and setup',\n description: 'How to use the server without an account, how to add an API key, and where the docs are.',\n mimeType: 'text/markdown',\n read: () => HELP,\n },\n {\n uri: 'visualsentinel://tools',\n name: 'tools',\n title: 'Tool reference',\n description: 'Every tool, whether it needs an API key, and whether it is read-only.',\n mimeType: 'text/markdown',\n read: toolsReference,\n },\n];\n\nexport function findResource(uri: string): ResourceDefinition | undefined {\n return RESOURCES.find((r) => r.uri === uri);\n}\n"],"mappings":";;;AAYA,SAAS,cAAc;AACvB,SAAS,4BAA4B;AACrC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;;;ACdP,IAAM,eAAe;AAQd,IAAM,aAAN,cAAyB,MAAM;AAAA,EACpC,YACE,SACgB,QACA,MAChB;AACA,UAAM,OAAO;AAHG;AACA;AAGhB,SAAK,OAAO;AAAA,EACd;AAAA,EALkB;AAAA,EACA;AAKpB;AAEO,IAAM,YAAN,MAAgB;AAAA,EACJ;AAAA,EACA;AAAA,EACA;AAAA,EAEjB,YAAY,OAAyB,CAAC,GAAG;AACvC,SAAK,SACH,KAAK,UACL,QAAQ,IAAI,cACZ,QAAQ,IAAI,0BACZ;AACF,SAAK,WAAW,KAAK,WAAW,QAAQ,IAAI,eAAe,cAAc;AAAA,MACvE;AAAA,MACA;AAAA,IACF;AACA,SAAK,YAAY,KAAK,aAAa;AAAA,EACrC;AAAA,EAEA,YAAqB;AACnB,WAAO,OAAO,KAAK,WAAW,YAAY,KAAK,OAAO,SAAS;AAAA,EACjE;AAAA,EAEA,MAAM,QACJ,QACA,MACA,UAA6G,CAAC,GAClG;AACZ,UAAM,OAAO,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O,IAAI,GAAG,CAAC;AAAA,MACtE;AAAA,IACF;AAEA,QAAI;AACF,YAAM,SAAS,MAAM,KAAK,QAAQ,IAAI,OAAO,aAAa,CAAC,GAAG,MAAM;AACpE,aAAO;AAAA,QACL,SAAS;AAAA,UACP;AAAA,YACE,MAAM;AAAA,YACN,MAAM,KAAK,UAAU,QAAQ,MAAM,CAAC;AAAA,UACtC;AAAA,QACF;AAAA,MACF;AAAA,IACF,SAAS,KAAK;AACZ,YAAM,UAAU,eAAe,aAC3B,8BAA8B,IAAI,MAAM,MAAM,IAAI,OAAO;AAAA,EACvD,OAAO,IAAI,SAAS,WAAW,IAAI,OAAO,KAAK,UAAU,IAAI,MAAM,MAAM,CAAC,CAC5E,KACA,eAAe,QACb,IAAI,UACJ,OAAO,GAAG;AAChB,aAAO;AAAA,QACL,SAAS;AAAA,QACT,SAAS,CAAC,EAAE,MAAM,QAAQ,MAAM,QAAQ,CAAC;AAAA,MAC3C;AAAA,IACF;AAAA,EACF,CAAC;AAED,QAAM,YAAY,IAAI,qBAAqB;AAC3C,QAAM,OAAO,QAAQ,SAAS;AAChC;AAEA,KAAK,EAAE,MAAM,CAAC,QAAQ;AAEpB,UAAQ,MAAM,sCAAsC,GAAG;AACvD,UAAQ,KAAK,CAAC;AAChB,CAAC;","names":[]}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * MCP prompts: ready-made workflows built on the Visual Sentinel tools.
3
+ * Each prompt returns one user message that tells the assistant which tools to
4
+ * call and how to report back. They work without an API key unless noted.
5
+ */
6
+ interface PromptArgument {
7
+ name: string;
8
+ description: string;
9
+ required: boolean;
10
+ }
11
+ interface PromptDefinition {
12
+ name: string;
13
+ title: string;
14
+ description: string;
15
+ arguments: PromptArgument[];
16
+ /** Builds the user message for the given arguments. */
17
+ build: (args: Record<string, string | undefined>) => string;
18
+ }
19
+ declare const PROMPTS: PromptDefinition[];
20
+ declare function findPrompt(name: string): PromptDefinition | undefined;
21
+
22
+ export { PROMPTS, type PromptArgument, type PromptDefinition, findPrompt };
@@ -0,0 +1,105 @@
1
+ #!/usr/bin/env node
2
+
3
+ // src/prompts.ts
4
+ function need(args, key) {
5
+ const v = args[key]?.trim();
6
+ if (!v) throw new Error(`Argument "${key}" is required.`);
7
+ return v;
8
+ }
9
+ function hostOf(value) {
10
+ return value.replace(/^https?:\/\//i, "").replace(/\/.*$/, "");
11
+ }
12
+ var PROMPTS = [
13
+ {
14
+ name: "check_website_health",
15
+ title: "Check a website's health",
16
+ description: "Run uptime, SSL, DNS and speed checks on one site and summarise what needs attention. No account or API key needed.",
17
+ arguments: [
18
+ { name: "url", description: "Site to check, e.g. https://example.com", required: true }
19
+ ],
20
+ build: (args) => {
21
+ const url = need(args, "url");
22
+ const host = hostOf(url);
23
+ return [
24
+ `Check the health of ${url} with the Visual Sentinel tools and report back in plain language.`,
25
+ "",
26
+ `1. vs_website_check with url "${url}": HTTP status, response time, server header.`,
27
+ `2. vs_ssl_check with domain "${host}": certificate validity, expiry date and chain.`,
28
+ `3. vs_dns_check with domain "${host}": A, AAAA, MX, NS and TXT records.`,
29
+ `4. vs_speed_test with url "${url}": time to first byte, total load time, transfer size, redirects.`,
30
+ "",
31
+ "Then give: a one-line verdict, a short list of anything that looks wrong (non-200 status, certificate close to expiry, missing or odd DNS records, slow response, long redirect chain), and the one fix to do first. Say which checks succeeded and which returned an error. Do not guess at anything a tool did not return."
32
+ ].join("\n");
33
+ }
34
+ },
35
+ {
36
+ name: "investigate_broken_site",
37
+ title: "Investigate why my site looks broken",
38
+ description: "Work out why a site is down, slow or looking wrong by checking each layer in order. With an API key it also reads open incidents and recent alerts.",
39
+ arguments: [
40
+ { name: "url", description: "The affected page, e.g. https://example.com/pricing", required: true },
41
+ { name: "symptom", description: 'What you see, e.g. "blank page", "images missing", "very slow"', required: false }
42
+ ],
43
+ build: (args) => {
44
+ const url = need(args, "url");
45
+ const host = hostOf(url);
46
+ const symptom = args.symptom?.trim();
47
+ return [
48
+ `${symptom ? `The page ${url} shows this problem: ${symptom}.` : `Something looks wrong on ${url}.`} Find the most likely layer at fault, using the Visual Sentinel tools in this order and stopping to report as soon as you find a clear cause:`,
49
+ "",
50
+ `1. DNS: vs_dns_check for "${host}". Do the records resolve, and do they point where they should?`,
51
+ `2. TLS: vs_ssl_check for "${host}". Is the certificate valid, unexpired and issued for this hostname?`,
52
+ `3. Server response: vs_website_check for "${url}". Status code, response time, content snippet.`,
53
+ `4. Speed: vs_speed_test for "${url}". Is time to first byte or load time unusually high, and is there a redirect chain?`,
54
+ "5. If a Visual Sentinel API key is configured: vs_monitors_list to find a monitor for this site, then vs_incidents_list and vs_alerts_list for it, and vs_monitors_uptime for the last 24 hours. If no key is set, say that account data was not checked.",
55
+ "",
56
+ "A page can return HTTP 200 and still look broken (missing styles, empty content, a failed script). If every check above is healthy, say so and suggest comparing the page against an earlier screenshot, which is what Visual Sentinel visual monitoring does.",
57
+ "Report: the evidence from each step, the most likely cause, and the next action."
58
+ ].join("\n");
59
+ }
60
+ },
61
+ {
62
+ name: "pre_launch_checklist",
63
+ title: "Pre-launch checklist for a site",
64
+ description: "Check a new or migrated site before it goes live: DNS, certificate, response and speed, then a short list of fixes. No API key needed.",
65
+ arguments: [
66
+ { name: "domain", description: "The domain being launched, e.g. example.com", required: true }
67
+ ],
68
+ build: (args) => {
69
+ const domain = hostOf(need(args, "domain"));
70
+ return [
71
+ `Run a pre-launch check on ${domain} with the Visual Sentinel tools and return a checklist with Pass, Warn or Fail for each line.`,
72
+ "",
73
+ `- DNS: vs_dns_check for "${domain}" and for "www.${domain}". Both resolve, and the records point to the intended host. Check MX and TXT (SPF) records if the domain sends email.`,
74
+ `- Certificate: vs_ssl_check for "${domain}" and for "www.${domain}". Valid, issued for the hostname, and more than 30 days from expiry.`,
75
+ `- Response: vs_website_check for "https://${domain}" and "https://www.${domain}". Both return 200 or one cleanly redirects to the other.`,
76
+ `- Speed: vs_speed_test for "https://${domain}". Report time to first byte, total load time and redirect count.`,
77
+ "",
78
+ "Finish with the Fail items first, each with a concrete fix, then the Warn items. Add one line suggesting monitors to create after launch (uptime on the home page, certificate expiry, DNS records), and say that creating them needs a Visual Sentinel account with an API key. Do not create anything unless asked."
79
+ ].join("\n");
80
+ }
81
+ },
82
+ {
83
+ name: "triage_open_incidents",
84
+ title: "Triage open incidents",
85
+ description: "Review open incidents and unacknowledged alerts on your account and rank what to look at first. Needs a Visual Sentinel API key (Business and Agency plans).",
86
+ arguments: [],
87
+ build: () => [
88
+ "Review my Visual Sentinel account and tell me what needs attention first.",
89
+ "",
90
+ "1. vs_incidents_list with status OPEN, then vs_incidents_get for each one (up to 5, most recent first).",
91
+ "2. vs_alerts_list with status UNACKNOWLEDGED.",
92
+ "3. For each affected monitor, vs_monitors_get and vs_monitors_uptime for the last 24 hours.",
93
+ "",
94
+ 'Rank the incidents by customer impact (production sites and checkout pages before staging), group alerts that belong to the same incident, and give one suggested next step for each. If the tools return an "API key required" error, tell me that account tools need an API key from the Business or Agency plan, and stop. Ask before acknowledging any alert.'
95
+ ].join("\n")
96
+ }
97
+ ];
98
+ function findPrompt(name) {
99
+ return PROMPTS.find((p) => p.name === name);
100
+ }
101
+ export {
102
+ PROMPTS,
103
+ findPrompt
104
+ };
105
+ //# sourceMappingURL=prompts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/prompts.ts"],"sourcesContent":["/**\n * MCP prompts: ready-made workflows built on the Visual Sentinel tools.\n * Each prompt returns one user message that tells the assistant which tools to\n * call and how to report back. They work without an API key unless noted.\n */\n\nexport interface PromptArgument {\n name: string;\n description: string;\n required: boolean;\n}\n\nexport interface PromptDefinition {\n name: string;\n title: string;\n description: string;\n arguments: PromptArgument[];\n /** Builds the user message for the given arguments. */\n build: (args: Record<string, string | undefined>) => string;\n}\n\nfunction need(args: Record<string, string | undefined>, key: string): string {\n const v = args[key]?.trim();\n if (!v) throw new Error(`Argument \"${key}\" is required.`);\n return v;\n}\n\nfunction hostOf(value: string): string {\n return value.replace(/^https?:\\/\\//i, '').replace(/\\/.*$/, '');\n}\n\nexport const PROMPTS: PromptDefinition[] = [\n {\n name: 'check_website_health',\n title: 'Check a website\\'s health',\n description:\n 'Run uptime, SSL, DNS and speed checks on one site and summarise what needs attention. No account or API key needed.',\n arguments: [\n { name: 'url', description: 'Site to check, e.g. https://example.com', required: true },\n ],\n build: (args) => {\n const url = need(args, 'url');\n const host = hostOf(url);\n return [\n `Check the health of ${url} with the Visual Sentinel tools and report back in plain language.`,\n '',\n `1. vs_website_check with url \"${url}\": HTTP status, response time, server header.`,\n `2. vs_ssl_check with domain \"${host}\": certificate validity, expiry date and chain.`,\n `3. vs_dns_check with domain \"${host}\": A, AAAA, MX, NS and TXT records.`,\n `4. vs_speed_test with url \"${url}\": time to first byte, total load time, transfer size, redirects.`,\n '',\n 'Then give: a one-line verdict, a short list of anything that looks wrong (non-200 status, certificate close to expiry, missing or odd DNS records, slow response, long redirect chain), and the one fix to do first. Say which checks succeeded and which returned an error. Do not guess at anything a tool did not return.',\n ].join('\\n');\n },\n },\n {\n name: 'investigate_broken_site',\n title: 'Investigate why my site looks broken',\n description:\n 'Work out why a site is down, slow or looking wrong by checking each layer in order. With an API key it also reads open incidents and recent alerts.',\n arguments: [\n { name: 'url', description: 'The affected page, e.g. https://example.com/pricing', required: true },\n { name: 'symptom', description: 'What you see, e.g. \"blank page\", \"images missing\", \"very slow\"', required: false },\n ],\n build: (args) => {\n const url = need(args, 'url');\n const host = hostOf(url);\n const symptom = args.symptom?.trim();\n return [\n `${symptom ? `The page ${url} shows this problem: ${symptom}.` : `Something looks wrong on ${url}.`} Find the most likely layer at fault, using the Visual Sentinel tools in this order and stopping to report as soon as you find a clear cause:`,\n '',\n `1. DNS: vs_dns_check for \"${host}\". Do the records resolve, and do they point where they should?`,\n `2. TLS: vs_ssl_check for \"${host}\". Is the certificate valid, unexpired and issued for this hostname?`,\n `3. Server response: vs_website_check for \"${url}\". Status code, response time, content snippet.`,\n `4. Speed: vs_speed_test for \"${url}\". Is time to first byte or load time unusually high, and is there a redirect chain?`,\n '5. If a Visual Sentinel API key is configured: vs_monitors_list to find a monitor for this site, then vs_incidents_list and vs_alerts_list for it, and vs_monitors_uptime for the last 24 hours. If no key is set, say that account data was not checked.',\n '',\n 'A page can return HTTP 200 and still look broken (missing styles, empty content, a failed script). If every check above is healthy, say so and suggest comparing the page against an earlier screenshot, which is what Visual Sentinel visual monitoring does.',\n 'Report: the evidence from each step, the most likely cause, and the next action.',\n ].join('\\n');\n },\n },\n {\n name: 'pre_launch_checklist',\n title: 'Pre-launch checklist for a site',\n description:\n 'Check a new or migrated site before it goes live: DNS, certificate, response and speed, then a short list of fixes. No API key needed.',\n arguments: [\n { name: 'domain', description: 'The domain being launched, e.g. example.com', required: true },\n ],\n build: (args) => {\n const domain = hostOf(need(args, 'domain'));\n return [\n `Run a pre-launch check on ${domain} with the Visual Sentinel tools and return a checklist with Pass, Warn or Fail for each line.`,\n '',\n `- DNS: vs_dns_check for \"${domain}\" and for \"www.${domain}\". Both resolve, and the records point to the intended host. Check MX and TXT (SPF) records if the domain sends email.`,\n `- Certificate: vs_ssl_check for \"${domain}\" and for \"www.${domain}\". Valid, issued for the hostname, and more than 30 days from expiry.`,\n `- Response: vs_website_check for \"https://${domain}\" and \"https://www.${domain}\". Both return 200 or one cleanly redirects to the other.`,\n `- Speed: vs_speed_test for \"https://${domain}\". Report time to first byte, total load time and redirect count.`,\n '',\n 'Finish with the Fail items first, each with a concrete fix, then the Warn items. Add one line suggesting monitors to create after launch (uptime on the home page, certificate expiry, DNS records), and say that creating them needs a Visual Sentinel account with an API key. Do not create anything unless asked.',\n ].join('\\n');\n },\n },\n {\n name: 'triage_open_incidents',\n title: 'Triage open incidents',\n description:\n 'Review open incidents and unacknowledged alerts on your account and rank what to look at first. Needs a Visual Sentinel API key (Business and Agency plans).',\n arguments: [],\n build: () =>\n [\n 'Review my Visual Sentinel account and tell me what needs attention first.',\n '',\n '1. vs_incidents_list with status OPEN, then vs_incidents_get for each one (up to 5, most recent first).',\n '2. vs_alerts_list with status UNACKNOWLEDGED.',\n '3. For each affected monitor, vs_monitors_get and vs_monitors_uptime for the last 24 hours.',\n '',\n 'Rank the incidents by customer impact (production sites and checkout pages before staging), group alerts that belong to the same incident, and give one suggested next step for each. If the tools return an \"API key required\" error, tell me that account tools need an API key from the Business or Agency plan, and stop. Ask before acknowledging any alert.',\n ].join('\\n'),\n },\n];\n\nexport function findPrompt(name: string): PromptDefinition | undefined {\n return PROMPTS.find((p) => p.name === name);\n}\n"],"mappings":";;;AAqBA,SAAS,KAAK,MAA0C,KAAqB;AAC3E,QAAM,IAAI,KAAK,GAAG,GAAG,KAAK;AAC1B,MAAI,CAAC,EAAG,OAAM,IAAI,MAAM,aAAa,GAAG,gBAAgB;AACxD,SAAO;AACT;AAEA,SAAS,OAAO,OAAuB;AACrC,SAAO,MAAM,QAAQ,iBAAiB,EAAE,EAAE,QAAQ,SAAS,EAAE;AAC/D;AAEO,IAAM,UAA8B;AAAA,EACzC;AAAA,IACE,MAAM;AAAA,IACN,OAAO;AAAA,IACP,aACE;AAAA,IACF,WAAW;AAAA,MACT,EAAE,MAAM,OAAO,aAAa,2CAA2C,UAAU,KAAK;AAAA,IACxF;AAAA,IACA,OAAO,CAAC,SAAS;AACf,YAAM,MAAM,KAAK,MAAM,KAAK;AAC5B,YAAM,OAAO,OAAO,GAAG;AACvB,aAAO;AAAA,QACL,uBAAuB,GAAG;AAAA,QAC1B;AAAA,QACA,iCAAiC,GAAG;AAAA,QACpC,gCAAgC,IAAI;AAAA,QACpC,gCAAgC,IAAI;AAAA,QACpC,8BAA8B,GAAG;AAAA,QACjC;AAAA,QACA;AAAA,MACF,EAAE,KAAK,IAAI;AAAA,IACb;AAAA,EACF;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,OAAO;AAAA,IACP,aACE;AAAA,IACF,WAAW;AAAA,MACT,EAAE,MAAM,OAAO,aAAa,uDAAuD,UAAU,KAAK;AAAA,MAClG,EAAE,MAAM,WAAW,aAAa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,KAAK,CAAC,MAAM,EAAE,SAAS,IAAI;AAC5C;","names":[]}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * MCP resources: read-only reference material the assistant can attach as
3
+ * context. Static on purpose, so they work without an API key and never touch
4
+ * account data. Plan limits come from the public pricing page; check
5
+ * https://visualsentinel.com/pricing for current prices.
6
+ */
7
+ interface ResourceDefinition {
8
+ uri: string;
9
+ name: string;
10
+ title: string;
11
+ description: string;
12
+ mimeType: string;
13
+ read: () => string;
14
+ }
15
+ declare const RESOURCES: ResourceDefinition[];
16
+ declare function findResource(uri: string): ResourceDefinition | undefined;
17
+
18
+ export { RESOURCES, type ResourceDefinition, findResource };