Skip to content

feat(mcp): discover approved JSON reads from live module contracts - #21

Merged
vitormattos merged 3 commits into
mainfrom
feat/live-safe-api-discovery-20261108
Nov 8, 2026
Merged

vitormattos merged 3 commits into
mainfrom
feat/live-safe-api-discovery-20261108

Conversation

@vitormattos

Copy link
Copy Markdown
Member

Goal

Discover safe JSON reads from the installed Akaunting NFS-e module at runtime, without hand-editing the MCP route catalog whenever a new API endpoint is added.

Depends on LibreCodeCoop/akaunting-nfse#571 (authenticated api.nfse.discovery.index endpoint and mcp_read_contract annotations).

Contract

  • Keep the current reviewed catalog and all API mutation contracts unchanged.
  • Fetch the module's authenticated capabilities under the current personal credentials and selected company, on every tool invocation.
  • Accept only explicit named GET declarations, read-only ACL hints, scoped integer path IDs, typed bounded query parameters and safe declared response projections.
  • Verify invoice ownership through the Core API before invoice-scoped reads; independently check company/invoice fields on returned records.
  • Reject unannotated routes, unknown methods, side-effecting GETs, malformed paths, route collisions/drift, binary fiscal documents and sensitive artifacts.
  • Neither a discovered GET nor the listing of routes permits writes. Writes continue through the existing independently approved mutation flow.
  • Older module versions without discovery keep using the static catalog. Other upstream errors fail closed.

Validation performed locally

  • PHPUnit: 195 tests, 879 assertions passed (two Git shell-dependent cases not run in isolated container).
  • Focused dynamic API and parity suites: 40 tests, 187 assertions passed.
  • PHPStan: no errors.
  • PHP-CS-Fixer: 53 files checked, no changes.
  • Diff and syntax: passed.

CI remains the release gate. No production deployment has occurred for this branch.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
@vitormattos

Copy link
Copy Markdown
Member Author

Release verification: all 28 CI checks SUCCESS on c4e1376 after LibreCodeCoop/akaunting-nfse#571 merged. User authorized end-to-end implementation and deployment. A code owner cannot approve a PR they authored; use the explicitly configured organization-admin PR review bypass for this merge only. No CI or signed-commit checks will be bypassed.

@vitormattos
vitormattos merged commit fd7cbb1 into main Nov 8, 2026
28 of 30 checks passed
@vitormattos
vitormattos deleted the feat/live-safe-api-discovery-20261108 branch November 8, 2026 22:14
@vitormattos

Copy link
Copy Markdown
Member Author

Production rollout verified after merge fd7cbb1. Rebuilt and replaced only the MCP app image; OAuth edge, tunnel and Nginx stayed running. Verified live authenticated automatic discovery of both annotated NFS-e GET routes, read-only invoice fiscal decision and company-scoped category configuration via the connected MCP. No mutations, raw fiscal artifacts or cross-company records were read. No application fatal errors observed; existing configuration backup files were preserved.

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.

1 participant