Skip to main content
Glama

cn-llm-mcp

本地 MCP Server,用来让 Claude、Codex、Cursor 等支持 MCP 的 agent 把低风险小任务委托给低成本模型执行,主 agent 负责审核结果。

它按 OpenAI-compatible Chat Completions 接口实现,支持 DeepSeek、通义千问兼容模式、Kimi、智谱、豆包,也支持自定义兼容服务。

适合做什么

  • 摘要、改写、文案初稿

  • README、说明文档、邮件草稿

  • 简单 HTML/CSS/JS 页面初稿

  • 小范围测试草稿

  • 低风险机械代码修改建议

不建议把安全、权限、支付、生产数据、复杂架构判断、密钥、cookie、令牌或隐私数据委托给这个工具。

Related MCP server: unlimited-mcp

客户本地安装

客户需要自己准备国内模型或代理服务的 API Key。API Key 留在客户自己的电脑上。

git clone https://github.com/ZhuoS62/cn-llm-mcp.git
cd cn-llm-mcp
npm run setup

npm run setup 会自动:

  • 安装依赖

  • 构建项目

  • 询问模型服务商、API Key、Base URL 和模型名称

  • 写入 .env

  • 运行 npm run doctor

  • 可选自动配置 Codex MCP 和 AGENTS.md

AI agent 自动安装时,也可以在询问用户后用环境变量非交互运行:

CN_LLM_SETUP_PROVIDER=deepseek \
CN_LLM_SETUP_MODEL=deepseek-chat \
CN_LLM_SETUP_API_KEY=客户自己的_API_Key \
npm run setup

自定义 OpenAI-compatible 代理:

CN_LLM_SETUP_PROVIDER=custom \
CN_LLM_SETUP_BASE_URL=https://example.com/v1 \
CN_LLM_SETUP_MODEL=your-model \
CN_LLM_SETUP_API_KEY=客户自己的_API_Key \
npm run setup

如果不想使用交互式安装,也可以手动配置 .env

DeepSeek 示例:

CN_LLM_PROVIDER=deepseek
CN_LLM_API_KEY=replace_me
CN_LLM_MODEL=deepseek-chat

自定义 OpenAI-compatible 代理示例:

CN_LLM_PROVIDER=custom
CN_LLM_BASE_URL=https://example.com/v1
CN_LLM_MODEL=your-model
CN_LLM_API_KEY=replace_me

服务启动时会自动读取项目根目录的 .env

自检

npm run doctor

自检会检查:

  • Node.js 版本是否 >= 20

  • dist/index.js 是否存在

  • .env 是否存在

  • CN_LLM_API_KEY 是否填写

  • MCP 是否能列出 run_cn_modeldraft_code_patch

doctor 不会真实调用模型生成内容。

常用 provider

# DeepSeek
CN_LLM_PROVIDER=deepseek
CN_LLM_MODEL=deepseek-chat

# 通义千问 OpenAI 兼容模式
CN_LLM_PROVIDER=qwen
CN_LLM_MODEL=qwen-plus

# Kimi
CN_LLM_PROVIDER=kimi
CN_LLM_MODEL=moonshot-v1-8k

# 智谱
CN_LLM_PROVIDER=zhipu
CN_LLM_MODEL=glm-4-flash

# 豆包,需要按火山方舟创建的 endpoint/model 调整
CN_LLM_PROVIDER=doubao
CN_LLM_MODEL=doubao-seed-1-6-250615

Claude Desktop 配置

把下面配置加入 Claude Desktop 的 MCP 配置文件。把路径替换成客户本机的绝对路径。

{
  "mcpServers": {
    "cn-llm-worker": {
      "command": "node",
      "args": ["/absolute/path/to/cn-llm-mcp/dist/index.js"]
    }
  }
}

模板文件:

examples/claude-desktop.json

Codex 配置

把下面配置加入 ~/.codex/config.toml。把路径替换成客户本机的绝对路径。

[mcp_servers.cn-llm-worker]
command = "node"
args = ["/absolute/path/to/cn-llm-mcp/dist/index.js"]
startup_timeout_sec = 30

模板文件:

examples/codex-config.toml

Cursor 配置

Cursor 的 MCP 配置通常也是 JSON。把路径替换成客户本机的绝对路径。

{
  "mcpServers": {
    "cn-llm-worker": {
      "command": "node",
      "args": ["/absolute/path/to/cn-llm-mcp/dist/index.js"]
    }
  }
}

模板文件:

examples/cursor-mcp.json

建议给 agent 的规则

可以把下面规则加入 Claude Project instructions、Codex AGENTS.md 或 Cursor rules:

对于低风险、小范围、机械性任务,可以优先调用 `cn-llm-worker` 让低成本模型生成草稿,例如摘要、文案、README 初稿、简单测试草稿、小型 patch 或简单网页初稿。

不要把 secrets、API key、cookie、令牌、隐私数据或无关的大段上下文发送给 `cn-llm-worker`。

收到 `cn-llm-worker` 的结果后,必须由主 agent 审核;涉及安全、权限、支付、数据一致性、复杂架构判断或高风险代码时,不要委托给该工具。

如果调用了 `cn-llm-worker`,请告诉用户 provider、model 和 token usage。如果没有调用,不要假装调用。

模板文件:

examples/agent-rule.md

暴露的工具

run_cn_model

通用任务委托工具。适合摘要、文案、方案、简单代码草稿。

参数示例:

{
  "task": "把下面内容整理成三点摘要",
  "context": "需要处理的内容",
  "output_format": "text"
}

draft_code_patch

代码 patch 草稿工具。适合小范围、低风险代码任务。

参数示例:

{
  "task": "给 add 函数补一个边界测试",
  "files": [
    {
      "path": "src/math.ts",
      "content": "export function add(a: number, b: number) { return a + b; }"
    }
  ],
  "constraints": "只返回 unified diff"
}

测试提示词

配置完成后,在 agent 里测试:

优先使用 cn-llm-worker。请让低成本模型用三句话解释 MCP 是什么,然后你审核它的回答。

如果调用成功,agent 应该能看到 providermodelusage

常见问题

401 invalid credentials

API Key 无效、过期、填错,或代理服务不接受当前 key。重新生成 API Key 后更新 .env

404 Not Found

通常是 CN_LLM_BASE_URL 不对。OpenAI-compatible 服务一般需要以 /v1 结尾,例如:

CN_LLM_BASE_URL=https://example.com/v1

model not found

CN_LLM_MODEL 不在服务商支持列表里。改成服务商文档里的模型名。

agent 看不到工具

先运行:

npm run doctor

如果 doctor 正常,重启 Claude/Codex/Cursor,确认 MCP 配置里的路径是绝对路径并且指向 dist/index.js

安全说明

  • .env 不要提交到仓库。

  • 客户应使用自己的 API Key。

  • 这个 MCP Server 不会直接修改文件,只返回文本或 patch 草稿。

  • 最终应用 patch、运行测试和判断风险应由主 agent 完成。

Available Tools

2 tools
draft_code_patchA

Ask a Chinese LLM provider to draft a minimal unified diff for a small code task. Use this only for low-risk changes, then inspect and test the patch before applying it.

ParametersJSON Schema
NameRequiredDescriptionDefault
taskYesThe code change to draft.
filesYesRelevant file paths and contents. Keep this list small.
max_tokensNo
constraintsNoExtra implementation constraints.
temperatureNo

TDQS

A3.9/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description must cover behavioral traits. It mentions the tool drafts a diff (not applying it) and involves a Chinese LLM provider. However, it omits details like authentication, rate limits, whether it modifies state, or what happens on error. The caution to inspect before applying is useful but not exhaustive.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences with no redundancy. The action, scope, and caution are front-loaded. Every word adds value.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The tool has 5 parameters and no output schema. The description explains the purpose and usage constraints but fails to describe the return value (the diff). Given complexity, it covers most aspects but the missing output specification lowers completeness.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 60%. The description adds value for 'task' and 'files' (e.g., 'Keep this list small'), but 'max_tokens' and 'temperature' lack descriptions in both schema and description. The description does increase clarity for half the parameters, but the gap for the other two prevents a higher score.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Ask a Chinese LLM provider to draft a minimal unified diff') and the resource ('small code task'). It distinguishes from the sibling tool 'run_cn_model' by specifying a focused use case (code patch drafting) rather than general model execution.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly advises using this tool 'only for low-risk changes' and instructs to 'inspect and test the patch before applying it.' It provides clear context but does not enumerate alternatives or explicitly state when not to use it beyond the risk qualifier.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

run_cn_modelA

Delegate a small, low-risk task to a Chinese LLM provider. Best for drafts, summaries, simple code generation, and mechanical edits. The supervising agent must review the result before using it.

ParametersJSON Schema
NameRequiredDescriptionDefault
taskYesThe exact task for the delegated model.
contextNoOnly the minimal context needed for the task. Avoid secrets and unnecessary private data.
max_tokensNo
temperatureNo
output_formatNoDesired output format.text
system_promptNoOptional override for the delegated model's system prompt.

TDQS

A3.7/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries full disclosure burden. It mentions delegation to a Chinese LLM provider and the need for review, but lacks details on behavioral traits such as timeouts, error handling, or data sovereignty. The transparency is adequate but minimal for a tool delegating to an external provider.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description consists of two concise sentences that front-load the purpose and usage guidelines. Every sentence adds value: one for delegation and use cases, one for the review requirement. No unnecessary information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with 6 parameters, no output schema, and no annotations, the description is brief. It addresses the task's nature and usage but omits crucial context like output format hints, error scenarios, or cost/speed trade-offs. Adequate but leaves gaps given the complexity.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 67%, with 4 of 6 parameters explained in the schema itself. The tool description adds no new parameter insights beyond the schema. Given high coverage, baseline is 3; the description does not compensate for uncovered parameters (max_tokens, temperature).

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool delegates tasks to a Chinese LLM provider and lists specific use cases (drafts, summaries, simple code generation, mechanical edits). While it distinguishes from the sibling 'draft_code_patch' by emphasizing simplicity and delegation, the differentiation could be more explicit, hence a 4 rather than 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear guidance on when to use the tool ('Best for drafts, summaries, simple code generation, and mechanical edits') and explicitly requires review of results. However, it does not specify when not to use it or mention alternative tools, so it falls short of a 5.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 2 tool updatesv0.1.0
    • First observeddraft_code_patch
    • First observedrun_cn_model

TDQS

A3.8/5.0

Scored across 2 tools

Disambiguation5/5

The two tools have clearly distinct purposes: one for drafting code patches and one for general low-risk tasks. No overlap in functionality.

Naming Consistency5/5

Both tools use a consistent verb_noun pattern in snake_case (draft_code_patch, run_cn_model), making the naming predictable.

Tool Count3/5

With only 2 tools, the server feels minimal but still focused. The count is borderline for the scope but not extreme.

Completeness2/5

The tool surface is severely incomplete for delegating tasks to a Chinese LLM; missing operations like listing models, managing tasks, or retrieving results beyond the initial call.

Maintenance

ActivityInactive
ResponsivenessNo issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    An MCP server that delegates coding and sysops work to cheaper agents via durable background queues, with git worktree isolation, safety policies, and clarification rounds to avoid hitting limits of frontier models.
    2
    Apache 2.0