Qwen MCP Tool
Enables AI assistants to leverage Qwen's code analysis capabilities with large context windows, supporting file/directory analysis, sandbox execution, and multiple approval modes for safe code operations.
README
Qwen MCP Tool
Model Context Protocol server for Qwen CLI integration. This tool enables AI assistants like Claude to leverage Qwen's powerful code analysis and large context window capabilities through the MCP protocol.
Features
- Large Context Windows: Leverage Qwen's massive token capacity for analyzing large files and entire codebases
- File Analysis: Use
@filenameor@directorysyntax to include file contents in your queries - Sandbox Mode: Safely execute code and run tests in isolated environments
- Multiple Models: Support for various Qwen models (qwen3-coder-plus, qwen3-coder-turbo, etc.)
- Flexible Approval Modes: Control tool execution with plan/default/auto-edit/yolo modes
- MCP Protocol: Seamless integration with MCP-compatible AI assistants
Prerequisites
- Node.js v16 or higher
- Qwen CLI installed and configured (qwen-code)
Installation
Quick Setup (Easiest - Recommended)
Use Claude Code's built-in MCP installer:
claude mcp add qwen-cli -- npx -y @jaggerxtrm/qwen-mcp-tool
This single command configures everything automatically!
Via Global Install
Install via npm:
npm install -g @jaggerxtrm/qwen-mcp-tool
Then add to Claude Code MCP settings (~/.config/claude/mcp_settings.json):
{
"mcpServers": {
"qwen-cli": {
"command": "qwen-mcp-tool"
}
}
}
Via npx (Manual Configuration)
Manually configure to use npx without installing:
{
"mcpServers": {
"qwen-cli": {
"command": "npx",
"args": ["-y", "@jaggerxtrm/qwen-mcp-tool"]
}
}
}
From Source (Development)
- Clone and install dependencies:
git clone <repo-url>
cd qwen-mcp-tool
npm install
- Build the project:
npm run build
- Link locally:
npm link
Available Tools
ask-qwen
The main tool for interacting with Qwen AI.
Parameters:
prompt(required): Your question or instruction- Use
@filenameto include a file's contents - Use
@directoryto include all files in a directory
- Use
model(optional): Model to use (qwen3-coder-plus, qwen3-coder-turbo, etc.)sandbox(optional): Enable sandbox mode for safe code executionapprovalMode(optional): Control tool execution approvalplan: Analyze tool calls without executingdefault: Prompt for approval (default behavior)auto-edit: Auto-approve file editsyolo: Auto-approve all tool calls
yolo(optional): Shortcut for approvalMode='yolo'allFiles(optional): Include all files in current directory as contextdebug(optional): Enable debug mode
Examples:
// Analyze a specific file
{
"prompt": "@src/main.ts Explain what this code does"
}
// Analyze entire codebase
{
"prompt": "@src/ Summarize the architecture of this codebase"
}
// Use specific model with sandbox
{
"prompt": "Run the test suite and fix any failures",
"model": "qwen3-coder-plus",
"sandbox": true,
"approvalMode": "auto-edit"
}
ping
Simple echo test to verify the connection.
Parameters:
prompt(optional): Message to echo (defaults to "Pong!")
Help
Display Qwen CLI help information.
Parameters: None
Configuration
The tool uses the following default models:
- Primary: qwen3-coder-plus
- Fallback: qwen3-coder-turbo (used if primary hits quota limits)
You can override these by specifying the model parameter in your requests.
Usage with Claude Code
Once installed as an MCP server, you can use it within Claude Code:
Ask Qwen to analyze the authentication system in @src/auth/
Claude will automatically use the ask-qwen tool with the appropriate parameters.
Project Structure
qwen-mcp-tool/
├── src/
│ ├── index.ts # MCP server entry point
│ ├── constants.ts # Configuration and constants
│ ├── tools/
│ │ ├── registry.ts # Tool registration system
│ │ ├── ask-qwen.tool.ts # Main Qwen interaction tool
│ │ ├── simple-tools.ts # Utility tools (ping, help)
│ │ └── index.ts # Tool exports
│ └── utils/
│ ├── commandExecutor.ts # Command execution utility
│ ├── qwenExecutor.ts # Qwen CLI wrapper
│ └── logger.ts # Logging utility
├── package.json
├── tsconfig.json
└── README.md
How It Works
- The MCP server listens for tool calls via stdio transport
- When a tool is called, the server validates the arguments using Zod schemas
- For
ask-qwen, the prompt is passed to the Qwen CLI with appropriate flags - File references (
@filename) are handled by Qwen's built-in file processing - Output is captured and returned to the MCP client
- If quota limits are hit, the server automatically falls back to the turbo model
Comparison with Gemini MCP Tool
This tool is inspired by gemini-mcp-tool but adapted for Qwen CLI:
| Feature | Gemini MCP | Qwen MCP |
|---|---|---|
| File references | ✅ | ✅ (more advanced) |
| Sandbox mode | ✅ | ✅ |
| Multiple models | ✅ | ✅ |
| Approval modes | ❌ | ✅ |
| Directory traversal | Basic | Advanced (git-aware) |
| Multimodal support | Limited | Images, PDFs, audio, video |
Troubleshooting
"Qwen CLI not found"
Make sure the Qwen CLI is installed and available in your PATH:
npm install -g @qwen/cli
# or follow instructions at https://github.com/QwenLM/qwen-code
"Command timed out"
For very large files or codebases, the analysis may take longer than the default 10-minute timeout. Consider:
- Using
.qwenignoreto exclude unnecessary files - Breaking down large queries into smaller chunks
- Using
approvalMode: "plan"to analyze without executing
"Invalid tool arguments"
Check that your arguments match the tool schema. Use the Help tool to see available options.
License
MIT
Contributing
Contributions are welcome! Please feel free to submit issues or pull requests.
Credits
Inspired by gemini-mcp-tool by jamubc. Built for use with Qwen Code.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。