@access-mcp/shared
Version:
Shared utilities for ACCESS-CI MCP servers
40 lines (39 loc) • 1.55 kB
TypeScript
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
import { AxiosInstance } from "axios";
export declare abstract class BaseAccessServer {
protected serverName: string;
protected version: string;
protected baseURL: string;
protected server: Server;
protected transport: StdioServerTransport;
private _httpClient?;
private _httpServer?;
private _httpPort?;
constructor(serverName: string, version: string, baseURL?: string);
protected get httpClient(): AxiosInstance;
private setupHandlers;
protected abstract getTools(): any[];
protected abstract getResources(): any[];
protected abstract handleToolCall(request: any): Promise<any>;
protected handleResourceRead(request: any): Promise<any>;
/**
* Start the MCP server with optional HTTP service layer for inter-server communication
*/
start(options?: {
httpPort?: number;
}): Promise<void>;
/**
* Start HTTP service layer for inter-server communication
*/
private startHttpService;
/**
* Call a tool on another ACCESS-CI MCP server via HTTP
*/
protected callRemoteServer(serviceName: string, toolName: string, args?: Record<string, any>): Promise<any>;
/**
* Get service endpoint from environment configuration
* Expected format: ACCESS_MCP_SERVICES=nsf-awards=http://localhost:3001,xdmod-metrics=http://localhost:3002
*/
private getServiceEndpoint;
}