Skip to content

[Feature]: MCP server for permission-scoped, read-only-by-default AI access to OSPOS data #4836

Open

Description

@objecttothis

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

  1. 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).
  2. Data maintenance: report duplicate items, near-duplicate names, and items missing important data (category, price, supplier, barcode, attribute values).
  3. 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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions