
Smart-MCP-Proxy
3 years
Works with Finder
0
Github Watches
0
Github Forks
0
Github Stars
Smart MCP Proxy
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
- Value Proposition
- Features
- Architecture
- Configuration
- Operating Modes
- Usage
- Docker Usage
- Development
- Documentation
- License
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
相关推荐
Flock是一个基于工作流程的低音平台,可快速构建聊天机器人,抹布和协调多代理团队,由Langgraph,Langchain,Langchain,Fastapi和Nextjs提供支持。(羊群工作流工作流的低代码平台,rag rag rag 用于快速构建聊天机器人、 rag temant Agent fastem temantfaster和muti-agent agagent应用
😎简单易用、🧩丰富生态 -大模型原生即时通信机器人平台| 适配QQ / 微信(企业微信、个人微信) /飞书 /钉钉 / discord / telegram / slack等平台| 支持chatgpt,deepseek,dify,claude,基于LLM的即时消息机器人平台,支持Discord,Telegram,微信,Lark,Dingtalk,QQ,Slack
Reviews

user_voNbP1yX
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!

user_ErwEefUh
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.

user_RQLW3dEE
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!

user_h4yehJOr
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!

user_NCavepFh
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!

user_Ol5kjBSb
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!