Prerequisites
- Node.js 18.17+ (Node 20+ recommended)
- A running MCP server using
@modelcontextprotocol/sdk(or compatible: Skybridge,@vercel/mcp-handler) - A WaniWani account at app.waniwani.ai
Get an API key
- Open app.waniwani.ai and sign in.
- Create an MCP environment (one per deployment target, for example
my-app-prod). - Copy the API key from the environment settings. Keys start with
wwk_and are shown in full only once. - Expose it to your server process:
.env
WANIWANI_API_KEY from the environment by default.Wrap your MCP server
Call With no arguments,
withWaniwani(server) once, after creating the server and before connecting the transport. It intercepts registerTool and emits a tool.called event for every invocation.server/src/index.ts
withWaniwani creates a client from WANIWANI_API_KEY. Tools registered before or after the wrap call are both instrumented.Verify it works
Restart the server, trigger any tool call from your MCP client (Claude Desktop, ChatGPT, inspector, etc.), then open the WaniWani dashboard. The
tool.called event should appear within a few seconds.If nothing shows up, check that WANIWANI_API_KEY is set in the process running the server and look for [waniwani] lines in your server logs.Track a custom event
For anything beyondtool.called (a completed purchase, a successful quote, a custom funnel step), call client.track() from inside a tool handler. Pass meta: extra._meta so the event is linked to the current MCP session.
What’s next
Client configuration
Requirements, options, and graceful shutdown.
API keys
Per-environment keys, rotation, and troubleshooting.
withWaniwani reference
All options for the server wrapper.
Build a flow
Multi-turn, stateful MCP tools.