Skip to the page

Qwen Code

Qwen Code's built-in web_search runs only on DashScope or a Qwen subscription. On any other model provider, web search comes from an mcpServers entry. Add SpecStream with one qwen mcp add command and Qwen Code can search the live web, read whole pages, and get a written research report with the page behind each cited sentence.

SpecStream for Qwen CodeCoding agents

What you need

  • Qwen Code, installed with npm install -g @qwen-code/qwen-code@latest (Node.js 22 or newer) or brew install qwen-code.
  • A SpecStream account. New accounts get $10 of credit, no card.
  1. 1. Create a SpecStream key

    In your SpecStream workspace, open Agents & API, choose API keys, then Create API key. Give the key execute access and a spending limit, so it can search and read pages up to that limit and no further.

    Export it in the shell where you start Qwen Code:

    Shell
    export SPECSTREAM_API_KEY="YOUR_SPECSTREAM_KEY"
  2. 2. Add the server

    Run this once. qwen mcp add writes the entry to ~/.qwen/settings.json, which covers every project on your machine. Add --scope project to write it to .qwen/settings.json in the current project instead.

    Your shell fills in the variable before Qwen Code sees it, so the file holds the key itself. To keep the key out of the file, write the entry by hand as the last step shows.

    Shell
    qwen mcp add specstream \
    -t http \
    "https://api.specstream.ai/mcp" \
    -H "Authorization: Bearer ${SPECSTREAM_API_KEY}"
  3. 3. Check the connection

    Start qwen and enter /mcp. The dialog lists specstream with its tools. If Qwen Code was already running when you added the server, restart it in the same project first.

    From the shell, qwen mcp list shows the same server. If it shows Disconnected, check that SPECSTREAM_API_KEY is set in the shell Qwen Code starts from.

    In Qwen Code
    /mcp
  4. 4. Ask for a report

    Ask a question and name SpecStream. Qwen Code calls research_price to show the price of each depth, starts the report with start_research once you approve that price, and reads it with get_research until it is completed. A quick report takes about a minute.

    For a quick answer, ask it to search with SpecStream, and it calls search_web and read_pages instead.

    In Qwen Code
    Use SpecStream to write a quick research report: which Node.js versions are in long-term support today, and when does each one end? Show me the price first.
  5. 5. Or write the entry by hand

    Add this to ~/.qwen/settings.json, or to .qwen/settings.json in a project. Remote servers over streamable HTTP use the httpUrl field in Qwen Code. url is the field for SSE servers.

    Here the file keeps the variable's name. Qwen Code reads the key from the environment each time it starts.

    ~/.qwen/settings.json
    {
    "mcpServers": {
    "specstream": {
    "httpUrl": "https://api.specstream.ai/mcp",
    "headers": {
    "Authorization": "Bearer ${SPECSTREAM_API_KEY}"
    }
    }
    }
    }

What Qwen Code gets

SpecStream's server at https://api.specstream.ai/mcp adds these tools to Qwen Code.

  • search_web answers a question from the live web, with up to 10 results for $5 per 1,000 searches.
  • read_pages returns the main text of the pages you name, at $0.80 per 1,000 pages. A page that gives no text is not charged.
  • research_price, start_research and get_research produce a written report from the live web, with the page behind each cited sentence. A report costs $0.10 (quick), $0.30 (standard) or $1.00 (deep), and the price is taken once, when the report is delivered.
  • Deep Search builds a list from a request in plain words. compile reads the request back, quote_capacity_work prices it, and authorize_capacity_work starts it only after you approve the maximum. get_find and list_find_rows read the results with their sources.

Qwen Code's own web search and SpecStream

Qwen Code's built-in web_search turns on by itself with a Qwen Plus or Pro subscription and with supported DashScope setups. With a model from another provider it stays off, and Qwen Code's own docs say to connect an MCP search service. SpecStream is one such service, and it works with any model you run in Qwen Code.

With both in place, the two run side by side. Name SpecStream in your request when you want its results or a report.

You needToolPrice
A fact or a quick answersearch_web$5 per 1,000 searches
The full text of pages you knowread_pages$0.80 per 1,000 pages
A written answer with its sourcesstart_research$0.10, $0.30 or $1.00 a report
A complete list with the same facts on each rowcompile, then a quoteQuoted before it runs

Sign in with OAuth in place of a key

On a machine with a browser you can leave the header out: qwen mcp add specstream -t http "https://api.specstream.ai/mcp". When an httpUrl server answers that sign-in is needed, Qwen Code starts OAuth discovery by itself and opens the browser. Sign in to SpecStream and approve the access Qwen Code asks for. The /mcp dialog shows the server's authentication state.

Qwen Code receives the sign-in on http://localhost:7777/oauth/callback, so this works where Qwen Code and the browser run on the same machine. On a remote server or a web terminal, use the key.

Qwen Code stores OAuth tokens in ~/.qwen/mcp-oauth-tokens.json as plain text by default. Set QWEN_CODE_FORCE_ENCRYPTED_FILE_STORAGE=true on a shared machine.

Approvals in Qwen Code

Leave trust off for this server, which is the default. Qwen Code then asks before each SpecStream tool call. Searches and page reads are charged per call. A report or a list adds SpecStream's own gate: nothing starts until you approve the exact price it shows.

To give Qwen Code only some of the tools, add includeTools to the entry, for example "includeTools": ["search_web", "read_pages"].

Cost

Connecting SpecStream to Qwen Code is free, and new accounts start with $10 of credit. A search of up to 10 results costs $5 per 1,000, and a page read costs $0.80 per 1,000. A research report costs $0.10, $0.30 or $1.00 by depth, and a cancelled report is not charged. The key's spending limit is the most Qwen Code can spend. See pricing and how billing works.

Remove

Run qwen mcp remove specstream, or delete the specstream entry from settings.json, and restart Qwen Code. To end its access, open Agents & API in your SpecStream workspace and revoke the key under API keys. Questions: [email protected]. More tools are covered in Connect your tools.

More

SpecStream for Qwen Code covers what it does in Qwen Code on one page. Every other tool has its guide in Connect your tools. You see the most a request can cost before it starts, and the matches are paid from your balance. Billing has the details. For help, email [email protected].