# Model Context Protocol

Canonical URL: https://agentlearn.dev/learn/agents/mcp
Author: [Hemanth HM](https://h3manth.com)
Track: agents
Reading time: 10 minutes

MCP standardizes how applications connect to tools and context. It does not replace authorization or validate the truth of a tool result.

## A protocol is a contract, not intelligence

A host application connects through clients to servers exposing capabilities such as tools, resources, and prompts. This reduces one-off integration work. The model still needs useful descriptions, and the application still needs policy checks before executing an operation. Treat results from an external server as untrusted data.

## How it works

Pin the protocol revision and verify the transport, authentication, and capability requirements for that revision. This course references the July 28, 2026 specification, whose architecture uses self-contained requests and per-request capability negotiation. Older examples may assume a different initialization lifecycle. The exercise only illustrates argument validation; it is not a complete MCP client or wire message.

## A concrete example

The shop exposes a read-only policy search tool with a required query string. A client can discover what the tool expects. That schema does not establish which customer's records the server may return, and a tool description cannot grant itself new privileges.

## Apply it to your assistant

Try an empty query and inspect the contract failure. Before running the exercise, predict the result. Afterward, explain which assumption changed and add one case where the system should refuse, ask for clarification, or escalate.

All exercise inputs and outputs are deterministic teaching examples. No language model is called. Run the same idea against a versioned dataset before making a production claim.


## Key takeaway

Use MCP for interoperability, with version-pinned contracts and independent trust boundaries.

## JavaScript exercise: Model Context Protocol · code experiment

Try an empty query and inspect the contract failure.

```javascript
const tool = { name: 'search_policy', required: ['query'] };
function validate(args) {
  return tool.required.every(key => typeof args[key] === 'string' && args[key].trim().length > 0);
}
console.log({ tool: tool.name, valid: validate({ query: 'returns' }) });
console.log('Conceptual schema check, not an MCP protocol implementation.');
```

## Knowledge check

What does discovering a tool schema establish?

1. The declared argument shape, not permission to access all data
2. That all tool outputs are safe instructions
3. That protocol versions never matter

Answer: The declared argument shape, not permission to access all data

Discovery describes an interface. Authentication, authorization, data validation, and version compatibility remain separate responsibilities.

## Sources

- [Model Context Protocol specification](https://modelcontextprotocol.io/specification/2026-07-28) — MCP contributors, 2026-07-28. Versioned protocol reference. Implementation details should be checked against the version you deploy.
