MCP Servers

A collection of Model Context Protocol servers, templates, tools and more.

SmolAgentWithMCP enables developers to build powerful AI agents that integrate multiple MCP tool servers, like Brave Search, with LLMs for enhanced, real-time question-answering and tool orchestration.

Created 7/15/2025
Updated 6 days ago
Repository documentation and setup instructions

SmolAgentWithMCP

Overview

SmolAgentWithMCP is a Python-based AI agent framework that connects multiple Model Context Protocol (MCP) tool servers and orchestrates them with a large language model (LLM). With support for Brave Search and other MCP-compatible tools, it enables powerful, tool-augmented question-answering workflows. The agent leverages smolagents, LiteLLM, and MCP protocol to offer flexible, extensible, and modern AI tooling.


Use Case

This project is ideal for developers and researchers who want to:

  • Integrate multiple tool servers (e.g., Brave Search, custom MCP crawlers) into a single AI agent.
  • Enable conversational AI agents to use external tools for enhanced answering capabilities.
  • Prototype and deploy advanced AI workflows with minimal setup.
  • Extend the agent with custom tools using the MCP protocol.

Example Scenarios:

  • An assistant that answers queries using live web search data and custom knowledge bases.
  • A research agent that leverages both public APIs and private datasets/tools.
  • An automation bot that can interact with external services via MCP-enabled tools.

Features

  • Multi-tool orchestration: Connects to multiple MCP tool servers.
  • Tool-calling agent: Uses LLM to decide when and how to call tools.
  • Configurable via .env: Supports multiple API keys and environment settings.
  • Async workflow: Efficient asynchronous tool management.
  • Extensible: Easily add new MCP tools or change LLM models.

Project Structure

- smolagentwithmcp.py         # Main agent source code
- requirements.txt            # Python dependencies
- .env.example                # Example env file
- README.md                   # Project documentation

Setup & Installation

  1. Clone the repository:

    git clone https://github.com/ashishpatel26/SmolAgentWithMCP.git
    cd SmolAgentWithMCP
    
  2. Install dependencies:

    pip install -r requirements.txt
    
  3. Configure environment variables:

    • Copy .env.example to .env and fill in your API keys.
    cp .env.example .env
    
  4. Run the agent:

    python smolagentwithmcp.py
    

Code Workflow Diagram

flowchart TD
    subgraph User Interaction
        U([User]) -->|Query| AGENT[SmolAgentWithMCP]
    end
    AGENT -->|Loads| MCP1[MCP Tool Server 1: Brave Search]
    AGENT -->|Loads| MCP2[MCP Tool Server 2: Custom]
    AGENT -->|Initializes| LLM[LiteLLM Model]
    U -->|Input| AGENT
    AGENT -->|Decides tool usage| TOOLCALL[ToolCallingAgent]
    TOOLCALL -->|Calls| MCP1
    TOOLCALL -->|Calls| MCP2
    MCP1 -->|Returns Data| TOOLCALL
    MCP2 -->|Returns Data| TOOLCALL
    TOOLCALL -->|Generates Answer| AGENT
    AGENT -->|Output| U

How It Works

  1. Initialization: Loads MCP tool servers (like Brave Search, custom crawlers) and configures LLM.
  2. User Query: Accepts user input via terminal.
  3. Tool Orchestration: Determines which tools to call for the query.
  4. Execution: Calls tools, gathers results, and generates a final response using the LLM.
  5. Async Management: Handles multiple tool collections and steps asynchronously.
  6. Output: Returns the answer to the user interactively.

Configuration

Edit .env to set your API keys:

BRAVE_API_KEY=your_brave_search_api_key
OPENAI_API_KEY=your_openai_api_key

Requirements

See requirements.txt:

  • smolagents
  • python-dotenv
  • mcp
  • litellm

License

MIT License. See LICENSE for details.


Contributing

Contributions welcome! Please open issues or PRs for feature requests, bug fixes, or enhancements.


Credits

Quick Setup
Installation guide for this server

Install Package (if required)

uvx smolagentwithmcp

Cursor configuration (mcp.json)

{ "mcpServers": { "ashishpatel26-smolagentwithmcp": { "command": "uvx", "args": [ "smolagentwithmcp" ] } } }