Scrivio Interview library
ConceptFoundations5 min read · updated 12 November 2026

What is the Model Context Protocol (MCP)? Explain servers, clients, tools, resources and prompts, and the transports a Java MCP server can use.

The Model Context Protocol is an open protocol, built on JSON-RPC, that lets AI applications, called hosts, use MCP clients to discover and call capabilities offered by MCP servers. A server exposes tools, which are functions the model can call, resources, which are data the application can read by URI, and prompts, which are reusable templates. A Java MCP server can talk over stdio when it runs as a local process, or over HTTP using the Streamable HTTP transport, which replaced the older HTTP plus SSE transport; the official MCP Java SDK and Spring AI's MCP starters make both easy.

Why this question is asked

Before MCP, every AI application had its own way of connecting to tools: a plugin format here, a function definition there. A company with five AI assistants and ten internal systems could need fifty integrations. MCP addresses that by defining one protocol, so a system is wrapped once as an MCP server and any MCP-capable assistant can use it. Interviewers ask this concept question because MCP appears in more and more AI platform work and the vocabulary is easy to confuse. In this answer, we will recap the roles, look at the three kinds of capabilities with examples, see what the messages look like, cover the transports and the Java options, and end with why the protocol saves effort.

1A Quick Recap: Hosts, Clients and Servers

The host is the AI application the user works with, such as a chat assistant, an IDE with an AI feature or an internal agent service. Inside the host, an MCP client manages the connection to one MCP server. The server is a program that offers capabilities from some system, for example a ticketing system or a file store. So a host connected to three servers has three clients, one per connection.

The protocol is based on JSON-RPC 2.0, a simple standard for remote procedure calls in which each message is a JSON object with a method name, parameters and an id that matches a response to its request. When a connection starts, client and server exchange an initialize message in which each states the protocol version and the capabilities it supports.

Step throughWho is who in MCP
  1. Hostthe AI application, for example an assistant
  2. MCP clientsone per server connection, inside the host
  3. Transportstdio or Streamable HTTP, JSON-RPC messages
  4. MCP serverswrap a system: tickets, files, a database API
  5. Systemsthe real services and data behind each server

5 layers, from the top down. Step through them one at a time.

2Tools, Resources and Prompts

A server can offer three kinds of capabilities. Tools are functions the model can decide to call, such as searchTickets(query, status) or createTicket(title). Each tool has a name, a description and a JSON schema for its input, which the host passes on to the model. Resources are pieces of readable data addressed by a URI, such as tickets://TCK-1024 or file:///reports/q3.md; the host application decides when to read them and include them as context. Prompts are reusable prompt templates with parameters, such as a 'summarise ticket' template, that the user can pick in the host's interface.

The difference is who is in control. Tools are chosen by the model, resources are chosen by the application, and prompts are usually chosen by the user. Keeping this in mind helps us decide what to expose as which.

The three server capabilities
CapabilityWhat it isWho decides to use itExample
Toolcallable function with a JSON schemathe modelsearchTickets(query, status)
Resourcereadable data addressed by URIthe host applicationtickets://TCK-1024
Promptreusable template with argumentsusually the usersummarise-ticket(id)

3What the Messages Look Like

Discovery and calls are ordinary JSON-RPC requests. The client asks for the list of tools, then calls one.

Java
// client -> server
{"jsonrpc": "2.0", "id": 1, "method": "tools/list"}
// server -> client: [{"name": "searchTickets", "description": "...", "inputSchema": {...}}]
// client -> server
{"jsonrpc": "2.0", "id": 2, "method": "tools/call",
"params": {"name": "searchTickets", "arguments": {"query": "login error", "status": "OPEN"}}}
// server -> client: {"content": [{"type": "text", "text": "TCK-1024 Login fails for SSO users"}]}

Resources and prompts follow the same pattern with methods such as resources/list, resources/read, prompts/list and prompts/get. Servers can also send notifications, for example that their list of tools changed, so clients refresh their copy.

