spring-ai-mcp-client
ogulcanarbc/spring-ai-mcp-client · 45 stars · Java
MCP server mcp client application that utilizes spring ai. it integrates with mcp protocol-supported servers to enable ai-powered chat interactions.
Install
The repo has no one-line install. Follow its README.
Files
spring-ai-mcp-client
The Model Context Protocol (MCP) client application utilizes Spring AI and Anthropic Claude models (Or OpenAI). It integrates with MCP protocol-supported servers to enable AI-powered chat interactions.
What is Spring MCP Client
The MCP Client is a key component in the Model Context Protocol (MCP) architecture, responsible for establishing and managing connections with MCP servers. It implements the client-side of the protocol, handling:
- Protocol version negotiation to ensure compatibility with servers
- Capability negotiation to determine available features
- Message transport and JSON-RPC communication
- Tool discovery and execution
- Resource access and management
- Prompt system interactions
- Optional features like roots management and sampling support
- Supports openai and anthropic models
Requirements
Java 17+
Maven or Gradle
Docker (Optional)
Anthropic API key Or OpenAI API key
- Anthropic API key from the Anthropic Console.
- OpenAI API key from the OpenAI Console.
Installation
1. Clone Repository
git clone <repo-url>
cd spring-ai-mcp-client
2. MCP Server Configuration
The MCP server information must be added to the mcp-servers.json file as follows.
{
"mcpServers":{
"any-mcp-server":{
"command":"node",
"args":[
"any-mcp-server/build/index.js"
]
}
}
}
3. Spring Configuration
The application.yml file should be configured as follows:
spring:
ai:
mcp:
client:
enabled: true
name: any-mcp-server # MCP server name
version: 1.0.0
type: SYNC
request-timeout: 20s
stdio:
root-change-notification: true
servers-configuration: classpath:mcp-servers.json # MCP server config such/same as claude desktop configs.
anthropic:
api-key: ${ANTHROPIC_API_KEY}
# openai:
# api-key: ${OPENAI_API_KEY}
server:
port: 8081
4. Run Applicaton
mvn clean install
mvn spring-boot:run
Usage
Once the application is running, it can be accessed via the following endpoint:
You can start a chat with the following cURL command:
curl -X GET "http://localhost:8081/ai?message=Hello" -H "Accept: application/json"
Facts
- Kind
- MCP server
- Group
- Uncategorized
- Stars
- 45
- Language
- Java
- Last push
- 2025-02-26
- Forks
- 2
- Topics
- anthropic-claude, mcp, mcp-client, spring-ai, ai
- 1REAio.github.morluto/reaReverse engineer anything from your terminal or agent with one CLI and MCP server.125.3k
- 2com.browser-use/browser-usecom.browser-use/browser-useControl a real Chrome browser to complete any task: fill forms, extract data, book flights.117.7k
- 3World Monitorapp.worldmonitor/mcpLive markets, conflicts, country risk, chokepoints, energy, and China decision signals. 93 tools.88.3k
- 4Scrapling MCP Serverd4vinci/scrapling🕷️ An adaptive Web Scraping framework that handles everything from a single request to a full-scale crawl! Don't be shy, join here: https://discord.gg/EMgGbDceNQ and follow here for daily tips and tricks: https://x.com/Scraplingdev86.9k
- 5Everythingmodelcontextprotocol/serversThis MCP server attempts to exercise all the features of the MCP protocol. It is not intended to be a useful server, but rather a test server for builders of MCP clients. It implements prompts, tools, resources, sampling, and more to showcase MCP capabilities.85.8k
- 6Fetchmodelcontextprotocol/serversA Model Context Protocol server that provides web content fetching capabilities. This server enables LLMs to retrieve and process content from web pages, converting HTML to markdown for easier consumption.85.8k