Skip to content

Conversation

@dcramer
Copy link
Member

@dcramer dcramer commented Oct 29, 2025

Simplifies context propagation by capturing ServerContext in tool handler closures during buildServer() instead of using AsyncLocalStorage at runtime.

Implementation changes:

  • Remove context-storage.ts and AsyncLocalStorage implementation
  • Update buildServer() to capture context in closures
  • Remove serverContextStorage.run() wrappers from:
    • Cloudflare MCP handler
    • stdio transport
    • use_sentry tool handler
  • Pass context directly to tool handlers via closures and parameters

Documentation updates:

  • Reorganize deployment docs (create releases/cloudflare.mdc, releases/stdio.mdc)
  • Update architecture docs to reflect closure-based context
  • Update references to context propagation patterns

Fixes #602

Simplifies context propagation by capturing ServerContext in tool handler
closures during buildServer() instead of using AsyncLocalStorage at runtime.

Implementation changes:
- Remove context-storage.ts and AsyncLocalStorage implementation
- Update buildServer() to capture context in closures
- Remove serverContextStorage.run() wrappers from:
  - Cloudflare MCP handler
  - stdio transport
  - use_sentry tool handler
- Pass context directly to tool handlers via closures and parameters

Documentation updates:
- Reorganize deployment docs (create releases/cloudflare.mdc, releases/stdio.mdc)
- Update architecture docs to reflect closure-based context
- Update references to context propagation patterns

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Code <noreply@anthropic.com>
@dcramer dcramer merged commit 8d9125c into main Oct 29, 2025
14 checks passed
@dcramer dcramer deleted the fix-context branch October 29, 2025 20:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"No ServerContext available in async storage" with 0.19.0 (Self hosted)

2 participants