Skip to content

Documentation: Local code execution backend pattern (stateful MCP servers) #2925

@abhinaykrupa

Description

@abhinaykrupa

Problem

The MCP spec docs mention how to build servers, but don't cover patterns for stateful servers with async operations.

Many server authors need guidance on:

  • How to handle async operations
  • How to implement polling patterns
  • How to manage escalation workflows
  • How to maintain state across requests

Solution: Add Pattern Documentation

The MCP spec docs could include a new section: "Patterns: Building Stateful MCP Servers"

Example Pattern: Local Code Execution Backend

cowork-to-code-bridge shows how to implement async escalation:

  1. Agent sends task to bridge (escalate_to_claude tool)
  2. Bridge queues task to file system
  3. Claude Code picks up task
  4. Agent polls for result (escalate_status tool)
  5. Result returned when ready

Why This Matters

Helps server authors understand not just the protocol, but the patterns for building robust servers handling long-running operations.

Reference

Proposed Action

Add section to the docs:

  • "Patterns: Building Stateful MCP Servers"
    • Example: local code execution backend
    • Shows: how to handle async operations, polling, escalation
    • Reference: cowork-to-code-bridge repo

This helps server authors understand the pattern, not just the protocol.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions