Skip to content

Latest commit

 

History

History
97 lines (72 loc) · 2.3 KB

File metadata and controls

97 lines (72 loc) · 2.3 KB

MCP Server Bridge

中文 | English

A Model Context Protocol (MCP) server bridge that allows dynamic registration of CLI tools and HTTP requests as MCP tools.

Features

  • Dynamic Tool Registration:
    • CLI Tools: Register any CLI tool available in the environment.
    • HTTP Tools: Register simple HTTP endpoints as tools.
  • Configuration Persistence:
    • CLI tools are persisted as YAML configurations.
    • HTTP tools are persisted as JSON configurations.
  • Examples: The following APIs and CLI tools can be registered via LLM conversations:
    • CLI: fscan, httpx, naabu, nmap, nuclei, subfinder
    • HTTP: http://cip.cc

Installation

"mcp-server-bridge": {
	"type": "stdio",
	"command": "uvx",
	"args": [
		"mcp-server-bridge"
	]
}

Development

  1. Install uv (if not installed):
pip install uv
  1. Install dependencies and packages:
uv sync
  1. Run the server:
uv run mcp-server-bridge

Usage

Connecting to the Server

The server runs in stdio or SSE mode.

Built-in Management Tools

  1. get_cli_tool_help(command, help_flag):
    • Get help text for a CLI command.
    • Used to determine arguments during registration.
  2. register_cli_tool(command, tool_description, tool_usage, tool_args):
    • Register a new CLI tool to expose via MCP.
    • Generates YAML configuration in src/mcp_server_bridge/config/.
  3. register_http_tool(name, description, method, url, params, data, headers):
    • Register a new HTTP tool.
    • Generates JSON configuration in src/mcp_server_bridge/config/.

Usage Examples

Register CLI Tool

Register a CLI tool fscan as an MCP tool:

alt text

CLI tool usage: alt text

Register HTTP Tool

Register an HTTP interface as an MCP tool: alt text

HTTP tool usage: alt text

Project Structure

  • src/mcp_server_bridge/: Main package source.
    • server.py: Core server logic and tool definitions.
    • config/: Directory for storing registered tool configurations (YAML/JSON).
    • __init__.py: Package exports.
    • __main__.py: Entry point.
  • tests/: Test suite.

Development

Run tests:

uv run pytest