返回市场
MCP中心里卡多

MCP中心里卡多

作者:Ricardouchub2 星标更新:2025-11-04

项目介绍

<p align="right"> <a href="https://github.com/Ricardouchub/mcp-hub-ricardo/blob/master/README-english.md"> 英文README </a> </p>

MCP Hub Personal

状态 Python uv FastMCP GitHub VSCode Codex Claude

MCP Server个人版用于集成日常使用的工具(如Gmail、Google日历、Google云端硬盘、VSCode和GitHub),并与兼容的客户端如GitHub CopilotCodexClaude for Desktop进行交互。


描述

本项目实现了一个多功能MCP服务器,作为本地中心与以下服务进行交互:

  • Gmail:列出邮件、阅读内容、发送消息、管理标签和附件。
  • Google日历:列出事件、创建/编辑/删除会议并导出为.ics
  • Google云端硬盘:搜索、创建、更新、下载、删除和共享文件。
  • VSCode本地:打开文件/文件夹、管理扩展、搜索文本并执行命令或从VSCode CLI运行Git。
  • GitHub:列出仓库、创建问题、管理拉取请求、分支、提交和发布。

整个服务器基于FastMCP框架构建,不依赖于Docker或其他外部服务。


工具列表

服务工具
Gmailgmail_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
GitHubgithub_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
VSCodevscode_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

要求

  • Python 3.10+
  • Node.js 18+(仅用于可选的MCP Inspector)
  • 带有OAuth2凭据的Google Cloud账户
  • 具有repo范围的GitHub个人访问令牌
  • 安装了Copilot / Codex的Visual Studio Code

安装

git clone https://github.com/Ricardouchub/mcp-hub-ricardo.git
cd mcp-hub-ricardo
uv sync
uv pip install -e .

使用Google进行身份验证

  1. 在Google Cloud Console中创建OAuth2凭据。
  2. 下载credentials.json文件。
  3. 将其保存为secrets/credentials.google.json
  4. 第一次运行一个工具(例如calendar_upcoming)以启动授权流程。
  5. 完成后,持久化令牌将保存在data/token.google.json中(如果更改范围,请删除此文件并重新运行流程)。

本地运行

uv run mcp dev mcp_hub/server.py

这将打开MCP Inspector以测试工具和验证响应。

生产模式(STDIO):

uv run mcp run stdio mcp_hub/server.py

客户端集成

1) Codex

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"

2) Claude Desktop

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"
      }
    }
  }
}

3) GitHub Copilot

在命令面板中执行: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中

  1. 确保VS Code已更新且可以访问Copilot。
  2. Copilot Chat中,点击工具选择工具,并启用mcp-hub-ricardo服务器的工具。

技术栈

  • Python 3.10+ 使用uv进行环境管理和执行。
  • FastMCP 作为MCP框架。
  • Google API Client (google-api-python-client, google-auth-oauthlib) 用于Gmail/日历/云端硬盘。
  • PyGithub 用于与GitHub的交互。

使用示例

Copilot (VSCode)

<img width="700" src="img/Copilot_example.png" alt="主图"/>

Claude (桌面)

<img width="400" src="img/Claude_example.png" alt="主图"/>

Codex (VSCode)

<img width="400" src="img/Codex_example.png" alt="主图"/>

MCP Inspector

<img width="700" src="img/Mpc_inspector.png" alt="主图"/>

作者

Ricardo Urdaneta

LinkedIn | GitHub