SpringMcpServer

StuartRB/SpringMcpServer

3.1

If you are the rightful owner of SpringMcpServer and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

The Model Context Protocol (MCP) server is a framework that allows developers to expose existing REST endpoints to agentic clients using the Spring AI Starter MCP.

Sample Spring RestController with MCP server conversion

Using Spring AI Starter MCP to expose existing REST endpoints to agentic clients

Steps

  1. Import dependency org.springframework.ai:spring-ai-starter-mcp-server-webmvc
  2. Annotate GetMappings with
@Tool(description="this is a tool")
  1. Create MCPconfig class to register the controller
  2. Add configuration
  spring:
    ai:
    mcp:
      server:
        name: webmvc-mcp-server
        sse-message-endpoint: /mcp/messages
        type: SYNC
        version: 1.0.0

Test with MCP Inspector

npx @modelcontextprotocol/inspector

OR

git clone https://github.com/modelcontextprotocol/inspector.git
cd inspector
npm install
npm run dev

When launched (usually http://localhost:6274/):

  • Transport Type: SSE
  • URL http://localhost:8080/sse
  • Connection type: Via Proxy
  • Click Connect
  • Once connected, select Tools on top menu and then List Tools
  • Select required tool and click Run Tool