Skip to content

Expose every remaining Party operation as an MCP tool, taking the BIAN body as request and an expected version, with HTTP parity (roadmap 1.17) - #137

Merged
KsiProgramming merged 8 commits into
mainfrom
plan/1.17-party-mcp-remaining-tools
Nov 9, 2026
Merged

KsiProgramming merged 8 commits into
mainfrom
plan/1.17-party-mcp-remaining-tools

Conversation

@KsiProgramming

Copy link
Copy Markdown
Owner

Roadmap phase

Phase: 1.17 MCP adapter: remaining operations
Planning package: specs/2026-11-09-party-mcp-remaining-tools/

Closes #42

Summary

Every Party Reference Data Directory operation RimBank implements is now an MCP tool as well as an HTTP endpoint, which completes Stage 1's HTTP and MCP parity (mission principle 6). The 11 operations that 1.16 left out get their tool, and the tool-list guard no longer has an allow-list.

Commands (write side), 7 new tools. Each dispatches the existing core command through IMessageBus and answers from its acknowledgement:

  • party_reference_data_directory_update (UpdatePartyReferenceDataDirectoryEntry)
  • …_update_demographics and …_exchange_demographics (UpdateDemographics, ExchangeDemographics)
  • …_update_reference (UpdatePartyReference)
  • …_register_associations and …_update_associations (RegisterPartyAssociation, UpdatePartyAssociation)
  • …_update_bank_relations (UpdateBankRelations)

Queries (read side), 4 new tools. …_retrieve_demographics, …_retrieve_reference and …_retrieve_bank_relations read the existing inline entry view. …_retrieve_associations reads the existing inline association view. No read model is added or changed.

Arguments (ADR 0040, amends ADR 0039 and tech-stack §6).

  • One request body. A command takes its BIAN request body as one request object with BIAN's property names, so it is the same JSON as HTTP. Its mirror in RimBank.Mcp only translates the JSON into the core inputs HTTP already uses. Rules and errors stay in RimBank.Core.
  • Same partial-update rules as HTTP:
    • a field left out keeps its value;
    • an empty value clears it;
    • an address or document is replaced whole;
    • an unrecorded BIAN part is refused by its path.
  • Required expectedVersion. Every Update and Exchange tool requires it: MCP's If-Match (ADR 0027).
  • Associations version. The Associations tools use the association's own stream version, because an association is its own aggregate (ADR 0033).
  • Flat parameters. Ids and idempotencyKey stay flat camelCase parameters. The Control Record's Register keeps its flat partyType.

Docs:

  • ADR 0040;
  • ADR 0039's follow-up note;
  • tech-stack §6 (Naming);
  • CONTRIBUTING "MCP": arguments, an Update example and the tests;
  • the roadmap tick.

HTTP description fix. The OpenAPI description of PUT …/Reference/{referenceid}/Update still said the corporate and officer references were refused "until roadmap phase 1.21". It now states the rules 1.21 shipped (ADR 0034), as the new MCP tool does. Only the text changes, not the behaviour.

Definition of done

  • Working code that follows tech-stack.md (naming, dependency rules, business-only names in core). Tools live in src/RimBank.Mcp/Party/PartyReferenceDataDirectory/<BQ>/, namespace RimBank.Party.PartyReferenceDataDirectory.Mcp.
  • Commands and queries kept separate as described in tech-stack.md §8: command tools answer from acknowledgements, Retrieve tools only from the inline views
  • Unit tests for domain and application logic, including a projection test (Given events → Then view) for every new or changed read model, plus integration tests (Testcontainers) for any adapter touched. The core and read models are unchanged (N/A for projection tests). The MCP adapter has Testcontainers tool tests and parity tests for every new tool.
  • Every new or changed read model can be rebuilt from the context's own event store. N/A: no read model is added or changed.
  • Contexts stay loosely coupled as described in tech-stack.md §8.4. No new cross-context reference; .Mcp still never references .Api.
  • Architecture tests green
  • Every new error path returns RFC 9457 Problem Details (on both HTTP and MCP). Parity tests compare the Problem Details members of each operation's errors.
  • Every new BIAN operation exposed over HTTP is also exposed as an MCP tool, with a parity test. All 11 remaining operations; the tool list now equals the implemented operations (13 tools).
  • GitHub Actions CI green (build, test, format, CodeQL)
  • An ADR in docs/adr/ for any significant or BIAN-interpretation decision (ADR 0040)
  • The roadmap checkbox ticked in the same PR

