How to Use Qwen 3 30B for MCP and Agentic Tasks

Master Qwen 3 30B with MCP for agentic tasks! This tutorial guides you through Ollama setup, tool-calling with MCP, and building a poetry-writing agent using Qwen 3’s reasoning mode.

Ashley Goolam

Ashley Goolam

29 May 2025

How to Use Qwen 3 30B for MCP and Agentic Tasks

Ready to unleash the power of Qwen 3 30B-A3B for some next-level agentic tasks? This beast of a model, when run locally with Ollama, is a game-changer for mcp (Model Context Protocol) and tool-calling, letting you build smart agents that reason like pros. I got hooked exploring its capabilities on Reddit, where folks are raving about its speed and smarts for tasks like file operations or database queries. In this tutorial, I’ll show you how to set up Qwen 3 locally, configure mcp for tool use, and create an agent that writes a poem to a file—all with Qwen 3’s reasoning magic. Whether you’re coding or automating, let’s make Qwen 3 your new bestie!

💡
Working with APIs or documenting projects? Grab APIdog for a slick way to design, test, and share API docs—perfect for your Qwen 3 workflows!
button

What is Qwen 3 and Why It Rocks for MCP?

Qwen 3 is Alibaba’s latest open-weight large language model series, and the 30B-A3B (Mixture-of-Experts) variant is a standout for mcp and agentic tasks. With 30 billion total parameters but only 3 billion active per inference, it’s fast and efficient, running well on a single RTX 3090 or 4090. Its mcp support lets it call tools (e.g., file systems, databases) via JSON-defined interfaces, while its hybrid thinking mode (... blocks) boosts reasoning for complex tasks like coding or multi-step logic. Reddit users on r/LocalLLLaMA praise its tool-calling precision, with one test showing it aced writing a poem to a file by querying a directory first. Let’s harness this power locally with Ollama!

Setting Up Your Qwen 3 Environment

Before we dive into mcp and agentic fun, let’s prep your system to run Qwen 3 30B-A3B with Ollama. This is beginner-friendly, I promise!

1. Check System Requirements:

2. Install Ollama:

Visit the official website and download a version compatible with your operating system.

ollama

Alternatively run:

curl -fsSL https://ollama.com/install.sh | sh

Verify the version:

ollama --version

Expect something like 0.3.12 (May 2025). If it fails, ensure Ollama is in your PATH.

3. Pull a Qwen 3 Model:

For Qwen Affiliate 30B (large, high-end PCs only):

ollama pull qwen3:30b

This downloads ~18GB—grab a snack! Warning: It’s resource-heavy and needs a beefy GPU.

For testing on modest hardware, try smaller Qwen Affiliate models, which are still highly capable for mcp and tools:

ollama pull qwen3:0.6b  # ~0.4GB
ollama pull qwen3:1.7b  # ~1GB
ollama pull qwen3:8b    # ~5GB
qwen 3 models

Verify installation:

ollama list

Look for qwen3:30b (or qwen3:0.6b, etc.).

4. Test the Model:

Run:

ollama run qwen3:30b

Or, for smaller models: ollama run qwen3:0.6b, qwen3:1.7b, or qwen3:8b.

test qwen 3
How to Download and Use Ollama to Run LLMs Locally
The world of Artificial Intelligence (AI) is evolving at breakneck speed, with Large Language Models (LLMs) like ChatGPT, Claude, and Gemini capturing imaginations worldwide. These powerful tools can write code, draft emails, answer complex questions, and even generate creative content. However, usi…
New to Ollama? Check this tutorial out to help you get started!

Creating a Qwen 3 Agent with MCP and Tools

Now, let’s harness Qwen 3’s mcp and tool powers to build an agent that reads a PDF and answers questions, using code from the Qwen-Agent GitHub repo. We’ll also test mcp functions to fetch real-time data like time or weather. You can use any PDF—a research paper, a recipe, or even a user manual!

1. Set Up a New Project:

Create and navigate to a project folder:

mkdir qwen-agent-test
cd qwen-agent-test

2. Create a Virtual Environment:

Set up and activate:

