Skip to content

list: server instructions missing unless --no-oauth (regression of #76) #455

Closed

Description

@Strajk

Summary

Single-server mcporter list <server> no longer shows the server's instructions from the initialize response unless --no-oauth is passed. This affects both text and --json output. It's a regression of the feature from #76 (5d8e64d).

Reproduction

Minimal stdio server:

// /tmp/server.mjs
import readline from 'node:readline';
readline.createInterface({ input: process.stdin }).on('line', (line) => {
  const m = JSON.parse(line);
  if (m.id === undefined) return;
  const result = m.method === 'initialize'
    ? { protocolVersion: m.params.protocolVersion, capabilities: { tools: {} }, serverInfo: { name: 't', version: '1' }, instructions: 'HELLO-INSTRUCTIONS' }
    : m.method === 'tools/list' ? { tools: [{ name: 'ping', inputSchema: { type: 'object' } }] } : {};
  process.stdout.write(JSON.stringify({ jsonrpc: '2.0', id: m.id, result }) + '\n');
});
mcporter list --stdio "node /tmp/server.mjs" --json | jq .instructions             # null
mcporter list --stdio "node /tmp/server.mjs" --json --no-oauth | jq .instructions  # "HELLO-INSTRUCTIONS"
Version text text --no-oauth --json --json --no-oauth
0.13.12 missing shown missing shown
0.15.0 missing shown missing shown
main @ 5362d60 missing shown missing shown

The same happens with a config-defined server and with an empty HOME. No daemon or keep-alive is involved.

Cause

  • src/cli/list-command.ts (~215-220 and ~289-294) loads tool metadata with autoAuthorize: false, and disableOAuth is false unless --no-oauth is passed.
  • In src/runtime.ts (~268-272), that takes the legacy no-authorize path: maxOAuthAttempts: 0, skipCache: true. The context is closed after listing.
  • loadServerInstructions then calls runtime.getInstructions → connection-cache.ts getInstructions (~73-88). That only checks cached or active entries, so it returns undefined (~line 77).

getConnectionInfo doesn't have this problem because it falls back to the lastConnectionInfo snapshot stored on every connect (~line 334). Instructions have no such fallback. The list tests mock runtime.getInstructions, so they don't catch it.

Suggested fix

Store a lastInstructions snapshot next to lastConnectionInfo in connection-cache.ts. Set it on connect, clear it in supersedeDefinition, and return it from getInstructions when there's no cached entry. With that patch on main, all four combinations show the instructions, and the runtime-cache, cli-list-modes, cli-list-formatting and keep-alive-runtime tests pass. A non-mocked regression test (real stdio fixture through list, without --no-oauth) would guard it.

Workaround for now: mcporter list <server> --no-oauth.

Activity

  1. added
    clawsweeper:intake:bugPreliminary submission classification; full source review pending.
    P2Normal priority bug or improvement with limited blast radius.
    clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.
    clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.
    clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.
    impact:ux-frictionUser-facing flow adds avoidable confusion or support burden without fully blocking progress.
    issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.
    no-staleExempts this issue from stale automation.
    and removed
    clawsweeper:intake:bugPreliminary submission classification; full source review pending.
    on Oct 19, 2026
  2. clawsweeper commented on Oct 19, 2026

    @clawsweeper
    Contributor

    Codex review: this still needs some work.

    Summary
    Current main still loses instructions after uncached discovery, and an open fixing PR owns the repair.

    Reproducibility: Current source establishes the failure for a fresh runtime after uncached discovery; Strajk supplies a minimal stdio reproduction corroborated by contributor output in the linked PR, but this review executed no code or tests.

    Regression provenance
    Possible regression — suspected (reviewed change). No predecessor PR is attributed.

    Root-cause cluster
    Relationship: canonical
    Canonical: #455
    Summary: This issue owns instruction loss after uncached discovery, with an open PR supplying the focused repair.

    Members:

    Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

    Next step
    Review #456 and keep this issue open until its fixing PR merges.

    Review details

    Best possible solution:

    Retain initialization instructions through uncached discovery while preserving authorization behavior, connection cleanup, and definition invalidation.

    Do we have a high-confidence way to reproduce the issue?

    Current source establishes the failure for a fresh runtime after uncached discovery; Strajk supplies a minimal stdio reproduction corroborated by contributor output in the linked PR, but this review executed no code or tests.

    Is this the best way to solve the issue?

    The retained snapshot in #456 follows the existing connection-info pattern and addresses the lifecycle gap without reconnecting or changing OAuth policy.

    AGENTS.md: found and applied where relevant.

    Codex review notes: model internal, reasoning medium; reviewed against 5362d60d2e17.

    Label changes

    Label changes:

    No label changes.

    Label justifications:

    • P2: Named listings omit documented server guidance, but tool discovery remains usable and --no-oauth provides a workaround.
    • impact:ux-friction: Users and agents must discover an unrelated-looking OAuth flag to retrieve server initialization instructions.
    Evidence reviewed

    What I checked:

    How this review workflow works
    • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
    • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
    • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
    • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
    • Maintainers can also comment @clawsweeper review to request a fresh review only.
    • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge; those execution lanes are retired.
    • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

    Reviewed October 20, 2026, 3:46 PM ET / 19:46 UTC.

  3. added
    clawsweeper:intake:bugPreliminary submission classification; full source review pending.
    and removed
    clawsweeper:intake:bugPreliminary submission classification; full source review pending.
    on Oct 19, 2026
  4. 14 remaining items

  5. added
    clawsweeper:intake:bugPreliminary submission classification; full source review pending.
    and removed
    clawsweeper:intake:bugPreliminary submission classification; full source review pending.
    on Oct 20, 2026
  6. added a commit that references this issue on Oct 20, 2026
    845961a
  7. steipete commented on Oct 20, 2026

    @steipete
    Collaborator

    Fixed in #456, merged as 845961a. Named text and JSON listings now retain server instructions after uncached discovery, with active-connection precedence and cancellation/definition invalidation preserved.

    I reproduced five failures on main: the cache regression plus real CLI listings against legacy and modern servers over both stdio and HTTP. With the fix, all 2,275 tests, formatting, lint, typechecking, and installed npm package/CLI/library/OAuth checks passed. Coverage also checks that cancelled setup cannot retain instructions and that a subsequent connection with no instructions clears the snapshot.

    Exact-head CI passed on Linux/Node 24, Linux/Node 26, macOS, and Windows. Thanks @Strajk for the reproduction and @KrasimirKralev for the repair.

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

    P2Normal priority bug or improvement with limited blast radius.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:ux-frictionUser-facing flow adds avoidable confusion or support burden without fully blocking progress.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions