qodercli-mcp
qodercli-mcp
A minimal MCP server that wraps qodercli (Qoder CLI), letting any MCP client delegate coding tasks to a local Qoder agent.
一个极简的 MCP server,把本地的 qodercli(Qoder CLI)包装成 MCP 工具,让任意 MCP 客户端(Qoder IDE、Claude Code、Cursor 等)可以像调用子 Agent 一样调用 Qoder。
Why / 为什么
Some CLI agents ship an official MCP server mode (e.g. codex mcp-server), but qodercli currently only acts as an MCP client. This project fills that gap with a thin wrapper: it spawns qodercli -p <prompt> under the hood and streams the result back over MCP stdio.
部分 CLI Agent 自带官方 MCP server 模式(如 codex mcp-server),但 qodercli 目前只能作为 MCP 客户端。本项目用一个薄包装层补上这个缺口:内部调用 qodercli -p <prompt>,把结果通过 MCP stdio 返回。
Features / 功能
ask-qodertool — delegate a prompt to qodercliask-qoder工具 —— 把任务委托给 qodercliStructured output (
session_id,is_error,duration_ms,total_credits,num_turns) via-o jsonparsing结构化输出(
session_id、is_error、duration_ms、total_credits、num_turns),自动解析-o jsonlist-sessionstool to discover resumable sessionslist-sessions工具,用于发现可续接的会话list-modelstool for runtime model discovery (no stale model lists)list-models工具,运行时发现可用模型(不依赖过时清单)reasoning_effortparameter (--reasoning-effort)reasoning_effort参数(透传--reasoning-effort)Server
instructionsin the MCP initialize result guide clients on usageMCP initialize 结果携带服务器使用说明,引导客户端正确调用
Codex-style
sandboxlevels (read-only/workspace-write/danger-full-access)仿 codex 的
sandbox分级(read-only/workspace-write/danger-full-access)System prompt injection (
system_prompt/append_system_prompt)系统提示注入(
system_prompt/append_system_prompt)Working directory, model, permission mode, output format control
支持指定工作目录、模型、权限模式、输出格式
Session resume (
resume_session_id) for multi-turn delegation支持会话续接(
resume_session_id),可多轮委托Timeout protection with SIGKILL fallback
超时保护(超时自动 SIGKILL)
Proxy quota support (
HTTP_PROXY/HTTPS_PROXYinjection)代理额度支持(
HTTP_PROXY/HTTPS_PROXY注入)Zero build step — plain ESM JavaScript, Node.js >= 18
无需构建 —— 纯 ESM JavaScript,Node.js >= 18
Prerequisites / 前置条件
Node.js >= 18
qodercliinstalled and signed in (qodercli login)
Install / 安装
Option A — npx (recommended / 推荐): no clone needed, the MCP client downloads the package on first use. 无需克隆,MCP 客户端首次使用时自动下载:
"command": "npx", "args": ["-y", "qodercli-mcp"]Option B — from source (for development / 开发用):
git clone https://github.com/cantbeblank96/qodercli-mcp.git
cd qodercli-mcp
npm installMCP client configuration / MCP 客户端配置
Qoder IDE
Add to ~/.qoder/mcp.json. Prefer the absolute path of node and set QODERCLI_PATH explicitly (nvm-managed binaries are often missing from the PATH seen by MCP child processes):
Proxy Support: To use your Qoder CLI proxy quota, add
HTTP_PROXYand/orHTTPS_PROXYto the server's environment. When these are set at the MCP server level, they will be passed to all qodercli subprocesses.
添加到 ~/.qoder/mcp.json。建议使用 node 的绝对路径并显式设置 QODERCLI_PATH(MCP 子进程的 PATH 中经常缺少 nvm 管理的二进制目录):
代理支持:要使用 Qoder CLI 代理额度,可在服务器的环境变量中添加
HTTP_PROXY和/或HTTPS_PROXY。当这些变量在 MCP 服务器级别设置时,它们会被传递到所有 qodercli 子进程。
{
"mcpServers": {
"qodercli-mcp": {
"command": "npx",
"args": ["-y", "qodercli-mcp"],
"env": {
"QODERCLI_PATH": "/absolute/path/to/qodercli",
"PATH": "/usr/local/bin:/usr/bin:/bin"
}
},
"qodercli-mcp-with-proxy": {
"command": "npx",
"args": ["-y", "qodercli-mcp"],
"env": {
"QODERCLI_PATH": "/absolute/path/to/qodercli",
"HTTP_PROXY": "http://127.0.0.1:39900",
"HTTPS_PROXY": "http://127.0.0.1:39900",
"PATH": "/usr/local/bin:/usr/bin:/bin"
}
}
}
}Developers running a local checkout instead of the published package (Option B) should replace command/args with the absolute node path and /path/to/qodercli-mcp/src/index.js (nvm-managed node is often missing from the PATH seen by MCP child processes).
使用本地源码(方式 B)的开发者请将 command/args 换成 node 绝对路径与 /path/to/qodercli-mcp/src/index.js(MCP 子进程的 PATH 中经常缺少 nvm 管理的二进制目录)。
Claude Code / Claude Desktop
{
"mcpServers": {
"qodercli-mcp": {
"command": "node",
"args": ["/absolute/path/to/qodercli-mcp/src/index.js"],
"env": {
"QODERCLI_PATH": "/absolute/path/to/qodercli"
}
}
}
}Tool: ask-qoder
Parameter | Type | Description |
| string (required) | The task or question for qodercli / 交给 qodercli 的任务或问题 |
| string | Working directory / 工作目录 |
| string | Model for this session; call |
| string | Reasoning effort level ( |
| enum |
|
| enum | codex-style: |
| enum |
|
| string | Replace the default system prompt / 替换默认系统提示 |
| string | Append instructions to the default system prompt / 追加系统提示 |
| string | Resume a previous session / 续接之前的会话 |
| string | Passed to |
| string[] | Raw CLI args appended before the prompt; reserved flags (permission mode, system prompt, model, |
| number | Timeout in ms, default 600000 / 超时毫秒数,默认 600000 |
Structured output / 结构化输出
ask-qoder declares an MCP outputSchema and returns, in addition to the
human-readable text, a structuredContent object:
ask-qoder 声明了 MCP outputSchema,除可读文本外还返回 structuredContent 对象:
{
"session_id": "77826b5c-...", // pass back as resume_session_id / 回传用于续接
"content": "OK",
"is_error": false,
"exit_code": 0,
"duration_ms": 1280,
"total_credits": 0.53,
"num_turns": 1,
"timed_out": false,
"truncated": false
}Sandbox mapping / 沙箱映射
sandbox | Effective permission mode / 实际权限模式 | Effect on qodercli / 对 qodercli 的效果 |
(omitted / 缺省) |
| Read-only: permission-requiring tools are silently denied / 只读:需授权的工具调用被静默拒绝 |
|
| Plus |
|
| Agent can create/modify files in |
|
| Full access including shell / 完全权限(含 shell) |
Explicit permission_mode or approval_policy always wins over sandbox.
显式设置的 permission_mode / approval_policy 优先于 sandbox。
Permission modes (verified semantics) / 权限模式(实测语义)
Mode | Behavior / 行为 |
| Read-only: silently denies every tool call that requires permission. Headless-safe default / 只读:静默拒绝一切需授权的工具调用;无头安全默认值 |
| Auto-approves file edits; shell still governed by policy / 自动批准文件编辑 |
| Auto-approves everything including shell / 全部自动批准(含 shell) |
| qodercli's own automatic policy / qodercli 自动策略 |
| Interactive confirmation — not headless-friendly, avoid in MCP calls / 交互式确认,无头调用中应避免 |
Tool: list-sessions
Lists local qodercli sessions (index, summary, session id) so a client can
pick a resume_session_id. Takes no arguments.
列出本地 qodercli 会话(序号、摘要、会话 ID),便于挑选 resume_session_id。无参数。
Tool: list-models
Lists models currently supported by qodercli (via --list-models), so a
client can pick a valid model value at runtime instead of relying on
stale knowledge. Returns both a text list and a structured models array.
Takes no arguments.
列出 qodercli 当前支持的模型,供运行时选择有效的 model 值(不依赖过时知识)。返回文本清单和结构化 models 数组。无参数。
Usage Examples / 使用示例
Example 1: Simple code explanation / 简单代码解释
{ "name": "ask-qoder", "arguments": {
"prompt": "Explain what main.py does",
"cwd": "/path/to/project",
"timeout_ms": 180000
}}结果会返回一段自然语言解释,帮助理解文件功能。
Example 2: Ask a second opinion / 获取第二意见
{ "name": "ask-qoder", "arguments": {
"prompt": "@src/service.py Review this file for security issues and suggest improvements",
"model": "qwen-plus",
"permission_mode": "dont_ask",
"timeout_ms": 300000
}}Qoder 会给出安全建议和改进方案。
Example 3: Multi-turn conversation via resume / 多轮对话续接
// First call — session_id comes back in structuredContent
// 首次调用 —— session_id 会在 structuredContent 中返回
{ "name": "ask-qoder", "arguments": {
"prompt": "Help me refactor this module to improve readability",
"cwd": "/projects/backend",
"timeout_ms": 300000
}}
// Then reuse structuredContent.session_id:
// 然后把 structuredContent.session_id 回传:
{ "name": "ask-qoder", "arguments": {
"prompt": "Now add error handling for database timeouts",
"resume_session_id": "77826b5c-cd6b-4213-b423-d95b4e1deab0"
}}
// Or discover ids with list-sessions / 或用 list-sessions 查找历史会话 ID
{ "name": "list-sessions", "arguments": {} }通过 resume_session_id 可实现多轮交互式迭代优化。
Example 4: Code review with specific focus / 针对性代码审查
{ "name": "ask-qoder", "arguments": {
"prompt": "Analyze performance bottlenecks in utils.py",
"model": "qwen-max",
"permission_mode": "default",
"output_format": "text",
"timeout_ms": 240000
}}适合性能分析和优化建议场景。
Example 5: Read-only analysis / 只读分析
{ "name": "ask-qoder", "arguments": {
"prompt": "Audit this codebase for security issues; do not modify anything",
"cwd": "/workspaces/repo",
"sandbox": "read-only",
"timeout_ms": 300000
}}read-only 会禁用写文件与 shell 工具,适合审计/评审场景。
Example 6: Project-wide analysis / 项目范围分析
{ "name": "ask-qoder", "arguments": {
"prompt": "Summarize the architecture of this project and identify key modules",
"cwd": "/workspaces/repo",
"timeout_ms": 420000,
"model": "qwen-plus"
}}适用于大型项目快速梳理和架构理解。
Best Practices / 最佳实践
Specify working directory — Always pass
cwdwhen operating on a specific project 操作特定项目时务必指定cwdUse timeout protection — For complex prompts, set explicit
timeout_msshorter than 60min 复杂任务设置timeout_ms(建议 5–10 分钟),避免挂起Resume for multi-turn — Chain follow-ups via
resume_session_idinstead of repeating context 后续追问用resume_session_id续接会话,避免重复上下文Model selection — Call
list-modelsfirst to discover currently supported models; larger models are better for deep analysis 先调list-models查询当前可用模型;深度分析建议选择大模型Permission mode — The server default is read-only (
dont_ask); setQODERCLI_DEFAULT_PERMISSION_MODE=bypass_permissionsto make full (YOLO) access the default for personal deployments. Per-call: tasks that must create/modify files needsandbox: "workspace-write"; shell access needsdanger-full-access. Do not combinesandboxwith an explicitpermission_mode(the latter wins) 服务器默认只读(dont_ask);个人部署可用QODERCLI_DEFAULT_PERMISSION_MODE=bypass_permissions将全开(YOLO)设为默认。单次调用:需要改文件设sandbox: "workspace-write",需要 shell 用danger-full-access;勿与显式permission_mode混用(后者优先生效)
Environment variables / 环境变量
Variable | Default | Description |
|
| Path to the qodercli binary / qodercli 二进制路径 |
|
| Default timeout / 默认超时 |
|
| Per-call stdout/stderr cap in MB (OOM protection) / 单次调用输出上限(MB,防 OOM) |
|
| Default permission mode when the caller omits permission_mode/approval_policy/sandbox; set |
| - | HTTP proxy URL for qodercli / qodercli 的 HTTP 代理地址 |
| - | HTTPS proxy URL for qodercli / qodercli 的 HTTPS 代理地址 |
Development / 开发
npm test # smoke test: protocol handshake + tool invocation
node src/index.js # run the server manually (stdio)Disclaimer / 免责声明
This is an unofficial, third-party tool. It is not affiliated with, endorsed, or sponsored by Qoder. Use permission_mode: bypass_permissions with care — delegated prompts may modify files in the target working directory.
本项目为非官方第三方工具,与 Qoder 官方无关。请谨慎使用 bypass_permissions 权限模式——委托的任务可能修改目标工作目录中的文件。
License
MIT
This server cannot be installed
Maintenance
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
MCP server exposing the Backtest360 engine API as tools for AI agents.
Agent-native MCP server over the public saagarpatel.dev corpus. Read-only, stateless.
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/cantbeblank96/qodercli-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server