andreacomo/mcp-poc
If you are the rightful owner of mcp-poc 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 Maven Multi Module project designed to facilitate communication through STDIO, offering tools for geolocation and weather forecasting.
Model Context Protocol POC
This project aims to play with MCP and Spring AI.
This is a Maven Multi Module project
MCP Server
STDIO based communication implementation. Based on Official walkthrough
The server exposes two tools:
get_city_geolocation: get latitude and longitude from a city nameget_weather_forecast: retrieve weather forecast for the given latitude and longitude. Default is 7 days
How to inspect the server
- build the project:
mvn clean package - Run the inspector (requires Node.js)
npx @modelcontextprotocol/inspector - Go to
http://localhost:6274and set:- Transport Type:
STDIO - Command:
java - Arguments:
-jar /absolute/path/to/mcp-server-1.0.0-SNAPSHOT.jar - Connect
- Transport Type:
Now you can explore the MPC server
How to connect the MCP Server to Claude Desktop
-
Locate the file
claude_desktop_config.json:- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json - Linux not yet supported by Claude Desktop
- macOS:
-
Add a new entry in the
mcpServersobject:{ "mcpServers": { "spring-ai-mcp-weather": { "command": "java", "args": [ "-jar", "/absolute/path/to/mcp-server-1.0.0-SNAPSHOT.jar" ] } } } -
Try to ask Claude "what's the forecast for tomorrow in [your city name]?". Claude will be capable of understand that need to retrieve geo info to give you the answer (using both tools)
Please note that the prompt is bound to Italy cities
MCP Client
The client is basically a command line chat based on OpenAI: thanks to Spring AI and MCP integration, the client connects to the MCP servers defined in and create the clients automatically for each configured server.
Please note that the
claude_desktop_config.jsoncontains absolute paths because is using STDIO communication: this type of communication requires the client to start the server, so the project must me built first!mvn package
The client requires the OpenAI key, provided as env variable
OPENAI_API_KEY.
The client starts and list the available tools, then is ready to chat.