AI EngineeringIntermediate14 min

Model Context Protocol (MCP)

A standard way to expose tools and data to any compatible AI client, including your own servers.

See it on the map

MCP is an open protocol that lets an AI application discover and use tools and data from a server without custom glue for each pair. A server advertises tools with names, descriptions and JSON-schema arguments. A client lists them, lets the model choose, calls them and returns results.

Servers speak JSON-RPC. Locally they run over standard input and output. Remotely they use streamable HTTP, which lets hosted clients and API providers connect to a public URL. A stateless server that answers each POST on its own is simple to deploy on serverless platforms.

Because a model can be steered by what a tool returns, treat server output as untrusted input and treat tool permissions seriously. Expose the narrowest set of tools that does the job, mark read-only tools honestly, and authenticate anything that touches private data.

Key points

  • One server can serve many different AI clients.
  • Remote servers use streamable HTTP. Local ones use stdio.
  • Keep tools few, narrow and well described.
  • Authenticate private data and treat tool output as untrusted.

Answer these out loud

  1. 1Which of your product's capabilities should be tools, and which are better as read-only resources?
  2. 2What could go wrong if a tool returns text containing instructions?

Build it

Write a stateless MCP server with two read-only tools and connect it to an MCP-capable client or an API that supports remote MCP.

Use this from an agent

Any MCP client, including Grok, can read this lesson. See how to connect.

REST
curl https://engineeros-delta.vercel.app/api/v1/topics/mcp-protocol