Spring MCP 桥接器
STDIO将Spring Boot接口转换为MCP服务
将Spring Boot接口转换为MCP服务
Spring MCP Bridge is a tool that automatically converts REST endpoints from Spring Boot applications into an MCP (Message Conversation Protocol) server, allowing AI assistants like Claude, Cursor, and other MCP-compatible tools to directly interact with your APIs.
*It does not currently include authentication. If your Spring Boot API requires authentication, you will need to modify the handler code to include the appropriate headers or tokens.
Integrating existing APIs with AI assistants typically requires manual coding or complex configuration. Spring MCP Bridge eliminates this complexity by automatically scanning your Spring Boot project and generating a ready-to-use MCP server.
# Clone the repository git clone https://github.com/brunosantos/spring-mcp-bridge.git # Enter the directory cd spring-mcp-bridge
python spring_boot_mcp_converter.py --project /path/to/spring-project --output ./mcp_server --name MyAPI
cd mcp_server pip install -r requirements.txt python main.py
http://localhost:8000
http://localhost:8000/.well-known/mcp-schema.json
Argument | Description | Default |
---|---|---|
--project | Path to Spring Boot project | (required) |
--output | Output directory | ./mcp_server |
--name | Application name | SpringAPI |
--debug | Enable debug logging | False |
python spring_mcp_bridge.py --project ~/projects/my-spring-api --output ./mcp_server --name MyAPI
The tool will:
@RestController
, @Controller
)@GetMapping
, @PostMapping
, @PutMapping
, @DeleteMapping
, @PatchMapping
)@RequestParam
)@PathVariable
)@RequestBody
)The generated MCP server can be configured by editing the main.py
file:
# The Spring Boot base URL - modify this to match your target API SPRING_BASE_URL = "http://localhost:8080"
To test the MCP server:
http://localhost:8000/docs
to see the FastAPI documentationhttp://localhost:8000/.well-known/mcp-schema.json
Contributions are welcome! Please feel free to submit a Pull Request.
git checkout -b feature/amazing-feature
)git commit -m 'Add some amazing feature'
)git push origin feature/amazing-feature
)This project is licensed under the MIT License - see the LICENSE file for details.
Bruno Santos