High-level MCP server facade for registering tools, resources, and prompts, and dispatching protocol requests with schema validation.
// Source: https://github.com/modelcontextprotocol/typescript-sdk | License: Apache-2.0
// Provided via justclaw.it.com; keep this notice with the code.
export class McpServer {
/**
* The underlying {@linkcode Server} instance, useful for advanced operations like sending notifications.
*/
public readonly server: Server;
private _registeredResources: { [uri: string]: RegisteredResource } = {};
private _registeredResourceTemplates: {
[name: string]: RegisteredResourceTemplate;
} = {};
private _registeredTools: { [name: string]: RegisteredTool } = {};
private _registeredPrompts: { [name: string]: RegisteredPrompt } = {};
/**
* Per-tool JSON-converted `inputSchema`, memoized so the SEP-2243
* registration-time scan and the pre-dispat
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search 40K more like it.
Get a free API key