@cyanheads/jinaai-mcp-server
Version:
A Model Context Protocol (MCP) server that provides intelligent web reading capabilities using the Jina AI Reader API. It extracts clean, LLM-ready content from any URL.
58 lines • 1.93 kB
JavaScript
/**
* @fileoverview Defines a wrapper around the McpServer class to provide
* extended functionality, such as metadata introspection, without needing
* to access private properties of the underlying SDK class.
* @module src/mcp-server/core/managedMcpServer
*/
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
/**
* A wrapper around the McpServer that captures registration metadata
* to make it available for status endpoints and other diagnostics.
* It acts as a full pass-through for all McpServer functionality.
*/
export class ManagedMcpServer extends McpServer {
storedTools = [];
serverIdentity;
serverOptions;
constructor(identity, options) {
super(identity, options);
this.serverIdentity = identity;
this.serverOptions = options;
}
registerTool(name, spec, implementation) {
this.storedTools.push({ name, spec });
return super.registerTool(name, spec, implementation);
}
/**
* Retrieves the metadata for all registered tools.
*/
getTools() {
return this.storedTools.map((t) => ({
name: t.name,
description: t.spec.description,
inputSchema: t.spec.inputSchema,
outputSchema: t.spec.outputSchema,
}));
}
/**
* Gets the server's name from its identity.
*/
get name() {
return this.serverIdentity.name;
}
/**
* Gets the server's version from its identity.
*/
get version() {
return this.serverIdentity.version;
}
/**
* Gets the server's capabilities from its options.
*/
get capabilities() {
// The type inference for McpServerOptions is imperfect, so we cast to a
// known shape as a pragmatic solution, knowing the property exists at runtime.
return this.serverOptions?.capabilities;
}
}
//# sourceMappingURL=managedMcpServer.js.map