Openai Compatible Mcp — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited Openai Compatible Mcp (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
<div align="center">
一个 [MCP](https://modelcontextprotocol.io) 服务器,桥接到任何 OpenAI 兼容的 Chat API
</div>
| 特性 | 说明 |
|---|---|
| 🪶 零依赖 | 仅用 Python 3.9+ 标准库,无需 pip install 第三方包 |
| 🔌 万能兼容 | DeepSeek · OpenAI · Azure · OpenRouter · Together · Groq · llama.cpp |
| 🎯 模型别名 | deepseek-v4-flash → deepseek-v4-flash 等智能映射 |
| 🧠 推理提取 | 自动提取 <think>...</think> 中的 reasoning 内容 |
| 🔄 双模式 | MCP stdio + 直接 HTTP /v1/chat/completions |
| 🌐 Web UI | 浏览器可视化配置,热更新无需重启 |
| 🖥️ 后台代理 | --background 后台运行,--status/--stop 管理 |
| 📦 极简代码 | ~400 行核心代码 |
┌──────────────────┐ stdio JSON-RPC ┌─────────────────────┐
│ Claude Desktop │ ───────────────────▶│ │
│ Cursor / VSCode │ │ openai-compatible │
│ Claude Code │ │ -mcp │
└──────────────────┘ │ │
│ ┌───────────────┐ │
┌──────────────────┐ HTTP /v1/chat/... │ │ 翻译代理 │ │
│ Codex CLI 0.140+ │ ───────────────────▶│ │ 127.0.0.1 │ │
│ (直连 API) │ │ │ :7878 │ │
└──────────────────┘ │ └──────┬────────┘ │
│ │ │
┌──────────────────┐ http://127/8989 │ ▼ │
│ 你的浏览器 │ ───────────────────▶│ 上游 API │
│ (向导 UI) │ 一次性配置 │ (DeepSeek 等) │
└──────────────────┘ └─────────────────────┘双击 setup\install.bat(Windows)或运行 ./setup/install.sh(macOS / Linux), 浏览器会自动打开图形化向导。选 provider、填 API key、勾选客户端,一键配置。
详细文档见 setup/README.md。
pip install openai-compatible-mcp
# 两种等价命令
openai-compatible-mcp --help
xbcode --help# DeepSeek (默认)
export DEEPSEEK_API_KEY="sk-..."
# 其他兼容端点
export OPENAI_COMPATIBLE_MCP_API_KEY="..."
export OPENAI_COMPATIBLE_MCP_BASE_URL="https://my-endpoint.com"
export OPENAI_COMPATIBLE_MCP_DEFAULT_MODEL="my-model"| 设置项 | 查找顺序(第一个非空胜出) |
|---|---|
| API Key | OPENAI_COMPATIBLE_MCP_API_KEY → DEEPSEEK_API_KEY → OPENAI_API_KEY |
| Base URL | OPENAI_COMPATIBLE_MCP_BASE_URL → DEEPSEEK_API_BASE → OPENAI_BASE_URL |
| 默认模型 | OPENAI_COMPATIBLE_MCP_DEFAULT_MODEL → DEEPSEEK_DEFAULT_MODEL |
Claude Desktop / Cursor:
{
"mcpServers": {
"openai-compatible": {
"command": "python",
"args": ["-m", "openai_compatible_mcp"],
"env": { "DEEPSEEK_API_KEY": "sk-..." }
}
}
}chat — 对话补全| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
messages | array | ✅ | {role, content} 消息列表 |
model | string | 模型名或别名 | |
temperature | number | 0-2,越小越确定 | |
max_tokens | integer | 最大生成 token 数 | |
system | string | 系统提示 | |
include_reasoning | boolean | 包含 <think> 推理内容 |
示例:
{
"method": "tools/call",
"params": {
"name": "chat",
"arguments": {
"messages": [{"role": "user", "content": "写一首关于 Python 的俳句。"}],
"model": "deepseek-v4-flash",
"temperature": 0.7
}
}
}list_models — 列出模型返回默认模型和完整的别名映射表。
| 别名 | 解析为 |
|---|---|
deepseek-v4-pro | deepseek-v4-pro |
deepseek-v4-flash | deepseek-v4-flash |
deepseek-reasoner | deepseek-reasoner |
deepseek-r1 | deepseek-reasoner |
gpt-4o | gpt-4o |
o1-mini | o1-mini |
不在别名表中的模型名会原样透传,provider 发布新模型可直接使用。
当使用 Codex CLI 等需要 Responses API (/v1/responses) 的客户端时, openai-compatible-mcp 启动翻译代理将 Responses API → Chat Completions → Responses。
xbcode --proxy
xbcode --proxy --api-key sk-你的key代理默认监听 http://127.0.0.1:7878:
POST /responses → 翻译为 DeepSeek 请求并返回 Responses 格式GET /v1/models → 模型别名列表GET /health → 健康检查# 后台启动
xbcode --proxy --background
# 查看状态(PID + 日志)
xbcode --status
# 停止
xbcode --stop后台文件: ~/.openai-compatible-mcp/proxy.pid · ~/.openai-compatible-mcp/proxy.log
浏览器打开 http://127.0.0.1:7878/:
# 单元测试
python -m pytest tests/test_unit.py -v
# 冒烟测试
PYTHONPATH=src python tests/smoke_test.pyopenai-compatible-mcp/
├── src/openai_compatible_mcp/
│ ├── __main__.py # CLI 入口
│ ├── __init__.py # MCP server + JSON-RPC
│ ├── client.py # API 调用封装
│ └── proxy_server.py # Responses ↔ Chat 翻译代理
├── tests/
│ ├── test_unit.py # 单元测试
│ └── smoke_test.py # 冒烟测试
├── setup/ # 一键安装向导
└── pyproject.toml查看 CHANGELOG.md 了解完整变更历史。
v0.2.22 亮点:
xbcode 命令别名--background / --status / --stop)globals() 污染欢迎 Issue 和 PR!
MIT License — 见 LICENSE。
~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.