MCP Server
A lightweight Java-based implementation of the Model Context Protocol (MCP) server with support for both JSON-RPC and SSE transports.
Features
- Dual Protocol Support: JSON-RPC (POST) and Server-Sent Events (GET)
- Plugin System: Load tools dynamically from JSON configurations
- Built-in Tools: Calculator, web search, file operations, and more
- Lightweight: Minimal dependencies (~415 lines of code)
Requirements
- Java 17 or higher
- Maven 3.6+
Build```bash
mvn clean package
## Run```bash
java -jar target/mcp-server-1.0-jar-with-dependencies.jar
The server will start on http://0.0.0.0:8080:
- POST
http://127.0.0.1:8080/mcp(JSON-RPC) - GET
http://127.0.0.1:8080/mcp(SSE)
Adding Tools
Create a JSON file in the tools/ directory:json
{
"name": "my-tool",
"description": "My custom tool",
"type": "command",
"command": "python tools/my-tool.py",
"inputSchema": {
"type": "object",
"properties": {
"param": { "type": "string" }
},
"required": ["param"]
}
}
License
MIT License - see LICENSE for details
