Emcee

Emcee

Generate an MCP server for any OpenAPI documented endpoint.

Category
访问服务器

README

emcee 流程图

emcee

emcee 是一个工具,它为任何具有 OpenAPI 规范的 Web 应用程序提供 模型上下文协议 (MCP) 服务器。 你可以使用 emcee 将 Claude Desktop其他应用程序 连接到外部工具和数据服务, 类似于 ChatGPT 插件

快速开始

如果你使用的是 macOS 并且安装了 Homebrew, 你可以快速启动并运行。

# 安装 emcee
brew install loopwork-ai/tap/emcee

确保你已安装 Claude Desktop

要配置 Claude Desktop 以与 emcee 一起使用:

  1. 打开 Claude Desktop 设置 (<kbd>⌘</kbd><kbd>,</kbd>)
  2. 在侧边栏中选择“开发者”部分
  3. 单击“编辑配置”以打开配置文件

Claude Desktop 设置编辑配置按钮

配置文件应位于 Application Support 目录中。 你也可以使用以下命令直接在 VSCode 中打开它:

code ~/Library/Application\ Support/Claude/claude_desktop_config.json

添加以下配置以添加 weather.gov MCP 服务器:

{
  "mcpServers": {
    "weather": {
      "command": "emcee",
      "args": [
        "https://api.weather.gov/openapi.json"
      ]
    }
  }
}

保存文件后,退出并重新打开 Claude。 你现在应该在聊天框的右下角看到 <kbd>🔨57</kbd>。 单击它以查看通过 MCP 提供给 Claude 的所有工具的列表。

开始新的聊天,并询问你所在地的天气。

波特兰,俄勒冈州的天气怎么样?

Claude 将查阅通过 MCP 提供给它的工具, 并请求使用一个工具,如果认为适合回答你的问题。 你可以查看此请求并批准或拒绝它。

<img src="https://github.com/user-attachments/assets/394ac476-17c2-4a29-aaff-9537d42b289b" alt="允许来自 weather MCP 对话框的工具" width="460">

如果允许,Claude 将与 MCP 通信 并使用结果来告知其响应。

Claude 响应与 MCP 工具使用


[!TIP] 正在构建代理?想要部署远程 MCP 服务器? 请通过 emcee@loopwork.com 与我们联系


为什么使用 emcee?

MCP 提供了一种标准化的方式来将 AI 模型连接到工具和数据源。 现在还处于早期阶段,但已经有各种 可用的服务器 用于连接到浏览器、开发人员工具和其他系统。

我们认为 emcee 是一种连接到服务的便捷方式, 这些服务没有现有的 MCP 服务器实现—— 特别是对于你自己构建的服务。 有一个带有 OpenAPI 规范的 Web 应用程序? 你可能会惊讶于你能走多远 而无需仪表板或客户端库。

安装

安装脚本

使用 安装脚本 下载并安装适用于你的平台的 emcee 的 预构建版本 (Linux x86-64/i386/arm64 和 macOS Intel/Apple Silicon)。

