Cover image
Try Now
2025-04-14

3 years

Works with Finder

0

Github Watches

0

Github Forks

0

Github Stars

Smart MCP Proxy

Smart MCP Proxy Logo

Smart MCP Proxy is a powerful, secure, and configurable gateway that centralizes access to multiple Model Context Protocol (MCP) servers. It enables organizations to manage tokens centrally, unify MCP server configurations, and expose only the tools and resources they choose — all through a single, transparent HTTP interface with detailed logging.

Table of Contents

Introduction

Smart MCP Proxy acts as a secure gateway between clients and multiple MCP servers, exposing a curated subset of tools and resources. It simplifies client interactions by presenting a unified API while enforcing fine-grained access control and transparent logging.

Value Proposition

  • Centralized Token Management: Manage authentication tokens in one place, reducing complexity and improving security.
  • Unified MCP Server Configuration: Configure multiple MCP servers in a single proxy configuration file.
  • Fine-Grained Exposure: Selectively expose only approved tools and resources from each MCP server.
  • Cost Savings Through Smaller Tool Footprint: By exposing only the necessary tools and resources, Smart MCP Proxy reduces token overhead and operational costs, enabling organizations to optimize resource usage and minimize expenses.
  • Transparent Logging: Detailed logs of all requests and responses for auditing and troubleshooting.

Features

  • Configurable list of MCP servers (HTTP and stdio-based).
  • Tool and resource allow-listing per MCP server.
  • Automatic lifecycle management of stdio-based MCP servers.
  • Implements all standard MCP HTTP endpoints.
  • Transparent request and response logging.
  • Supports environment variable and command-line configuration.
  • Example configuration provided for quick start.

Architecture

+-------------------+         +-------------------+         +-------------------+
|                   |         |                   |         |                   |
|   Client(s)       +-------->+  Smart MCP Proxy  +-------->+  MCP Server(s)    |
|                   |  HTTP   |   (this project)  |   MCP   |  (downstream)     |
+-------------------+         +-------------------+         +-------------------+
                                   |         |         |
                                   |         |         |
                                   v         v         v
                              [Tool A]   [Tool B]   [Tool C]
  • The proxy listens on HTTP port 8080.
  • Routes client requests to allowed tools on configured MCP servers.
  • Exposes only explicitly whitelisted tools and resources.

Configuration

Smart MCP Proxy is configured primarily via a JSON file specifying MCP servers, allowed tools, and resources. The configuration file path can be set via the MCP_PROXY_CONFIG environment variable or the -config command-line argument.

See the detailed configuration documentation in docs/configuration.md and the example configuration at configs/example-config.json.

Operating Modes

The proxy can operate in two modes:

  • HTTP Mode (default): The proxy listens on an HTTP port (default 8080) and communicates with clients using the standard MCP HTTP protocol.
  • Command/STDIO Mode: The proxy communicates with a single client via standard input (STDIN) and standard output (STDOUT), using the MCP command protocol. Logs are written to standard error (STDERR). This mode is useful for direct integration with tools or scripts.

You can select the mode using:

  • The -mode command-line flag (e.g., -mode command).
  • The MCP_PROXY_MODE environment variable (e.g., export MCP_PROXY_MODE=command).

If neither is specified, the proxy defaults to HTTP mode.

Usage

Running Locally

HTTP Mode (Default):

# Using command-line flag for config
./smart-mcp-proxy -config /path/to/config.json

# Using environment variable for config
export MCP_PROXY_CONFIG=/path/to/config.json
./smart-mcp-proxy

Command/STDIO Mode:

# Using command-line flags
./smart-mcp-proxy -config /path/to/config.json -mode command

# Using environment variables
export MCP_PROXY_CONFIG=/path/to/config.json
export MCP_PROXY_MODE=command
./smart-mcp-proxy

For stdio-based MCP servers defined in the configuration, the proxy manages the lifecycle of the server process, including starting and stopping it as needed.

See detailed usage instructions in docs/usage.md.

Docker Usage

The official Docker image ghcr.io/timthesinner/smart-mcp-proxy:latest supports amd64 and arm64 architectures.

Default Mode (Command/STDIO)

The Docker image defaults to running the proxy in Command/STDIO mode.

# Example: Run in default Command/STDIO mode, mounting a local config
docker run --rm -i \
  -v ./configs/example-config.json:/app/config.json:ro \
  -e MCP_PROXY_CONFIG=/app/config.json \
  ghcr.io/timthesinner/smart-mcp-proxy:latest

Note: -i is used to attach STDIN for command mode.

Overriding to HTTP Mode

To run the container in HTTP mode, set the MCP_PROXY_MODE environment variable to http and expose the port (default 8080).

