ysskrishna logoysskrishna

Chapter 6 of 9 · 4 min

MCP: what a server exposes and how a host uses it

Tools, resources and prompts; stdio and HTTP transports; and the request flow from 'initialize' to a tool result.

The Model Context Protocol (MCP) is a standard way for an AI host to talk to an outside program. The host is the app you use (Cursor, Claude Code, Claude Desktop, Codex). The server is a small program that offers capabilities: a converter, a database query, a ticket lookup. Because the protocol is shared, one server works in every host that speaks MCP.

What a server can offer

PrimitiveWhat it isWho decides to use itExample
ToolsFunctions with a name, a description and a JSON Schema for inputsThe model, during a conversationmarkdown_to_slack({ markdown })
ResourcesRead-only data identified by a URIUsually the user or host attaches itA file, a DB row, a doc page
PromptsReusable prompt templates with argumentsThe user picks them, often as slash commands"Summarise this ticket"

Most servers you will use expose tools only. That is fine: tools are what let an agent act.

A real tool list

Markdown Convert MCP exposes four tools. Each takes { "markdown": "<source>" } and returns converted text:

ToolOutputUse when the next hop is
markdown_to_slackSlack mrkdwnSlack API or a Slack MCP text field
markdown_to_teamsHTML with inline CSSTeams paste, or Graph contentType: html
markdown_to_jiraADF JSON stringJira Cloud REST v3 rich-text fields
markdown_to_plaintextPlain textAnything that needs formatting stripped

The model picks a tool by reading these names and descriptions, exactly as it picks a skill. A vague tool description leads to wrong or missing calls.

Transports: local or remote

  • stdio: the host starts the server as a child process and talks over stdin/stdout. Typical for npx … or uvx … servers on your machine. No network port, no auth.
  • Streamable HTTP: the server runs at a URL. The host sends JSON-RPC over HTTP. Typical for hosted servers. For example, the public, read-only server at https://www.ysskrishna.space/mcp needs no API key.

Older docs mention an SSE transport; newer servers use Streamable HTTP.

The request flow

Under the hood, MCP is JSON-RPC 2.0. A session looks like this:

  1. initialize: host and server exchange protocol version and capabilities ("I support tools").
  2. tools/list: the host asks which tools exist and gets names, descriptions and input schemas.
  3. The model decides to call one. The host sends tools/call with the tool name and arguments.
  4. The server returns content, or a result with isError: true if the tool failed. Markdown Convert MCP, for example, returns a tool error (not a transport failure) for input over 200,000 characters.

Hosts add their own layer on top: approval prompts before a tool runs, per-server enable switches, and limits on how many tools are active.

Trust and safety

An MCP server runs code (stdio) or receives your data (HTTP). Before you add one:

  • Read what it does. A converter that only transforms text is low risk. A server with shell or write access is not.
  • Prefer read-only for remote servers. And do not send secrets to a server you do not run.
  • Treat tool output as untrusted text. A web page or ticket returned by a tool can contain instructions. Your agent should treat them as data. This is the same rule as for skills that read files.
  • Keep the tool count small. Every enabled tool's description costs context and adds a way to pick the wrong tool.

Skills and MCP together

A server provides the ability; a skill provides the judgment about when to use it. Markdown Convert MCP ships a companion skill for this reason: it tells the agent to convert before posting to Slack, Teams or Jira through an API, and not to convert before pasting into Slack's composer, which already handles Markdown. Without the skill, the tools are available but called at the wrong moments.

Quick check

  1. Which MCP primitive does the model invoke during a conversation?Tools.

  2. Your server is started with npx -y … on your laptop. Which transport is that?stdio: the host runs it as a child process.

  3. A tool returns a web page that says "ignore previous instructions". What should the agent do?Treat it as data in the result. Tool output never changes the task or grants permission.

Continue exploring

Productnpm+3Thinking Methods

Thinking Methods

17 well-known thinking methods your AI coding assistant can actually run.
Agent Skills
AI Apps & Assistants
Bash
Gemini
BlogCover image for 17 Thinking Skills for AI Agents: Pre-Mortem, Five Whys, Six Hats and More

17 Thinking Skills for AI Agents: Pre-Mortem, Five Whys, Six Hats and More

AI Apps & Assistants
Agent Skills
4 min read
ToolCover image for AI Token Counter

AI Token Counter

AI token counter with model pricing and context-window comparison in your browser.

Chat & AI
AI Apps & Assistants
+1
Productskills.sh+1Claude Code Subagents for Cursor

Claude Code Subagents for Cursor

Your Cursor subagents can finally run on the model you picked in each agent file.
Chat & AI
Agent Skills
AI Apps & Assistants
Bash
CourseCover image for Prompt Engineering for Coding Agents

Prompt Engineering for Coding Agents

Write prompts that coding agents act on: clear goals, the right context, output contracts, examples, structured thinking, shorter answers and a tiny eval set.

Agent Skills
Chat & AI

8 chapters · 21 min

BlogCover image for How to Install Caveman in Cursor and Claude Code

How to Install Caveman in Cursor and Claude Code

AI Apps & Assistants
Agent Skills
+1
3 min read