adamsalah13/mcp_server_full
If you are the rightful owner of mcp_server_full and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
The MCP Agentic Server is a modular implementation of the Model Context Protocol (MCP), designed to orchestrate multiple agents and tool handlers.
File Tool
Handles file operations and management.
Vector Tool
Manages vector data and operations.
Graph Tool
Facilitates graph-based data handling and processing.
Pure Agentic MCP Server
A pure implementation of the Model Context Protocol (MCP) following an agentic architecture where all features are exposed as MCP tools through specialized agents.
Features
- š¤ Pure Agentic Architecture: All capabilities (OpenAI, Ollama, File operations) are implemented as agents
- š Dual Access Modes: MCP protocol for Claude Desktop + HTTP endpoints for web/Streamlit UI
- ā” Dynamic Tool Registry: Agents register their tools automatically at startup
- š§ Modular Design: Add new agents easily without modifying core server code
- š± Clean Web UI: Modern Streamlit interface for interactive tool usage
- š”ļø Graceful Degradation: Agents fail independently without affecting the system
- š Environment-Based Config: Secure API key management via environment variables
Architecture Overview
The server implements a pure agentic pattern where:
- Agents encapsulate specific functionality (OpenAI API, Ollama, file operations)
- Registry manages dynamic tool registration and routing
- MCP Server provides JSON-RPC protocol compliance for Claude Desktop
- HTTP Host exposes tools via REST API for web interfaces
- Streamlit UI provides user-friendly web access to all tools
Claude Desktop āā MCP Protocol āā Pure MCP Server āā Agent Registry āā Agents
ā
Web Browser āā HTTP API āā Simple MCP Host āā Agent Registry āā Agents
Quick Start
Prerequisites
- Python 3.11+
- Virtual environment support
Installation
git clone <repo-url>
cd mcp_server_full
# Create and activate virtual environment
python -m venv .venv
# Windows
.venv\Scripts\activate
# Linux/Mac
source .venv/bin/activate
# Install dependencies
pip install --upgrade pip
pip install -r requirements.txt
Configuration
Create a .env
file with your API keys (all optional):
# OpenAI Agent (optional)
OPENAI_API_KEY=your_openai_api_key_here
# Ollama Agent (optional, uses local Ollama server)
OLLAMA_BASE_URL=http://localhost:11434
OLLAMA_MODEL=llama3.2
# File Agent (enabled by default, no config needed)
# Provides file reading, writing, and listing capabilities
Running the Server
For Claude Desktop (MCP Protocol)
# Start the pure MCP server for Claude Desktop
python run_mcp_server.py
Add to your Claude Desktop config (claude_desktop_config.json
):
{
"mcpServers": {
"agentic-mcp": {
"command": "python",
"args": ["run_mcp_server.py"],
"cwd": "d:\\AI Lab\\MCP research\\mcp_server_full"
}
}
}
For Web Interface (HTTP + Streamlit)
# Terminal 1: Start HTTP host for tools
python simple_mcp_host.py
# Terminal 2: Start Streamlit UI
streamlit run streamlit_app.py
Access the web interface at: http://localhost:8501
Testing Your Setup
# Test agent registration and tool availability
python test_quick.py
# Test specific agents
python test_both.py
# Validate server functionality
python validate_server.py
Available Agents & Tools
š¤ OpenAI Agent
Status: Available with API key
Tools:
openai_chat
: Chat completion with GPT modelsopenai_analysis
: Text analysis and insights
Setup: Add OPENAI_API_KEY
to .env
file
š¦ Ollama Agent
Status: Available with local Ollama server
Tools:
ollama_chat
: Chat with local Ollama modelsollama_generate
: Text generation
Setup: Install and run Ollama locally, configure OLLAMA_BASE_URL
and OLLAMA_MODEL
š File Agent
Status: Always available
Tools:
file_read
: Read file contentsfile_write
: Write content to filesfile_list
: List directory contents
Setup: No configuration needed
API Usage
MCP Protocol (Claude Desktop)
Tools are automatically available in Claude Desktop once the server is configured. Ask Claude to:
- "Read the contents of file.txt"
- "Generate text using Ollama"
- "Analyze this text with OpenAI"
HTTP API (Web/Streamlit)
# List available tools
curl http://localhost:8000/tools
# Call a specific tool
curl -X POST http://localhost:8000/tools/call \
-H "Content-Type: application/json" \
-d '{
"tool_name": "file_read",
"arguments": {
"file_path": "example.txt"
}
}'
Architecture
Core Components
pure_mcp_server.py
: Main MCP JSON-RPC server for Claude Desktop integrationsimple_mcp_host.py
: HTTP wrapper that exposes MCP tools via REST APIregistry.py
: Dynamic agent and tool registration systemrun_mcp_server.py
: Entry point script for Claude Desktop configurationconfig.py
: Environment-based configuration managementprotocol.py
: MCP protocol models and types
Agents
agents/base.py
: Base agent interface that all agents implementagents/openai_agent.py
: OpenAI API integration agentagents/ollama_agent.py
: Local Ollama model integration agentagents/file_agent.py
: File system operations agent
User Interfaces
streamlit_app.py
: Modern web UI for interactive tool usage- Claude Desktop: Direct MCP protocol integration
Agent Registration Flow
# Each agent registers its tools dynamically
class YourAgent(BaseAgent):
def get_tools(self) -> Dict[str, Any]:
return {
"your_tool": {
"description": "What your tool does",
"inputSchema": {...}
}
}
async def handle_tool_call(self, tool_name: str, params: Dict[str, Any]) -> Any:
# Handle the tool call
pass
# Registry automatically discovers and routes tools
registry.register_agent("your_agent", YourAgent(config))
Development
Project Structure
mcp_server_full/
āāā agents/ # Agent implementations
ā āāā base.py # Base agent interface
ā āāā openai_agent.py # OpenAI integration
ā āāā ollama_agent.py # Ollama integration
ā āāā file_agent.py # File operations
āāā pure_mcp_server.py # Main MCP server for Claude Desktop
āāā simple_mcp_host.py # HTTP host for web interfaces
āāā registry.py # Dynamic tool registration
āāā run_mcp_server.py # Claude Desktop entry point
āāā streamlit_app.py # Web UI
āāā config.py # Configuration management
āāā protocol.py # MCP protocol models
āāā requirements.txt # Dependencies
āāā .env # Environment variables (create this)
āāā ADDING_NEW_AGENTS.md # Detailed agent development guide
āāā README.md # This file
Adding New Agents
For a complete step-by-step guide on adding new agents, see .
Quick Overview:
- Create agent file in
agents/
inheriting fromBaseAgent
- Implement
get_tools()
andhandle_tool_call()
methods - Register agent in both
pure_mcp_server.py
andsimple_mcp_host.py
- Add configuration and test your agent
The guide includes complete code examples, best practices, and troubleshooting tips.
Adding New Tools
To add new tools to existing agents:
- Edit the agent's
get_tools()
method to define new tool schema - Add handler method in agent's
handle_tool_call()
method - Test the new tool functionality
- Update documentation
Example:
# In your agent
def get_tools(self):
return {
"new_tool": {
"description": "Description of new tool",
"inputSchema": {
"type": "object",
"properties": {
"param": {"type": "string", "description": "Parameter description"}
},
"required": ["param"]
}
}
}
async def handle_tool_call(self, tool_name: str, params: Dict[str, Any]) -> Any:
if tool_name == "new_tool":
return await self._handle_new_tool(params)
Troubleshooting
Common Issues
-
Agent Not Available: Check API keys and service connectivity
# Test agent registration python test_quick.py
-
Claude Desktop Not Connecting: Verify config path and entry point
# Check claude_desktop_config.json { "mcpServers": { "agentic-mcp": { "command": "python", "args": ["run_mcp_server.py"], "cwd": "d:\\AI Lab\\MCP research\\mcp_server_full" } } }
-
Streamlit UI Issues: Ensure HTTP host is running
# Start HTTP host first python simple_mcp_host.py # Then start Streamlit streamlit run streamlit_app.py
-
OpenAI Errors: Check API key and quota
# Test OpenAI directly python openai_test.py
-
Ollama Not Working: Verify Ollama server is running
# Check Ollama status curl http://localhost:11434/api/tags
Debug Mode
Enable detailed logging:
# Set environment variable
export LOG_LEVEL=DEBUG
python run_mcp_server.py
Health Checks
# Check HTTP API health
curl http://localhost:8000/health
# List registered tools
curl http://localhost:8000/tools
# Test tool call
curl -X POST http://localhost:8000/tools/call \
-H "Content-Type: application/json" \
-d '{"tool_name": "file_list", "arguments": {"directory_path": "."}}'
Dependencies
Core Runtime
- pydantic: Configuration and data validation
- asyncio: Async operation support
- httpx: HTTP client for external APIs
- aiofiles: Async file operations
Agent-Specific
- openai: OpenAI API client (for OpenAI agent)
- ollama: Ollama API client (for Ollama agent)
Web Interface
- streamlit: Modern web UI framework
- requests: HTTP requests for Streamlit
Development & Testing
- pytest: Testing framework
- logging: Debug and monitoring
All dependencies are automatically installed via requirements.txt
.
Contributing
- Fork the repository
- Create a feature branch:
git checkout -b feature/your-feature
- Add your agent following the
- Test your changes:
python test_quick.py
- Submit a pull request
Agent Development Workflow
- Plan: Define what tools your agent will provide
- Implement: Create agent class inheriting from
BaseAgent
- Register: Add agent registration to both server files
- Test: Verify agent works in both MCP and HTTP modes
- Document: Update README and create usage examples
License
MIT
Streamlit Web Interface
The Streamlit app provides an intuitive web interface for all MCP tools.
Features
- š§ Real-time Tool Discovery: Automatically displays all available tools from registered agents
- š¬ Interactive Interface: Easy-to-use forms for tool parameters
- š Response Display: Formatted display of tool results
- ļæ½ Agent Status: Real-time monitoring of agent availability
- āļø Configuration: Environment-based setup with clear status indicators
Usage
- Start the backend:
python simple_mcp_host.py
- Launch Streamlit:
streamlit run streamlit_app.py
- Open browser: Navigate to http://localhost:8501
- Select tools: Choose from available agent tools
- Execute: Fill parameters and run tools interactively
Tool Integration
The Streamlit UI automatically discovers and creates forms for any tools registered by agents, making it easy to test and use new functionality as agents are added.