Model Context Protocol (MCP) Gateway - A tool management and execution service.
MCP Gateway provides a central service for registering, discovering, and executing various tools. It acts as a gateway between applications and specialized tools, offering a standardized interface for tool execution.
- Tool discovery and registration
- Standardized tool execution interface
- Support for multiple tool types:
- Calculator for mathematical operations
- Text analyzer for text processing
- Weather forecast for retrieving weather information
The MCP Gateway follows a modular architecture:
- Tools Registry: Central repository of all available tools
- Tool Handlers: Implementations for specific tool functionalities
- Protocol Layer: REST API for tool discovery and execution
mvn clean package
java -jar target/mcp-gateway-0.0.1-SNAPSHOT.jarThe gateway will start on port 8080 by default.
- GET
/mcp/api/tools- List all available tools - GET
/mcp/api/tools/{toolName}- Get details about a specific tool - POST
/mcp/api/tools/{toolName}/execute- Execute a specific tool
- GET
/mcp/api/health- Check gateway health
curl -X GET http://localhost:8080/mcp/api/toolscurl -X POST http://localhost:8080/mcp/api/tools/calculator/execute \
-H "Content-Type: application/json" \
-d '{"operation": "add", "a": 10, "b": 5}'Configuration options in application.properties:
# Server Configuration
server.port=8080
server.servlet.context-path=/mcp/api
# Logging Configuration
logging.level.com.mcp.mcpgateway=DEBUGTo add a new tool to the gateway:
- Create a new implementation of the
ToolHandlerinterface - Register the tool handler as a Spring component
- The tool will be automatically discovered and made available via the API