Repository navigation
Expand file tree
/
Copy pathcontext7.json
More file actions
30 lines (30 loc) · 3.26 KB
/
Copy pathcontext7.json
File metadata and controls
30 lines (30 loc) · 3.26 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
{
"$schema": "https://context7.com/schema/context7.json",
"url": "https://context7.com/wakeshift/wakeshift-python",
"public_key": "pk_VQQuS8pdgK6PLLe6L8HXe",
"projectTitle": "Wakeshift SDK for Python",
"description": "wakeshift (PyPI): wake the AI agents that use your MCP server (Claude Code, Codex, Cursor, ChatGPT and others) when something they're waiting for happens. Define events, register the tools that subscribe, and emit. For the official MCP Python SDK (MCPServer or the low-level Server) and FastMCP 4.",
"excludeFolders": [
"tests"
],
"excludeFiles": [
"CHANGELOG.md",
"CONTRIBUTING.md",
"SECURITY.md"
],
"rules": [
"Install wakeshift[mcp] for the official MCP Python SDK, or wakeshift[fastmcp] for FastMCP 4. On FastMCP 2.12+ or 3.x, install plain wakeshift and never add [mcp]: attach works there, and native MCP Events need FastMCP 4.",
"Create the client with Wakeshift(), which reads WAKESHIFT_KEY and does no I/O; without a key it's a disabled no-op, so no try/except or None checks are needed. Never hard-code the key or commit it.",
"Define every event with wake.define_event at startup, before calling wake.attach.",
"Register tools that subscribe with @attached.tool(subscribes=[event]) and a parameter annotated ToolCall; call await call.subscribe(event, args, once=True) before starting the work. Leave the tool's own arguments as they are: Wakeshift adds its arguments in tools/list.",
"Tools registered elsewhere (a low-level Server's handlers, a generated catalog) go in wake.attach(server, wrap={\"tool_name\": [event]}) and subscribe with wake.current_call().subscribe(...).",
"An event with neither personal, authorize nor public can be subscribed only by your own tools: keep that default for IDs your tool mints, use personal=True for per-user things, authorize=f for shared resources, and public=True only for streams anyone may watch. Never decide authorize on subscriber.client or subscriber.native.",
"With sign-in, pass identify (it gets a wakeshift.Request; return Identity(user=...) from the verified r.token) and require_user=True. Take a personal event's to= from your own ownership records, never from the subscriber list.",
"builtin_tools={\"wait\": True} turns on wakeshift_wait; only where a request may stay open 30 seconds or more.",
"Never log call.session, tokens or tool arguments; use wakeshift.redact_secrets on text you log yourself.",
"From sync code, use asyncio.run(event.emit(...)) or asgiref's async_to_sync(event.emit); asyncio only.",
"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.should_skip_wait(seconds) (call.wakes, and the wait reaches call.call_limit: 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 on mcp 2.x hosts with nothing more to write, by webhook, poll and push (events/stream). Push is offered only where the transport can stream (not json_response=True); pass push=False to attach when something in front of the server forces JSON answers."
]
}