Skip to main content

MCP Bridge: A unified interface for CLI, HTTP, and LLM integration.

Project description

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 工具 fscanMCP 工具:

alt text

CLI 工具使用: alt text

注册 HTTP 工具

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

HTTP 工具使用: alt text

其他工具

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

  • CLIfscan, httpx, naabu, nmap, nuclei, subfinder
  • HTTPhttp://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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcp_server_bridge-0.1.1.tar.gz (2.1 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mcp_server_bridge-0.1.1-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file mcp_server_bridge-0.1.1.tar.gz.

File metadata

  • Download URL: mcp_server_bridge-0.1.1.tar.gz
  • Upload date:
  • Size: 2.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for mcp_server_bridge-0.1.1.tar.gz
Algorithm Hash digest
SHA256 831066568e517cdd64bbb493a2e93bf302976ef61cf520635bcadd9beeb78be4
MD5 f392793fa3bce3561926b3c104398053
BLAKE2b-256 af11a9860aa1f0926ed0afc6aa4667b622ff98d87862d713d967299613a570ae

See more details on using hashes here.

File details

Details for the file mcp_server_bridge-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for mcp_server_bridge-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 37fd2e9d0fa1d9e08a19c824ab56d2f653a9cd64a9089bf1a17bb9d05f489843
MD5 1b50e89d527feee9c0d0d2e25d684dee
BLAKE2b-256 2089700493a45a64484b1d5fdd02eb4c9b696a52d9b00bdd2bbaf1f10171cec8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page