MCP Host Project
Showcases how to integrate Spring AI's support for MCP (Model Context Protocol) within Spring Boot applications, covering both server-side and client-side implementations.
Overview
The MCP Host Project showcases how to integrate Spring AI's support for the Model Context Protocol (MCP) within Spring Boot applications, covering both server-side and client-side implementations.
To use the MCP Host Project, start the Geocoder Service, Timezone Service, and MCP Host application. Then, interact with the MCP Host via the console by entering city names to receive geographical information.
- Integration of MCP for managing contextual interactions in AI models. - Provides latitude and longitude for cities through the Geocoder Service. - Offers timezone information based on geographical coordinates via the Timezone Service. - Console interface for user interaction with an AI model.
- Finding geographical coordinates for cities.
- Determining timezone information based on location.
- Enhancing AI model capabilities with contextual data.
Add to your AI client
Use these steps to connect MCP Host Project in Cursor, Claude, VS Code, and other MCP-compatible apps. The same JSON appears in the Use with menu above for one-click copy.
Cursor
Add this to your .cursor/mcp.json file in your project root, then restart Cursor.
.cursor/mcp.json
{
"mcpServers": {
"spring-ai-mcp-test-oalles": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-spring-ai-mcp-test-oalles"
]
}
}
}Claude Desktop
Add this server entry to the mcpServers object in your Claude Desktop config, then restart the app.
~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows)
{
"mcpServers": {
"spring-ai-mcp-test-oalles": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-spring-ai-mcp-test-oalles"
]
}
}
}Claude Code
Add this to your project's .mcp.json file. Claude Code will detect it automatically.
.mcp.json (project root)
{
"mcpServers": {
"spring-ai-mcp-test-oalles": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-spring-ai-mcp-test-oalles"
]
}
}
}VS Code (Copilot)
Add this to your .vscode/mcp.json file. Requires the GitHub Copilot extension with MCP support enabled.
.vscode/mcp.json
{
"servers": {
"spring-ai-mcp-test-oalles": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-spring-ai-mcp-test-oalles"
]
}
}
}Windsurf
Add this to your Windsurf MCP config file, then restart Windsurf.
~/.codeium/windsurf/mcp_config.json
{
"mcpServers": {
"spring-ai-mcp-test-oalles": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-spring-ai-mcp-test-oalles"
]
}
}
}Cline
Open Cline settings, navigate to MCP Servers, and add this server configuration.
Cline MCP Settings (via UI)
{
"mcpServers": {
"spring-ai-mcp-test-oalles": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-spring-ai-mcp-test-oalles"
]
}
}
}FAQ
What is MCP?
MCP is a standard that streamlines the management of contextual interactions in AI models, enabling consistent integration with external data sources and tools.
How do I run the project?
Start each service (Geocoder, Timezone, and MCP Host) using Maven commands in their respective directories.
What technologies are used?
The project is built using Java and Spring Boot.