Draft: worker/mcp-proposals-a69e7b #3
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "worker/mcp-proposals-a69e7b"
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?
Task spec:
Implement the MCP proposed-transaction flow with in-app approval (Forgejo
issue ayush/accounting#1) for this Laravel accounting app.
Background: the MCP server (app/Mcp/Servers/AccountingServer.php) currently
exposes 13 read-only tools plus the accounting://schema resource; every tool
carries #[IsReadOnly] and nothing mutates data. Add a write path gated on
human approval: 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 proposal in the app. Zero ledger
changes without a human click is the design goal.
Requirements:
MCP tool propose-transactions (app/Mcp/Tools/ProposeTransactionsTool.php):
validation with helpful messages like the existing year_month.regex
message).
all-or-nothing vs per-item validation results.
Proposal storage: transaction_proposals table with 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. Model + factory +
migration, created via artisan make: commands.
ProposalService with three outcomes:
ALL transaction creation must funnel through TransactionService::create()
(and update() where appropriate for the edit path) so domain rules are
enforced identically to manual entry via TransactionForm: integer paise
amounts (_paise fields, 1 INR = 100), date must fall within the selected
month, exact enum values (status/origin/account_type), envelope balance
checks, splits and reimbursements consistency.
Approval UI: a Livewire review queue showing each proposed transaction
as it would appear (item, amount, date, type, envelope, payment method,
person, splits). Per proposal the user can Approve, Deny, or Edit &
create. Follow existing Livewire component conventions in the repo.
Update the accounting://schema resource to document the proposal
lifecycle and the new tool so agents can self-serve the conventions.
Update the MCP server instruction text: it currently states "No tool
mutates data" — re-scope it to "no tool mutates ledger data directly;
proposals only".
Tests (Pest, mirroring tests/Feature/Mcp/*ToolTest.php):
(no transactions created)
Working rules:
read its index and every rule file matching the paths you touch.
SQLite per phpunit.xml.
with a file path or --filter). Before finishing, run the full new test
files plus the existing Mcp and Services suites, and
vendor/bin/pint --dirty --format agent.
any part cannot be completed, commit what works with its tests and state
the remainder in your final message.
Acceptance:
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.