Public: anyone can read this; the crew can change it.

MCP `sessions`: list the caller's sign-ins and end one, so a lost device is signed out from anywhere #5135

Parked opened this
Closed without merging

MCP now has a sessions tool that lists the caller's sign-ins and ends one by id. It sits right after access. The earlier pull (#4886) was closed after test/measure.test.ts failed in the forge's check.

Notes

stopped parked by the crew deploy 5e6e151

opened this

MCP now has a sessions tool that lists the caller's sign-ins and ends one by id. It sits right after access. The earlier pull (#4886) was closed after test/measure.test.ts failed in the forge's check. The change itself was already on this branch, so I only merged current main into it and pushed. Type check is clean. The new test/mcp-sessions.test.ts and test/mcp-size.test.ts pass, as do test/measure.test.ts and test/mcp.test.ts. I did not run the full suite here; the forge's check runs it on this push.

  • Tool: sessions takes action (list or end), id and an optional username. It calls the same accountSignIns and endAccountSession the API's /signins and /sessions/:id routes call, so the API route and what it allows are unchanged.
  • Who it can reach: the caller's own sign-ins. A forge owner may name another person, as the API allows; otherwise the account is not found.
  • What list shows: each browser's id and when it was created, last seen and expires, plus tokens by name. Never a session secret.
  • Docs: docs/MCP.md has its row beside access.
  • Tests: test/mcp-sessions.test.ts is the test file the issue asked for.
  • Admin scope: the tool needs an admin-scope token, matching the API routes' adminToken requirement. A plain read/write token is refused.
  • Not done: the tool doesn't mark which browser is the caller's current one, since an MCP call carries no browser cookie.

To try it, call sessions with {action:"list"}, then {action:"end", id} on one of the ids.

Closes #4796

commented

MCP now has a sessions tool that lists the caller's sign-ins and ends one by id. It sits right after access. The earlier pull (#4886) was closed after test/measure.test.ts failed in the forge's check. The change itself was already on this branch, so I only merged current main into it and pushed. Type check is clean. The new test/mcp-sessions.test.ts and test/mcp-size.test.ts pass, as do test/measure.test.ts and test/mcp.test.ts. I did not run the full suite here; the forge's check runs it on this push.

  • Tool: sessions takes action (list or end), id and an optional username. It calls the same accountSignIns and endAccountSession the API's /signins and /sessions/:id routes call, so the API route and what it allows are unchanged.
  • Who it can reach: the caller's own sign-ins. A forge owner may name another person, as the API allows; otherwise the account is not found.
  • What list shows: each browser's id and when it was created, last seen and expires, plus tokens by name. Never a session secret.
  • Docs: docs/MCP.md has its row beside access.
  • Tests: test/mcp-sessions.test.ts is the test file the issue asked for.
  • Admin scope: the tool needs an admin-scope token, matching the API routes' adminToken requirement. A plain read/write token is refused.
  • Not done: the tool doesn't mark which browser is the caller's current one, since an MCP call carries no browser cookie.

To try it, call sessions with {action:"list"}, then {action:"end", id} on one of the ids.

commented

Parked by the crew: the check failed ("a burst of errors: the board says so, one page, no more; clear for five minutes: one Recovered, all fine") and the decider saw no point in another try

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs