Multi-Service MCP Platform
Provides a unified MCP interface to multiple utility services including transportation info, mindful sentences, weather forecasts, emoji oracle, timestamps, fortune cookies, and lucky numbers.
README
Multi-Service MCP Platform
A comprehensive Model Context Protocol (MCP) platform that hosts multiple utility services through a unified HTTP-based API structure. The platform provides various services including transportation information, mindful sentences, weather forecasts, emoji oracle, random timestamps, fortune cookies, and lucky numbers.
Features
Platform Features
- Unified API Structure: Access all services through a consistent URL pattern:
http(s)://<domain>/<service>/<version> - Service Registry: Dynamic service discovery and management
- Service Router: Intelligent request routing to appropriate service handlers
- MCP Protocol Support: Full implementation of MCP protocol methods
- Error Handling: Comprehensive error handling with structured error codes
- Configuration Management: Enable/disable services through configuration
- Health Monitoring: Service status reporting and health checks
- CORS Support: Cross-origin resource sharing for web clients
- Landing Page: User-friendly documentation and service showcase
Available Services
- MVG Service (
/mvg/v1): Munich public transport departures and station information - Mindful Service (
/mindful/v1): Daily inspirational mindful sentences with rotation - Weather Service (
/weather/v1): Optimistic weather forecasts with pleasant conditions - Emoji Oracle Service (
/emoji-oracle/v1): Cryptic guidance through symbolic emoji combinations - Timestamp Service (
/timestamp/v1): Random timestamp generation within specified ranges - Fortune Cookie Service (
/fortune/v1): Surreal and cryptic fortune phrases that change hourly - Lucky Numbers Service (
/lucky-numbers/v1): Mystical number generation for various life scenarios
Prerequisites
- Python 3.11+
- FastAPI
- Uvicorn
Setup
There are two ways to set up the environment: using venv or uv.
Using venv (standard library)
-
Create a virtual environment:
python3 -m venv .venv -
Activate the virtual environment:
source .venv/bin/activate # On Windows: .venv\Scripts\activate -
Install the required dependencies:
pip install -r requirements.txt
Using uv
- Initialize the project:
uv init - Create a virtual environment:
uv venv - Activate the virtual environment:
source .venv/bin/activate # On Windows: .venv\Scripts\activate - Install dependencies:
uv pip install -r requirements.txt
Running the Multi-Service Platform
Start the multi-service platform with:
python start_platform.py
This will display detailed information about available services and endpoints before starting the server.
This starts an HTTP server on http://localhost:8003 with the following endpoints:
/mcp- Main MCP protocol endpoint/services/{service_name}/v{version}- Service-specific MCP endpoints/services/{service_name}/v{version}/{method}- Direct service method calls/services- List all available services/services/{service_name}- Get information about a specific service/health- Health check endpoint/- Landing page with service information
Service Architecture
The platform uses a plugin-based architecture with the following components:
- ServiceRegistry: Manages service discovery and instantiation
- ServiceRouter: Routes requests to appropriate services
- BaseService: Abstract base class for all services
- Service Implementations: Individual service classes
Adding New Services
To add a new service:
- Create a new service class that inherits from
BaseService - Implement the required methods (
handle_request,get_tools) - Optionally implement prompts support (
supports_prompts,get_prompts) - Place the service in the
services/directory - The service will be auto-discovered by the platform
Example:
from services.base_service import BaseService
from data.models import ToolResult
class MyCustomService(BaseService):
def __init__(self):
super().__init__(
name="custom",
version="v1",
description="My custom service"
)
def get_tools(self):
return [{
"name": "my_tool",
"description": "My custom tool",
"inputSchema": {
"type": "object",
"properties": {},
"required": []
}
}]
async def handle_request(self, method, params):
if method == "my_tool":
return self._create_text_response("Custom response")
else:
return self._create_error_response(f"Unknown method: {method}")
Service Details
MVG Service
The MVG Service provides real-time information about Munich's public transportation system.
Endpoints
/mvg/v1
Tools
-
get_departures
- Description: Get real-time departures from a Munich public transport station
- Parameters:
station(string, required): Name of the stationlimit(integer, optional): Maximum number of departures to returnoffset(integer, optional): Time offset in minutes
- Example:
{ "station": "Hauptbahnhof", "limit": 5, "offset": 10 }
-
find_station
- Description: Find stations by name or partial name
- Parameters:
query(string, required): Station name or partial namelimit(integer, optional): Maximum number of results to return
- Example:
{ "query": "Marien", "limit": 3 }
Mindful Service
The Mindful Service provides inspirational sentences that rotate throughout the day.
Endpoints
/mindful/v1
Tools
- get_mindful_sentence
- Description: Get an inspirational mindful sentence for the day
- Parameters: None
- Example Response:
"Take a moment to breathe deeply and connect with the present moment."
Features
- Pool of 50+ inspirational sentences
- Daily rotation with 4 different sentences per day
- Consistent sentences within the same day
Weather Service
The Weather Service provides consistently optimistic weather forecasts.
Endpoints
/weather/v1
Tools
- get_weather_forecast
- Description: Get an optimistic weather forecast for tomorrow
- Parameters: None
- Example Response:
"Tomorrow will be a beautiful day with a temperature of 22°C (72°F) and partly cloudy skies. Perfect for outdoor activities!"
Features
- Always predicts pleasant weather conditions
- Temperature ranges between 18-24°C (64-75°F)
- Only sunny or partly cloudy conditions
- No rain, storms, or extreme temperatures
Emoji Oracle Service
The Emoji Oracle Service provides cryptic guidance through emoji combinations.
Endpoints
/emoji-oracle/v1
Tools
- get_emoji_oracle
- Description: Get a cryptic three-emoji combination as guidance
- Parameters: None
- Example Response:
"🌟 🔑 🚪"
Features
- Returns exactly 3 emojis per request
- Draws from a diverse pool of meaningful symbols
- Creates potentially interpretable but cryptic messages
- Different combinations for each request
Timestamp Service
The Timestamp Service generates random timestamps within specified ranges.
Endpoints
/timestamp/v1
Tools
- generate_random_timestamp
- Description: Generate a random timestamp within a specified range
- Parameters:
start_time(string, optional): Start of the time range (ISO 8601 format)end_time(string, optional): End of the time range (ISO 8601 format)
- Example:
{ "start_time": "2025-01-01T00:00:00Z", "end_time": "2025-12-31T23:59:59Z" }
Features
- Generates random timestamps within specified ranges
- Automatically swaps start/end times if start is after end
- Default range is next day between 10:00 and 16:00
- Returns timestamps in ISO 8601 format
Fortune Cookie Service
The Fortune Cookie Service provides surreal and cryptic phrases that change hourly.
Endpoints
/fortune/v1
Tools
- get_fortune_cookie
- Description: Get a surreal, cryptic fortune phrase
- Parameters: None
- Example Response:
"The silent whisper of forgotten dreams echoes in the corridors of possibility."
Features
- Generates surreal, cryptic phrases
- Same phrase returned within the same hour
- New phrase generated each hour
- LLM integration for content generation
- Supports MCP prompts/list method
Lucky Numbers Service
The Lucky Numbers Service generates "statistically blessed" numbers for various life scenarios.
Endpoints
/lucky-numbers/v1
Tools
- generate_blessed_numbers
- Description: Generates mystically optimized numbers for various life scenarios
- Parameters:
scenario(string, required): The scenario for which you need lucky numbers- Options: lottery, decision, restaurant, date, love, career, creativity, health, travel, learning
count(integer, optional): Number of lucky numbers to generate (1-10)min_value(integer, optional): Minimum value for generated numbersmax_value(integer, optional): Maximum value for generated numbersenergy_level(string, optional): Intensity of cosmic energy applied- Options: low, medium, high, extreme
- Example:
{ "scenario": "lottery", "count": 6, "min_value": 1, "max_value": 49, "energy_level": "high" }
Features
- Scenario-specific number generation for 10 different contexts
- Mystical methodology explanations and cosmic alignment calculation
- Customizable parameters (count, range, energy level)
- Formatted responses with emojis and encouraging language
MCP Protocol Support
The platform supports the following MCP methods:
- initialize: Initialize the MCP connection
- tools/list: List available tools across all services
- tools/call: Call a specific tool
- prompts/list: List available prompts (from services that support prompts)
Each service-specific endpoint also supports these methods for that particular service.
API Usage Examples
Using the Main MCP Endpoint
# List all available tools
curl -X POST http://localhost:8003/mcp -H "Content-Type: application/json" -d '{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/list",
"params": {}
}'
# Call a specific tool
curl -X POST http://localhost:8003/mcp -H "Content-Type: application/json" -d '{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/call",
"params": {
"name": "mindful_get_mindful_sentence",
"arguments": {}
}
}'
Using Service-Specific Endpoints
# List tools for a specific service
curl -X POST http://localhost:8003/services/lucky-numbers/v1 -H "Content-Type: application/json" -d '{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/list",
"params": {}
}'
# Call a specific tool on a service
curl -X POST http://localhost:8003/services/lucky-numbers/v1 -H "Content-Type: application/json" -d '{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/call",
"params": {
"name": "generate_blessed_numbers",
"arguments": {
"scenario": "lottery",
"count": 6
}
}
}'
Using Direct Method Calls
# Call a method directly
curl -X POST http://localhost:8003/services/mvg/v1/get_departures -H "Content-Type: application/json" -d '{
"station": "Hauptbahnhof"
}'
# Get a mindful sentence
curl -X POST http://localhost:8003/services/mindful/v1/get_mindful_sentence
Configuration
The platform can be configured using a JSON configuration file or environment variables.
Configuration File (config.json)
{
"server": {
"log_level": "info",
"port": 8003
},
"services": {
"mvg": {
"enabled": true
},
"mindful": {
"enabled": true
},
"weather": {
"enabled": true
},
"emoji-oracle": {
"enabled": true
},
"timestamp": {
"enabled": true
},
"fortune": {
"enabled": true
},
"lucky-numbers": {
"enabled": true
}
}
}
Environment Variables
MCP_CONFIG: Path to configuration file (default:config.json)MCP_LOG_LEVEL: Logging level (default:info)MCP_PORT: Server port (default:8003)MCP_SERVICE_<NAME>_ENABLED: Enable/disable specific services (e.g.,MCP_SERVICE_MVG_ENABLED=true)
Claude Desktop Configuration
Add this to your Claude Desktop configuration file (typically ~/Library/Application Support/Claude/claude_desktop_config.json on macOS):
{
"mcpServers": {
"multi-service-mcp": {
"command": "uv",
"args": [
"run",
"--directory",
"/path/to/your/multi-service-mcp-project",
"python",
"multi_service_server.py"
]
}
}
}
Replace /path/to/your/multi-service-mcp-project with the actual path to your project directory.
Testing
Running Tests
# Run all tests
python -m pytest
# Run specific test categories
python -m pytest tests/unit/
python -m pytest tests/integration/
# Run tests for specific services
python -m pytest tests/unit/services/test_lucky_numbers_service.py
python -m pytest tests/integration/test_mindful_service_integration.py
Test Structure
tests/unit/: Unit tests for individual componentstests/integration/: Integration tests for service interactionstests/performance/: Performance and concurrency tests
MCP Test with Inspector
This command initiates a Model Context Protocol (MCP) test session using the Inspector tool to validate and debug contextual behavior.
npx @modelcontextprotocol/inspector
Docker Support
The project includes a Dockerfile for containerization:
# Build the Docker image
docker build -t multi-service-mcp .
# Run the container
docker run -p 8003:8003 multi-service-mcp
License
This project is licensed under the MIT License - see the LICENSE file for details.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。