# mcporter — TypeScript API Wrapper for MCPs > A TypeScript-first wrapper to call MCP tools as a typed API or package them as a CLI; verified 4399★, pushed 2026-05-14. ## Install Merge the JSON below into your `.mcp.json`: ## Quick Use ```bash pnpm add mcporter # or global CLI (README): npm install -g mcporter mcporter --help ``` ## Intro A TypeScript-first wrapper to call MCP tools as a typed API or package them as a CLI; verified 4399★, pushed 2026-05-14. **Best for:** TypeScript teams who want a clean API surface over MCP tool calls **Works with:** Node.js runtimes; works with MCP tool providers and CLI workflows per README **Setup time:** 6-12 minutes ### Key facts (verified) - GitHub: 4399 stars · 281 forks · pushed 2026-05-14. - License: MIT · owner avatar + repo URL verified via GitHub API. - README-backed entrypoint: `mcporter`. ## Main - Treat MCP calls as an API: wrap tool invocations behind typed functions so your agent/app logic stays readable. - Start with the CLI when prototyping; switch to a library import once the tool surface stabilizes. - Keep transport concerns separate: use mcporter to standardize how you connect to MCP providers across environments. - Document your tool contracts in code: types + examples reduce agent hallucinations about tool params. ### README (excerpt) **MCPorter 🧳 - Call MCPs from TypeScript or as CLI**

MCPorter header banner

npm version CI Status Platforms MIT License

_TypeScript runtime, CLI, and code-generation toolkit for the Model Context Protocol._ MCPorter helps you lean into the "code execution" workflows highlighted in Anthropic's **Code Execution with MCP** guidance: discover the MCP servers already configured on your system, call them directly, compose richer automations in TypeScript, and mint single-purpose CLIs when you need to share a tool. All of that works out of the box -- no boilerplate, no schema spelunking. ## Key Capabilities - **Zero-config discovery.** `createRuntime()` merges your home config (`~/.mcporter/mcporter.json[c]`, or `$XDG_CONFIG_HOME/mcporter/mcporter.json[c]` when set) first, then `config/mcporter.json`, plus Cursor/Claude/Codex/Windsurf/OpenCode/VS Code imports, expands `${ENV}` placeholders, and pools connections so you can reuse transports across multiple calls. - **One-command CLI generation.** `mcporter generate-cli` turns any MCP server definition into a ready-to-run CLI, with optional bundling/compilation and metadata for easy regeneration. - **Typed tool clients.** `mcporter emit-ts` emits `.d.ts` interfaces or ready-to-run client wrappers so agents/tests can call MCP servers with strong TypeScript types without hand-writing plumbing. - **Friendly composable API.** `createServerProxy()` exposes tools as ergonomic camelCase methods, automatically applies JSON-schema defaults, validates required arguments, and hands back a `CallResult` with `.text()`, `.markdown()`, `.json()`, `.images()`, and `.content()` helpers. ### Source-backed notes - README shows install options including `pnpm add mcporter`, `npm install -g mcporter`, and a Homebrew tap. - GitHub topics include `mcp` and `cli` (verified via GitHub API). - Repo is MIT licensed and recently pushed (verified via GitHub API). ### FAQ - **Is there a CLI?**: Yes—README includes `npm install -g mcporter` and `mcporter --help` usage. - **Do I need TypeScript?**: TypeScript is the primary target, but CLI usage works from any shell environment with Node installed. - **What license is it under?**: MIT (verified via GitHub license metadata). ## Source & Thanks > Created by [openclaw](https://github.com/openclaw). Licensed under MIT. > > [openclaw/mcporter](https://github.com/openclaw/mcporter) — ⭐ 4399 Thanks to the upstream maintainers and contributors for publishing this work under an open license. --- ## Quick Use ```bash pnpm add mcporter # or global CLI (README): npm install -g mcporter mcporter --help ``` ## Intro mcporter 把 MCP 工具封装成 TypeScript API,也可打包成 CLI 做脚本化调用,适合把工具参数与返回值固化为可测试模块,减少 agent 乱填;已验证 4399★,更新于 2026-05-14。 **Best for:** 希望把 MCP 工具调用做成类型安全 API 的 TypeScript 团队 **Works with:** Node.js 运行环境;可用于 MCP 工具提供方与 CLI 脚本化流程(见 README) **Setup time:** 6-12 minutes ### Key facts (verified) - GitHub:4399 stars · 281 forks;最近更新 2026-05-14。 - 许可证:MIT;作者头像与仓库链接均已通过 GitHub API 复核。 - README 中可对照的入口:`mcporter`。 ## Main - 把 MCP 调用当 API:把工具调用封装成类型化函数,让 agent/app 逻辑保持清晰。 - 原型阶段先用 CLI;接口稳定后再改为库方式集成,减少脚本漂移。 - 把传输层抽离:统一 MCP provider 的连接方式,降低环境切换成本。 - 用类型与示例固化工具契约:减少 agent 对参数的臆测与误填。 ### README (excerpt) **MCPorter 🧳 - Call MCPs from TypeScript or as CLI**

MCPorter header banner

npm version CI Status Platforms MIT License

_TypeScript runtime, CLI, and code-generation toolkit for the Model Context Protocol._ MCPorter helps you lean into the "code execution" workflows highlighted in Anthropic's **Code Execution with MCP** guidance: discover the MCP servers already configured on your system, call them directly, compose richer automations in TypeScript, and mint single-purpose CLIs when you need to share a tool. All of that works out of the box -- no boilerplate, no schema spelunking. ## Key Capabilities - **Zero-config discovery.** `createRuntime()` merges your home config (`~/.mcporter/mcporter.json[c]`, or `$XDG_CONFIG_HOME/mcporter/mcporter.json[c]` when set) first, then `config/mcporter.json`, plus Cursor/Claude/Codex/Windsurf/OpenCode/VS Code imports, expands `${ENV}` placeholders, and pools connections so you can reuse transports across multiple calls. - **One-command CLI generation.** `mcporter generate-cli` turns any MCP server definition into a ready-to-run CLI, with optional bundling/compilation and metadata for easy regeneration. - **Typed tool clients.** `mcporter emit-ts` emits `.d.ts` interfaces or ready-to-run client wrappers so agents/tests can call MCP servers with strong TypeScript types without hand-writing plumbing. - **Friendly composable API.** `createServerProxy()` exposes tools as ergonomic camelCase methods, automatically applies JSON-schema defaults, validates required arguments, and hands back a `CallResult` with `.text()`, `.markdown()`, `.json()`, `.images()`, and `.content()` helpers. ### Source-backed notes - README 给出安装方式:`pnpm add mcporter`、`npm install -g mcporter`,以及 Homebrew tap。 - GitHub topics 包含 `mcp` 与 `cli`(已通过 GitHub API 复核)。 - 仓库为 MIT 许可且近期更新(已通过 GitHub API 复核)。 ### FAQ - **有 CLI 吗?**:有:README 提供 `npm install -g mcporter`,并可用 `mcporter --help` 查看用法。 - **必须用 TypeScript 吗?**:不必须:CLI 只要有 Node.js 就能用;但库的最佳体验在 TypeScript。 - **许可证是什么?**:MIT(已通过 GitHub 许可证元数据复核)。 ## Source & Thanks > Created by [openclaw](https://github.com/openclaw). Licensed under MIT. > > [openclaw/mcporter](https://github.com/openclaw/mcporter) — ⭐ 4399 --- Source: https://tokrepo.com/en/workflows/mcporter-typescript-api-wrapper-for-mcps Author: MCP Hub