Repository navigation
Expand file tree
/
Copy pathcontext7.json
More file actions
34 lines (34 loc) · 3.41 KB
/
Copy pathcontext7.json
File metadata and controls
34 lines (34 loc) · 3.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
{
"$schema": "https://context7.com/schema/context7.json",
"url": "https://context7.com/wakeshift/wakeshift-node",
"public_key": "pk_VQQuS8pdgK6PLLe6L8HXe",
"projectTitle": "Wakeshift SDK for TypeScript",
"description": "@wakeshift/sdk: let the tools of an MCP server subscribe the agent conversation calling them to the app's events, and emit; Wakeshift wakes each subscribed conversation (Claude Code, Codex, Cursor, ChatGPT and others). For @modelcontextprotocol/server 2.x and @modelcontextprotocol/sdk 1.x, with Mastra and tools-only (xmcp, hand-rolled JSON-RPC) adapters.",
"excludeFolders": [
"test",
"node_modules",
"dist"
],
"excludeFiles": [
"CHANGELOG.md",
"CONTRIBUTING.md",
"SECURITY.md"
],
"rules": [
"Create the client with new Wakeshift(), which reads WAKESHIFT_KEY and makes no network request; without a key it's disabled and every call still works. Never hard-code the key, commit it or log it.",
"Import z from \"zod\", not \"zod/v4\": the MCP SDK refuses a schema that mixes the two.",
"Define every event with wake.defineEvent at startup, before wake.attach. text is optional.",
"Register a tool that subscribes through the attachment: attached.registerTool(name, { description, inputSchema, subscribes: [event] }, async (args, ctx, call) => { await call.subscribe(event, args, { once: true }) }). It's the MCP SDK's own registerTool with subscribes added and call appended; leave inputSchema as it is.",
"Tools registered elsewhere (a low-level Server, server.tool, a generated catalog) are named in attach's wrap: { tool_name: [event] }, and subscribe with wake.currentCall().subscribe(...).",
"With createMcpHandler, call wake.attach inside the function that makes each server.",
"An event with neither personal, authorize nor public can be subscribed only by your own tools: keep that for IDs your tool mints; use personal for per-user things (emit's to comes from your own ownership records), authorize for shared resources, public only for streams anyone may watch.",
"When the caller names a resource, check they can see it before call.subscribe; subscribe before starting the work, or pass replay with once.",
"With sign-in, pass identify (returning { user } from a verified token) and requireUser: true.",
"builtinTools: { wait: true } turns on wakeshift_wait, off by default; only on a server whose requests may stay open 30 seconds or more.",
"Pass an id to event.emit when the source may retry (a webhook delivery ID), so a retried emit is delivered once.",
"Catch errors with isWakeshiftError(err, code); never log call.session, tokens or tool arguments, and use redactSecrets on text you log.",
"Write event descriptions as plain statements of what happened, not instructions to the agent.",
"Skip a tool's own polling or waiting only when call.wakes is true after call.subscribe; when the agent asked for a wait (wait_seconds), return at once only if call.shouldSkipWait(seconds) (call.wakes, and the wait reaches call.callLimit: Claude Code 60 s, Codex 300 s). Keep the subscription either way.",
"MCP Events clients (ChatGPT, OpenClaw, Mastra, opencode and others) are served by attach with nothing more to write, by webhook, poll and push (events/stream). Push is offered only where the transport can stream; pass push: false to attach when something in front of the server forces JSON answers (mcp-use 1.x's 2026-07-28 middleware, say)."
]
}