AM

avelino/mcp

开发工具

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

72 stars 19 forks 质量 84 趋势 34MIT

将MCP服务器转换为终端命令的CLI单一二进制

概览

CLI将MCP服务器转换为终端命令。 没有 SDK。没有包装代码。一个二进制文件,任何 MCP 服务器。 MCP(模型上下文协议)服务器会暴露工具——搜索问题、查询日志、发送消息、读取文件。这个CLI允许你直接从终端调用这些工具。你只需配置一次服务器,然后像使用其他命令一样使用它。 输出总是JSON。用管道处理,JQ处理,用脚本处理。 CLI读取你的配置(~/.config/mcp/servers.json),通过stdio或HTTP连接到服务器,并用JSON-RPC 2.0调用工具。认证(OAuth 2.0,API令牌)是自动处理的。 服务器运行于 ~/.config/mcp/servers.json: 三种服务器类型:- — CLI 生成本地进程(命令 + args)- — CLI 连接远程 URL(URL + 可选头部)- — 将任何命令行工具封装为 MCP 服务器(命令 + cli: true) 环境变量使用 ${VAR_NAME} 语法,并在运行时解析。

概述(AI 翻译)

CLI将MCP服务器转换为终端命令。

没有 SDK。没有包装代码。一个二进制文件,任何 MCP 服务器。

它的作用

MCP(模型上下文协议)服务器会暴露工具——搜索问题、查询日志、发送消息、读取文件。这个CLI允许你直接从终端调用这些工具。你只需配置一次服务器,然后像使用其他命令一样使用它。

输出总是 JSON。管道化,jq 它,编写脚本。

快速开始

安装:

从注册表添加服务器:

或者手动添加一个HTTP服务器:

查看有哪些工具可用:

呼叫工具:

就是这样。你用的是MCP。

它是如何运作的

CLI读取你的配置(~/.config/mcp/servers.json),通过stdio或HTTP连接到服务器,并用JSON-RPC 2.0调用工具。认证(OAuth 2.0,API令牌)是自动处理的。

配置

服务器位于~/.config/mcp/servers.json:

服务器分为三种类型:

  • Stdio — CLI 生成本地进程 ([command + args)
  • HTTP — CLI连接远程URL(url + 可选headers)
  • CLI — 将任何命令行工具包装为MCP服务器(command + cli: true)

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

README

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

mcp

CLI that turns MCP servers into terminal commands.

mcp sentry search_issues '{"query": "is:unresolved level:error"}'

No SDKs. No wrapper code. One binary, any MCP server.

What it does

MCP (Model Context Protocol) servers expose tools — search issues, query logs, send messages, read files. This CLI lets you call those tools directly from your terminal. You configure a server once, then use it like any other command.

$ mcp slack list_channels
$ mcp grafana search_dashboards '{"query": "api-latency"}'
$ mcp sentry get_issue_details '{"issue_id": "12345"}'

Output is always JSON. Pipe it, jq it, script it.

Quick start

Install:

# Homebrew (macOS and Linux)
brew tap avelino/mcp https://github.com/avelino/mcp.git
brew install avelino/mcp/mcp

# Docker
docker pull ghcr.io/avelino/mcp
alias mcp='docker run --rm -v ~/.config/mcp:/root/.config/mcp ghcr.io/avelino/mcp'

# Pre-built binary from GitHub Releases
# Download the latest from https://github.com/avelino/mcp/releases

# From source (requires Rust)
cargo install --path .

Add a server from the registry:

mcp add filesystem

Or add an HTTP server manually:

mcp add --url https://mcp.sentry.dev/sse sentry

See what tools are available:

mcp sentry --list

Call a tool:

mcp sentry search_issues '{"query": "is:unresolved"}'

That’s it. You’re using MCP.

How it works

graph LR
    You["You(terminal)"] --> CLI["mcp CLI"]
    CLI |"JSON-RPC 2.0stdio or HTTP"| Server["MCP Server"]
    Server  API["Service API"]
    Config[("servers.json")] -.-> CLI

    style CLI fill:#4a9,color:#fff

The CLI reads your config (~/.config/mcp/servers.json), connects to the server using stdio or HTTP, and speaks JSON-RPC 2.0 to call tools. Authentication (OAuth 2.0, API tokens) is handled automatically.

Configuration

Servers live in ~/.config/mcp/servers.json:

{
  "mcpServers": {
    "slack": {
      "command": "npx",
      "args": ["-y", "slack-mcp-server@latest", "--transport", "stdio"],
      "env": {
        "SLACK_MCP_XOXP_TOKEN": "${SLACK_TOKEN}",
        "SLACK_MCP_TEAM_ID": "${SLACK_TEAM_ID}"
      }
    },
    "sentry": {
      "url": "https://mcp.sentry.dev/sse"
    }
  }
}

Three types of servers:

  • Stdio — the CLI spawns a local process (command + args)
  • HTTP — the CLI connects to a remote URL (url + optional headers)
  • CLI — wraps any command-line tool as an MCP server (command + cli: true)

Environment variables use ${VAR_NAME} syntax and are resolved at runtime.

Authentication

For HTTP servers that require auth, mcp handles it automatically:

  1. OAuth 2.0 — If the server supports it, mcp opens your browser, completes the flow, and saves the token
在 GitHub 查看完整 README

安装

npx -y slack-mcp-server@latest --transport stdio
新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "slack": { "command": "npx", "args": ["-y", "slack-mcp-server@latest", "--transport", "stdio"], "env": { "SLACK_MCP_XOXP_TOKEN": "${SLACK_TOKEN}", "SLACK_MCP_TEAM_ID": "${SLACK_TEAM_ID}" } }, "sentry": { "url": "https://mcp.sentry.dev/sse" } } }