Token导航 LogoToken导航TokenDH.com
mcpboot (Vivekhaldar) logo
开发工具stdio官方级别未说明来源级核验

mcpboot (Vivekhaldar)

MCP Server

@modelcontextprotocol/inspector

mcpboot是一款通过自然语言提示生成并启动MCP服务器的工具,无需SDK知识或编写样板代码,适用于快速API封装和工具创建。

工具数

10

提示词数

0

GitHub Stars

1

资源数

0
JavaScriptClaudeAPI封装Claude DesktopClaude

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

vivekhaldar

提供方

vivekhaldar

最后核验

2026/5/17 20:21

运行时

Node.js

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

npx @modelcontextprotocol/inspector --transport http --server-url http://localhost:8100/mcp

详细介绍

mcpboot

从自然语言提示符生成并提供MCP服务器。

将mcpbot指向API文档(或者只是描述您想要的内容),它生成一个工作 主控程序 服务器。不需要SDK知识。没有样板。无需维护代码。

使用LLM 仅在启动时 用于代码生成。在运行时,工具调用执行缓存的JavaScript,不涉及LLM,也不需要每次调用API成本。

安装

npm install -g mcpboot

需要Node.js 18+。

快速开始

# Set your LLM API key
export ANTHROPIC_API_KEY=sk-ant-...

# Generate an MCP server for the Hacker News API
mcpboot --prompt "Create MCP tools for the Hacker News API: https://github.com/HackerNews/API"

mcpbot获取API文档,生成工具处理程序,并开始在 http://localhost:8000/mcp.

用法

mcpboot [options]

Options:
  --prompt               Generation prompt (inline)
  --prompt-file 
         Generation prompt from file

  --provider             LLM provider: anthropic | openai (default: anthropic)
  --model                  LLM model ID (default: provider-specific)
  --api-key               LLM API key (env: ANTHROPIC_API_KEY | OPENAI_API_KEY)

  --port               HTTP server port (default: 8000)
  --cache-dir 
           Cache directory (default: .mcpboot-cache)
  --no-cache                   Disable caching, regenerate on every startup
  --verbose                    Verbose logging (structured JSON to stderr)
  --log-file 
            Write full verbose log to file (JSON lines, untruncated)
  --dry-run                    Show generation plan without starting server

例子

# Wrap the Hacker News API
mcpboot --prompt "Create MCP tools for the Hacker News API: https://github.com/HackerNews/API"

# Wrap an API from an OpenAPI spec
mcpboot --prompt "Create MCP tools from https://petstore.swagger.io/v2/swagger.json"

# Create specific tools from a known API
mcpboot --prompt "Using the GitHub REST API (https://docs.github.com/en/rest), \
  create tools for listing repos, creating issues, and searching code"

# Create utility tools (no external API needed)
mcpboot --prompt "Create tools for JSON manipulation: pretty-print, validate, diff, and JSONPath extraction"

# Complex prompt from file
mcpboot --prompt-file ./my-api-prompt.txt --port 9000

# Preview what would be generated
mcpboot --prompt "Create MCP tools for https://github.com/HackerNews/API" --dry-run

演练:黑客新闻API

以下是为生成MCP服务器的完整示例 黑客新闻API.

1.启动mcpboot:

mcpboot --model claude-haiku-4-5 --port 8100 --verbose \
  --prompt "Create MCP tools for the Hacker News API. The API docs are at
    https://github.com/HackerNews/API . Figure out what tools are appropriate
    to expose — things like getting top stories, new stories, getting an item
    by ID, getting a user profile, etc."

mcpbot从GitHub获取API文档,使用LLM规划和编译10个工具,并开始提供:

[mcpboot] Found 1 URL(s) in prompt
[mcpboot] Fetched 1 page(s)
[mcpboot] Cache miss — generating tools via LLM
[mcpboot] Plan: 10 tool(s)
[mcpboot] Compiled 10 handler(s)
[mcpboot] Listening on http://localhost:8100/mcp
[mcpboot] Serving 10 tool(s)

随着 --verbose,每个步骤还向stderr发出结构化JSON事件(每行一个JSON对象),其中包含时间戳、请求相关性ID和详细的有效载荷:

{"ts":"...","event":"llm_call_start","req_id":"startup","call_id":1,"provider":"anthropic","model":"claude-haiku-4-5",...}
{"ts":"...","event":"llm_call_end","req_id":"startup","call_id":1,"elapsed_ms":2100,"prompt_tokens":1240,"completion_tokens":892,...}

