MCP Sample Java Application

by Saularch97

290 downloads
Not rated
GitHub

About

Sample of an MCP server using Spring AI with Java

Details

Author
Saularch97
Downloads
290
Categories
Other

- Minimal Spring Boot MCP server implementation
- Built with Spring AI’s MCP server starter
- Configurable host and port at startup
- Runs as an external MCP server
- Compatible with multiple MCP clients (Cursor, Claude Desktop, VSCode)
- Sample/reference implementation for learning

Clone the repository, build with mvn clean package, then configure your MCP client to launch the server using the generated JAR with optional --port and --host arguments.

MCP Sample Java Application

This is a minimal Spring Boot application implementing an MCP (Model Controller Provider) server using Spring AI.
It is designed to be used as an external MCP server for client applications.

---

πŸš€ Getting Started

1. Clone the Project

    git clone git@github.com:Saularch97/mcp-java-sample.git
    cd openmeteomcp

2. Build the Project

  mvn clean package

The output will be located at target/openmeteomcp-0.0.1-SNAPSHOT.jar

βš™οΈ Client Configuration

To run the server from your client, insert the following configuration:
{
  "mcpServers": {
    "mcpopenmeteo": {
      "command": "java",
      "args": [
        "-jar",
        "<PATH_TO_YOUR_PROJECT>/openmeteomcp/target/openmeteomcp-0.0.1-SNAPSHOT.jar",
        "--port",
        "8080",
        "--host",
        "localhost"
      ]
    }
  }
}
Replace <PATH_TO_YOUR_PROJECT> with the actual path to your project directory.

πŸ“¦ Project Dependencies

The project depends on the following Spring AI starter module:

<dependencies>
<dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-starter-mcp-server-webmvc</artifactId>
</dependency>
</dependencies>

🧰 Requirements


- Java 21
- Maven 3.8+

To use the project just connect with an client, Cursor, ClaudeDesktop, Vscode etc.

img.png

No reviews yet β€” be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.