一键导入
knowledge-base
Set up a knowledge base with search for an MCP project. Creates FAQ tool and ingestion script using the Waniwani KB API via @waniwani/sdk.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Set up a knowledge base with search for an MCP project. Creates FAQ tool and ingestion script using the Waniwani KB API via @waniwani/sdk.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Audit Waniwani event tracking across an MCP project. Does an in-depth overview check of the whole app (server, flows, tools, widgets, chat embed), verifies that only events defined in the Waniwani taxonomy are sent, and identifies missing events worth adding at each funnel stage (identify, lead_qualified, price_shown, prices_compared, option_selected, converted). Trigger when the user wants to audit tracking, check event coverage, find missing funnel events, verify events are valid, or review the instrumentation of an MCP built with @waniwani/sdk.
Auto-instrument Waniwani funnel events across a createFlow app. Analyzes every flow in the project, decides where each tracking event belongs (lead_qualified, price_shown, prices_compared, option_selected, converted, identify), inserts the calls with the right metadata from flow state, and verifies the result. Trigger when the user wants to add tracking to a flow, track qualified leads, instrument a funnel, measure conversions, or right after scaffolding a new flow with @waniwani/sdk.
MCP distribution SDK: build sales funnels, lead generation, booking flows, insurance quote flows, pricing quote flows, and any multi-step conversational MCP app with @waniwani/sdk. Open source createFlow engine (no API key required) with pluggable state backends (in-memory, Redis, Upstash, Cloudflare KV, DynamoDB, or hosted). Optional free tier adds a revenue-first event taxonomy (track leads, prices shown/compared, options selected, and conversions — including off-platform purchases), funnel analytics, knowledge base, and a chat widget. Trigger when the user wants to add an MCP funnel, sales funnel, lead gen flow, booking flow, quote flow, knowledge base / FAQ tool, or embedded chat to an MCP server — or to instrument tracking on a @waniwani/sdk app: emit or track events, record a conversion or revenue, attribute an off-platform purchase back to a lead, or measure where users drop off in a funnel.
Migrate a project from @waniwani/sdk 0.16.x to 0.17.0 and auto-apply its breaking change: useWaniwani() from @waniwani/sdk/mcp/react no longer auto-discovers its config from a WidgetProvider context or by opening its own host connection, so a bare useWaniwani() in a widget silently stops tracking. Skybridge widgets switch the import to @waniwani/sdk/mcp/react/skybridge; other hosts pass toolResponseMetadata or explicit { endpoint, source }. Trigger when the user is on @waniwani/sdk 0.16.x and wants to move to 0.17, asks to migrate to 0.17, or finds widget tracking silently stopped after bumping @waniwani/sdk to 0.17.
Migrate a project from @waniwani/sdk 0.17.x to 0.18.0 and auto-apply its breaking change: the generic funnel events quote.requested, quote.succeeded, quote.failed, and purchase.completed are removed from the track() taxonomy (with the QuoteSucceededProperties / PurchaseCompletedProperties types and the legacy quoteAmount / quoteCurrency / purchaseAmount / purchaseCurrency input fields). Call sites move to the typed revenue helpers track.priceShown() and track.converted(), or are deleted. Trigger when the user is on @waniwani/sdk 0.17.x and wants to move to 0.18, asks to migrate to 0.18, or hits type errors on quote.* / purchase.completed events after bumping @waniwani/sdk.
Cut a @waniwani/sdk version bump that ships its own migration path so users can upgrade automatically. Use when bumping the SDK version, releasing a breaking change, editing the changelog for a release, or when the user says "cut a release", "version bump", "ship a breaking change", or "prepare a migration".
| name | knowledge-base |
| description | Set up a knowledge base with search for an MCP project. Creates FAQ tool and ingestion script using the Waniwani KB API via @waniwani/sdk. |
| user-invocable | true |
| allowed-tools | Read, Write, Edit, Bash, Glob, Grep |
Add semantic search over markdown documents to an MCP project using the Waniwani KB API (client.kb).
{{MCP_NAME}} placeholders)@waniwani/sdk must be installedWANIWANI_API_KEY must be set in the environmentLook in lib/ for the directory that isn't shared — that's the MCP name. Store as {MCP_NAME}.
Create lib/{MCP_NAME}/knowledge-base/knowledge/ directory.
Ask the user: "Do you have .md files to add to the knowledge base, or should I create an example file?"
If no files provided, create lib/{MCP_NAME}/knowledge-base/knowledge/example.md:
# Example Knowledge Base
## What is this?
This is an example knowledge base entry. Replace this file with your own .md files containing information you want your AI assistant to be able to search through.
## How does it work?
Each .md file is split into chunks by H2 headings. The H1 title provides context for each chunk. Run `bun run kb:ingest` to upload your knowledge files to the Waniwani API.
Create scripts/kb-ingest.ts (create scripts/ directory if it doesn't exist):
import { readdir, readFile } from "node:fs/promises";
import { join } from "node:path";
import { waniwani } from "@waniwani/sdk";
const knowledgeDir = join(import.meta.dirname, "../lib/{MCP_NAME}/knowledge-base/knowledge");
const mdFiles = (await readdir(knowledgeDir)).filter((f) => f.endsWith(".md"));
console.log(`Found ${mdFiles.length} knowledge file(s)`);
const files = await Promise.all(
mdFiles.map(async (filename) => ({
filename,
content: await readFile(join(knowledgeDir, filename), "utf-8"),
})),
);
const client = waniwani();
console.log("Ingesting files into knowledge base...");
console.log("⚠️ This will replace all existing KB chunks for this environment.");
const result = await client.kb.ingest(files);
console.log(`Done: ${result.chunksIngested} chunks from ${result.filesProcessed} files`);
Add to scripts:
"kb:ingest": "bun run scripts/kb-ingest.ts"
Create lib/{MCP_NAME}/tools/faq.ts:
import { waniwani } from "@waniwani/sdk";
import { createTool } from "@waniwani/sdk/mcp";
import { z } from "zod";
const client = waniwani();
export const faqTool = createTool(
{
id: "faq",
title: "FAQ",
description:
"Answer frequently asked questions. Use this when users ask general questions about the product or service.",
inputSchema: {
question: z.string().describe("The user's question"),
},
annotations: {
readOnlyHint: true,
openWorldHint: false,
destructiveHint: false,
},
},
async ({ question }) => {
const results = await client.kb.search(question, { topK: 5 });
if (results.length === 0) {
return {
text: "I don't have a specific answer for that question.",
};
}
const text = results
.map((r) => `**${r.heading}**\n${r.content}`)
.join("\n\n---\n\n");
return { text };
},
);
Export from lib/{MCP_NAME}/tools/index.ts:
export { faqTool } from "./faq";
Import and register in app/mcp/route.ts:
import { faqTool } from "@/lib/{MCP_NAME}/tools";
// ...
await registerTools(server, [faqTool]);
bun run kb:ingest
This requires WANIWANI_API_KEY to be set in the environment.
bun run build
Tell the user:
lib/{MCP_NAME}/knowledge-base/knowledge/bun run kb:ingest after adding or updating .md filesWANIWANI_API_KEY must be set in the environment# Title (H1) and ## Section (H2) structure