π€ MCP-Agent-1.7B
The first open-source small language model fine-tuned to natively speak the Model Context Protocol (MCP).
What Is This?
MCP-Agent-1.7B is Qwen/Qwen3-1.7B fine-tuned with LoRA to:
- π§ Call tools using MCP protocol (JSON-RPC format)
- π Plan multi-step tool chains with DAG dependencies
- β Ask clarifying questions when info is missing (instead of hallucinating)
- π‘οΈ Refuse dangerous requests (e.g., "delete all files")
Training
| Detail | Value |
|---|---|
| Base model | Qwen/Qwen3-1.7B (2B params) |
| Method | LoRA SFT (rank=16, all-linear) |
| Dataset | muhammadtlha944/mcp-agent-training-data (16.5K examples) |
| Epochs | 3 |
| Learning rate | 2e-4 (cosine schedule) |
| Effective batch size | 16 |
| Precision | fp16 |
| Cost | $0 (trained on free Kaggle/Colab GPU) |
π Train It Yourself (FREE)
Option 1: Kaggle (Recommended β 30 free GPU hrs/week)
- Go to kaggle.com/code β New Notebook
- Settings β Accelerator β GPU T4Γ2 β Internet β ON
- Copy-paste the code from
MCP_Agent_1_7B_Kaggle.ipynb - Run all cells β wait ~2 hours β model auto-pushes to Hub
Option 2: Google Colab (Backup β free T4)
- Open colab.research.google.com
- Runtime β Change runtime type β T4 GPU
- Copy-paste from
MCP_Agent_1_7B_Training.ipynb - Run all cells β wait ~2 hours
Quick Start
from transformers import pipeline
pipe = pipeline("text-generation", model="muhammadtlha944/MCP-Agent-1.7B")
messages = [
{"role": "system", "content": "You are an MCP agent with tools: github_search, read_file, shell_exec."},
{"role": "user", "content": "Find all Python files that import pandas"}
]
response = pipe(messages, max_new_tokens=512)
print(response[0]['generated_text'][-1]['content'])
Research Background
This project is informed by:
- STAR Framework (arxiv 2602.03022) β proved Qwen3-1.7B beats Llama-3.1-8B at function calling
- TinyAgent (arxiv 2409.00608) β proved 1.1B models can match GPT-4 at focused tool calling
- LoRA Without Regret β all-linear LoRA matches full fine-tuning quality
License
Apache 2.0 (same as base model)
Author
Built by Muhammad Talha β learning ML by building real projects.