4Transports for a Java Server

The transport is how these JSON messages travel. With stdio, the host starts the server as a local child process and they exchange messages through standard input and output. It is simple and needs no network, which suits developer tools running on a laptop. For servers shared over a network, the specification defines Streamable HTTP: the client sends JSON-RPC messages with HTTP POST to one endpoint, and the server can answer with plain JSON or open a server-sent events stream when it needs to send several messages. Streamable HTTP replaced the earlier HTTP plus SSE transport in the 2025 versions of the specification, though some clients and servers still support the old one; check your version.

In Java, the official MCP Java SDK implements the protocol, with client and server APIs and transports. Spring AI builds on it with Spring Boot starters for MCP servers, in WebMVC and WebFlux variants, and for MCP clients, so a Spring application can expose its @Tool methods as an MCP server or use remote MCP tools in a ChatClient.

5Why One Protocol Saves So Much Effort

The benefit is arithmetic. Without a shared protocol, connecting M AI applications to N systems can need M times N custom integrations. With MCP, each system gets one server and each application one client implementation, so the work is closer to M plus N. When a new assistant arrives, it can use every existing server on day one. That is also why MCP needs care: it makes connecting powerful tools very easy, so authentication, permissions and review of which servers are allowed matter a great deal.

6Follow-up questions

Is MCP only for tools?

No. Tools get the most attention, but resources and prompts are part of the protocol, and the specification also has client features such as sampling, where a server asks the host's model to generate text, and elicitation, where a server asks the user for input. Support for these varies between hosts.

How does a remote MCP server handle authentication?

The specification defines an authorization flow based on OAuth, in which the MCP server acts as a protected resource and clients obtain access tokens from an authorization server. Inside a company, this usually means the server validates bearer tokens from the corporate identity provider.

How is MCP different from just calling a REST API as a tool?

A REST API needs a custom tool wrapper in every AI application. MCP standardises discovery, descriptions and calling, so any MCP host can find and use the tools without custom code.

7Conclusion

In this answer, we saw that MCP is an open, JSON-RPC based protocol in which hosts use MCP clients to discover and call capabilities from MCP servers. Servers expose tools that the model calls, resources that the application reads by URI and prompts that users pick, over stdio for local processes or Streamable HTTP for network servers. Java has the official MCP Java SDK and Spring AI starters on top of it, and the main benefit is one integration per system instead of one per AI application.

What to say in the interviewAbout 80 seconds aloud

Open with

MCP, the Model Context Protocol, is an open protocol for connecting AI applications to tools and data. The AI application is the host, and inside it an MCP client holds a connection to an MCP server, which wraps some system like a ticket tracker.

Then, if they want more

It is based on JSON-RPC 2.0, so the client sends requests like tools/list or tools/call and gets JSON responses.

A server can expose three things: tools, which are functions with a name, description and JSON schema that the model can decide to call; resources, which are readable data identified by a URI that the application can pull into context; and prompts, which are reusable templates the user can pick.

For transports, a local server usually uses stdio, where the host starts it as a child process. A remote server uses Streamable HTTP, POST requests to one endpoint with optional server-sent events, which replaced the older HTTP plus SSE transport, though I would check what our clients support.

In Java there is an official MCP Java SDK, and Spring AI has starters that turn @Tool methods into an MCP server or use remote MCP tools from ChatClient. The value is that each system is integrated once and every MCP-capable assistant can use it.

About this answer

Last updated
12 November 2026
Checked
Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
Where the question comes from
Written by Scrivio for practice. It is not taken from an interview.
Official documentation
Spring AI reference
Report an issue with this answer

Copy the line below and send it to the author with what you found. It carries the address of this page.

Issue with "What is the Model Context Protocol (MCP)? Explain servers, clients, tools, resources and...": https://scrivio-interview-library.netlify.app/spring-boot/ai-agents-and-mcp/6b817b4553/