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
  • Exécutez sans effort LLM Backends, API, Frontends et Services avec une seule commande.

  • 1Panel-dev
  • 🔥 1Panel fournit une interface Web intuitive et un serveur MCP pour gérer des sites Web, des fichiers, des conteneurs, des bases de données et des LLM sur un serveur Linux.

  • rulego
  • ⛓️RULEGO est un cadre de moteur de règle d'orchestration des composants de nouvelle génération légère, intégrée, intégrée et de nouvelle génération pour GO.

  • WangRongsheng
  • 🧑‍🚀 全世界最好的 LLM 资料总结 (数据处理、模型训练、模型部署、 O1 模型、 MCP 、小语言模型、视觉语言模型) | Résumé des meilleures ressources LLM du monde.

  • Onelevenvy
  • Flock est une plate-forme à faible code de workflow pour construire rapidement des chatbots, un chiffon et coordonner des équipes multi-agents, alimentée par Langgraph, Langchain, Fastapi et NextJs. (Flock 是一个基于 Workflow 工作流的低代码平台 , 用于快速构建聊天机器人、 Rag 、 Agent 和 和 , 采用 采用 采用 采用 Langgraph 、 Langchain 、 Fastapi 和 ,))

  • Byaidu
  • PDF Traduction de papier scientifique avec formats conservés - 基于 AI 完整保留排版的 PDF 文档全文双语翻译 , 支持 Google / Deepl / Olllama / Openai 等服务 , 提供 CLI / GUI / MCP / DOCKER / ZOTERO

  • n8n-io
  • Plateforme d'automatisation de workflow à code équitable avec des capacités d'IA natives. Combinez le bâtiment visuel avec du code personnalisé, de l'auto-hôte ou du cloud, 400+ intégrations.

  • hkr04
  • SDK C ++ MCP (Protocole de contexte modèle léger)

  • sigoden
  • Créez facilement des outils et des agents LLM à l'aide de fonctions Plain Bash / JavaScript / Python.

  • RockChinQ
  • 😎简单易用、🧩丰富生态 - 大模型原生即时通信机器人平台 | 适配 QQ / 微信 (企业微信、个人微信) / 飞书 / 钉钉 / Discord / Telegram / Slack 等平台 | 支持 Chatgpt 、 Deepseek 、 Dify 、 Claude 、 GEMINI 、 XAI 、 PPIO 、 OLLAMA 、 LM Studio 、阿里云百炼、火山方舟、 Siliconflow 、 Qwen 、 Moonshot 、 ChatGlm 、 Sillytraven 、 MCP 等 LLM 的机器人 / Agent | Plateforme de bots de messagerie instantanée basés sur LLM, prend en charge Discord, Telegram, WeChat, Lark, Dingtalk, QQ, Slack

  • lasso-security
  • Une passerelle basée sur un plugin qui orchestre d'autres MCP et permet aux développeurs de s'appuyer sur des agents de qualité d'entreprise informatiques.

    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!