为concept和VERCEL工作,GITHUB OUATH问题
MCP工具过滤器
将多个MCP服务器中的特定工具组合到一个自定义服务器中。
快速开始
# Install dependencies
pip3 install -r requirements.txt
# (Optional) Set up authentication for servers that require it
cp .env.example ~/.config/mcp-filter/.env
# Edit ~/.config/mcp-filter/.env and add your API keys
# Run interactive mode
python -m mcp_filter
# Or list available servers (🔑 indicates auth required)
python -m mcp_filter --list-servers它做什么
从多个MCP服务器中选择特定工具,并将其组合到一个经过筛选的服务器中。
示例:仅使用以下内容创建服务器:
create_page来自Notionget_deployments来自Vercel
交互模式
python -m mcp_filter- 选择服务器(例如。,
1,3Notion+Vercel) - 如果服务器需要身份验证(显示为🔑), 系统将提示您输入API密钥
- 从每个服务器中选择工具
- 在中获取组合过滤服务器
output/ - 可选择自动添加到Claude Code配置中
程序化使用
from mcp_filter import CodeGenerator
selected_tools = [
{"name": "create_page", "server": "notion"},
{"name": "get_deployments", "server": "vercel"},
]
server_commands = {
"notion": "npx -y mcp-remote https://mcp.notion.com/mcp",
"vercel": "npx -y mcp-remote https://mcp.vercel.com/mcp",
}
CodeGenerator.generate_filtered_mcp(
server_commands=server_commands,
selected_tools=selected_tools,
output_file="my_server.py"
)管理服务器
# Add server
python -m mcp_filter --add-server myserver "command to start server"
# Remove server
python -m mcp_filter --remove-server myserver
# List servers
python -m mcp_filter --list-servers使用生成的服务器
在克劳德桌面
添加到 ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"my-filtered-server": {
"command": "python3",
"args": ["/absolute/path/to/output/filtered_server.py"]
}
}
}独立
python3 output/filtered_server.py默认服务器
- 概念 - https://mcp.notion.com/mcp
- GitHub 🔑 - 官方GitHub MCP(需要Docker+
GITHUB_PERSONAL_ACCESS_TOKEN) - 维尔塞尔 - https://mcp.vercel.com/mcp
需求
- Python 3.6+
- npx(Node.js)
- Docker(GitHub MCP服务器需要)
- 网络连接
认证
一些MCP服务器需要API密钥或令牌(用🔑).
设置
- 复制示例环境文件:
cp .env.example ~/.config/mcp-filter/.env- 编辑
~/.config/mcp-filter/.env并添加您的凭据:
GITHUB_PERSONAL_ACCESS_TOKEN=ghp_your_token_here- 当你奔跑时
python -m mcp_filter,该工具将:
- 自动使用来自的凭据 .env 文件 - 提示您输入任何缺少的凭据 - 将新凭据保存到 .env 供将来使用 - 在Claude代码配置中包含凭据
在哪里获取凭证
- GitHub个人访问令牌:
- 创建时间https://github.com/settings/tokens - 所需范围: repo, read:packages, read:org - 需要安装并运行Docker
故障排除
服务器无法连接:
- 服务器标记为🔑 需要身份验证-检查您的
.env文件 - 先尝试Notion(无需身份验证)
未列出服务器:
python -m mcp_filter --add-server notion "npx -y mcp-remote https://mcp.notion.com/mcp"项目结构
mcp_filter/
├── core/ # MCP client, config, code generation
├── cli/ # Display and input handling
└── interactive.py # Main workflow