MCP限制工具
MCP(模型上下文协议)工具的代理服务器,具有配额管理和工具过滤功能。
特性
- 配额管理:为每个MCP工具设置每小时、每天、每周、每月、每年或一次的使用配额
- 工具筛选:允许列出客户端可以访问的特定工具
- 热重新加载:动态更新配置,无需重新启动服务器
- 使用情况跟踪:跟踪并保存重启过程中的工具使用情况
- 多个MCP服务器:通过单个代理管理多个MCP工具后端
快速开始
1.克隆存储库
git clone https://github.com/36bian/mcp-limit-tool.git
cd mcp-limit-tool
go build -o mcp-limit-tool2.配置
编辑 config/config.json 要配置MCP服务器连接和配额,请执行以下操作:
{
"app_name": {
"command": "npx",
"args": ["-y", "your-mcp-server"],
"env": {
"API_KEY": "your-api-key"
},
"allowed_tools": ["tool_name_1", "tool_name_2"],
"rate_limits": {
"hourly": {"total": 100, "duration": "1h"},
"daily": {"total": 500, "duration": "24h"},
"weekly": {"total": 3000, "duration": "7d"},
"monthly": {"total": 10000, "duration": "30d"},
"yearly": {"total": 50000, "duration": "1y"},
"once": {"total": 1000000, "duration": "unlimited"}
}
},
"second_app_name": {}
}3.配置IDE(VS代码/光标/托盘)
将以下内容添加到IDE的MCP配置中。这 AppName 必须与中定义的应用程序名称匹配 config.json:
{
"mcpServers": {
"github": {
"command": "/path/to/mcp-limit-tool",
"env": {
"AppName": "github"
}
}
}
}备注:TheAppNameenv变量必须与中的键名匹配config.json(例如。,"github","exa","jina").
热重新加载
该工具支持配置更改的热重新加载:
- 添加/删除应用程序:修改
config.json添加新的MCP服务器或删除现有服务器 - 更新配额:更改中的配额配置
config.json-更改立即生效 - 重置使用情况:编辑
usage.json手动重置使用计数器
服务器会自动监视文件更改,无需重新启动。
需求
- 转到1.24+
- Node.js(用于基于npx的MCP服务器)
许可证
麻省理工学院
