clinicaltrialsgov-mcp-server
Version:
ClinicalTrials.gov Model Context Protocol (MCP) Server that provides a suite of tools for interacting with the official ClinicalTrials.gov v2 API. Enables AI agents and LLMs to programmatically search, retrieve, and analyze clinical trial data.
32 lines (31 loc) • 1.75 kB
TypeScript
/**
* @fileoverview Stateful Transport Manager implementation for MCP SDK.
* This manager handles multiple, persistent sessions, creating a dedicated
* McpServer and StreamableHTTPServerTransport instance for each one.
* This version is adapted for Hono by bridging the SDK's Node.js-style
* request handling with Hono's stream-based response model.
* @module src/mcp-server/transports/core/statefulTransportManager
*/
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import type { IncomingHttpHeaders } from "http";
import { RequestContext } from "../../../utils/index.js";
import { BaseTransportManager } from "./baseTransportManager.js";
import { StatefulTransportManager as IStatefulTransportManager, TransportResponse, TransportSession } from "./transportTypes.js";
/**
* Stateful Transport Manager that handles MCP SDK integration and session management
* for a Hono-based HTTP server.
*/
export declare class StatefulTransportManager extends BaseTransportManager implements IStatefulTransportManager {
private readonly transports;
private readonly servers;
private readonly sessions;
private readonly garbageCollector;
constructor(createServerInstanceFn: () => Promise<McpServer>);
initializeAndHandle(headers: IncomingHttpHeaders, body: unknown, context: RequestContext): Promise<TransportResponse>;
handleRequest(headers: IncomingHttpHeaders, body: unknown, context: RequestContext, sessionId?: string): Promise<TransportResponse>;
handleDeleteRequest(sessionId: string, context: RequestContext): Promise<TransportResponse>;
getSession(sessionId: string): TransportSession | undefined;
shutdown(): Promise<void>;
private closeSession;
private cleanupStaleSessions;
}