Astron MCP
An MCP server that wraps multiple vendors' Coding Plan services (iFlytek Spark, Volcengine) to provide code review, plan review, and multi-turn dialogue for AI coding tools like Claude Code.
README
Coding Bridge MCP
基于 MCP 协议 封装的多厂商 Coding Plan 服务,目前已支持讯飞星火 / 讯飞星辰 Coding Plan 与火山方舟 Coding Plan 个人版,为 Claude Code 等 AI 编程工具提供代码审查、计划审查与多轮对话能力。
本项目参考了 KimiMCP 的工具签名与返回结构,但在底层直接调用讯飞 API(无官方 CLI),并针对不同订阅类型做了适配。
一、支持的 Provider
Coding Bridge MCP 通过统一的 OpenAI 兼容 HTTP 客户端接入多个厂商的 Coding Plan / 大模型服务。
| Provider | 协议 | 凭证 | 默认端点 | 默认模型 |
|---|---|---|---|---|
| xfyun-coding(默认) | OpenAI 兼容 | SPARK_API_PASSWORD |
https://maas-coding-api.cn-huabei-1.xf-yun.com/v2/chat/completions |
astron-code-latest |
| xfyun-http | OpenAI 兼容 | SPARK_API_PASSWORD |
https://spark-api-open.xf-yun.com/v1/chat/completions |
4.0Ultra |
| xfyun-websocket | 原生 WebSocket | SPARK_APP_ID + SPARK_API_KEY + SPARK_API_SECRET |
wss://spark-api.xf-yun.com/v4.0/chat |
4.0Ultra |
| volcengine-coding | OpenAI 兼容 | VOLCENGINE_API_KEY |
https://ark.cn-beijing.volces.com/api/coding/v3/chat/completions |
ark-code-latest |
注意:Coding Plan 类套餐(讯飞、火山)的 API Key 仅限在 AI 编程工具交互场景中使用,禁止用于自动化脚本、批量任务或自建后端。
切换 Provider 只需修改 PROVIDER 环境变量(旧版 SPARK_MODE 仍兼容)。为统一凭证入口,推荐使用通用变量 API_KEY:
# 讯飞 Coding Plan
PROVIDER=xfyun-coding
API_KEY=your-xfyun-key
# 火山方舟 Coding Plan 个人版
PROVIDER=volcengine-coding
API_KEY=your-volcano-key
仍兼容旧变量:
SPARK_API_PASSWORD/SPARK_API_KEY(讯飞)、VOLCENGINE_API_KEY/ARK_API_KEY(火山)。当API_KEY为空时会按旧变量回退。
二、快速开始
1. 安装 uv(如果还没有)
curl -LsSf https://astral.sh/uv/install.sh | sh
2. 克隆并进入项目
git clone https://github.com/htmambo/coding-bridge-mcp.git
cd coding-bridge-mcp
3. 配置环境变量
cp .env.example .env
# 编辑 .env,填入你的 API Key
提示:Coding Bridge MCP 启动时会自动加载当前工作目录下的
.env文件(不覆盖已有的环境变量),所以本地使用时不必手动source。
讯飞 Coding Plan 用户最少只需要:
PROVIDER=xfyun-coding
API_KEY=your-xfyun-key
火山方舟 Coding Plan 个人版用户最少只需要:
PROVIDER=volcengine-coding
API_KEY=your-volcano-key
4. 安装依赖
uv sync
5. 接入 Claude Code
方式 A:本地开发(推荐,方便改配置和二次开发)
claude mcp add coding-bridge -s user --transport stdio -- uv run --python 3.12 coding-bridge-mcp
方式 B:直接从 GitHub 安装(无需克隆)
claude mcp add coding-bridge -s user --transport stdio -- uvx --from git+https://github.com/htmambo/coding-bridge-mcp.git coding-bridge-mcp
注意:方式 B 需要你在 Claude Code 配置中注入环境变量(见下文「配置 API Key」),或者从已设置好环境变量的 Shell 启动 Claude Code。
验证:
claude mcp list
应看到 coding-bridge: uv run --python 3.12 coding-bridge-mcp - ✓ Connected 或 coding-bridge: uvx --from git+https://github.com/htmambo/coding-bridge-mcp.git coding-bridge-mcp - ✓ Connected。
三、配置 API Key
MCP Server 作为 Claude Code 的子进程运行,需要从环境变量读取密钥。claude mcp add 不能直接带 --env,推荐通过 ~/.claude/settings.json 注入:
讯飞 Coding Plan
{
"mcpServers": {
"coding-bridge": {
"command": "uvx",
"args": [
"--from",
"git+https://github.com/htmambo/coding-bridge-mcp.git",
"coding-bridge-mcp"
],
"env": {
"PROVIDER": "xfyun-coding",
"API_KEY": "your-xfyun-key"
}
}
}
}
火山方舟 Coding Plan 个人版
{
"mcpServers": {
"coding-bridge": {
"command": "uvx",
"args": [
"--from",
"git+https://github.com/htmambo/coding-bridge-mcp.git",
"coding-bridge-mcp"
],
"env": {
"PROVIDER": "volcengine-coding",
"API_KEY": "your-volcano-key"
}
}
}
}
如果你用的是本地克隆的方式 A,把 command/args 换成:
{
"command": "uv",
"args": ["run", "--python", "3.12", "coding-bridge-mcp"]
}
修改配置后,重启 Claude Code 或运行
claude mcp list刷新。
替代方案:从 Shell 启动
如果你用的是 Claude Code CLI,也可以在启动它的 Shell 中导出环境变量:
export PROVIDER=xfyun-coding
export API_KEY=your-xfyun-key
claude
但这种方式对桌面版 Claude 无效,建议优先使用 settings.json。
四、工具说明
chat — 通用多轮对话
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
PROMPT |
str |
✅ | 任务指令 |
cd |
Path |
✅ | 工作目录 |
SESSION_ID |
str |
❌ | 继续会话,空则新建 |
model |
str |
❌ | 模型版本,默认 SPARK_DEFAULT_MODEL |
return_all_messages |
bool |
❌ | 是否返回完整历史 |
返回值:
{
"success": true,
"SESSION_ID": "uuid-string",
"agent_messages": "模型回复内容...",
"usage": { "prompt_tokens": 100, "completion_tokens": 200, "total_tokens": 300 }
}
review_code — 代码审查
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
CODE |
str |
✅ | 要审查的代码 |
cd |
Path |
✅ | 工作目录 |
REQUIREMENTS |
str |
❌ | 额外要求/上下文 |
SESSION_ID |
str |
❌ | 继续会话 |
model |
str |
❌ | 模型版本 |
return_all_messages |
bool |
❌ | 返回完整历史 |
review_plan — 计划/方案审查
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
PLAN |
str |
✅ | 计划文本 |
cd |
Path |
✅ | 工作目录 |
CONTEXT |
str |
❌ | 项目背景 |
SESSION_ID |
str |
❌ | 继续会话 |
model |
str |
❌ | 模型版本 |
return_all_messages |
bool |
❌ | 返回完整历史 |
五、环境变量完整列表
| 变量 | 默认值 | 说明 |
|---|---|---|
PROVIDER |
xfyun-coding |
xfyun-coding / xfyun-http / xfyun-websocket / volcengine-coding |
API_KEY |
- | 通用 API Key,根据 PROVIDER 自动对应到讯飞或火山 |
SPARK_MODE |
- | 旧版变量,仍兼容:coding / http / websocket |
SPARK_API_PASSWORD |
- | 讯飞 Coding Plan / HTTP 模式的 API Key 或 APIPassword |
SPARK_API_KEY |
- | SPARK_API_PASSWORD 的别名;WebSocket 签名用 |
SPARK_APP_ID |
- | WebSocket 模式 AppID |
SPARK_API_SECRET |
- | WebSocket 模式 APISecret |
SPARK_API_URL |
见 Provider | 讯飞 HTTP 端点覆盖 |
SPARK_WS_URL |
wss://spark-api.xf-yun.com/v4.0/chat |
WebSocket 端点覆盖 |
SPARK_DEFAULT_MODEL |
见 Provider | 讯飞默认模型覆盖 |
VOLCENGINE_API_KEY |
- | 火山方舟 Coding Plan API Key |
VOLCENGINE_API_URL |
见 Provider | 火山 HTTP 端点覆盖 |
VOLCENGINE_MODEL |
ark-code-latest |
火山默认模型覆盖 |
MCP_TIMEOUT_SECONDS |
120 |
请求超时(兼容旧 SPARK_TIMEOUT_SECONDS) |
MCP_MAX_CONTEXT_CHARS |
见 Provider | 上下文字符上限(兼容旧 SPARK_MAX_CONTEXT_CHARS) |
MCP_MAX_MESSAGES |
40 |
单会话最大消息数(兼容旧 SPARK_MAX_MESSAGES) |
MCP_MAX_TOKENS |
见 Provider | 单次最大输出 tokens(兼容旧 SPARK_MAX_TOKENS) |
六、在 Claude Code 提示词中推荐使用
在 ~/.claude/CLAUDE.md 中加入类似内容,可让 Claude Code 在编码流程中主动调用审查工具:
## Coding Bridge MCP 使用规范
1. 在形成初步实现思路后,可调用 `review_plan` 审查实施计划。
2. 完成代码修改后,必须调用 `review_code` 审查改动。
3. 保存每次返回的 `SESSION_ID`,以便对同一话题进行多轮追问。
4. 星火/Coding Plan 的回复仅供参考,你仍需保持独立判断。
七、常见问题
Q: Coding Plan 返回 401 怎么办?
- 确认 API Key 来自「套餐订阅」页面,而不是星火大模型控制台。
- 确认
SPARK_MODE=coding。 - 确认 model 使用
astron-code-latest(默认)。
Q: 模型底层怎么切换?
在 讯飞星辰 MaaS 套餐订阅页面 点击「配置模型」,1-3 分钟后生效。API 层仍使用 astron-code-latest。
Q: 出现 429 / 请求速率限制?
Coding Plan 有 5 小时/周/月的请求次数限制,高峰期也可能触发平台限流。代码已透传错误信息,建议稍后重试或升级套餐。
八、许可证
MIT
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.