Public: anyone can read this; the crew can change it.
MCP `sessions` lists the caller's sign-ins #5159
MCP now has a sessions tool, placed right after access. test/mcp-sessions.test.ts, test/mcp.test.ts and test/mcp-size.test.ts pass (42 tests). I didn't get a usable tsc run: it failed because the bun type definitions weren't found, so the type check is unverified here.
stopped parked by the crew deploy 8b78962
2 earlier comments · 1 event
MCP now has a sessions tool, placed right after access. test/mcp-sessions.test.ts, test/mcp.test.ts and test/mcp-size.test.ts pass (42 tests). I didn't get a usable tsc run: it failed because the bun type definitions weren't found, so the type check is unverified here.
- Tool:
sessionstakes{ username? }, defaulting to the caller. It callsaccountSignIns, the same function behindGET /api/v1/users/:username/signins. - Rules: a token below admin scope gets
forbidden, as the route refuses it. A stranger naming another person, or anyone naming an admin or an agent, getsnot_found. The forge's owner can look up any person. - Answer:
{ tokens, sessions, says }, with the same fields the route returns (ids, created, last seen, expires; no secrets). The description is one short sentence. - Docs and tests:
docs/MCP.mdhas asessionsrow. It sits besidepromptsbecause the file has noaccessrow.test/mcp.test.tsnow listssessionsin the expected tool order.test/mcp-sessions.test.tscovers three cases:- A person with two sessions sees both, and no secret appears in the answer.
- A stranger naming another person gets
not_found, and the route returns 404 for the same request. - The owner sees a person's sign-ins, and an
rwtoken is refused.
Left out:
- The route returns no device or place, so the tool doesn't either; those fields don't exist yet.
currentis always false over MCP, because there is no browser cookie to compare against.- Unlike the route, the tool doesn't accept a password or browser session. MCP is token-only, so an admin-scope token is the only way in.
I did not run the rest of the suite, so I haven't checked whether main is red anywhere.
🤖 Generated with Claude Code
I made no code change this turn. The failures look unrelated to this pull, so I didn't fix anything.
- Failing tests:
forge-degraded,restore-card,sizes-api,view-source,signin-timing,settings-repo-timingandtelemetry-reads-timingall pass here, 43 tests with none failing. - Pull's own tests:
mcp-sessionsandmcppass too, 41 tests. The pull only adds thesessionslisting insrc/http/mcp.ts, with its docs and tests. - What the log shows: shard 25 failed with a string of unnamed failures. Shards 22, 23 and 27 exited 143, meaning they were killed. That points to load or a shard-level problem on the check machine, not a defect in this pull.
- Not checked: the type check didn't run.
bun x tsc --noEmitstops because it can't find thebuntype definitions, and I did not runbun installfirst. - Push: nothing new is committed, so a plain
git pushhas nothing to send. The pull needs the check re-run on the same commit (8b789621).
Pull description: MCP sessions lists the caller's sign-ins and applies the same rules as the API. I documented it in docs/MCP.md and tested it in test/mcp-sessions.test.ts, with test/mcp.test.ts updated. I added no dependencies. Try it by calling the MCP sessions tool with a signed-in token.
Closed by the crew: main moved under it 2 times and the branch could not be brought up to date. Conflicting files: docs/MCP.md, src/http/mcp.ts.
MCP now has a
sessionstool, placed right afteraccess.test/mcp-sessions.test.ts,test/mcp.test.tsandtest/mcp-size.test.tspass (42 tests). I didn't get a usabletscrun: it failed because thebuntype definitions weren't found, so the type check is unverified here.sessionstakes{ username? }, defaulting to the caller. It callsaccountSignIns, the same function behindGET /api/v1/users/:username/signins.forbidden, as the route refuses it. A stranger naming another person, or anyone naming an admin or an agent, getsnot_found. The forge's owner can look up any person.{ tokens, sessions, says }, with the same fields the route returns (ids, created, last seen, expires; no secrets). The description is one short sentence.docs/MCP.mdhas asessionsrow. It sits besidepromptsbecause the file has noaccessrow.test/mcp.test.tsnow listssessionsin the expected tool order.test/mcp-sessions.test.tscovers three cases:not_found, and the route returns 404 for the same request.rwtoken is refused.Left out:
currentis always false over MCP, because there is no browser cookie to compare against.I did not run the rest of the suite, so I haven't checked whether main is red anywhere.
🤖 Generated with Claude Code
Closes #5147