Havanero/mcp-server
If you are the rightful owner of mcp-server 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 Advanced MCP Server is a sophisticated server designed to handle multiple transport layers, dynamic plugin discovery, and decorator-based tool creation.
greet
Greet someone with style
calculator
Advanced calculations
fibonacci
Calculate Fibonacci numbers
prime_check
Check if number is prime
๐ Advanced MCP Server - Multi-Transport Plugin System
A sophisticated Model Context Protocol (MCP) server with multiple transport layers, dynamic plugin discovery, and decorator-based tool creation.
โจ Features
- ๐ง 3 Transport Options: Stdio, WebSocket, HTTP
- ๐ฏ Decorator Tools:
@tool
,@mcp_tool
,@tool_method
- ๐ฆ Auto Plugin Discovery: Drop files in
tools/
, they work - โก Type-Driven Schemas: JSON schemas from Python type hints
- ๐ Multi-Client Support: WebSocket & HTTP support multiple clients
- ๐ Built-in Web UI: Test tools from your browser
- ๐ก๏ธ Error Isolation: Plugin failures don't crash server
๐ฏ Quick Start
1. Check Setup
cd /home/cubanguy/Projects/ai-framework/mcp-server/file-dir-projects/mcp-server
python3 check_setup.py
2. Install Dependencies (if needed)
pip install -r requirements.txt
3. Choose Your Transport
๐ก Stdio (Development)
python3 server_v2.py
python3 ../mcp-client/cli.py python3 server_v2.py
๐ WebSocket (Production)
python3 server_websocket.py
python3 websocket_client.py
๐ HTTP (REST API)
python3 server_http.py
# Then visit: http://localhost:8080/client
๐ง Creating Tools
Function Tool (Simplest)
# tools/my_tools.py
from tool_decorators import tool
@tool("greet", "Greet someone with style")
async def greet(name: str, style: str = "friendly") -> str:
return f"Hello {name}! ๐" if style == "friendly" else f"Greetings, {name}."
Class Tool (Complex Logic)
from tool_decorators import mcp_tool
@mcp_tool("calculator", "Advanced calculations")
class Calculator:
async def execute(self, operation: str, a: float, b: float) -> ToolResult:
result = ToolResult()
if operation == "add":
result.add_text(f"{a} + {b} = {a + b}")
return result
Method Tools (Multiple Tools)
from tool_decorators import tool_method, MethodToolRegistry
class MathTools:
@tool_method("fibonacci", "Calculate Fibonacci number")
async def fib(self, n: int) -> ToolResult:
# Implementation...
@tool_method("prime_check", "Check if number is prime")
async def is_prime(self, number: int) -> ToolResult:
# Implementation...
# Auto-register
MethodToolRegistry.register_class_methods(MathTools())
That's it! Tools appear automatically, no configuration needed.
๐ Current Tools
Your server includes these example tools:
Traditional Tools
file_ops
- Safe file operations (read/write/list)system_info
- System metrics (disk/memory/CPU)
Decorator Tools
opensearch
- Search regulations documentsdb_health
- Database connection healthcurrent_time
- Get current timestampgreet
- Greet with different stylesfibonacci
- Calculate Fibonacci numbersflip_coin
- Virtual coin flipword_stats
- Analyze text statistics
๐ Transport Comparison
Feature | Stdio | WebSocket | HTTP |
---|---|---|---|
Clients | Single | Multiple | Multiple |
Real-time | โ | โ | โ |
Web Browsers | โ | โ | โ |
REST API | โ | โ | โ |
Setup | Simple | Medium | Simple |
Best For | Development | Production | Integrations |
๐งช Test Examples
Stdio
mcp> list
mcp> call greet {"name": "Developer", "style": "enthusiastic"}
mcp> call fibonacci {"n": 10}
mcp> call opensearch {"query": "GDPR compliance"}
WebSocket
python3 websocket_client.py
# Interactive WebSocket client with real-time communication
HTTP REST
# List tools
curl http://localhost:8080/tools
# Call tool
curl -X POST http://localhost:8080/tools/greet \
-H "Content-Type: application/json" \
-d '{"name": "API User", "style": "formal"}'
# Web interface
open http://localhost:8080/client
๐ Documentation
- - Complete transport guide
- - Tool decorator patterns
- - Plugin system details
๐ What Makes This Special
1. Zero Configuration Tools
Drop a Python file in tools/
โ tool appears automatically
2. Multiple Decorator Patterns
Choose the right pattern for your use case:
@tool
for simple functions@mcp_tool
for complex classes@tool_method
for multiple related tools
3. Transport Flexibility
Same tools work across all transports - choose based on your needs
4. Type Safety
JSON schemas auto-generated from Python type hints
5. Production Ready
- Multi-client support
- Error isolation
- Real-time communication
- Web browser compatibility
๐ Next Steps
- Test the system:
python3 test_transports.py
- Add your tools: Create files in
tools/
directory - Choose transport: Stdio for dev, WebSocket for prod, HTTP for APIs
- Integrate with LLM: Ready for intelligent agent integration
๐ง Architecture
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ MCP Server Core โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Plugin Manager โ
โ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โ
โ โ Traditional โ โ @tool โ โ @tool_method โ โ
โ โ BaseTool โ โ Functions โ โ Classes โ โ
โ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Transport Layer โ
โ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โ
โ โ Stdio โ โ WebSocket โ โ HTTP โ โ
โ โ (Dev/CLI) โ โ (Production)โ โ (REST API) โ โ
โ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
This gives you a complete, production-ready MCP server with the flexibility to grow from simple CLI tools to sophisticated web applications! ๐