from a specific day • The LLM knows nothing about ◦ Personal information, private data ◦ Company-internal information ◦ What happened since the cut-off date • It can’t just “go out and look for stuff” Challenge 1
to the prompt ◦ E.g. before sending a user question to the LLM, add a section about your internal database schema, so that the LLM knows about it • This is what everybody is doing • Everything else is usually too complicated and error-prone for companies ◦ Train your own models ◦ Fine-tune existing models Prompt stuffing
limited • You can’t just add “everything you know” (all the database schemas of your company, all the manuals, all the weather data from all locations around the globe, etc.) • This might be a very open-ended situation ◦ There might be situations where you need to search the web (for example) What exactly to feed into the prompt?
extra information to the prompt upfront, we tell the LLM what we have to offer, what we “could” do • Then, the LLM decides what it wants and “calls us” • Existed before MCP: “function calling” MCP is basically standardizing how this works Don’t call us, we call you
calling capability on the client side • Allow a separation between ◦ the part that implements a certain functionality (like “query weather data” or “create an issue”) ◦ the AI application that would like to integrate that functionality when using an LLM Model Context Protocol
can be implemented in any language ◦ Runs in a separate (local or remote) process ◦ Can talk to external resources ◦ “Speaks” the protocol Part 1: The MCP Server
usually part of the host application ◦ e.g. an AI application talking to an LLM ◦ an IDE using LLMs for supporting AI coding ◦ Etc. • The client “talks” to the server in a generic way (“speaks the protocol”) ◦ The client is implemented once, not for every server Part 2: The MCP Client
https://github.com/modelcontextprotocol/java-sdk ◦ Java MCP Client ◦ Java MCP Server • Spring AI MCP: https://docs.spring.io/spring-ai/reference/api/mcp/mcp-overview.html ◦ Adds Spring Boot integration • Langchain4j: https://docs.langchain4j.dev/tutorials/mcp Using MCP in an app
wants to execute actions (e.g. add a comment, submit a PR, create ticket) while chatting with the user or running through the flow • What exactly the agent will do, we don’t know (upfront) • We can use MCP for this as well ◦ Don’t call the MCP server to get information ◦ Call the MCP server to do something Agentic systems
(user-driven) • Resources (application-driven) • Sampling • Roots MCP 201: The Protocol in Depth https://www.youtube.com/watch?v=C_nqAWHsldo Other things
machine • MCP servers have access to internal systems / internal data • You might not know where the MCP server is coming from (marketplaces emerge) • This opens the door for a lot of security related topics Security
https://github.com/modelcontextprotocol/servers • Java SDK: https://github.com/modelcontextprotocol/java-sdk • Spring AI MCP: https://docs.spring.io/spring-ai/reference/api/mcp/mcp-overview.html • Spring AI Examples: https://github.com/spring-projects/spring-ai-examples/tree/main/model-context-protocol • Craig Walls: https://github.com/habuma/spring-ai-examples Resources