Repository navigation
Open
Description
Summary
Add an optional Model Context Protocol (MCP) server so AI assistants can query OSPOS data through explicitly granted, fine-grained permissions. Defaults are no access. Read-only is the first thing an admin can enable. Write access is out of scope for the first release.
Use cases
- Product lookup: a customer asks for a product. Staff ask the assistant whether we carry it or something similar, and if not, what we stock that they might like (same category, matching attributes such as author, publisher, or language, frequently bought together).
- Data maintenance: report duplicate items, near-duplicate names, and items missing important data (category, price, supplier, barcode, attribute values).
- Aggregate reporting: low stock, dead stock, top sellers.
Security principles
- Default deny. A new MCP token has zero scopes.
- Read-only before any write capability. No raw SQL tool.
- Field-level allowlists per scope. Cost price, customers, employees, payments, and config are excluded by default.
- Row limits and rate limits per token.
- Treat all returned text (descriptions, attribute values) as untrusted input to the model. Write tools, if added later, must go through a human-approved proposal queue.
- Audit log of every tool call, viewable in the admin UI. One switch disables all MCP tokens.
- Should be able to run against a read-only DB user or replica.
Proposed scopes (example)
- items:read, items:attributes:read, stock:read
- reports:quality:read, reports:sales:aggregate:read
- Later, separately: items:propose (pending changes only)
- Optional: restrict by stock location
Initial tools
- search_items (name, item number/ISBN/barcode, category, supplier, attributes)
- get_item (with attributes and per-location stock)
- list_attribute_definitions, list_categories
- find_similar_items
- report_duplicate_items, report_incomplete_items
Relationship to existing work
The MCP should be a consumer of the same service layer and auth model planned for third-party integrations (#3789) and follow the security strategy (#3965), not a parallel data path. It should reuse the attribute search work in #4441 and #4654. Having its own policy tier (scopes, field allowlists, no PII by default) is deliberate: LLM clients have a different threat model than plugins.
Open questions
- Run as a separate process (stdio/HTTP) or embedded in the app?
- Token model: reuse the API key design from [Feature]: Third-party integration standard architecture #3789 or a dedicated MCP credential?
- Which attribute types need special handling for search?
Metadata
Metadata
Assignees
Labels
No labels
Activity