@agents-skills/mcp-gate
v1.0.0
Published
Stdio gate that fixes LLM parameter serialization in agent CLI tools (Amp, Claude Code, Cursor) - coerces string parameters to correct JSON types
Maintainers
Readme
MCP Gate
A transparent stdio gate that fixes the LLM parameter serialization bug in LLM-based agent CLI tools (Amp, Claude Code, Cursor, etc.) where tool parameters are sent as strings instead of their correct JSON types.
The Problem
LLMs non-deterministically serialize MCP parameters as strings:
"true"instead oftrue(boolean)"5"instead of5(number)"[\"markdown\"]"instead of["markdown"](array)
How It Works
Amp → [gate] → MCP Server
↓
1. Caches tool schemas from tools/list
2. Intercepts tools/call requests
3. Coerces string params → correct types
4. Forwards to real serverUsage
Wrap any MCP server command with the gate. Works with Amp, Claude Code, Cursor, and other agent CLI tools:
Before (breaks)
{
"amp.mcpServers": {
"firecrawl": {
"command": "npx",
"args": ["-y", "firecrawl-mcp"]
}
}
}After (fixed with mcp-gate)
{
"amp.mcpServers": {
"firecrawl": {
"command": "mcp-gate",
"args": ["npx", "-y", "firecrawl-mcp"]
}
}
}Brave Search example
{
"brave-search": {
"command": "mcp-gate",
"args": ["npx", "-y", "@nicepkg/brave-search-mcp"]
}
}Cursor config.json example
{
"mcpServers": {
"github": {
"command": "mcp-gate",
"args": ["npx", "-y", "github-mcp"]
}
}
}What It Coerces
| From (string) | To (native) | Schema type |
|---|---|---|
| "true" / "false" | true / false | boolean |
| "42" / "3.14" | 42 / 3.14 | number / integer |
| "[\"a\",\"b\"]" | ["a","b"] | array |
| "{\"k\":\"v\"}" | {"k":"v"} | object |
Also recurses into nested object properties and array items.
Zero Dependencies
Pure Node.js (>=18), no npm install needed.
