Skip to main content

MCP Server Bridge

中文 | English

一个模型上下文协议 (MCP) 服务器桥接器,允许动态注册简易的 CLI 工具及 HTTP 请求为 MCP 工具。

特性

  • 动态工具注册:
    • CLI 工具:可将注册环境中可用的 CLI 工具为 MCP 工具。
    • HTTP 工具:将简易的 HTTP 端点注册为 MCP 工具。
  • 配置持久化:
    • CLI 工具作为 YAML 配置持久化。
    • HTTP 工具作为 JSON 配置持久化。

项目结构

  • src/mcp_server_bridge/:主要包源码。
    • server.py:核心服务器逻辑和工具定义。
    • config/:存储已注册工具配置 (YAML/JSON) 的目录。
    • __init__.py:包导出。
    • __main__.py:入口点。
  • tests/:测试套件。

用法

连接到服务器

服务器运行 stdio 或 SSE 模式:

  • -t sse 启动 SSE 模式
  • -t stdio 或不指定参数则为 stdio 模式
"mcp-server-bridge": {
	"type": "stdio",
	"command": "uvx",
	"args": [
		"mcp-server-bridge"
	]
}

使用示例

注册 CLI 工具

注册一个 CLI 工具 fscan 为 MCP 工具:

alt text

CLI 工具使用: alt text

注册 HTTP 工具

注册一个 HTTP 接口为 MCP 工具: alt text

HTTP 工具使用: alt text

其他工具

还可以通过 LLM 对话注册以下 API 和 CLI 工具等等:

  • CLI:fscan, httpx, naabu, nmap, nuclei, subfinder
  • HTTP:http://cip.cc

内置管理工具

  1. get_cli_tool_help(command, help_flag):
    • 获取 CLI 命令的帮助文本。
    • 用于确定注册时的参数。
  2. register_cli_tool(command, tool_description, tool_usage, tool_args):
    • 注册一个新的 CLI 工具以通过 MCP 暴露。
    • 在 src/mcp_server_bridge/config/ 中生成 YAML 配置。
  3. register_http_tool(name, description, method, url, params, data, headers):
    • 注册一个新的 HTTP 工具。
    • 在 src/mcp_server_bridge/config/ 中生成 JSON 配置。

开发

  1. 安装 uv(如果尚未安装):
pip install uv
  1. 安装依赖项和包:
uv sync
  1. 运行服务器:
python src/mcp_server_bridge/server.py
  1. 安装
uv tool install . --force

测试

uv run pytest

Metadata

Release files for mcp-server-bridge 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mcp-server-bridge 0.1.1
File Size Uploaded
mcp_server_bridge-0.1.1.tar.gz 2.1 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for mcp-server-bridge 0.1.1
File Interpreter ABI Platform
mcp_server_bridge-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 2.2 MB

Release files / mcp_server_bridge-0.1.1.tar.gz

Download URL mcp_server_bridge-0.1.1.tar.gz
Size 2.1 MB
Tags Source
SHA-256 checksum
How to use checksums
831066568e517cdd64bbb493a2e93bf302976ef61cf520635bcadd9beeb78be4
BLAKE2b-256 checksum
How to use checksums
af11a9860aa1f0926ed0afc6aa4667b622ff98d87862d713d967299613a570ae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.13

Release files / mcp_server_bridge-0.1.1-py3-none-any.whl

Download URL mcp_server_bridge-0.1.1-py3-none-any.whl
Size 8.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
37fd2e9d0fa1d9e08a19c824ab56d2f653a9cd64a9089bf1a17bb9d05f489843
BLAKE2b-256 checksum
How to use checksums
2089700493a45a64484b1d5fdd02eb4c9b696a52d9b00bdd2bbaf1f10171cec8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.13

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page