mcp
MCP server from davidchanit/mcp-server
claude mcp add --transport stdio davidchanit-mcp-server docker run -p 8090:8090 mcp-server
How to use
This MCP server implements a Spring AI-based MCP server over HTTP using JSON-RPC. It exposes a set of tools divided into Calculator tools (calculate, add, subtract, multiply, divide) and Game tools (rockPaperScissors, playRockPaperScissors, getRandomChoice). The server supports both HTTP transport for direct JSON-RPC requests and an SSE transport for streaming updates, enabling real-time interactions in compatible clients. To test, send a POST request to the MCP endpoint with a JSON-RPC payload calling a tool, for example the ping method or one of the calculator tools, and you should receive a standard JSON-RPC response. Cursor IDE users can connect the MCP client to the HTTP endpoint to discover and invoke available tools automatically.
How to install
Prerequisites: Docker installed on your machine (Docker Desktop on Windows/macOS, or Docker Engine on Linux). Optionally, Java and Maven are useful if you want to build locally, but this server is containerized for easy deployment.
Step 1: Install Docker
- Follow the official installation guide for your OS: https://docs.docker.com/get-docker/
Step 2: Run the MCP server with Docker
- Build the image (if you haven’t already): mvn clean package -DskipTests docker build -t mcp-server .
- Run the container (exposes port 8090): docker run -p 8090:8090 mcp-server
Step 3: Verify the server is running
- Test the HTTP JSON-RPC endpoint:
curl -X POST http://localhost:8090/api/v1/mpc
-H "Content-Type: application/json"
-d '{"jsonrpc": "2.0", "id": 1, "method": "ping", "params": {}}'
Step 4 (Optional): Using Maven locally (if you prefer running directly from JAR)
- Build the JAR: mvn clean package -DskipTests
- Run the JAR (prod profile): java -jar target/mcp-server-0.0.1-SNAPSHOT.jar --spring.profiles.active=prod
- Ensure port 8090 is accessible for HTTP requests.
Additional notes
Tips and common issues:
- If the port is in use, modify the published port in Docker run (-p 8090:8090) or adjust application.yml before building.
- When Tools do not appear in Cursor, ensure the Java services are annotated with @Service and @Tool annotations as described in the docs.
- For production deployments, use the prod Spring profile and consider mounting configuration via environment variables or a config map if using Kubernetes.
- The server supports both HTTP and SSE transports; use the HTTP endpoint for single requests and the SSE stream for real-time updates.
- If you’re using Docker, ensure the image name matches the one used during docker build, and that the container exposes port 8090 to the host.