OM

openclaw/mcporter

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

5091 stars 361 forks 质量 88 趋势 49MIT

通过 TypeScript 调用 MCP,伪装成简单的 TypeScript API。或者打包成 CLI。

概览

TypeScript运行时、CLI和模型上下文协议的代码生成工具包。 MCPorter帮助你更好地发挥Anthropic指南中强调的“代码执行”工作流程:发现系统上已配置的MCP服务器,直接调用它们,在TypeScript中编写更丰富的自动化,并在需要共享工具时创建单一用途的CLI。这些操作开箱即用——无需模板化,无需模式探洞。 - createRuntime() 先合并你的家庭配置(~/.mcporter/mcporter.json[c],或设置时的 $XDG_CONFIG_HOME/mcporter/mcporter.json[c]),然后是 config/mcporter.json,以及 Cursor/Claude/Codex/Windsurf/OpenCode/VS Code 导入,扩展 ${ENV} 占位符,并池化连接,以便你在多个调用中重复使用传输。- mcporter generate-cli 将任何 MCP 服务器定义转换为现成 CLI,支持可选的捆绑/编译和元数据以便于重新生成。- mcporter emit-ts 发布 .d.

概述(AI 翻译)

MCPorter 是一款 TypeScript 运行时和命令行工具,用于发现和调用模型上下文协议服务器。它面向需要从终端、脚本或生成的独立 CLI 使用相同 MCP 工具的开发者和编码代理。

安装

试试不安装CLI的操作:

安装以重复命令行使用:

安装 npm 需要 Node 24 或更新版本。对于 TypeScript 运行时,请用包管理器在项目中添加 mcporter。已签名的 macOS 二进制文件及其他支持的安装路径已在安装指南中介绍。

快速开始

检查一个公共MCP服务器,然后调用其工具之一:

第一个命令打印服务器的TypeScript风格工具签名。第二个命令返回匹配的Context7库ID,无需本地配置或凭证。请参阅五分钟快速启动,了解资源、生成的CLI和类型客户端。

核心工作流程

目标 命令或API 详情
发现服务器和工具 mcporter list CLI 参考

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

MCPorter 🧳 — Carry MCP tools into scripts, CLIs, and agents

MCPorter is a TypeScript runtime and command-line tool for discovering and calling Model Context Protocol servers. It is for developers and coding agents that need the same MCP tools from a terminal, a script, or a generated standalone CLI.

Install

Try the CLI without installing it:

npx mcporter --version

Install it for repeated command-line use:

brew install steipete/tap/mcporter
# or
npm install -g mcporter

Node 24 or newer is required for npm installs. For the TypeScript runtime, add mcporter to your project with your package manager. Signed macOS binaries and the other supported install paths are covered in the install guide.

Quick start

Inspect a public MCP server, then call one of its tools:

npx mcporter list https://mcp.context7.com/mcp --brief
npx mcporter call https://mcp.context7.com/mcp.resolve-library-id \
  query="React hooks docs" libraryName=react

The first command prints the server’s TypeScript-style tool signatures. The second returns matching Context7 library IDs without requiring local configuration or credentials. See the five-minute quickstart for resources, generated CLIs, and typed clients.

Core workflows

Goal Command or API Details
Discover servers and tools mcporter list CLI reference
Call tools and read resources mcporter call, mcporter resource Call syntax
Connect to a one-off URL or stdio command --http-url, --stdio Ad-hoc servers
Complete or seed OAuth mcporter auth, mcporter vault Configuration
Encrypt the OAuth vault at rest MCPORTER_VAULT_PASSWORD Vault Encryption
在 GitHub 查看完整 README

安装

npx mcporter --version
新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "context7": { "url": "https://mcp.context7.com/mcp" } } }