MCP: proposed-transaction flow with in-app approval (approve / deny / edit & create) #1
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
The MCP server (
app/Mcp/Servers/AccountingServer.php) is currently 13 read-only tools + theaccounting://schemaresource — every tool carries#[IsReadOnly]and nothing mutates data. Add a write path with a human approval gate: an agent, given a dump of already-done transactions, proposes transactions in bulk; nothing enters the ledger until the user reviews and explicitly approves each one in the app.Why the gate
An agent parsing a dump can hallucinate or misread entries — unreviewed writes would leave bogus transactions in the ledger that the user must hunt down and delete. The design goal is: zero ledger changes without a human click.
Proposed shape (suggestions, not a mandate)
propose-transactions(batch-friendly: agent dumps N parsed transactions in one call). Writes proposals, neverTransactionrows. Follow existing tool conventions (SerializesAccountingData, schema validation with helpful messages like the existingyear_month.regexmessage).transaction_proposalstable: payload (JSON, the exact create-data the agent wants), source note (dump context / agent session id), status (pending/approved/denied/edited), timestamps, and the created-transaction FK once approved.TransactionService::create()(andupdate()for the edit path) so every domain rule is enforced identically to manual entry viaTransactionForm: integer paise amounts (_paisefields, 1 INR = 100), date must fall within the selected month, enum values exact (status/origin/account_type), envelope balance checks, splits and reimbursements consistency.accounting://schemaresource updated to document the proposal lifecycle and the new tool so agents can self-serve the conventions.Tests
Feature tests mirroring
tests/Feature/Mcp/*ToolTest.php:propose-transactionsaccepts a batch and creates pending proposals (no transactions)Context
routes/ai.phpmountsMcp::web('/mcp/accounting', AccountingServer::class)behindauth:sanctumapp/Mcp/Tools/, tests intests/Feature/Mcp/