Playbooks

How to Build a Distribution MCP

WaniWani
·

Last updated: June 2026

For twenty years, funnels lived in web forms. A user arrived on a page, you asked a sequence of questions, you validated each answer, you branched on their responses, and you moved them toward an outcome: a qualified lead, a booking, a quote, a sale. You owned the page, so you owned the sequence.

That funnel is moving into AI clients. People now ask ChatGPT, Claude, and Cursor for help before they ever reach your website. If your product can answer, qualify, and convert inside that conversation, the conversation becomes your funnel. There is no page anymore; the funnel is a tool call.

A distribution MCP is an MCP server that runs a multi-step conversational funnel, taking someone from intent to outcome (a qualified lead, a booking, a quote) inside whichever AI client they already use. (If you want the business case for why distribution is the highest-impact use of MCP, start with our technical guide to MCP distribution. This guide is the how, in code.)

Why this is hard

The instinct is to write a few MCP tools and let the model orchestrate them. That breaks immediately, because you no longer control the surface or the sequence. The host model sits between you and the user. It paraphrases your questions, skips fields you marked required, accepts malformed input, and loses state between turns. A funnel needs the opposite: deterministic order, typed fields, validation, branching, and state that survives across turns.

So the real problem is control. You have to recreate sequence, state, and validation in an environment where you own none of them. The fix is to stop trying to make the model behave and instead make the server deterministic. The model only renders the next question; the server decides what that question is.

The shape: a state graph that compiles to one tool

The pattern that works is to express the funnel as a typed state graph and compile it into a single MCP tool. One tool, many steps. Each turn, the server advances the graph, validates the input, and hands the model exactly one next question to ask. The model cannot skip a step because there is only ever one legal next step.

@waniwani/sdk is the open-source (MIT) TypeScript SDK for this. It is built around createFlow: you declare typed state with Zod, add nodes and edges, and interrupt to ask the user for input. It works with any MCP runtime, has zero required runtime dependencies, and brings its own key-value store so you can run it on serverless or edge.

Install:

[@portabletext/react] Unknown block type "code", specify a component for it in the `components.types` prop

A minimal funnel, qualify then capture:

[@portabletext/react] Unknown block type "code", specify a component for it in the `components.types` prop

The user is now walked through the funnel in order, inside ChatGPT or Claude, with validated fields. If they give a malformed email, the server re-asks rather than accepting it. If a field is already known, the server skips it. The model never sees the wiring; it only relays the next question.

Branching and stages

Real funnels are not linear. You qualify, then branch: a high-intent user goes to booking, a low-intent user goes to a newsletter capture. In a state graph that is just conditional edges out of a node, decided by validated state rather than by the model’s choice. Because the branch is evaluated on the server, it is deterministic and testable.

Measuring the funnel

A funnel you cannot measure is a guess. Because every step runs server-side, you can emit an event at each stage and see where people drop off. The SDK tracks tool calls automatically when you wrap the server, and you can record stage events at any node:

[@portabletext/react] Unknown block type "code", specify a component for it in the `components.types` prop

You infer drop-off from the sequence of events per session: how many reached qualify, how many reached capture, where the gap is. That is the MCP equivalent of a funnel report.

How is a distribution MCP different from LangChain or LangGraph?

LangChain and LangGraph give you general-purpose agent graphs. A distribution MCP is funnel-shaped: the primitives you need are interrupts, re-asking on validation failure, auto-skipping pre-filled fields, typed state, and stage analytics.

NeedRaw MCP SDKLangChain / LangGraph@waniwani/sdk
Deterministic step orderHand-rolledPossible, general-purposeBuilt in via the state graph
Typed fields + validationHand-rolledHand-rolledZod state, re-ask on failure
State across turnsSerialized through the modelYour own storeServer-side, keyed by session id
Compiles to one MCP toolNoNoYes
Funnel-stage analyticsNoNoBuilt in

If you want the longer comparison, the docs have a direct one.

Where conversion actually happens

You cannot render a checkout inside a chat. The bottom of the funnel is a handoff: return a link that carries the session state so your web page resumes exactly where the conversation left off. The chat owns discovery and qualification; the web page owns the close; the session token stitches them into one funnel.

FAQ

What is a distribution MCP?
A distribution MCP is an MCP server that runs a multi-step conversational funnel (lead generation, booking, a quote) as a single MCP tool, so a user moves from intent to outcome inside ChatGPT, Claude, or Cursor without leaving the conversation.

Do I need an API key or a hosted service?
No. The createFlow engine in @waniwani/sdk is open source (MIT) and runs with no API key against any state backend you choose: in-memory, Redis, Upstash, Cloudflare KV, or DynamoDB. A hosted tier (event tracking, funnel analytics, knowledge base, chat widget) is optional and turns on with one environment variable.

How is it different from LangChain or LangGraph?
Those are general-purpose agent graphs. A distribution MCP is funnel-shaped: it compiles a typed state graph into one MCP tool, with interrupts, validation, auto-skip of known fields, and stage analytics built in, so you do not re-invent funnel mechanics on every project.

Which AI clients does it work in?
Any MCP-capable client, including ChatGPT, Claude, and Cursor. The same server runs across all of them.

Start here

  • SDK: @waniwani/sdk on npm.
  • Skill, so your coding agent builds this for you: npx skills add WaniWani-AI/sdk -s waniwani-sdk.
  • Template, a full starter with a chat widget, dev tunnel, and a sample funnel: github.com/WaniWani-AI/mcp-distribution-template.
  • Docs: quickstart, why MCP funnels, and a sales-funnel guide at docs.waniwani.ai.

The funnel did not disappear, it moved into the conversation, and a distribution MCP is how you run it there.