π Model Context Protocol (MCP)
Descriptionβ
< What is it? >β
The Model Context Protocol (MCP) is an open protocol for connecting an AI application to external tools and context through a standard interface. An MCP server can expose capabilities such as a documentation search, browser, GitHub integration, or database, without every AI client needing a custom integration.
- MCP architecture
ββββββββββββ
β User β
ββββββ¬ββββββ
βΌ
βββββββββββββββββββββββββββββββββ
β MCP Host β
β ChatGPT, Claude Desktop, IDE β
β β
β ββββββββββββββ β
β β LLM/Agent β β
β βββββββ¬βββββββ β
β β chooses a tool β
β βββββββΌβββββββ β
β β MCP Client β β
β βββββββ¬βββββββ β
ββββββββββΌβββββββββββββββββββββββ
β MCP/JSON-RPC <-- Communication via pipes (stdin/stdout)
βΌ Server dies when client exits
βββββββββββββββββββββββββββββββββ
β MCP Server β
β β
β convert_currency(...) β
ββββββββββββββββ¬βββββββββββββββββ
βΌ
Exchange-rate API
- MCP workflow
- MCP interaction sequence diagram
< Core roles >β
| Part | Role |
|---|---|
| MCP host | The AI application that needs external capabilitiesex1. The AI application where users type their financial questions & receive responses.ex2. Determines which external connections are needed based on the user's query. |
| MCP client | The connection inside the host that communicates with a serverex1. Receives tool definitions from the server & executes the corresponding requests.ex2. Establishes a session with the MCP server using JSON-RPC messaging. |
| MCP server | The service that exposes tools or context to the clientex1. Translates complex banking API calls into a consistent, easy-to-use format.ex2. Can run locally on machine or be hosted in the cloud. |
< Primitives >β
- Tools:
- Actions the LLM can perform
- Querying a database, searching documentation, running code, or booking a flight
- Resources:
- Context the LLM can use to answer questions
- Documents, code, or database records that is too large to fit in a prompt
- Prompts:
- Pre-defined workflows and instructions that can be invoked by the LLM
- Saves users from having to write complex prompts for every task
Key pointsβ
- Tools let an agent take actions or retrieve live results, such as searching documentation or creating an issue.
- Context gives an agent relevant information from an external source instead of placing everything in its prompt.
- MCP servers may run locally through stdio or remotely through Streamable HTTP.
- MCP expands an agent's access; it does not change the underlying model's knowledge or reasoning ability.
- Treat each server as a security boundary: enable only trusted servers and grant the least access needed.
Ecosystemβ
-
Use third-party server
- Benefits:
- Speed: filesystem and database access without writing a server
- Maintained by others: you focus on the client and application
- Integration: client code can be shared and reused for different MCP servers
- Considerations:
- Security: trust the server to handle your data and not leak it. It requires careful management of private data and credentials. The server runs code and may call external APIs β check these sources.
- Surface area: more tools mean more the LLM can do; be aware of what each server exposes
- Availability: if the server is down, your client may not work
- Cost: some servers may charge for usage
- Benefits:
-
Awesome MCP Servers (mcpservers.org): A collection of servers for the Model Context Protocol
-
MCP Open Library (8enSmith | github)
-
Model Context Protocol (modelcontextprotocol.io)
- Interested in creating your own MCP server? Visit the official documentation at modelcontextprotocol.io for comprehensive guides, best practices, and technical details on implementing MCP servers.
Implementationβ
- mcp example (iddv | github)
- A reference implementation of the Model Context Protocol (MCP) enabling seamless tool calling between LLMs and applications. Features client/server architecture with HTTP APIs, local CLI execution, and AWS Bedrock integration in a production-ready, extensible framework.
Q & Aβ
< Why does MCP use JSON-RPC instead of REST? >β
JSON-RPC fits MCP because the interaction is naturally βcall this operation with these arguments,β and the same messages need to work locally or over HTTP. REST could support similar functionality, but it organizes communication around resources.
| Aspect | JSON-RPC in MCP | Typical REST API |
|---|---|---|
| Main idea | Call an operation, such as tools/call | Access resources through URLs and HTTP methods |
| Request structure | method, params, and request id | HTTP method, URL, headers, and body |
| Transport | Works over stdio or HTTP | Typically HTTP |
| Response structure | Standard result or error, matched by id | HTTP status plus an API-defined response body |
The practical advantages for MCP are:
- Local and remote use: the same message format works with a local subprocess over stdio and a remote server over HTTP.
- A consistent envelope: requests, results, errors, and notifications have defined formats.
- A shared tool interface: clients use operations such as
tools/listandtools/callacross different servers. MCP supplies those operation names and schemas; JSON-RPC supplies the message structure.
See the JSON-RPC specification and MCP architecture documentation for the message format and transport design.
-
Example: an MCP server can expose a customer lookup tool while calling an existing REST API internally:
Agent β MCP tools/call: get_customer(customer_id=42)βMCP serverβREST API: GET /customers/42
JSON-RPC and REST can work together. The agent gets a standard MCP tool interface, while the server integrates with the underlying REST service.
< When should I use a skill, MCP, or both? >β
Use a skill when the agent needs reusable guidance for performing a task. Use MCP when an application needs a standard way to discover and access tools or context provided by a server. Use both when a repeatable workflow depends on those capabilities.
| Need | Use | Example |
|---|---|---|
| Consistent procedures, domain knowledge, or output formatting | Skill | Follow a code-review checklist or produce a report in a required format |
| A standard connection to tools, databases, files, or services | MCP server | Expose search_documents(query) or get_sales(month) to compatible AI applications |
| A reusable procedure that uses connected tools or data | Skill + MCP | Retrieve sales through an MCP tool, then follow a skill's analysis and reporting steps |
| A one-off task already supported by existing tools | An ordinary prompt may be enough | Summarize a document already in the conversation |
- Example: for a monthly sales report, the MCP server provides
get_sales(month)to retrieve records. The skill tells the agent how to group revenue, verify totals, and format the report. The agent follows the skill and calls the tool when it needs the data.
A skill can bundle scripts that read files or call APIs directly, so external access does not automatically require MCP. MCP is useful when you want to expose capabilities through a shared interface that compatible clients can discover and call. MCP servers can also supply resources and prompt templates, so they are broader than tool APIs alone. See the Agent Skills overview and MCP server concepts.
For short code examples, see Skill vs. MCP.
Video Tutorialβ
Referenceβ
- What is the Model Context Protocol? (databricks)
- OpenAI: Model Context Protocol
- Model Context Protocol documentation
- Model Context Protocol: Architecture overview
- JSON-RPC 2.0 specification
- Agent Skills overview
- Model Context Protocol: Server concepts
- Model Context Protocol GitHub
- Building a Full-Fledged MCP Workflow using Tools, Resources, and Prompts
- Getting Started with Managed Snowflake MCP Server (snowflake)
- Popular MCP Servers for Work (geeksforgeeks.org)
- Extending Claude Code with Skills and MCP (geeksforgeeks.org)
- JSON-RPC Explained for MCP Developers (Kuldeep Singh)