Skip to content

Replace stub READMEs with real, runnable examples - #2

Merged
ifsantana merged 3 commits into
mainfrom
feat/1-real-examples-mcp-settlement
Jul 9, 2026
Merged

Replace stub READMEs with real, runnable examples#2
ifsantana merged 3 commits into
mainfrom
feat/1-real-examples-mcp-settlement

Conversation

@ifsantana

Copy link
Copy Markdown
Contributor

Summary

  • settlement/PendingSettlementExample.kt replaces the doc-only stub: registers a settlement expectation, posts the matching on-chain transaction, forces the match via reconcileBatch, confirms SETTLED, and also demonstrates a second registration -> cancelSettlement -> CANCELLED.
  • mcp/McpAgentWorkflowExample.kt replaces the doc-only stub: a real MCP client (official io.modelcontextprotocol.sdk:mcp, pinned to the same version the main repo's server pulls in via spring-ai-bom) connecting over SSE, minting an agent-scoped API key + a permissive policy rule, then driving postTransaction -> reconcileBatch -> rollbackWorkflow -> getAgentAuditLog.
  • ExampleAccounts.kt and ReconciliationExample.kt now call the real IdemClient.createAccount/reconcileBatch SDK methods added in idem-finance/idem#234 instead of raw httpClient workarounds.
  • New support/ExampleAdmin.kt for the one-time ADMIN-scope setup (minting the agent key, creating the policy rule) — kept as raw HTTP by design, since these aren't ledger data-plane operations the SDK should expose.
  • Bumped idem-sdk.version to 0.0.12-test, added the MCP client dependency, updated README.md's example table and run instructions.

Closes #1.

Test plan

  • ./mvnw compile — BUILD SUCCESS
  • docker compose up -d + dev,seed one-off for a real API key
  • Ran all 5 examples live via exec:java, confirmed real (non-mocked) results:
    • 01/02: unaffected, still post real transactions
    • 03: real PENDING -> SETTLED and PENDING -> CANCELLED transitions
    • 04: real UNMATCHED outcome via the new reconcileBatch SDK method
    • 05: real SSE MCP session — COMMITTED transaction, ROLLED_BACK rollback, 4 real HMAC-signed audit events
  • git status/git diff reviewed before commit — no .env/real API key staged

- settlement/PendingSettlementExample.kt: registers a settlement expectation,
  posts the matching on-chain transaction, forces the match via
  reconcileBatch, confirms SETTLED, and demonstrates the CANCELLED path.
- mcp/McpAgentWorkflowExample.kt: a real MCP client (official
  io.modelcontextprotocol.sdk:mcp) over SSE, mints an agent-scoped API key +
  policy rule, and drives postTransaction -> reconcileBatch -> rollbackWorkflow
  -> getAgentAuditLog against the live server.
- ExampleAccounts.kt / ReconciliationExample.kt now call the real
  IdemClient.createAccount / reconcileBatch SDK methods (idem-finance/idem#234)
  instead of raw httpClient workarounds.
- Bumped idem-sdk.version to 0.0.12-test; added the MCP client dependency.

All 5 examples verified live against docker-compose (real transaction IDs,
real SETTLED/CANCELLED settlement transitions, real HMAC-signed audit trail).

Closes #1.
@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

ifsantana added 2 commits July 8, 2026 20:42
No lint/coverage gates yet — this repo has no test source set today, just
compileable examples. Runs ./mvnw verify on push/PR to main so it's ready
to catch regressions as soon as tests get added.
mvnw was tracked as mode 100644 — fine on Windows (where Git's fileMode
tracking is typically off and the file still runs via its .cmd counterpart
or an IDE's own Maven wrapper handling), but GitHub Actions' ubuntu-latest
runners need the executable bit set to invoke ./mvnw directly.
@ifsantana
ifsantana merged commit 0700ba6 into main Jul 9, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Replace McpAgentWorkflowReadme/PendingSettlementReadme stubs with runnable examples; fix ExampleAccounts/ReconciliationExample workarounds

1 participant