agent/php/tests/Feature/Mcp
Snider 599544010e feat(agent/mcp): McpContext::getScopes() + hasScope() (HIGH)
McpContext exposes the authenticated session's authorisation scopes
via getScopes(): array and hasScope(string): bool.

Resolution order:
1. Explicit scope source passed to constructor
2. Session-like object linked to an API key
3. Authenticated Laravel request context (mcp_workspace_context,
   agent_api_key, api_key)
4. Empty array (default) — never null

Dedupes scope strings, normalises separators in hasScope() matching.

Closes the OFM MCP tool gap where scope-gated tools currently return
empty/incorrect handling. No call-site stubs found needing update in
this worktree — call sites pick up the new method directly.

Pest covers: session scopes returned, hasScope present/missing, empty
session defaults to [], request-context regression against real MCP
auth shape.

Co-authored-by: Codex <noreply@openai.com>
Closes tasks.lthn.sh/view.php?id=1014
2026-04-25 19:04:35 +01:00
..
Console feat(mcp): implement §8 Console Commands (3 commands) (#853) 2026-04-25 05:27:48 +01:00
Middleware feat(mcp): implement §4 Middleware (5 middleware classes) (#852) 2026-04-25 05:25:09 +01:00
Resources feat(mcp): implement extended RFC services + transport (#842) 2026-04-25 05:50:16 +01:00
Services feat(mcp): implement extended RFC services + transport (#842) 2026-04-25 05:50:16 +01:00
Support feat(mcp): implement extended RFC services + transport (#842) 2026-04-25 05:50:16 +01:00
Transport feat(agent/mcp): McpContext::getScopes() + hasScope() (HIGH) 2026-04-25 19:04:35 +01:00
BrainSchemaOrgTest.php fix(agent/brain): batch — org maxLength + retry semantics + forget index cleanup 2026-04-25 14:55:40 +01:00
BrainSmokeTest.php test(brain): partial MCP smoke-test for remember/list/forget 2026-04-23 18:57:22 +01:00
SessionArtifactTest.php fix(mcp): SessionArtifact passes description as metadata array 2026-04-23 18:10:21 +01:00