# Example: Run in HTTP mode, mounting a local config and exposing port 8080
docker run --rm -d \
  -p 8080:8080 \
  -v ./configs/example-config.json:/app/config.json:ro \
  -e MCP_PROXY_CONFIG=/app/config.json \
  -e MCP_PROXY_MODE=http \
  ghcr.io/timthesinner/smart-mcp-proxy:latest

Docker-in-Docker (DinD)

For scenarios requiring the proxy to interact with Docker (e.g., managing stdio servers running in containers), you might need to mount the host's Docker socket or use a DinD sidecar. See docs/usage.md for details and security considerations.

Development

Running Pre-commit Checks Locally

To run the pre-commit checks on your local machine, execute:

go fmt ./...
go test ./...

Ensure your code is properly formatted and all tests pass before committing.

VS Code Launch Configuration

A VS Code launch configuration named "Launch Proxy (STDIO Mode)" is provided in .vscode/launch.json. This allows you to easily run and debug the proxy directly in Command/STDIO mode using the example configuration file. Access it via the "Run and Debug" panel in VS Code.

Documentation

License

MIT

相关推荐

  • av
  • 毫不费力地使用一个命令运行LLM后端,API,前端和服务。

  • 1Panel-dev
  • 🔥1Panel提供了直观的Web接口和MCP服务器,用于在Linux服务器上管理网站,文件,容器,数据库和LLMS。

  • WangRongsheng
  • 🧑‍🚀 llm 资料总结(数据处理、模型训练、模型部署、 o1 模型、mcp 、小语言模型、视觉语言模型)|摘要世界上最好的LLM资源。

  • rulego
  • ⛓️Rulego是一种轻巧,高性能,嵌入式,下一代组件编排规则引擎框架。

  • Byaidu
  • PDF科学纸翻译带有保留格式的pdf -基于ai完整保留排版的pdf文档全文双语翻译

  • Onelevenvy
  • Flock是一个基于工作流程的低音平台,可快速构建聊天机器人,抹布和协调多代理团队,由Langgraph,Langchain,Langchain,Fastapi和Nextjs提供支持。(羊群工作流工作流的低代码平台,rag rag rag 用于快速构建聊天机器人、 rag temant Agent fastem temantfaster和muti-agent agagent应用

  • n8n-io
  • 具有本机AI功能的公平代码工作流程自动化平台。将视觉构建与自定义代码,自宿主或云相结合,400+集成。

  • sigoden
  • 使用普通的bash/javascript/python函数轻松创建LLM工具和代理。

  • hkr04
  • 轻巧的C ++ MCP(模型上下文协议)SDK

  • RockChinQ
  • 😎简单易用、🧩丰富生态 -大模型原生即时通信机器人平台| 适配QQ / 微信(企业微信、个人微信) /飞书 /钉钉 / discord / telegram / slack等平台| 支持chatgpt,deepseek,dify,claude,基于LLM的即时消息机器人平台,支持Discord,Telegram,微信,Lark,Dingtalk,QQ,Slack

  • dmayboroda
  • 带有可配置容器的本地对话抹布

    Reviews

    3.3 (6)
    Avatar
    user_voNbP1yX
    2025-04-23

    I've been using the Smart-MCP-Proxy by timthesinner for several months now, and I'm thoroughly impressed. This tool offers seamless integration and robust performance. The welcome information is a nice touch, making it user-friendly even for beginners. Highly recommended for anyone looking to optimize their proxies efficiently!

    Avatar
    user_ErwEefUh
    2025-04-23

    I've been using Smart-MCP-Proxy by Timthesinner, and it's a game-changer! The seamless integration and intuitive interface make it a breeze to work with. Highly recommend it for anyone needing a reliable proxy solution.

    Avatar
    user_RQLW3dEE
    2025-04-23

    The smart-mcp-proxy by timthesinner is a game-changer for anyone using MCP applications. The proxy seamlessly integrates, providing a smooth and efficient performance boost. It’s user-friendly and enhances the overall experience significantly. Highly recommend for any MCP users looking to optimize their workflow!

    Avatar
    user_h4yehJOr
    2025-04-23

    Smart-mcp-proxy by timthesinner is a game-changer for streamlining my network operations. Its robust performance and ease of use are unmatched. This tool is essential for anyone looking to optimize proxy management with minimal hassle. Highly recommended!

    Avatar
    user_NCavepFh
    2025-04-23

    As a dedicated user of the mcp application, I find the smart-mcp-proxy by timthesinner to be incredibly efficient and reliable. This smart proxy tool seamlessly integrates with my existing setup, providing swift and secure routing. It has significantly improved my workflow with its user-friendly interface and robust performance. Highly recommended for anyone looking to enhance their mcp usage!

    Avatar
    user_Ol5kjBSb
    2025-04-23

    I've been using smart-mcp-proxy by timthesinner for a while now, and it's phenomenal! The seamless integration and intuitive interface make managing my proxies a breeze. It supports multiple languages and is consistently reliable. Highly recommend for anyone looking for an efficient proxy management tool!