This is where Model Context Protocol (MCP) comes in.
In this article, we'll explore the core concepts behind MCP without using any specific framework. In the next article, we'll build an MCP server and client using Spring AI.
Why Do We Need MCP?
Modern AI applications often need to interact with many external systems. For example, an AI assistant may need to:
- Search a GitHub repository
- Read local files
- Query a database
- Send emails
- Create Jira tickets
- Access internal REST APIs
Without MCP, every AI application would need to build custom integrations for every service. Every framework would repeatedly solve the same integration problem. There was no common standard.
MCP solves this by defining a standard protocol that AI applications can use to communicate with external systems.
Think of MCP as:
USB-C for AI applications.
Just as USB-C provides one standard connector for many devices, MCP provides one standard way for AI applications to communicate with external tools and data sources.
MCP Architecture
MCP defines three main components.
Host
The application users interact with.
- Claude Desktop
- VS Code
- AI desktop applications
- Spring AI applications
The host manages conversations and creates MCP client connections.
Client
An MCP client communicates with one MCP server. A host can create multiple clients to communicate with multiple servers simultaneously.
Server
An MCP server exposes capabilities to AI applications. These capabilities may include:
- Tools
- Resources
- Prompts
The server hides implementation details such as REST APIs, databases, or file systems.
What Can an MCP Server Provide?
An MCP server can expose three primary capabilities.
Tools
Tools perform actions.
- Search products
- Query a database
- Read a file
- Send an email
- Create a GitHub issue
- Check an order status
Resources
Resources provide read only information.
- Documentation
- Markdown files
- PDFs
- Configuration files
- Source code
Prompts
Prompts are reusable prompt templates provided by the server.
- Summarize this repository.
- Explain this code.
- Review this pull request.
Instead of every application creating identical prompts, they can be shared through MCP.
Understanding the Layers
There are different technologies we use with MCP.
- MCP defines the protocol.
- JSON-RPC defines the message format.
- STDIO and Streamable HTTP transport those messages.
STDIO
STDIO (Standard Input / Standard Output) is the most common transport for local MCP servers. The host starts the MCP server as a child process and communicates using the process's standard input and output streams.
Advantages:
- Simple
- Fast
- No network configuration
- Perfect for local development
Examples:
- Filesystem Server
- SQLite Server
- Local Git Server
Streamable HTTP
When an MCP server runs remotely, communication usually happens over HTTP.
Advantages:
- Remote deployment
- Cloud native
- Shared by multiple applications
- Easy to secure using existing HTTP infrastructure
The protocol remains exactly the same. Only the transport changes.
JSON-RPC
MCP uses JSON-RPC 2.0 to exchange messages between clients and servers.
Common messages include:
initializetools/listtools/callresources/listprompts/list
For example, discovering available tools looks like this.
Request
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/list"
}
Response
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"tools": [
{
"name": "searchMovies",
"description": "Search movies by title"
}
]
}
}
Later, the client can invoke a tool.
{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/call",
"params": {
"name": "searchMovies",
"arguments": {
"title": "Interstellar"
}
}
}
Unlike REST, clients don't need to know custom endpoints. Everything is described through the protocol.
Capability Discovery
One of MCP's biggest strengths is dynamic discovery. Instead of hardcoding integrations, the client simply asks the server:
- What tools do you provide?
- What resources are available?
- What prompts do you support?
The server responds with its capabilities. This allows new capabilities to be added without changing the client.
MCP vs REST
REST remains the standard communication mechanism between traditional applications.
MCP is designed specifically for AI applications.
| REST | MCP |
|---|---|
| Designed for applications | Designed for AI applications |
| Fixed endpoints | Dynamic capability discovery |
| API documentation is separate | Tool descriptions are part of the protocol |
| Developers implement integrations | Clients discover capabilities automatically |
MCP does not replace REST. In many systems, an MCP server internally calls existing REST APIs.
When Should You Use MCP?
MCP is particularly useful when AI applications interact with multiple external systems. Typical use cases include:
- Customer support assistants
- Software development assistants
- Enterprise AI platforms
- Internal knowledge assistants
- DevOps automation
- Research assistants
If your application only needs to call a single internal REST API, introducing MCP may not provide significant benefits.
Further Reading
The following official resources provide more information about MCP.
-
Model Context Protocol Official Documentation
https://modelcontextprotocol.io -
Anthropic MCP Documentation
https://docs.anthropic.com/en/docs/agents-and-tools/mcp -
MCP Specification
https://github.com/modelcontextprotocol/specification -
Official MCP Servers
https://github.com/modelcontextprotocol/servers -
MCP Inspector
https://github.com/modelcontextprotocol/inspector
Conclusion
Model Context Protocol (MCP) provides a standard way for AI applications to communicate with external tools and data sources.
Instead of building custom integrations for every application, developers expose capabilities through MCP servers. Any compatible AI client can then discover and use those capabilities dynamically.


Comments
Post a Comment