Skip to content

mcp server setup using cli #1278

@eliird

Description

@eliird

What would you like to be added?

Add support for configuring the MCP server via a CLI option, similar to how Claude Code handles it. This would provide a cleaner, safer, and more explicit integration point for SDK and programmatic usage. Similar to --mcp-config flag for claude-code.

Why is this needed?

There are ongoing efforts to make Qwen Code usable programmatically via an SDK (for example, #926). An experimental TypeScript SDK already exists, and I am currently working on a Python SDK following a similar architecture to the Claude Code SDK. I already have a basic working version, but I ran into an issue around MCP server configuration for the CLI.

In the Claude CLI, the MCP server configuration can be passed directly as a CLI option (see reference):
https://github.com/anthropics/claude-agent-sdk-python/blob/27575ae2ca7460c6a0f9224350b1f2941704b89d/src/claude_agent_sdk/_internal/transport/subprocess_cli.py#L271

Currently, Qwen Code does not support passing MCP server configuration via CLI arguments, so the wrorkaround is to write the mcp server in the config file and remove it at the end but this can cause issues if multiple instances of program are running

Additional context

The contribution guidelines mention that each PR should be linked to an issue and requires maintainer approval. Based on this, I created this issue first to discuss the need and approach.

If this is something that aligns with the project’s direction, I would be happy to work on the implementation after getting confirmation or guidance from a maintainer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions