MCP Server个人版用于集成日常使用的工具(如Gmail、Google日历、Google云端硬盘、VSCode和GitHub),并与兼容的客户端如GitHub Copilot、Codex和Claude for Desktop进行交互。
本项目实现了一个多功能MCP服务器,作为本地中心与以下服务进行交互:
.ics。整个服务器基于FastMCP框架构建,不依赖于Docker或其他外部服务。
| 服务 | 工具 |
|---|---|
| Gmail | gmail_list_unread, gmail_search_messages, gmail_get_message, gmail_modify_message, gmail_mark_as_read, gmail_send_message |
| 日历 | calendar_upcoming, calendar_create_event, calendar_update_event, calendar_delete_event, calendar_export_event |
| 云端硬盘 | drive_search, drive_create_file, drive_update_file, drive_download_file, drive_delete_file, drive_share_file |
| GitHub | github_list_repos, github_create_issue, github_list_pull_requests, github_create_pull_request, github_merge_pull_request, github_create_branch, github_commit_file, github_list_releases, github_create_release |
| VSCode | vscode_open, vscode_open_file, vscode_install_ext, vscode_list_extensions, vscode_search_text, vscode_run_command, vscode_git_status |
mcp-hub-ricardo/
├── mcp_hub/
│ ├── auth/
│ │ └── google_auth.py # 处理Google API的OAuth2
│ ├── tools/
│ │ ├── calendar_tool.py # 日历端点
│ │ ├── drive_tool.py # 云端硬盘端点
│ │ ├── gmail_tool.py # Gmail端点
│ │ ├── github_tool.py # 集成GitHub API
│ │ └── vscode_tool.py # 对VSCode的本地操作
│ ├── core/
│ │ └── mcp.py # FastMCP的核心实例
│ └── server.py # MCP服务器的入口点
├── secrets/
│ └── credentials.google.json # OAuth2凭据(手动创建)
├── data/
│ └── token.google.json # 初始认证后生成的令牌
├── pyproject.toml
└── .env.example
repo范围的GitHub个人访问令牌git clone https://github.com/Ricardouchub/mcp-hub-ricardo.git
cd mcp-hub-ricardo
uv sync
uv pip install -e .
credentials.json文件。secrets/credentials.google.json。calendar_upcoming)以启动授权流程。data/token.google.json中(如果更改范围,请删除此文件并重新运行流程)。uv run mcp dev mcp_hub/server.py
这将打开MCP Inspector以测试工具和验证响应。
生产模式(STDIO):
uv run mcp run stdio mcp_hub/server.py
Codex从~/.codex/config.toml读取MCP配置。
~/.codex/config.toml[mcp_servers.mcp_hub_ricardo]
# Windows:
command = "PROJECT_ROOT/.venv/Scripts/mcp.exe"
# macOS/Linux:
# command = "PROJECT_ROOT/.venv/bin/mcp"
args = ["run", "--transport", "stdio", "PROJECT_ROOT/mcp_hub/server.py"]
cwd = "PROJECT_ROOT"
[mcp_servers.mcp_hub_ricardo.env]
GOOGLE_CREDENTIALS_PATH = "PROJECT_ROOT/secrets/credentials.google.json"
GOOGLE_TOKEN_PATH = "PROJECT_ROOT/data/token.google.json"
GOOGLE_SCOPES = "https://www.googleapis.com/auth/gmail.readonly https://www.googleapis.com/auth/gmail.modify https://www.googleapis.com/auth/gmail.send https://www.googleapis.com/auth/calendar https://www.googleapis.com/auth/drive https://www.googleapis.com/auth/drive.metadata.readonly"
GITHUB_TOKEN = "GITHUB_TOKEN"
Claude Desktop使用%APPDATA%/Claude/claude_desktop_config.json(Windows)或~/Library/Application Support/Claude/claude_desktop_config.json(macOS)。编辑后,重启Claude Desktop。
claude_desktop_config.json{
"mcpServers": {
"mcp-hub-ricardo": {
"command": "PROJECT_ROOT/.venv/Scripts/mcp.exe",
"args": [
"run",
"--transport",
"stdio",
"PROJECT_ROOT/mcp_hub/server.py"
],
"cwd": "PROJECT_ROOT",
"env": {
"GOOGLE_CREDENTIALS_PATH": "PROJECT_ROOT/secrets//credentials.google.json",
"GOOGLE_TOKEN_PATH": "PROJECT_ROOT/data/token.google.json",
"GOOGLE_SCOPES": "https://www.googleapis.com/auth/gmail.readonly https://www.googleapis.com/auth/gmail.modify https://www.googleapis.com/auth/gmail.send https://www.googleapis.com/auth/calendar https://www.googleapis.com/auth/drive https://www.googleapis.com/auth/drive.metadata.readonly",
"GITHUB_TOKEN": "GITHUB_TOKEN"
}
}
}
}
在命令面板中执行:MCP: 打开用户配置
mcp.json{
"servers": {
"mcp-hub-ricardo": {
"type": "stdio",
"command": "PROJECT_ROOT/.venv/Scripts/mcp.exe",
"args": ["run", "--transport", "stdio", "PROJECT_ROOT/mcp_hub/server.py"],
"cwd": "PROJECT_ROOT",
"env": {
"GOOGLE_CREDENTIALS_PATH": "PROJECT_ROOT/secrets/credentials.google.json",
"GOOGLE_TOKEN_PATH": "PROJECT_ROOT/data/token.google.json",
"GOOGLE_SCOPES": "https://www.googleapis.com/auth/gmail.readonly https://www.googleapis.com/auth/gmail.modify https://www.googleapis.com/auth/gmail.send https://www.googleapis.com/auth/calendar https://www.googleapis.com/auth/drive https://www.googleapis.com/auth/drive.metadata.readonly",
"GITHUB_TOKEN": "GITHUB_TOKEN"
}
}
}
}
步骤在VS Code中:
google-api-python-client, google-auth-oauthlib) 用于Gmail/日历/云端硬盘。Ricardo Urdaneta