Implement agentic Java app with Quarkus, MCP, LangChain4j, API integrations, testing, packaging, and native build
The Model Context Protocol (MCP) Server leverages Quarkus, a high-performance Java framework, to act as a bridge between AI applications and various data sources or tools. This server adheres to the MCP protocol, providing a standardized interface that enables flexible integration with multiple AI applications such as Claude Desktop, Continue, Cursor, and others. By following the documented protocols, this server ensures seamless communication and data exchange between these AI applications and external resources.
The core features of the Model Context Protocol (MCP) Server include:
.env
files and application.properties
, ensuring that these values are not exposed in public repositories.The architecture of the Model Context Protocol (MCP) Server is designed to facilitate easy integration with various AI applications and external tools. Key components include:
graph TD
A[AI Application] -->|MCP Client Request| B[MCP Protocol]
B --> C[MCP Server]
C --> D[Data Source/Tool]
style A fill:#e1f5fe
style C fill:#f3e5f5
style D fill:#e8f5e8
graph TB
U[MCP Client] -->|Request| S[Model Context Protocol Server]
S --> T[MCP Adapter Layer]
T --> D[Data Source/Tool]
style U fill:#e6f2ff
style S fill:#d8ecf4
style T fill:#cbe5ee
style D fill:#dbf9d3
Prerequisites: Install node
and npm
as they are required to start the necessary MCP services.
Environment Setup: Ensure you have a container environment (like Podman or Docker) for accessing built-in telemetry, or comment out relevant configurations in application.properties
.
Project Directory: Create a directory called playground
at the root folder of your local clone. This is required if using the filesystem
MCP server.
API Keys: Obtain necessary keys from various services:
Bot User OAuth Token
and Team ID
Environment Variables: Create a .env
file in your local clone with API keys, or update them directly in application.properties
.
Example of an .env
file:
quarkus.langchain4j.mcp.bravesearch.environment.BRAVE_API_KEY=<YOUR BRAVE API KEY HERE>
quarkus.langchain4j.mcp.googlemaps.environment.GOOGLE_MAPS_API_KEY=<YOUR GMAPS API KEY HERE>
quarkus.langchain4j.mcp.slack.environment.SLACK_BOT_TOKEN=<YOUR SLACK BOT TOKEN HERE>
quarkus.langchain4j.mcp.slack.environment.SLACK_TEAM_ID=<YOUR SLACK TEAM ID HERE>
quarkus.langchain4j.openai.api-key=<YOUR OPENAI API KEY HERE>
./mvnw compile quarkus:dev
to start the application in development mode.The Model Context Protocol Server supports several key use cases:
Input Prompt:
My name is Daniel Oh. I am a member of a team of 2 myself and James Falkner. I like Italian food, while Daniel is on a strict gluten-free diet.
Please find one good restaurant in Boston, MA with the highest rating that meets the team's dietary needs and preferences. Then, invite the team to a lunch at 12pm next Friday. In your message, include the name and description of the restaurant, the time and date of the lunch, and driving directions from Back Bay, Boston.
System Response:
I found an excellent restaurant for you: Pizzeria Regina at 167 North Street, Boston. It has excellent ratings and offers gluten-free options tailored to your needs. The address is: 167 North St, Boston, MA 02114.
The team will be invited to a lunch meeting at the restaurant on Friday, December 30th, starting at 12 pm. The driving directions from Back Bay are as follows (you can navigate using Google Maps):
- From Back Bay T Station
- Walk about 0.7 miles towards Tremont St
- Turn left onto Tremont St and continue straight.
Please let me know if you need any more assistance.
Input Prompt:
Can you create a calendar event for the restaurant reservation in the "playground/calendar" directory?
System Response:
Event created successfully in playground/calendar:
- Date & Time: Friday, December 30th, 2024, at 12 pm.
- Location: Pizzeria Regina (Boston)
- Description: Team lunch for members of the project.
You can view or edit this event using any calendar app that supports ICS files.
The Model Context Protocol Server is compatible with several MCP clients:
To integrate this server with the Slack client, follow these steps:
Bot User OAuth Token
and Team ID
..env
file or application.properties
as described above.MCP Client | Resources | Tools | Prompts | Status |
---|---|---|---|---|
Claude Desktop | ✅ | ✅ | ✅ | Full Support |
Continue | ✅ | ✅ | ✅ | Full Support |
Cursor | ❌ | ✅ | ❌ | Tools Only |
Here is a sample configuration snippet:
{
"mcpServers": {
"[server-name]": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-[name]"],
"env": {
"API_KEY": "your-api-key"
}
}
}
}
This comprehensive documentation aims to provide a clear and detailed guide for setting up, configuring, and utilizing the Model Context Protocol Server to facilitate seamless integration with AI applications and external tools.
RuinedFooocus is a local AI image generator and chatbot image server for seamless creative control
Simplify MySQL queries with Java-based MysqlMcpServer for easy standard input-output communication
Learn to set up MCP Airflow Database server for efficient database interactions and querying airflow data
Build stunning one-page websites track engagement create QR codes monetize content easily with Acalytica
Explore CoRT MCP server for advanced self-arguing AI with multi-LLM inference and enhanced evaluation methods
Access NASA APIs for space data, images, asteroids, weather, and exoplanets via MCP integration