C.W.K.
Stream
Lesson 04 of 04 · published

When to Use What

~18 min · decision, heuristics, architecture

Level 0Curious Reader
0 XP0/48 lessons0/14 achievements
0/100 XP to next level100 XP to go0% complete

One concise heuristic, refined through ecosystem usage so far. Walk it top to bottom on each new integration; the answer almost always lands cleanly.

  1. Is the consumer a single, bounded LLM-driven app you control? → use that provider's function calling. Don't introduce extra protocol surface for a single-app concern.
  2. Will the same capability serve multiple AI products you do not control? → write an MCP server. Every additional product becomes a configuration change instead of a code change.
  3. Will non-AI clients (browsers, mobile apps, scripts) also consume it? → expose REST/OpenAPI too; either as the underlying API the MCP server wraps, or as the canonical contract with a thin MCP layer derived from it.
  4. Is the producer pushing events the consumer must react to quickly? → add webhooks. Those events are still describable in the same OpenAPI doc.
  5. Is the operation slow and the consumer wants in-protocol asynchrony without a separate URL? → use MCP async tasks.

The deeper lesson is composition. The right answer is rarely "MCP or REST"; it is "REST as the underlying truth, MCP as the agent-friendly facade, function calling as the model's invocation envelope, webhooks for the event direction, async tasks for the slow paths." Each contract solves a piece. Stacking them is normal.

Code

A real architecture stacking all four·text
[Browser/mobile/CLI clients]
        │  REST + JSON  (OpenAPI document)
        ▼
[Your service]  ──── webhook events ────►  [Customer endpoints]
        ▲
        │  REST internal
[MCP server (thin facade)]
        ▲  protocol (sync calls + async tasks)
        │
[MCP host (Claude Desktop, IDE, custom)]
        ▲  function calling envelope
[LLM provider API]

External links

Exercise

Sketch the architecture diagram above for a real product you ship. Label every line with the contract it speaks. The labels expose where you have under-invested (an MCP layer would unlock a market) and where you have over-invested (a REST layer that no human or non-AI consumer ever uses).

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign inPlease sign in to comment.

No comments yet — be the first.