Ghost服务器
自托管MCP服务器,将任何AI工具连接到您的真实账户。你的代币永远不会离开你的机器。
适用于Claude Code、Cursor、VS Code Copilot、Windsurf和任何兼容MCP的客户端。
为什么
每个“MCP服务器”都有一个指向其他人云的设置向导,或者锁定到一个AI供应商。GhostServer在本地运行,将凭据存储在您自己的保险库中,并使用标准的MCP协议,因此任何客户端都可以使用它。
21工具,5服务
| 服务 | 工具 |
|---|---|
| GitHub | 列出仓库、创建问题、列出/获取PR、搜索代码 |
| Gmail | 搜索、阅读、发送、列出标签 |
| 谷歌日历 | 列出事件、创建事件、忙/闲、获取事件 |
| 云耀 | 列出区域、DNS记录、创建DNS、列出Workers |
| 亚马逊云服务 | S3存储桶/对象、EC2实例、CloudWatch指标 |
安装
pip install ghostserver或来源:
git clone https://github.com/adam-scott-thomas/ghostserver.git
cd ghostserver
pip install -e ".[dev]"快速开始
1.配置
cp ghostserver.toml.example ghostserver.toml编辑 ghostserver.toml --启用所需的服务并设置凭据引用。
2.存储凭据
GhostServer支持三个凭据后端:
环境变量 (最简单):
[server]
credential_backend = "env"
[github]
enabled = true
token_ref = "GITHUB_TOKEN"export GITHUB_TOKEN="ghp_your_token_here"凭据文件 (无环境污染):
[server]
credential_backend = "file"
credential_file = "~/.ghostserver/credentials"
[github]
enabled = true
token_ref = "GITHUB_TOKEN"# ~/.ghostserver/credentials
GITHUB_TOKEN=ghp_your_token_here
CLOUDFLARE_TOKEN=your_cf_token1Password命令行界面 (最安全):
[server]
credential_backend = "op"
[github]
enabled = true
token_ref = "op://Development/GitHub PAT/credential"自动检测 (默认):尝试1Password,然后是凭据文件,然后是env-vars。
3.谷歌服务(一次性设置)
Gmail和谷歌日历需要OAuth。运行安装向导一次:
python -m ghostserver.google_auth这将打开您的浏览器,获得同意,并将刷新令牌存储在您选择的后端。
4.连接到您的AI工具
克劳德代码:
claude mcp add --transport stdio ghostserver -- python -m ghostserver光标/VS代码: 添加到MCP设置中:
{
"ghostserver": {
"command": "python",
"args": ["-m", "ghostserver"]
}
}任何MCP客户端(stdio):
python -m ghostserver建筑
Your AI Tool (Claude Code, Cursor, etc.)
|
| MCP protocol (stdio)
|
v
GhostServer (local process)
|
|-- spine (frozen config registry)
|-- gate (per-service rate limiting + enabled checks)
|-- token store (pluggable: 1Password / env / file)
|
|-- GitHub adapter ──> api.github.com
|-- Gmail adapter ──> gmail.googleapis.com
|-- Calendar adapter ──> googleapis.com/calendar
|-- Cloudflare adapter ──> api.cloudflare.com
|-- AWS adapter ──> boto3 (local credentials)每个适配器都是一个文件。登机口强制执行每次服务的费率限制。Spine提供了冻结配置单例,因此适配器不会传递对象。
添加自己的适配器
创建 src/ghostserver/adapters/myservice.py:
from fastmcp import FastMCP
from spine import Core
from ghostserver.gate import check_gate
SERVICE = "myservice"
server = FastMCP("My Service")
@server.tool
async def myservice_do_thing(param: str) -> dict:
"""Description for the AI client."""
check_gate(SERVICE)
tokens = Core.instance().get("tokens")
token = tokens.get(Core.instance().get("config").myservice.token_ref)
# ... call your API ...
return {"result": "done"}将服务配置添加到 config.py,将模块名称添加到 adapters/__init__.py,完成。提交PR。
发展
git clone https://github.com/adam-scott-thomas/ghostserver.git
cd ghostserver
pip install -e ".[dev]"
pytest -v许可证
Apache 2.0
