Files
crafttable-mcp-client/test/stdioFixture.ts
T

19 lines
722 B
TypeScript

/**
* 为 stdio 协议集成测试提供最小 MCP 服务进程。
*
* @packageDocumentation
*/
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
import { createProxyServer } from "../src/bridge.js";
const server = createProxyServer({
listTools: async (params) => ({ tools: [{ name: "fixture_tool", inputSchema: { type: "object" } }], nextCursor: params?.cursor }),
callTool: async () => ({ content: [{ type: "text", text: "ok" }] }),
listResources: async () => ({ resources: [] }),
listResourceTemplates: async () => ({ resourceTemplates: [] }),
readResource: async ({ uri }) => ({ contents: [{ uri, text: "ok" }] }),
});
await server.connect(new StdioServerTransport());