Get the FREE Ultimate OpenClaw Setup Guide →

spring-boot-ai-mongo

A Spring Boot AI-powered Model Context Protocol Server for interacting with MongoDB

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio bootcamptoprod-spring-boot-ai-mongo-mcp-server java -jar spring-boot-ai-mongo-server.jar \
  --env MONGO_URI="mongodb://localhost:27017/mydb"

How to use

This MCP server is a MongoDB-backed service built with Spring Boot AI. It exposes a collection of database operations as callable tools through the MCP framework by annotating methods with @Tool and registering them via ToolCallbackProvider. To interact with it, start the server with the provided command and connect an MCP client (such as the Claude desktop app) to call the available tools. The tools perform typical MongoDB operations (e.g., find, insert, update, delete) and are surfaced as discrete callable endpoints that MCP clients can invoke in a structured, model-driven way. When connected, you’ll be able to browse or invoke the registered tools and pass the required parameters just like other MCP tools, receiving results back from the server.

How to install

Prerequisites:

  • Java (JDK 17 or newer) installed and available on PATH
  • MongoDB running locally (default URI mongodb://localhost:27017/mydb or your configured URI)
  • Build tooling (Maven or Gradle) to compile the Spring Boot application

Steps:

  1. Clone the repository containing the Spring Boot AI Mongo MCP Server.
  2. Ensure MongoDB is running locally or adjust the connection URI in the environment (see mcp_config.env for placeholder usage).
  3. Build the project (examples):
    • If using Maven: mvn clean package
    • If using Gradle: ./gradlew build
  4. Run the server:
    • java -jar spring-boot-ai-mongo-server.jar
  5. Verify the server starts and is listening on the expected port (default Spring Boot port 8080) and then connect your MCP client to the server.

Additional notes

Notes and tips:

  • The server exposes MongoDB operations as tools via @Tool annotations; ensure your methods are properly annotated and registered with ToolCallbackProvider.
  • If you need to change the MongoDB connection, set MONGO_URI in the environment or configure Spring properties (e.g., spring.data.mongodb.uri) as needed.
  • If the MCP client cannot discover tools, check that the ToolCallbackProvider is correctly initialized at startup and that the server logs indicate tool registration success.
  • Ensure MongoDB user permissions and network access allow the Spring Boot service to connect from your runtime environment.
  • For troubleshooting, review application logs for any issues related to MongoDB connectivity, tool registration, or MCP client compatibility.

Related MCP Servers

Sponsor this space

Reach thousands of developers