@waniwani/sdk 0.11.14 → 0.11.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +58 -58
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,36 +3,19 @@
|
|
|
3
3
|
[](https://www.npmjs.com/package/@waniwani/sdk)
|
|
4
4
|
[](./LICENSE)
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
The open-source TypeScript SDK for **MCP funnels**: multi-step conversational flows (sales, lead generation, booking, quotes) that run as a single MCP tool inside ChatGPT, Claude, Cursor, and any MCP-capable client. One typed state graph compiles to one MCP tool. MIT, bring your own store, optional hosted Platform via one env var.
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Forked from production MCPs we shipped for paying customers (insurance quoting, pet care, lead capture, booking), and open-sourced once the shape stabilized.
|
|
9
9
|
|
|
10
|
-
##
|
|
11
|
-
|
|
12
|
-
- **ChatGPT, Claude, and Cursor are the new browsers. MCP is the store.** One edit to your messaging deploys to every MCP-capable client and your own site.
|
|
13
|
-
- **Conversational funnels are the new web forms.** They are where money will be made in the AI-distribution era. Recreating a real funnel inside MCP is harder than it looks.
|
|
14
|
-
- **LLMs are not built to replicate forms.** Left to themselves, they rush through structured collection: they skip fields, paraphrase questions, and break validation. A real funnel needs deterministic order, typed fields, validation, branching, and resumable state across tool calls.
|
|
15
|
-
- **Generic agent builders are not shaped for funnels.** LangChain and LangGraph are general-purpose. They expose every primitive, leaving you to re-invent funnel ergonomics (interrupts, re-ask on error, auto-skip pre-filled fields, widget cards, deterministic step order) on every project.
|
|
16
|
-
- **`createFlow` is the missing abstraction.** A typed state graph (Zod-typed state, named nodes, direct and conditional edges, interrupts, widget signals) compiles to a single MCP tool. Funnel-shaped by design, not by convention.
|
|
17
|
-
- **Production-validated.** Forked out of internal distribution MCPs we shipped for paying customers (insurance quoting, pet care, lead capture, booking). Open-sourced once we hit the same pattern enough times.
|
|
18
|
-
|
|
19
|
-
## What you can build today
|
|
20
|
-
|
|
21
|
-
- **[Sales funnel MCP](https://docs.waniwani.ai/guides/sales-funnel)**. Qualify intent, capture lead data, branch on stage, push to CRM.
|
|
22
|
-
- **[Lead generation MCP](https://docs.waniwani.ai/guides/lead-generation)**. Collect email, role, use case. Webhook to your CRM.
|
|
23
|
-
- **[Booking MCP](https://docs.waniwani.ai/guides/booking)**. Pick a service, check availability, pick a slot, confirm.
|
|
24
|
-
- **[Insurance or pricing quote MCP](https://docs.waniwani.ai/guides/insurance-quote)**. Collect details, validate, call your pricing API, return widget cards.
|
|
25
|
-
|
|
26
|
-
Any other multi-step MCP tool where order, validation, and resumability matter.
|
|
27
|
-
|
|
28
|
-
## 30-second example
|
|
10
|
+
## Install
|
|
29
11
|
|
|
30
12
|
```bash
|
|
31
13
|
bun add @waniwani/sdk @modelcontextprotocol/sdk zod
|
|
32
14
|
```
|
|
33
15
|
|
|
16
|
+
## 30-second example
|
|
17
|
+
|
|
34
18
|
```ts
|
|
35
|
-
// hello.ts
|
|
36
19
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
37
20
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
38
21
|
import { createFlow, END, MemoryKvStore, START } from "@waniwani/sdk/mcp";
|
|
@@ -51,7 +34,7 @@ const flow = createFlow({
|
|
|
51
34
|
})
|
|
52
35
|
.addNode({
|
|
53
36
|
id: "greet",
|
|
54
|
-
run: () => ({ greeted: true }),
|
|
37
|
+
run: ({ state }) => ({ greeted: true }),
|
|
55
38
|
})
|
|
56
39
|
.addEdge(START, "ask")
|
|
57
40
|
.addEdge("ask", "greet")
|
|
@@ -67,57 +50,74 @@ await server.connect(new StdioServerTransport());
|
|
|
67
50
|
bun run hello.ts
|
|
68
51
|
```
|
|
69
52
|
|
|
70
|
-
|
|
53
|
+
A complete MCP server with one flow-driven tool, runnable over stdio. Connect it to ChatGPT, Claude, or any MCP client.
|
|
71
54
|
|
|
72
|
-
|
|
55
|
+
## What is an MCP funnel
|
|
73
56
|
|
|
74
|
-
|
|
57
|
+
A funnel is a multi-step conversation that drives a user or agent from intent to outcome: a qualified lead, a booking, a quote, a purchase. For twenty years funnels lived in web forms. They are moving into AI clients.
|
|
75
58
|
|
|
76
|
-
|
|
59
|
+
ChatGPT, Claude, and Cursor are the new browsers. MCP is the store. The funnel is a tool call.
|
|
77
60
|
|
|
78
|
-
|
|
61
|
+
LLMs cannot run funnels on their own. They paraphrase questions, skip fields, accept malformed input, and lose state between turns. A real funnel needs deterministic order, typed fields, validation, branching, and resumable state. `createFlow` makes the funnel deterministic on the server. The model just renders the next question.
|
|
79
62
|
|
|
80
|
-
|
|
63
|
+
The mapping from funnel to flow is direct:
|
|
81
64
|
|
|
82
|
-
|
|
65
|
+
| Funnel concept | Flow primitive |
|
|
66
|
+
|---|---|
|
|
67
|
+
| Step | Node |
|
|
68
|
+
| Form field | Interrupt |
|
|
69
|
+
| Transition | Edge |
|
|
70
|
+
| Branching question | Conditional edge |
|
|
71
|
+
| Lead data | Typed state (Zod) |
|
|
83
72
|
|
|
84
|
-
|
|
85
|
-
|---|---|---|
|
|
86
|
-
| `createFlow`, `StateGraph`, `KvStore`, `MemoryKvStore` | **OSS** | Multi-step conversational flows, runnable with no API key |
|
|
87
|
-
| `WaniwaniKvStore` | Free tier | Hosted, encrypted-at-rest flow state on `app.waniwani.ai` |
|
|
88
|
-
| `withWaniwani`, `useWaniwani` | Both | Tool tracking, session bridging, browser hook (no-op without a key) |
|
|
89
|
-
| `waniwani()`, `tracking`, `kb` | Free tier | Event tracking, funnel analytics, knowledge base |
|
|
90
|
-
| `ChatEmbed`, `embed.js` | Free tier | Embeddable chat UI |
|
|
73
|
+
See [Why MCP funnels](https://docs.waniwani.ai/why-mcp-funnels) for the full argument.
|
|
91
74
|
|
|
92
|
-
|
|
75
|
+
## How it compares
|
|
93
76
|
|
|
94
|
-
|
|
77
|
+
- **vs the raw MCP SDK.** You would serialize state through the model on every turn. `createFlow` persists state server-side under the session id; the model carries nothing between calls.
|
|
78
|
+
- **vs LangChain or LangGraph.** General-purpose agent graphs. WaniWani is funnel-shaped: interrupts, re-ask on validation, auto-skip pre-filled fields, widget delegation, typed state via Zod. See [vs LangGraph](https://docs.waniwani.ai/compare/vs-langgraph).
|
|
79
|
+
- **vs closed-source platform SDKs.** MIT. The flow engine has zero runtime dependency on `app.waniwani.ai`. The hosted Platform is opt-in via a single env var.
|
|
80
|
+
|
|
81
|
+
## Engine + optional Platform
|
|
95
82
|
|
|
96
|
-
|
|
83
|
+
The flow engine is MIT and runs without an API key against any `get` / `set` / `delete` store (Redis, Upstash, Cloudflare KV, DynamoDB, Postgres, in-memory).
|
|
97
84
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
-
|
|
101
|
-
-
|
|
102
|
-
-
|
|
85
|
+
Set `WANIWANI_API_KEY` to connect the [WaniWani Platform](https://docs.waniwani.ai/platform/overview):
|
|
86
|
+
|
|
87
|
+
- Hosted, encrypted-at-rest flow state. No infra to run.
|
|
88
|
+
- Event tracking and funnel analytics.
|
|
89
|
+
- Knowledge base (markdown ingest plus semantic search).
|
|
90
|
+
- Embeddable chat widget backend.
|
|
91
|
+
|
|
92
|
+
Same code, opt in by env var. `withWaniwani(server)` wraps any MCP server to add session bridging and auto-tracking; it is a no-op without a key, so it is safe to apply unconditionally. Pricing (including a free plan) lives at [app.waniwani.ai](https://app.waniwani.ai).
|
|
93
|
+
|
|
94
|
+
## What you can build
|
|
95
|
+
|
|
96
|
+
- [Sales funnel MCP](https://docs.waniwani.ai/guides/sales-funnel). Qualify intent, capture lead, branch on stage, push to CRM.
|
|
97
|
+
- [Lead generation MCP](https://docs.waniwani.ai/guides/lead-generation). Email, role, use case, webhook to CRM.
|
|
98
|
+
- [Booking MCP](https://docs.waniwani.ai/guides/booking). Pick service, check availability, pick slot, confirm.
|
|
99
|
+
- [Insurance or pricing quote MCP](https://docs.waniwani.ai/guides/insurance-quote). Collect details, validate, call your pricing API, return widget cards.
|
|
100
|
+
|
|
101
|
+
For a fuller starter project with chat widget, dev tunnel, and a sample funnel pre-wired:
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
git clone https://github.com/WaniWani-AI/mcp-distribution-template.git my-mcp-server
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## Documentation
|
|
103
108
|
|
|
104
|
-
**
|
|
105
|
-
- [Quickstart](https://docs.waniwani.ai/quickstart)
|
|
106
|
-
- [Flows overview](https://docs.waniwani.ai/flows/overview)
|
|
107
|
-
- [KV store adapters](https://docs.waniwani.ai/flows/kv-store)
|
|
108
|
-
- [Self-hosting](https://docs.waniwani.ai/deployment/self-hosting)
|
|
109
|
+
Full docs at **[docs.waniwani.ai](https://docs.waniwani.ai)**. Same source as [`./docs/`](./docs).
|
|
109
110
|
|
|
110
|
-
**
|
|
111
|
-
- [
|
|
112
|
-
- [
|
|
113
|
-
- [Chat widget](https://docs.waniwani.ai/chat/embed)
|
|
111
|
+
- **Start:** [Quickstart](https://docs.waniwani.ai/quickstart) · [Why MCP funnels](https://docs.waniwani.ai/why-mcp-funnels) · [Funnels overview](https://docs.waniwani.ai/guides/funnels)
|
|
112
|
+
- **Engine:** [Flows](https://docs.waniwani.ai/flows/overview) · [State](https://docs.waniwani.ai/flows/state) · [Interrupts](https://docs.waniwani.ai/flows/interrupts) · [KV store adapters](https://docs.waniwani.ai/flows/kv-store)
|
|
113
|
+
- **Deploy:** [Overview](https://docs.waniwani.ai/deployment/overview) · [Self-hosting](https://docs.waniwani.ai/deployment/self-hosting)
|
|
114
|
+
- **Platform:** [Overview](https://docs.waniwani.ai/platform/overview) · [Tracking](https://docs.waniwani.ai/tracking/overview) · [Knowledge base](https://docs.waniwani.ai/knowledge-base/overview) · [Chat widget](https://docs.waniwani.ai/chat/embed)
|
|
114
115
|
|
|
115
116
|
## Links
|
|
116
117
|
|
|
117
|
-
- **Website
|
|
118
|
-
- **Dashboard
|
|
119
|
-
- **
|
|
120
|
-
- **Issues**: [github.com/WaniWani-AI/sdk/issues](https://github.com/WaniWani-AI/sdk/issues)
|
|
118
|
+
- **Website:** [waniwani.ai](https://waniwani.ai)
|
|
119
|
+
- **Dashboard:** [app.waniwani.ai](https://app.waniwani.ai)
|
|
120
|
+
- **Issues:** [github.com/WaniWani-AI/sdk/issues](https://github.com/WaniWani-AI/sdk/issues)
|
|
121
121
|
|
|
122
122
|
## License
|
|
123
123
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@waniwani/sdk",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.15",
|
|
4
4
|
"description": "MCP distribution SDK. Build sales funnels, lead generation, booking, and quote apps on top of your MCP server. Event tracking, flows, widgets, knowledge base.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|