Problem
The MCP server (src/mcp/server.ts) fails to establish a connection with MCP clients. When running gbrain serve, the server outputs Schema is missing a method literal and the connection drops immediately.
Root cause: setRequestHandler is called with raw string literals ('tools/list', 'tools/call') cast via as any, instead of the Zod schema objects exported by @modelcontextprotocol/sdk. In SDK v1.29.0, this causes the handler registration to fail silently and the connection to close.
Reproduction
# Start the MCP server
DATABASE_URL=<your_url> bun run src/cli.ts serve
# Output: "Schema is missing a method literal"
# Attempt to list tools via mcporter
mcporter list gbrain --schema
# Output: "Tools: <timed out> / Connection closed"
Fix
Replace string literals with the SDK's typed request schemas:
+ import { ListToolsRequestSchema, CallToolRequestSchema } from '@modelcontextprotocol/sdk/types.js';
- server.setRequestHandler('tools/list' as any, async () => ({
+ server.setRequestHandler(ListToolsRequestSchema, async () => ({
- server.setRequestHandler('tools/call' as any, async (request: any) => {
+ server.setRequestHandler(CallToolRequestSchema, async (request: any) => {
After the fix, mcporter list gbrain --schema returns all 30 tools and mcporter call gbrain.get_stats works correctly.
Additional findings
While testing the MCP server fix, I also found two openclaw integration issues:
-
openclaw plugins install fails — package.json is missing openclaw.extensions, so the CLI treats it as an invalid native plugin instead of recognizing openclaw.plugin.json. The Plugin Bundles docs say openclaw.plugin.json should be detected as native, but the installer checks package.json first and errors out. This may require either adding openclaw.extensions to package.json or filing upstream with openclaw.
-
test/e2e/skills.test.ts uses openclaw -p — This flag no longer exists in openclaw 2026.4.x. The current equivalent is openclaw agent --local -m. This change is not backward compatible with older openclaw versions, so the minimum supported version needs to be decided (noting package.json already declares "pluginApi": ">=2026.4.0").
Environment
- gbrain v0.3.0
@modelcontextprotocol/sdk v1.29.0
- openclaw 2026.4.9
- macOS, Bun 1.3.11
Problem
The MCP server (
src/mcp/server.ts) fails to establish a connection with MCP clients. When runninggbrain serve, the server outputsSchema is missing a method literaland the connection drops immediately.Root cause:
setRequestHandleris called with raw string literals ('tools/list','tools/call') cast viaas any, instead of the Zod schema objects exported by@modelcontextprotocol/sdk. In SDK v1.29.0, this causes the handler registration to fail silently and the connection to close.Reproduction
Fix
Replace string literals with the SDK's typed request schemas:
After the fix,
mcporter list gbrain --schemareturns all 30 tools andmcporter call gbrain.get_statsworks correctly.Additional findings
While testing the MCP server fix, I also found two openclaw integration issues:
openclaw plugins installfails —package.jsonis missingopenclaw.extensions, so the CLI treats it as an invalid native plugin instead of recognizingopenclaw.plugin.json. The Plugin Bundles docs sayopenclaw.plugin.jsonshould be detected as native, but the installer checkspackage.jsonfirst and errors out. This may require either addingopenclaw.extensionstopackage.jsonor filing upstream with openclaw.test/e2e/skills.test.tsusesopenclaw -p— This flag no longer exists in openclaw 2026.4.x. The current equivalent isopenclaw agent --local -m. This change is not backward compatible with older openclaw versions, so the minimum supported version needs to be decided (notingpackage.jsonalready declares"pluginApi": ">=2026.4.0").Environment
@modelcontextprotocol/sdkv1.29.0