Skip to content

MCP UI: writes/role-access switches, health + APP_URL warning, server-backed tool/context estimates #526

Description

@nicdavidson

Wire the newer MCP backend into Kevin's editor: settings switches, health / APP_URL warning, real tool and context numbers.

What

  1. Settings tab (Kevin's df-mcp-settings, Serving or Authentication section as fits): two switches — Allow writes (allow_writes; off = server is read-only, write verbs and writing custom tools never registered) and Require role access (require_role_access; on = only roles granted access to this MCP service can connect, admins always pass). Short helper text for each. Hidden for system_mcp where not applicable. Saved via Kevin's existing whole-service PUT. Kevin's "read-only" computation in mcp-effective.ts / Tools side panel must account for allow_writes=false (write tools not served), and his Create flow should keep defaults consistent with the backend (new services: require_role_access true, allow_writes per his read-only/read-write choice or true).
  2. Health chip + APP_URL warning in Kevin's details header (df-mcp-details): call /_internal/ai/mcp-health, show a chip (ok / warn / error) with the first non-ok check's message; the app_url check is the APP_URL warning. Also: the endpoint URL Kevin shows (currently window.location.origin) should prefer APP_URL-based URL when the health report provides it, or at least warn when they differ. Port from Nic's df-mcp-exposure header (healthMessage / healthVariant).
  3. Tools / context estimation: Kevin's preview and side panel estimate tokens client-side (flat 81 tokens/tool, lazy assumed >8000 tokens). Replace with Nic's model: call /_internal/ai/mcp-catalog (as admin; for role preview the other agent adds role selection — expose a way to pass role_id/app_id) for the real tool count, bytes, lazy decision; fall back to Kevin's client-side simulation when the endpoint fails or the form is dirty (unsaved). Use the daemon's byte threshold (32 KiB, LAZY_THRESHOLD_BYTES) and Nic's tokensPerTurn / shapeCatalog / shapeFixedCatalog for estimates, including the fixed system_mcp catalog. Show the lazy-loading explanation (full vs facade size; search_tools → describe_tool → call_tool → fetch_more) where Kevin has his "on-demand delivery" line/tooltip.

Context (read first)

  • Base branch: feat/mcp-ui = Kevin's MCP redesign (origin/feat/mcp-config-redesign). Kevin's editor lives in src/app/adf-mcp/ (details shell with Connect / Tools / Settings tabs, mcp-store.ts, mcp-effective.ts, mcp-catalog.ts). Keep his layout, tab structure, style and conventions (plain English strings like his components, not Transloco; his component/spec patterns).
  • Source to port from: Nic's earlier implementation on local branch feat/mcp-exposure of this repo, under src/app/adf-ai/mcp/ (df-mcp-api.service.ts, mcp-model.ts + spec, df-mcp-access*, df-mcp-exposure*). Read it with git show feat/mcp-exposure:<path>. Port behaviour, adapt to Kevin's structure; do not bring over Nic's page shell, tabs or routing.
  • Backend is merged to df-mcp-server develop (PR Adds files tests #77) and is what df-dev runs: GET /_internal/ai/mcp-access?service=&period=, GET /_internal/ai/mcp-catalog?service=&role_id=|app_id=[&client=&lazy_mode=], GET /_internal/ai/mcp-health, config fields allow_writes (bool, default true) and require_role_access (bool; new services default true, existing false). Admin-only endpoints; call them with the admin session like Nic's df-mcp-api.service.ts does.
  • Live instance: df-dev http://localhost:8081, admin@dreamfactory.com / passwordpassword. MCP service logistics_mcp (id 15), role logistics_analyst — do not modify those; create your own throwaway services/roles prefixed e2e_mcp_ and delete them after.
  • Tests: npx jest src/app/adf-mcp (node_modules: symlink or copy from /data/projects/dreamfactory/df-development/packages/df-admin-interface/node_modules). src/app/shared/utilities/route.spec.ts has one pre-existing failure on develop — ignore it. Add specs for new logic.
  • Do NOT rebuild or commit dist/ (another agent works in parallel; dist gets rebuilt once at integration). No docker compose / container / config edits.
  • Deliver: commit on your branch, push, open a PR into feat/mcp-ui (not develop) with a "## Behaviour changes" section (what changed, before/after, upgrade impact, how verified). Then stop and report.

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