# mcporter
mcporter is a [[Peter Steinberger]] tool that solves the friction of integrating Model Context Protocol (MCP) servers into AI agents. Instead of stuffing huge tool-schema blobs into the system prompt, mcporter generates a *small typed surface* — TypeScript interfaces or a standalone CLI — so agents call MCP tools like ordinary typed functions.
The "porter" in the name is the design thesis: the runtime *carries* tool calls, schemas, OAuth tokens, and stdio handles between the agent and whichever MCP server happens to be on the other end.
## The problem mcporter is actually solving
Every MCP server publishes a JSON tool schema. The naive integration is to dump that schema into the prompt and let the model figure it out. This burns tokens, leaks server-side complexity into the model's context window, and pushes type-safety into runtime guesswork.
mcporter inverts that: discover the server, generate a minimal typed client at build time (or on demand), and keep the prompt tiny. The model sees `db.queryRows({...})`, not 4 KB of JSON Schema.
## How it works
- **Zero-config discovery.** Auto-detects servers from Cursor, [[Claude Code]], Claude Desktop, VS Code, and similar editors. Reads `~/.mcporter/mcporter.json` or `$XDG_CONFIG_HOME` configs.
- **CLI generation.** `mcporter generate-cli` bundles any MCP server into a standalone CLI with the schema embedded.
- **Typed clients.** `mcporter emit-ts` produces TypeScript interfaces; `createServerProxy()` returns a runtime client that maps tools to camelCase, validates arguments, and exposes results via `.text()` / `.json()` / `.markdown()`.
- **Ad-hoc connections.** Call any HTTP, SSE, or stdio MCP endpoint without editing config files.
- **OAuth automation.** Detects and caches OAuth flows for hosted services (Supabase, Vercel, etc.).
- **Pooled transports.** HTTP, SSE, and stdio connections are kept warm across calls — same runtime layer regardless of protocol.
## Design choices worth noting
- **Small typed surface > big schema in prompt.** This is the central bet, and it's the right one for token economics and reliability.
- **Multi-runtime distribution.** npm, npx, [[Homebrew]], or a Bun-compiled standalone binary. Pick whichever fits the target environment.
- **Composable, not monolithic.** Discovery, generation, and runtime are each addressable separately. Use one without the others if you only need one.
- **Editor-config-aware.** Reads existing MCP configs from major editors instead of forcing yet another config file.
## Where it fits
For anyone shipping AI agents that call out to MCP servers, mcporter is the layer that keeps prompts lean and types honest. Especially valuable when the same agent talks to many servers — the alternative (every tool's schema concatenated into the system prompt) scales badly. Same author as [[Discrawl]], [[Gitcrawl]], [[Birdclaw]], [[Spogo]], [[sag]], [[WaCLI]], and the [[OpenClaw]] ecosystem.
## References
- Project site: <https://mcporter.sh/>
- Source: <https://github.com/steipete/mcporter>
- Model Context Protocol: <https://modelcontextprotocol.io/>
## Related
- [[Peter Steinberger]]
- [[Claude Code]]
- [[OpenClaw]]
- [[Homebrew]]