Validation

Local, on the branch:

  • dotnet restore RimBank.slnx --locked-mode: OK (locked mode)
  • dotnet build RimBank.slnx -c Release: 0 warnings, 0 errors
  • dotnet test --solution RimBank.slnx -c Release --no-build: 2187 passed, 0 failed, 0 skipped (after the OpenAPI text fix, Api.Tests 313 and Conformance.Tests 58 rerun green)
  • dotnet format RimBank.slnx --verify-no-changes: exit 0

From validation.md:

  • Tool-list guard (PartyToolCatalogTests).
    • The tools are exactly the OperationPolicyCatalog operations (13).
    • Each tool has its policy and the annotations of its kind.
    • Every command requires idempotencyKey, Update and Exchange tools also require expectedVersion, a body-carrying command requires request, and queries take only ids.
    • The request schema of Reference Update is nested with BIAN names.
  • Parity per operation. Tool parity tests for the entry Update, Demographics, BankRelations, Associations and Reference check the success body against HTTP, with version equal to the ETag. They also check that the errors give the same Problem Details: validation, refused BIAN part, wrong-type or unregistered reference, malformed and unknown id, and stale version. The Reference checks cover every recorded person field and every organisation-only field.
  • Version round-trip (VersionRoundTripTests).
    • Retrieve's version updates once, and the old version is then a 409 party.version-conflict.
    • The answer's version lets the next update through.
    • The same key and request replay the first answer without a second event.
    • A missing expectedVersion is shared.tool-arguments-invalid and stores nothing.
  • Authorisation. A read-scope-only caller lists only the 5 Retrieve tools. Its call to a command is shared.forbidden (403), and nothing is stored.
  • Manual MCP Inspector demo. Not run: it is optional in validation.md. The steps are in CONTRIBUTING "MCP".

Review focus

  • Missing version. On MCP a missing expectedVersion is a 400 shared.tool-arguments-invalid, where HTTP answers 428 shared.if-match-required. The SDK rejects a missing required argument before the tool runs. ADR 0040 records this as the one known HTTP/MCP difference.
  • Model duplication. The .Mcp request and response mirrors are copies of the .Api models with the namespace changed. The results add version. It doubles the model code, as ADR 0039 chose; the parity tests are the guard. Is that guard enough, or should a shared model be revisited later?
  • Register's flat argument. The Control Record's Register keeps its flat partyType (1.16), while the Associations Register takes request. Consistent enough?

🤖 Generated with Claude Code

KsiProgramming and others added 8 commits November 9, 2026 12:13
…rty Reference Data Directory

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…its request and an expected version (roadmap 1.17, group 1)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ols, with HTTP parity (roadmap 1.17, group 2)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… HTTP parity (roadmap 1.17, group 3)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ols, with the association's own version and HTTP parity (roadmap 1.17, group 4)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ry BIAN field it records and HTTP parity (roadmap 1.17, group 5)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ch tool's arguments by kind, and record the request and expectedVersion conventions in ADR 0040 (roadmap 1.17)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ecorded since 1.21 in its OpenAPI text (roadmap 1.17)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@KsiProgramming KsiProgramming added stage:1 Roadmap Stage 1: Party Reference Data Directory (first vertical slice) type:feature New business or platform behaviour area:mcp Model Context Protocol adapters and tools context:party Party / Party Reference Data Directory labels Nov 9, 2026
@KsiProgramming KsiProgramming self-assigned this Nov 9, 2026
@KsiProgramming
KsiProgramming merged commit 53f0723 into main Nov 9, 2026
0 of 3 checks passed
@KsiProgramming
KsiProgramming deleted the plan/1.17-party-mcp-remaining-tools branch November 10, 2026 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:mcp Model Context Protocol adapters and tools context:party Party / Party Reference Data Directory stage:1 Roadmap Stage 1: Party Reference Data Directory (first vertical slice) type:feature New business or platform behaviour

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1.17 MCP adapter: remaining operations

1 participant