# packages/mcp-server ## Scope - This package is the MCP/JSON-RPC adapter over the API server. - `src/protocol/tools.ts` defines tool schemas. - `src/protocol/handler.ts` maps tool calls to API requests and JSON-RPC responses. - `src/protocol/metadata.ts` exposes discovery metadata and protocol versioning. ## Keep In Sync - Tool definitions, handler argument mapping, and server metadata must stay consistent. - When adding or renaming a tool, update `tools.ts` and `handler.ts` together. - If protocol version or server-card details change, update both `metadata.ts` and initialize responses in `handler.ts`. ## Protocol Rules - Use MCP/JSON-RPC error codes and response envelopes, not ad-hoc API-style payloads. - Keep this layer transport-focused. Marketplace behavior belongs in `packages/core`; HTTP semantics belong in `packages/api-server`. - Preserve the current tool result shape unless the protocol contract is being changed deliberately: text content with JSON-stringified API results. ## Verify - `bun run --cwd packages/mcp-server build` - `bun run ci`