Skip to content

manifullstackdeveloper/mcp-server

Repository files navigation

MCP + Spring Boot + Claude + Cursor (POC)

Overview

This Proof of Concept demonstrates an MCP (Model Context Protocol) server implemented with Spring Boot and Spring AI Tools, integrated for use with Claude Desktop and Cursor. The server exposes simple tools around a small in-memory dataset of prime ministers to showcase tool invocation from MCP-compatible clients.

Tech Stack

  • Language: Java 17+
  • Framework: Spring Boot + Spring AI Tools
  • Build: Gradle

Tools Exposed (via Spring AI Tools)

Available to MCP clients once the server is running:

  • get_all_services: List all microservices in the catalog.
  • get_service: Get a microservice by name.
  • search_services: Search by keyword in name, description, or tags.
  • list_dependencies: List direct dependencies for a given name.
  • services_by_status: Filter services by status (e.g., HEALTHY, DEGRADED).

Data model returned by the tools:

  • Microservice { name, owner, description, tags[], dependencies[], repoUrl, environment, status, lastDeployedAt }

Prerequisites

  • JDK 17+
  • macOS/Linux shell
  • Optional: IntelliJ IDEA or Cursor for development

Build and Run (local)

  1. Build JAR
./gradlew clean build
  1. Run as Spring Boot app
./gradlew bootRun

or run the built JAR directly:

java -jar ./build/libs/mcp-0.0.1-SNAPSHOT.jar

Configure Claude Desktop (MCP)

Add or update your Claude Desktop MCP config (on macOS): ~/Library/Application Support/Claude/claude_desktop_config.json

Use a configuration like:

{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem", "/Users/mani/Documents/Workspace/AI_MCP/"]
    },
    "mani-mcp": {
      "command": "java",
      "args": [
        "-jar",
        "/Users/mani/Documents/Workspace/AI_MCP/mcp/build/libs/mcp-0.0.1-SNAPSHOT.jar"
      ]
    }
  }
}

Then restart Claude Desktop. Claude should discover the mani-mcp server and list the tools (get_service, search_services, etc.).

Configure Cursor (MCP)

Cursor supports MCP servers via a JSON config. On macOS, create or edit: ~/Library/Application Support/Cursor/mcp.json

Example:

{
  "mcpServers": {
    "mani-mcp": {
      "command": "java",
      "args": [
        "-jar",
        "/Users/mani/Documents/Workspace/AI_MCP/mcp/build/libs/mcp-0.0.1-SNAPSHOT.jar"
      ]
    }
  }
}

Restart Cursor after saving the file.

How to Try It in Claude/Cursor

  • Ask Claude or Cursor to use the MCP tools, e.g., “Use get_all_services” or “Call get_service with name=foo-service”.
  • You can also try: “Search services with search_services and keyword=payment”, “List dependencies for name=foo-service”, or “Show services by status=HEALTHY”.
  • Tool results will reflect the in-memory microservice catalog initialized at startup.

Project Structure (key parts)

  • src/main/java/com/mani/poc/mcp/McpApplication.java: Spring Boot entry + tool registration
  • src/main/java/com/mani/poc/mcp/service/ServiceCatalogService.java: Tool implementations
  • src/main/java/com/mani/poc/mcp/pojo/Microservice.java: Data model

Testing

Run unit tests and view reports:

./gradlew test
open ./build/reports/tests/test/index.html

Notes

  • This POC focuses on tool exposure through MCP; it intentionally does not expose REST endpoints.
  • Update absolute paths in MCP configs as needed for your environment.

About

MCP in SpringBoot

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages