Skip to content

feat(mcp): add cost record read and write tools - #49

Merged
jonymaster merged 2 commits into
mainfrom
feat/mcp-cost-tools
Nov 2, 2026
Merged

jonymaster merged 2 commits into
mainfrom
feat/mcp-cost-tools

Conversation

@jonymaster

Copy link
Copy Markdown
Owner

Summary

  • Add MCP tools to manage cost records through the existing API:
    • Service costs: create_service_cost_record, update_service_cost_record, delete_service_cost_record.
    • Hardware cost: set_hardware_cost, delete_hardware_cost, get_hardware_cost.
    • Lookup: list_payment_methods. get_record_history now accepts record_type="cost_record".
  • No backend change. Role checks, financial and hardware visibility, archive locks (409), and history attribution come from the existing endpoints.
  • set_hardware_cost reads the current record and keeps purchase_year and fiscal_year when omitted, because the API PUT replaces them. It rejects amount=0; removing a cost goes through delete_hardware_cost.
  • _api_request returns None for 204 No Content; delete endpoints return no body.
  • New _DELETES annotation (destructive, not idempotent). Server instructions tell assistants to confirm deletes with the user.
  • Cost-record notes stay out of results and cannot be set.
  • Docs: docs/integrations/mcp.md, docs/releases/next.md, and design specs for this feature and the upcoming bulk actions.

Test plan

  • uv run --locked --with pytest pytest -q in mcp/ (46 passed, includes new tests/test_cost_tools.py)
  • On a running instance, with an editor token that has financial visibility: create, update, and delete a service cost record; confirm the Costs tab and history
  • Set and remove a hardware cost; confirm the hardware detail page
  • Viewer token gets 403 on cost writes; a cost write on an archived service returns 409

@jonymaster
jonymaster merged commit 24a0bb2 into main Nov 2, 2026
7 checks passed
@jonymaster
jonymaster deleted the feat/mcp-cost-tools branch November 2, 2026 09:44
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