使用 --log-file mcpboot.log 捕获完整的未截断输出(stderr将长字符串截断为500个字符)。

2.使用MCP检查员进行测试:

npx @modelcontextprotocol/inspector --transport http --server-url http://localhost:8100/mcp

或者使用CLI进行测试 麦克波特:

# List all generated tools
npx mcporter list http://localhost:8100/mcp --schema --allow-http

# Get the top 5 stories (returns story IDs)
npx mcporter call 'http://localhost:8100/mcp.get_top_stories' limit=5 --allow-http

# Fetch details for a story
npx mcporter call 'http://localhost:8100/mcp.get_item_by_id' item_id=42345678 --allow-http

# Look up a user profile
npx mcporter call 'http://localhost:8100/mcp.get_user_profile' username=dang --allow-http

生成的工具: get_top_stories, get_new_stories, get_best_stories, get_ask_stories, get_show_stories, get_job_stories, get_item_by_id, get_user_profile, get_max_item_id, get_recent_changes

后续使用相同提示的运行将完全跳过LLM,并立即从缓存中启动。

从MCP主机连接

mcpboot运行后,将任何与MCP兼容的主机连接到 http://localhost:8000/mcp例如,在Claude Desktop的配置中:

{
  "mcpServers": {
    "my-api": {
      "url": "http://localhost:8000/mcp"
    }
  }
}

运作原理

mcpboot遵循两阶段启动,然后在运行时提供工具:

启动(LLM协助):

  1. 获取 -从提示中提取URL,获取其内容(API文档、自述文件、OpenAPI规范),并构建用于运行时网络访问的域白名单。
  2. 计划 -将提示和提取的文档发送到LLM,LLM生成结构化的生成计划:创建什么工具,它们的模式,它们使用哪些API端点。
  3. 编译 -将每个计划的工具发送回LLM,LLM生成一个JavaScript处理程序函数,该函数调用API、解析响应并格式化结果。
  4. 缓存 --将计划和编译的处理程序存储在磁盘上,按提示哈希+内容哈希键控。后续具有相同提示和不变文档的初创公司完全跳过LLM。

运行时(无LLM):

  1. 服务 --通过StreamableHTTP将生成的工具作为MCP服务器公开。工具调用在沙盒中执行缓存的JavaScript处理程序 vm 获取权限仅限于白名单域。
Prompt + API Docs
       │
       ▼
  URL Fetcher ──► Planner (LLM) ──► Compiler (LLM) ──► Cache
                                                          │
                                                          ▼
  MCP Host ◄──► Exposed Server ◄──► Executor ◄──► Sandbox (vm + fetch)
                                                          │
                                                          ▼
                                                    External APIs

安全模型

生成的处理程序在Node.js中运行 vm 沙盒:

  • 允许: 标准JS全局, fetch (仅限白名单域名)、URL、URLSearchParams
  • 此 路 不通: require, import, process, fs, net, child_process
  • 超时: 每次工具调用30秒

域白名单是根据提示中的URL和在获取的文档中发现的URL自动构建的。

与mcpblox的比较

mcpboot和 mcpblox 是互补的:

|| mcpblox | mcpboot| |--|---------|---------| | 输入 |现有MCP服务器+转换提示|自然语言提示+可选API文档| | 输出 |改造后的MCP服务器|从头开始新的MCP服务器| | LLM生成 |转换函数(输入/输出映射器)|工具处理程序函数(API完整集成)| | 用例 |自定义现有服务器|创建尚不存在的服务器|

它们可以被链接:使用mcpboot引导服务器,然后使用mcpblox对其进行转换。

# Bootstrap an MCP server for the HN API
mcpboot --prompt "Create MCP tools for https://github.com/HackerNews/API" --port 8001

# Transform it with mcpblox to add higher-level tools
mcpblox --upstream-url http://localhost:8001/mcp \
  --prompt "Create a 'daily_digest' tool that gets top 10 stories with their top comments" \
  --port 8002

发展

# Install dependencies
npm install

# Run tests
npm test

# Build
npm run build

# Run from source
npx tsx src/index.ts --prompt "..."

许可证

阿帕奇-2.0

目录标签

目录标签

JavaScriptClaudeAPI封装MCP服务器TypeScript本地部署自然语言编程无代码工具

支持客户端

Claude DesktopClaude

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

api-key

运行时(runtime,运行环境)

Node.js

来源包(packageName,安装包名)

@modelcontextprotocol/inspector

工具数量(toolCount,工具数)

10

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdioapi-key部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

来源信息

继续浏览同类 MCP