# fish
sh (curl -fsSL https://get.emcee.sh | psub)

# bash, zsh
sh <(curl -fsSL https://get.emcee.sh)

Homebrew

使用 HomebrewLoopwork 的 tap 安装 emcee。

brew install loopwork-ai/tap/emcee

Docker

提供带有 emcee 的预构建 Docker 镜像

docker run -it ghcr.io/loopwork-ai/emcee

从源代码构建

需要 go 1.24 或更高版本。

git clone https://github.com/loopwork-ai/emcee.git
cd emcee
go build -o emcee cmd/emcee/main.go

构建完成后,你可以就地运行 (./emcee) 或将其移动到 PATH 中的某个位置,例如 /usr/local/bin

用法

Usage:
  emcee [spec-path-or-url] [flags]

Flags:
      --basic-auth string    Basic auth value (either user:pass or base64 encoded, will be prefixed with 'Basic ')
      --bearer-auth string   Bearer token value (will be prefixed with 'Bearer ')
  -h, --help                 help for emcee
      --raw-auth string      Raw value for Authorization header
      --retries int          Maximum number of retries for failed requests (default 3)
  -r, --rps int              Maximum requests per second (0 for no limit)
  -s, --silent               Disable all logging
      --timeout duration     HTTP request timeout (default 1m0s)
  -v, --verbose              Enable debug level logging to stderr
      --version              version for emcee

emcee 实现了 MCP 的 标准输入/输出 (stdio) 传输, 它使用 JSON-RPC 2.0 作为其线路格式。

当你从命令行运行 emcee 时, 它会启动一个程序,该程序侦听 stdin, 输出到 stdout, 并记录到 stderr。

身份验证

对于需要身份验证的 API, emcee 支持多种身份验证方法:

身份验证类型 示例用法 生成的标头
Bearer 令牌 --bearer-auth="abc123" Authorization: Bearer abc123
基本身份验证 --basic-auth="user:pass" Authorization: Basic dXNlcjpwYXNz
原始值 --raw-auth="Custom xyz789" Authorization: Custom xyz789

这些身份验证值可以直接提供 或作为 1Password 密钥引用

使用 1Password 引用时:

  • 使用格式 op://vault/item/field (例如 --bearer-auth="op://Shared/X/credential")
  • 确保已安装 1Password CLI (op) 并且在你的 PATH 中可用
  • 在运行 emcee 或启动 Claude Desktop 之前登录到 1Password
# 安装 op
brew install 1password-cli

# 登录 1Password CLI
op signin
{
  "mcpServers": {
    "twitter": {
      "command": "emcee",
      "args": [
        "--bearer-auth=op://shared/x/credential",
        "https://api.twitter.com/2/openapi.json"
      ]
    }
  }
}

<img src="https://github.com/user-attachments/assets/d639fd7c-f3bf-477c-9eb7-229285b36f7d" alt="1Password 访问请求" width="512">

[!IMPORTANT] emcee 在从作为命令参数提供的 URL 下载 OpenAPI 规范时,不使用身份验证凭据。 如果你的 OpenAPI 规范需要身份验证才能访问, 请首先使用你首选的 HTTP 客户端将其下载到本地文件, 然后将本地文件路径提供给 emcee。

转换 OpenAPI 规范

你可以在将 OpenAPI 规范传递给 emcee 之前,使用标准 Unix 实用程序对其进行转换。这对于以下情况很有用:

  • 选择要作为工具公开的特定端点 使用 jqyq
  • 修改描述或参数 使用 OpenAPI Overlays
  • 组合多个规范 使用 Redocly

例如, 你可以使用 jq 仅包含来自 weather.govpoint 工具。

cat path/to/openapi.json | \
  jq 'if .paths then .paths |= with_entries(select(.key == "/points/{point}")) else . end' | \
  emcee

JSON-RPC

你可以通过发送 JSON-RPC 请求直接与提供的 MCP 服务器交互。

[!NOTE] emcee 仅提供 MCP 工具功能。 尚不支持其他功能,如资源、提示和采样。

列出工具

<details open>

<summary>请求</summary>

{"jsonrpc": "2.0", "method": "tools/list", "params": {}, "id": 1}

</details>

<details open>

<summary>响应</summary>

{
  "jsonrpc":"2.0",
  "result": {
    "tools": [
      // ...
      {
          "name": "tafs",
          "description": "返回指定机场站的终端机场预报。",
          "inputSchema": {
              "type": "object",
              "properties": {
                  "stationId": {
                      "description": "观测站 ID",
                      "type": "string"
                  }
              },
              "required": ["stationId"]
          }
      },
      // ...
    ]
  },
  "id": 1
}

</details>

调用工具

<details open>

<summary>请求</summary>

{"jsonrpc": "2.0", "method": "tools/call", "params": { "name": "taf", "arguments": { "stationId": "KPDX" }}, "id": 1}

</details>

<details open>

<summary>响应</summary>

{
  "jsonrpc":"2.0",
  "content": [
    {
      "type": "text",
      "text": /* GeoJSON 格式的天气预报 */,
      "annotations": {
        "audience": ["assistant"]
      }
    }
  ]
  "id": 1
}

</details>

调试

MCP Inspector 是一个用于测试和调试 MCP 服务器的工具。 如果 Claude 和/或 emcee 未按预期工作, 检查器可以帮助你了解发生了什么。

npx @modelcontextprotocol/inspector emcee https://api.weather.gov/openapi.json
# 🔍 MCP Inspector 正在 http://localhost:5173 上运行 🚀
open http://localhost:5173

许可证

emcee 在 Apache License, Version 2.0 下获得许可。

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选