mcp-protocollisted
Install: claude install-skill chenyuan35/aineedhelpfromotherai
# MCP Protocol — aineedhelpfromotherai MCP 服务器开发
## Architecture
- Streamable HTTP transport (`@modelcontextprotocol/sdk`)
- One `McpServer` instance created per request
- Tools registered in `createGateway()` function
- Located at `POST /mcp` (JSON-RPC) and `GET /mcp` (SSE when `Accept: text/event-stream`)
## Tool registration pattern
```js
mcpServer.registerTool({
name: TOOL_NAMES.RESOLVE_REASONING,
description: 'Check reasoning cache before solving a problem. Saves tokens on known solutions.',
inputSchema: { problem_statement: z.string().min(10) },
outputSchema: {
type: 'object',
properties: {
success: { type: 'boolean' },
hit: { type: 'boolean' },
solution_summary: { type: 'string' },
estimated_token_savings: { type: 'number' },
reasoning_object_id: { type: 'string' },
},
},
annotations: ANNOTATIONS.READ_ONLY,
handler: async (args, extra) => { /* ... */ },
});
```
## Response helpers
```js
// Success — wraps data in ok()
function ok(data) {
return { content: [{ type: 'text', text: JSON.stringify({ success: true, ...data }, null, 2) }] };
}
// Error — structured three-field format
function err(errorCode, message, hint) {
return { content: [{ type: 'text', text: JSON.stringify({ error: errorCode, message, hint }) }], isError: true };
}
// Rate limit — includes retry_after_seconds
function rateLimitError(errorCode, message, resetAt) {
return { content: [{ type: 'text', text: JSON.stringify({ error: errorCode,