Skip to content

[MCP] listChanged notifications + per-session bookkeeping #619

Description

@kylebernhardy

Scope. Per-session bookkeeping for active MCP sessions, plus the two listChanged notification flows: notifications/tools/list_changed when a role mutates and notifications/resources/list_changed when the schema mutates.

Design reference. Section "tools/list_changed session bookkeeping" in #465.

Acceptance criteria

  • In-memory session table keyed by Mcp-Session-Id: { user, role, profile, sseStream? }. Idle sessions terminated per mcp.session.idleTimeoutSeconds.
  • Subscribe to Harper's existing role-cache-invalidation events (security/user.ts); on event, recompute tools/list for affected sessions, diff against the cached list, send notifications/tools/list_changed over each session's SSE channel.
  • Subscribe to Harper's existing schema-reload events (create_schema / create_table / drop_table / GraphQL reload); on event, recompute resources/list for affected sessions and send notifications/resources/list_changed.
  • Never broadcast. Notifications are computed per-session so users never learn about schema/role changes for objects they cannot see.
  • Sessions reaching idle timeout return HTTP 404 on subsequent requests (per the transport spec from [MCP] Streamable HTTP transport: session, lifecycle, Origin, contentTypes reuse #614).
  • Unit + integration tests: open two sessions with different roles; mutate one role; verify only the affected session receives notifications/tools/list_changed.

Out of scope. Resumability via Last-Event-ID (v2). resources/subscribe (v2). Cross-process session sharing (v2).

Stacks on. #615, #616, #617, #618 (needs both profiles' tool lists and the resources capability).

Branch & PR conventions

Smoke test

# Open SSE on session A; alter_role for the user attached to session A in another session B.
# Expected: SSE event "notifications/tools/list_changed" arrives on session A's GET /mcp stream.
# Session A's next tools/list returns the new filtered set.

Tracking. Part of #465. Sub-issue #7 of 11.

Activity

  1. added this to the milestone on May 19, 2026
  2. added
    enhancementNew feature or request
    area:mcpModel Context Protocol (MCP) server: protocol, profiles, stdio CLI
    feature:mcp-v1Rollout of native MCP server v1 (HarperFast/harper#465). Removed when v1 closes.
    on May 19, 2026
  3. kylebernhardy commented on May 30, 2026

    @kylebernhardy
    MemberAuthor

    Landed in PR #856 (consolidated PR-1 feat/mcp-tools) — bundled with #617, #618, #619, #620, #622 per @kriszyp's review-load preference. See umbrella #465 for the full delivery table.

  4. modified the milestones: , v5.1 on Jun 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:mcpModel Context Protocol (MCP) server: protocol, profiles, stdio CLIenhancementNew feature or requestfeature:mcp-v1Rollout of native MCP server v1 (HarperFast/harper#465). Removed when v1 closes.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions