Integrating with MCP Tools.
The application consumes the Brave Search API.
Visit api.search.brave.com and sign up for a new account. Then, in the Brave Search API console, navigate to Subscriptions and choose a subscription plan. You can choose the "Free AI" plan to get started.
In the Brave Search API console, navigate to API Keys and generate a new API key. Copy and securely store your API key on your machine as an environment variable. The application will use it to access the Brave Search API.
export BRAVE_API_KEY=<YOUR-API-KEY>
The application consumes models from an Ollama inference server. You can either run Ollama locally on your laptop, or rely on the Testcontainers support in Spring Boot to spin up an Ollama service automatically. If you choose the first option, make sure you have Ollama installed and running on your laptop. Either way, Spring AI will take care of pulling the needed Ollama models when the application starts, if they are not available yet on your machine.
If you're using the native Ollama application, run the application as follows.
./gradlew bootRun
If you want to rely on the native Testcontainers support in Spring Boot to spin up an Ollama service at startup time, run the application as follows.
./gradlew bootTestRun
Note
These examples use the httpie CLI to send HTTP requests.
Call the application that will use an MCP Server to retrieve the context to answer your question.
http :8080/chat/mcp question=="Does Spring AI supports a Modular RAG architecture? Please provide some references."