A comprehensive demonstration of Model Context Protocol (MCP) applications built with open source tools
This is a comprehensive demo showing how to build Model Context Protocol (MCP) applications using open source tools. It demonstrates:
- ποΈ MCP Server Development - How to create specialized MCP servers
- π€ Multi-Agent Systems - Building intelligent agent teams with Smolagents
- π§ Tool Integration - Connecting agents to external APIs and services
- π Real-world Use Cases - Code analysis, security scanning, file operations
- π§ͺ Testing & Validation - Comprehensive testing strategies for MCP applications
Perfect for developers who want to:
- Learn MCP fundamentals
- Build their own MCP servers
- Create multi-agent applications
- Understand MCP best practices
Start simple and work your way up to advanced multi-agent systems:
Perfect for understanding MCP fundamentals
# Setup environment
git clone https://github.com/juliensimon/smolagents-mcp-demo.git
cd smolagents-mcp-demo
export TOGETHER_API_KEY="your-api-key-here"
python -m venv env
source env/bin/activate # On Windows: env\Scripts\activate
pip install -r requirements.txt
# Start one server
python server/basic_server/basic_server.py
# In another terminal, run basic client
python client/basic_client/client.py
What you'll learn:
- How MCP clients connect to servers
- Basic tool usage with AI agents
- Simple text analysis capabilities
Learn to work with multiple MCP servers
# Start all servers
python start_all_servers.py
# Run the unified client
python client/code_client/client.py
What you'll learn:
- Connecting to multiple MCP servers
- Tool discovery and routing
- Unified interface for different capabilities
- Server status monitoring
Experience advanced multi-agent coordination
# Start all servers (if not already running)
python start_all_servers.py
# Launch the multi-agent system
python client/multi_agent_client/client.py
What you'll learn:
- Agent specialization and delegation
- Intelligent task routing
- Multi-agent coordination patterns
- Advanced MCP application architecture
- Server Architecture - How to structure MCP servers
- Tool Implementation - Creating custom tools and functions
- Error Handling - Robust error management in MCP servers
- Configuration - Centralized configuration management
- Testing - Comprehensive testing strategies
- Agent Specialization - Different agents for different tasks
- Task Delegation - Intelligent routing between agents
- Tool Coordination - Agents using MCP servers as tools
- Conversation Management - Multi-turn agent interactions
Server | Purpose | What You'll Learn |
---|---|---|
Code Metrics | Code quality analysis | Implementing analysis tools, metrics calculation |
Code Security | Vulnerability detection | Security scanning, pattern recognition |
Code Retrieval | File operations | HTTP handling, file processing, error management |
Git Server | Repository management | Git operations, version control integration |
Basic Server | Text processing | Simple tool implementation, text analysis |
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Multi-Agent Client β
β βββββββββββββββ ββββββββββββββββ ββββββββββββββββ β
β β Code Agent β βResearch Agentβ βManager Agent β β
β β(coder-large)β β(coder-large) β β(coder-large) β β
β βββββββββββββββ ββββββββββββββββ ββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β MCP Servers β
β βββββββββββββββ βββββββββββββββ ββββββββββββββββ β
β β Code Metricsβ βCode Securityβ βCode Retrievalβ β
β β (7862) β β (7865) β β (7866) β β
β βββββββββββββββ βββββββββββββββ ββββββββββββββββ β
β βββββββββββββββ βββββββββββββββ β
β β Git Server β βBasic Server β β
β β (7867) β β (7860) β β
β βββββββββββββββ βββββββββββββββ β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Code Analysis:
"Analyze the complexity of this Python function and suggest improvements"
Security Scan:
"Check this code for potential security vulnerabilities"
File Operations:
"Download and analyze the README from this GitHub repository"
Git Operations:
"What's the current status of this repository and what changes are pending?"
-
Study the examples in
server/
directory -
Create your server:
mkdir server/my_new_server cp server/basic_server/basic_server.py server/my_new_server/my_new_server.py
-
Add to configuration:
"my_new_server": { "name": "My New Server", "port": 7868, "url": "http://127.0.0.1:7868/gradio_api/mcp/sse", "description": "My custom functionality", "path": "server/my_new_server/my_new_server.py" }
-
Implement your tools following the MCP specification
# Quick validation
python run_tests.py validate
# Test all functionality
python run_tests.py all
# Health check servers
python run_tests.py health
- MCP Specification: Model Context Protocol
- MCP Tools: Understanding tool definitions and implementations
- Server Communication: How clients and servers interact
- Smolagents: Multi-agent framework documentation
- Agent Patterns: Specialization, delegation, coordination
- Tool Integration: Connecting agents to external services
- Configuration Management: See CONFIGURATION.md
- Testing Strategies: Comprehensive test suite examples
- Error Handling: Robust error management patterns
- Performance Optimization: Scaling MCP applications
# Install pre-commit hooks
./setup_precommit.sh
# Run quality checks
pre-commit run --all-files
Each server provides interactive docs:
- Basic Server: http://127.0.0.1:7860
- Code Metrics: http://127.0.0.1:7862
- Code Security: http://127.0.0.1:7865
- Code Retrieval: http://127.0.0.1:7866
- Git Server: http://127.0.0.1:7867
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
MIT License - see LICENSE for details.
Built with β€οΈ for the AI community