Model Context Protocol (MCP): Connecting LLM Apps to Tools and Data with a Standard Interface

LLM Development 55 min min read Updated: Nov 21, 2026 Intermediate
Model Context Protocol (MCP): Connecting LLM Apps to Tools and Data with a Standard Interface
Intermediate Topic 2 of 3

The Problem MCP Solves

Every AI app used to need custom code to connect to every tool, such as files, databases or chat systems. MCP is an open protocol that gives AI apps one common way to talk to tools and data. Build a tool server once and many MCP-capable apps can use it.

The Parts

PartRole
HostThe AI app the user works in
ClientPart of the host that talks to one server
ServerA program that offers capabilities

What a Server Can Offer

TypeMeaningExample
ToolsActions the model can ask to runcreate_ticket, run_query
ResourcesData the app can readA file or a database record
PromptsReusable prompt templatesSummarize this document

Messages use JSON-RPC. MCP supports local servers over standard input and output, and remote servers over HTTP.

Versions change MCP specification versions are named by date, and newer ones have changed how connections and sessions work. For example, a 2026-07-28 revision describes a stateless protocol core. Always follow the current specification and the official SDK for your language.

Shape of a Tool Request

A tool call is a JSON-RPC request. This demo builds and reads one to show the structure. Check the specification for the exact current fields.

python import json request = {"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {"name": "get_weather", "arguments": {"city": "Pune"}}} print(json.dumps(request)) def handle(req): if req["method"] == "tools/call" and req["params"]["name"] == "get_weather": city = req["params"]["arguments"]["city"] return {"jsonrpc": "2.0", "id": req["id"], "result": {"content": [{"type": "text", "text": f"Sunny in {city}"}]}} return {"jsonrpc": "2.0", "id": req["id"], "error": {"code": -32601, "message": "Method not found"}} print(json.dumps(handle(request)))
Result

{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {"name": "get_weather", "arguments": {"city": "Pune"}}} | {"jsonrpc": "2.0", "id": 1, "result": {"content": [{"type": "text", "text": "Sunny in Pune"}]}}

In practice you do not write this by hand. You use an official SDK, which handles messages and lets you write ordinary functions as tools.

Security Tips

  • Install and run only servers you trust
  • Give each server the least access it needs
  • Treat tool output as untrusted data. It may contain hidden instructions
  • Ask users to approve sensitive actions
  • Keep secrets out of tool descriptions and logs
A server is code on your machine A local MCP server can read files and run commands depending on how it is written. Review before use.

Practice

  1. Change the demo to add a second tool
  2. Read the introduction page of the official MCP documentation
  3. List the access a file-reading server really needs

Conclusion

MCP is a shared plug standard for AI tools. Use SDKs, follow the current spec and apply least privilege.

Quick Summary: Problem; host client server; tools resources prompts; security.

Get Newsletter

Subscibe to our newsletter and we will notify you about the newest updates on Edugators