Repository navigation
Expose Party Register and Retrieve as MCP tools, with the same policies, idempotency and Problem Details as HTTP (roadmap 1.16) - #136
Merged
Conversation
…rence Data Directory Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…es, idempotency and Problem Details as HTTP (roadmap 1.16) - party_reference_data_directory_register (command, required idempotencyKey) and party_reference_data_directory_retrieve (query, read-only) in the Party folder of RimBank.Mcp, dispatching the same RegisterParty and RetrievePartyReferenceDataDirectoryEntry through IMessageBus. - Results mirror the HTTP bodies with BIAN names plus version (the ETag), proven equal by parity tests. - [ToolOperation(OperationId)] and RimBank's own call and list filters apply the operation's policy: a caller without the scope does not see the tool and gets shared.forbidden, because the SDK's [Authorize] filter answers with a JSON-RPC error no filter can map (ADR 0039). - Tool catalog guard: the tools match the implemented operations, minus the 11 that 1.17 adds. - ADR 0039; ADR 0021, 0022 and 0038 notes; tech-stack, CONTRIBUTING and roadmap updated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Roadmap phase
Phase: 1.16 MCP adapter: Register & Retrieve
Planning package:
specs/2026-11-09-party-mcp-register-retrieve/Closes #41
Summary
AI agents can now register a party and retrieve its directory entry over MCP. They get the same business rules, authorisation, idempotency and errors as HTTP callers (mission principles 6 and 8). These are the first context tools on
/mcp.Tools (CQRS split)
party_reference_data_directory_registeris a command.RegisterPartyasPOST /PartyReferenceDataDirectory/Registerand answers from its acknowledgement.idempotencyKey. The existing idempotency policy replays the first answer for the same key and arguments, and answers 409 for other arguments.party_reference_data_directory_retrieveis a query (readOnly).RetrievePartyReferenceDataDirectoryEntryand reads only the existing inline view.partyTypeandidempotencyKey, orpartyReferenceDataDirectoryEntryId. BIAN's ignored Register fields are not offered to agents.version: the entry's stream version, which HTTP sends asETag. 1.17's Update tools need it asexpectedVersion.RimBank.Mcp(ADR 0025), which now referencesRimBank.Coreand Wolverine for its context folders..Mcpstill never references.Api, so parity tests prove the mirrored results are equal.Authorisation: a change from the plan
[Authorize(Policy = …)]on tools. With MCP SDK 2.3.1 this cannot give Problem Details:-32600;[Authorize]tool fails.[ToolOperation(OperationId)]instead. It names the same policy and scope as the endpoint'sRequireOperation.ToolAuthorizationFilterapplies it on two paths:isErrorresult withshared.forbidden(403), and nothing is dispatched or stored;tools/listhides the tool from that caller.Tool catalog guard (pulled forward from 1.17)
OperationPolicyCatalog, minus a named list of the 11 operations whose tools 1.17 adds.ADRs and docs
[ToolOperation]instead of[Authorize]).Definition of done
IdempotencyKey.TryCreate,PartyTypes.FromBianName,PartyReferenceDataDirectoryEntryId.TryCreate)..Subscriptions→.PublishedLanguagemcp-dependencies,shared-mcp-dependenciesandhttp-and-mcp-adapters-live-in-shared-projectshold with the new folder.isErrorwith the same Problem Details as HTTP, now includingshared.forbidden.PartyMcpParityTests. The other 11 operations come in 1.17, as listed in the catalog test.docs/adr/for any significant or BIAN-interpretation decision (ADR 0039)Validation
dotnet restore RimBank.slnx --locked-mode: OK. Lock files are updated for the new references, both runtimes ofRimBank.Architecture.Testsincluded.dotnet build RimBank.slnx -c Release: 0 warnings, 0 errors.dotnet test --solution RimBank.slnx -c Release --no-build: 2104 passed, 0 failed, 0 skipped.dotnet format RimBank.slnx --verify-no-changes: exit 0.New tests:
tests/RimBank.Host.Tests/Mcp/McpToolAuthorizationTests(fake module):shared.forbiddenwithinstance,traceIdand the same JSON as text, in both directions;tests/RimBank.Mcp.Tests/Party/PartyReferenceDataDirectory/(Testcontainers):RegisterPartyToolTests:party_registeredevent;partyType(400, with field errors);shared.tool-arguments-invalid);RetrievePartyReferenceDataDirectoryEntryToolTests:PartyToolCatalogTests:PartyMcpParityTests:versionequal to theETag;type,title,status,detail,errorCode,errors) for an invalid or blank party type, a reused key, a malformed or unknown id, and a missing scope.Manual MCP Inspector demo (in CONTRIBUTING "MCP"): not run. It was optional and not a merge gate in
validation.md.Review focus
[ToolOperation]instead of[Authorize](ADR 0039). It duplicates the SDK's list filtering in about 30 lines, in exchange for Problem Details on denial. Revisit if a later SDK lets a filter map its denial..Apiresponses, rather than relaxingmcp-dependencies. The parity tests are what stops drift.versionin the tool result next to the BIAN fields. There is no 304 on MCP.PartyToolCatalogTests. 1.17 should empty it.PostgresqlServeris copied fromRimBank.Api.TestsintoRimBank.Mcp.Tests. A shared fixture project could replace both later.🤖 Generated with Claude Code