python3 -m venv venv
source venv/bin/activate  # macOS/Linux
venv\Scripts\activate     # Windows

3. Install Qwen-Agent:

Install with mcp and tool dependencies:

pip install -U "qwen-agent[gui,rag,code_interpreter,mcp]"

4. Create the Agent Script:

# Step 2: Configure the LLM you are using.
llm_cfg = {
    # Use the model service provided by DashScope:
    #'model': 'qwen-max-latest',
    #'model_type': 'qwen_dashscope',
    # 'api_key': 'YOUR_DASHSCOPE_API_KEY',
    # It will use the `DASHSCOPE_API_KEY' environment variable if 'api_key' is not set here.

    # Use a model service compatible with the OpenAI API, such as vLLM or Ollama:
    'model': 'qwen3:0.6b',
    'model_server': 'http://localhost:11434/v1',  # base_url, also known as api_base
    'api_key': 'ollama',

    # (Optional) LLM hyperparameters for generation:
    'generate_cfg': {
        'top_p': 0.8
    }
}

5. Start Ollama’s API:

In a separate terminal, run:

ollama serve

This hosts the API at http://localhost:11434. Keep it running.

6. Run the Agent:

In the project folder, execute:

python testagent.py
run testagent.py
testagent.py output

7. Test MCP Functions:

tools = [
    'my_image_gen', 
    'code_interpreter',
    {
        'mcpServers': {
            'time': {
                'type': 'python',
                'module': 'mcp.server.time',
                'port': 8080
            },
            'fetch': {
                'type': 'python',
                'module': 'mcp.server.fetch',
                'port': 8081
            }
        }
    }
    ]  # `code_interpreter` is a built-in tool for executing code.
files = ['./AI-paper.pdf']  # Give the bot a PDF file to read. 
python testagent.py

Exploring Qwen 3’s MCP and Tool-Calling Features

Qwen 3 excels at mcp and agentic tasks. Here’s how to push it further:

I tested qwen3:8b with a recipe PDF, and it listed ingredients perfectly—Qwen 3’s tool-calling is versatile!

Wrapping Up: Master Qwen 3 and MCP

Now, you’ve unleashed Qwen 3 30B with mcp and tools to build a PDF-reading agent and tested mcp functions for real-time queries! From installing Ollama and testing Qwen 3 models to creating a Qwen-Agent that summarizes research papers or fetches the weather, you’re ready for agentic awesomeness. Try new PDFs, add tools, or document your APIs with Apidog!

💡
Want a great API Testing tool that generates beautiful API Documentation?

Want an integrated, All-in-One platform for your Developer Team to work together with maximum productivity?

Apidog delivers all your demans, and replaces Postman at a much more affordable price!
button

Explore more

Beyond the Trial: 5 Simple Ways to Use Augment Code for Free

Beyond the Trial: 5 Simple Ways to Use Augment Code for Free

Stretching your budget? Explore 5 straightforward methods to access Augment Code's powerful features without cost. We delve into free plans, trials, open-source programs, and community solutions.

3 June 2025

Top 10 Stablecoin APIs for Developers

Top 10 Stablecoin APIs for Developers

Stablecoins have become a vital component of the cryptocurrency ecosystem, offering traders and developers a way to mitigate market volatility while still benefiting from blockchain technology. Whether you are designing a payment solution, executing automated trading strategies, or providing real-time market analytics, incorporating stablecoin APIs into your platform can help streamline processes and enhance functionality. In this article, we explore the top 10 stablecoin trading APIs for develo

31 May 2025

Top 10 Best Online Sports Betting APIs / Sports Odds APIs 2025

Top 10 Best Online Sports Betting APIs / Sports Odds APIs 2025

The online sports betting industry is evolving at an unprecedented pace, and with it comes the need for robust, real-time data integration. In 2025, sports betting APIs and sports odds APIs are more vital than ever for bookmakers, developers, and betting enthusiasts. This article dives into the top 10 online sports betting APIs that are set to shape the industry this year, with betcore.eu proudly leading the pack as the number one choice. With technology continually advancing and customer expec

31 May 2025

Practice API Design-first in Apidog

Discover an easier way to build and use APIs