智能代理网关

MCPSmartProxy是一个高效的MCP服务器网关,支持语义工具搜索和动态配置更新。

  • by daedalus
  • Python
  • 本地部署
  • 更新于
在 GitHub 查看 daedalus/mcp-smart-proxy

使用说明

MCPSmartProxy

具有语义工具搜索的令牌高效MCP服务器网关

mcp名称:io.github.daedalus/mcp-smart-proxy

安装

pip install mcp-smart-proxy

用法

from mcp_smart_proxy import ProxyConfig

config = ProxyConfig.from_file("proxy.yaml")

命令行界面

mcp-smart-proxy --help
mcp-smart-proxy serve --config proxy.yaml
mcp-smart-proxy serve --config proxy.yaml --watch ./servers/
mcp-smart-proxy serve --config proxy.yaml --transport streamable-http --host 0.0.0.0 --port 8000
mcp-smart-proxy index --config proxy.yaml
mcp-smart-proxy status --config proxy.yaml
mcp-smart-proxy validate --config proxy.yaml

这 --watch 选项监视目录 .yaml, .yml,或 .json 包含以下内容的文件 上游服务器配置。添加、修改或删除文件以动态更新 运行时可用的服务器。

运输选项

这 --transport 选项支持:

  • stdio (默认)-本地MCP客户端的标准输入/输出传输

API

配置

  • ProxyConfig -主要配置模型
  • UpstreamConfig -上游服务器配置
  • EmbeddingConfig -嵌入后端配置
  • VectorStoreConfig -矢量存储后端配置

模型

  • ListResult -结果来自 list 工具
  • SearchResult -结果来自 search 工具
  • ToolResult -工具调用结果

发展

git clone https://github.com/daedalus/mcp-smart-proxy.git
cd mcp-smart-proxy
pip install -e ".[test]"

# run tests
pytest

# format
ruff format src/ tests/

# lint
ruff check src/ tests/

# type check
mypy src/