One Capability, Three Transports: Functions, CLIs and MCP Servers
Should this be an MCP server? The question dissolves once you see that MCP, a CLI and a plain function are three packagings of the same capability, and that the choice is an engineering decision with measurable inputs.
You will write one pure typed function, expose it as a CLI, expose the same function as an MCP server, then measure the context cost of each surface per call and per session. The token table is the deliverable, and it explains why teams are quietly moving MCP surfaces back to CLIs.
Five lessons, about two hours, a graded quiz on each. Free and open to access.
What you will learn
- Write a capability once as a pure typed function, then package it three ways
- Build a CLI with a sane argument surface, exit codes and JSON output
- Build an MCP server and see exactly what the model receives in its context
- Measure the token cost of each surface per call and per session
- Choose between them with a decision table rather than by fashion
Course curriculum
5 lessons, 2 hours, a graded quiz on each.
- The Capability in Isolation: One Pure Typed Function
- As a CLI: Arguments, Exit Codes, JSON and Composability Artifact: Working CLI
- As an MCP Server: The Protocol and What the Model Sees Artifact: Working MCP server
- Token Accounting: The Context Cost of Each Surface Artifact: Measured token table
- Choosing: A Decision Table You Can Defend Artifact: Decision table
Gate
One test suite green against all three surfaces, plus the measured token table.
Frequently asked questions
What is MCP, in one sentence?
A protocol that lets a model discover and call tools exposed by a server, with schemas and descriptions that the model reads from its context.
When does a CLI beat an MCP server?
When the caller is a process rather than a model, when discovery is not needed, when invocation is occasional, and whenever the context cost of the always-present tool descriptions outweighs the convenience.
Does this course teach the protocol itself?
Yes, enough of it to build a working server and to read the specification confidently, with attention to what the model actually sees.