Skip to main content
Glama

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 @filename or @directory syntax 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

Related MCP server: DevToolkit MCP Server

Prerequisites

  • Node.js v16 or higher

  • Qwen CLI installed and configured (qwen-code)

Installation

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)

  1. Clone and install dependencies:

git clone <repo-url>
cd qwen-mcp-tool
npm install
  1. Build the project:

npm run build
  1. Link locally:

npm link

Available Tools

ask-qwen

The main tool for interacting with Qwen AI.

Parameters:

  • prompt (required): Your question or instruction

    • Use @filename to include a file's contents

    • Use @directory to include all files in a directory

  • model (optional): Model to use (qwen3-coder-plus, qwen3-coder-turbo, etc.)

  • sandbox (optional): Enable sandbox mode for safe code execution

  • approvalMode (optional): Control tool execution approval

    • plan: Analyze tool calls without executing

    • default: Prompt for approval (default behavior)

    • auto-edit: Auto-approve file edits

    • yolo: Auto-approve all tool calls

  • yolo (optional): Shortcut for approvalMode='yolo'

  • allFiles (optional): Include all files in current directory as context

  • debug (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

  1. The MCP server listens for tool calls via stdio transport

  2. When a tool is called, the server validates the arguments using Zod schemas

  3. For ask-qwen, the prompt is passed to the Qwen CLI with appropriate flags

  4. File references (@filename) are handled by Qwen's built-in file processing

  5. Output is captured and returned to the MCP client

  6. 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 .qwenignore to 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.

Available Tools

3 tools
ask-qwenB

Query Qwen AI with support for file analysis (@file syntax), codebase exploration, and large context windows. Supports various models and execution modes.

ParametersJSON Schema
NameRequiredDescriptionDefault
promptYesThe query or instruction for Qwen. Use @filename or @directory to include file contents. Example: '@src/ Explain this codebase structure'
modelNoOptional model to use (e.g., 'qwen3-coder-plus'). If not specified, uses the default model (qwen3-coder-plus).
sandboxNoUse sandbox mode (-s flag) to safely test code changes, execute scripts, or run potentially risky operations in an isolated environment
approvalModeNoControl tool execution approval: 'plan' (analyze only), 'default' (prompt for approval), 'auto-edit' (auto-approve edits), 'yolo' (auto-approve all)
yoloNoEnable YOLO mode to automatically approve all tool calls without prompting (equivalent to approvalMode='yolo')
allFilesNoInclude all files in the current directory as context (use with caution for large directories)
debugNoEnable debug mode for more verbose output

TDQS

B3.1/5.0
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions 'execution modes' and 'large context windows' but lacks critical details: no information on rate limits, authentication needs, response format, error handling, or whether queries are logged/stored. For a complex AI query tool with 7 parameters, this is a significant gap.

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

Conciseness4/5

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

The description is appropriately concise (two sentences) and front-loaded with the core purpose. Every sentence adds value: the first establishes the main function and key features, the second mentions model and execution mode support. No wasted words, though it could be slightly more structured.

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

Completeness2/5

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

For a complex AI query tool with 7 parameters, no annotations, and no output schema, the description is incomplete. It doesn't explain what the tool returns (e.g., text response, structured data), error conditions, or important behavioral constraints. The schema covers parameters well, but the overall context for proper tool invocation is insufficient.

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 100%, so the schema already documents all 7 parameters thoroughly. The description adds minimal value beyond the schema, mentioning '@file syntax' and 'various models' but not providing additional context about parameter interactions or advanced usage patterns. Baseline 3 is appropriate when the schema does most of the work.

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's purpose: 'Query Qwen AI with support for file analysis (@file syntax), codebase exploration, and large context windows.' It specifies the verb ('Query') and resource ('Qwen AI') with additional capabilities. However, it doesn't explicitly differentiate from sibling tools like 'Help' or 'ping' beyond the AI query focus.

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

Usage Guidelines3/5

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

The description implies usage context through features like file analysis and codebase exploration, suggesting it's for AI-assisted development tasks. However, it lacks explicit guidance on when to use this tool versus alternatives (e.g., 'Help' for server info, 'ping' for connectivity), and doesn't mention prerequisites or exclusions.

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

HelpB

Display Qwen CLI help information

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

B3.2/5.0
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. 'Display' suggests a read-only operation that shows information, but it doesn't specify whether this triggers any side effects (like logging usage), whether authentication is needed, if there are rate limits, or what happens if the CLI isn't properly configured. The description is minimal and lacks important behavioral context for a tool that interacts with system components.

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 is perfectly concise at just four words: 'Display Qwen CLI help information.' Every word earns its place - 'Display' specifies the action, 'Qwen CLI' identifies the system, and 'help information' defines the resource. There's zero redundancy or unnecessary elaboration for such a straightforward tool.

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?

Given the tool's simplicity (no parameters, no output schema, no annotations), the description is adequate but has clear gaps. It explains what the tool does at a basic level but doesn't provide enough context about what 'help information' includes, how it's presented, or what users should expect. For a help tool that might be crucial for onboarding or troubleshooting, more detail about the nature and format of the help would be beneficial.

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

Parameters4/5

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

The tool has zero parameters, and schema description coverage is 100% (since there are no parameters to describe). The description appropriately doesn't waste space discussing nonexistent parameters. A baseline of 4 is appropriate for zero-parameter tools where the schema fully covers the parameter situation.

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's purpose with a specific verb ('Display') and resource ('Qwen CLI help information'). It distinguishes itself from siblings like 'ask-qwen' (which likely queries the AI) and 'ping' (which likely checks connectivity) by focusing on help documentation display. However, it doesn't explicitly mention what format the help information appears in or whether it's general vs. specific help.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention whether this should be used for general CLI overview, command-specific help, troubleshooting, or as a first step for new users. With siblings like 'ask-qwen' that might provide interactive assistance, there's no differentiation about when help display is preferable to asking the AI directly.

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

pingA

Echo a message to test the connection

ParametersJSON Schema
NameRequiredDescriptionDefault
promptNoMessage to echoPong!

TDQS

A3.5/5.0
Behavior3/5

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

No annotations are provided, so the description carries the full burden. It discloses the basic behavior ('echo a message') and purpose ('test the connection'), which covers the core functionality. However, it lacks details on potential side effects, error conditions, or response format, leaving gaps for a tool that might involve network or system interactions.

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 is a single, efficient sentence: 'Echo a message to test the connection'. It is front-loaded with the core action and purpose, with zero wasted words, making it highly concise and well-structured for quick understanding.

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?

Given the tool's low complexity (one optional parameter, no output schema, no annotations), the description is minimally adequate. It explains what the tool does but doesn't cover behavioral nuances or output details. For a simple echo tool, this might suffice, but it lacks depth for more informed usage.

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?

The input schema has 100% description coverage, with the parameter 'prompt' documented as 'Message to echo' and a default value 'Pong!'. The description adds no additional parameter semantics beyond what the schema provides, such as format constraints or usage examples. With high schema coverage, the baseline score of 3 is appropriate.

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's purpose: 'Echo a message to test the connection'. It specifies the verb ('echo') and resource ('message') with the explicit goal of connection testing. However, it doesn't differentiate from sibling tools like 'ask-qwen' or 'Help', which appear to serve different purposes.

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

Usage Guidelines3/5

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

The description implies usage context ('to test the connection'), suggesting this tool is for diagnostic or connectivity verification purposes. It doesn't provide explicit guidance on when to use this versus alternatives like 'ask-qwen' or 'Help', nor does it specify exclusions or prerequisites.

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. 3 tool updatesv1.0.0
    • Addedask-qwen
    • AddedHelp
    • Addedping

TDQS

B3.4/5.0

Scored across 3 tools

Disambiguation5/5

Each tool has a clearly distinct purpose: ask-qwen for AI queries with file/codebase support, Help for CLI documentation, and ping for connection testing. There is no overlap in functionality, making tool selection unambiguous for an agent.

Naming Consistency3/5

The naming is mixed: ask-qwen uses a verb-noun pattern, Help is a capitalized noun, and ping is a lowercase verb. While readable, this inconsistency in style (snake_case vs. no underscores, verb vs. noun forms) deviates from a predictable pattern.

Tool Count4/5

With 3 tools, the count is reasonable for a basic AI/utility server, though it feels slightly thin for broader use cases. Each tool serves a clear purpose, but the scope could support a few more complementary tools without being overwhelming.

Completeness3/5

For a Qwen AI tool server, core functions like querying (ask-qwen) and testing (ping) are covered, but there are notable gaps such as model management, session handling, or advanced configuration tools. The Help tool provides documentation, but operational coverage is limited.

Maintenance

ActivityInactive
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers