Manages secure API key configuration via environment variables stored in .env files
Provides file system operations including reading, writing, and listing directory contents through the File Agent
Connects to a local Ollama server to provide chat and text generation capabilities with local large language models
Enables chat completion and text analysis using OpenAI's GPT models through the OpenAI Agent
Offers a modern web UI for interactive usage of all available tools with real-time tool discovery and response display
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
Quick Start
Prerequisites
Python 3.11+
Virtual environment support
Installation
Configuration
Create a .env
file with your API keys (all optional):
Running the Server
For Claude Desktop (MCP Protocol)
Add to your Claude Desktop config (claude_desktop_config.json
):
For Web Interface (HTTP + Streamlit)
Access the web interface at: http://localhost:8501
Testing Your Setup
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)
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 usageClaude Desktop: Direct MCP protocol integration
Agent Registration Flow
Development
Project Structure
Adding New Agents
For a complete step-by-step guide on adding new agents, see ADDING_NEW_AGENTS.md.
Quick Overview:
Create agent file in
agents/
inheriting fromBaseAgent
Implement
get_tools()
andhandle_tool_call()
methodsRegister 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 schemaAdd handler method in agent's
handle_tool_call()
methodTest the new tool functionality
Update documentation
Example:
Troubleshooting
Common Issues
Agent Not Available: Check API keys and service connectivity
# Test agent registration python test_quick.pyClaude 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.pyOpenAI Errors: Check API key and quota
# Test OpenAI directly python openai_test.pyOllama Not Working: Verify Ollama server is running
# Check Ollama status curl http://localhost:11434/api/tags
Debug Mode
Enable detailed logging:
Health Checks
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 agent development guide
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.
This server cannot be installed
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
A Model Context Protocol implementation with a modular architecture that exposes capabilities through specialized agents, enabling seamless integration with Claude Desktop and web applications.
Related MCP Servers
- -securityFlicense-qualityA comprehensive suite of Model Context Protocol servers designed to extend AI agent Claude's capabilities with integrations for knowledge management, reasoning, advanced search, news access, and workspace tools.Last updated -5
- TypeScriptMozilla Public License 2.0
- AsecurityFlicenseAqualityA Model Context Protocol server that allows integration with Claude Desktop by creating and managing custom tools that can be executed through the MCP framework.Last updated -22