Skip to content

Latest commit

 

History

History
101 lines (83 loc) · 6.39 KB

apps.md

File metadata and controls

101 lines (83 loc) · 6.39 KB

MCP Apps

MCP Apps (SEP-1865, extension io.modelcontextprotocol/ui) let a tool result render as an interactive view inside the chat. This server offers one view, ui://appwrite/view, behind the apps flag (MCP_APPS=1, both transports).

Surface

Name Seen by What it does
appwrite_show model and view view=table: a page of a table's rows, newest first, with cursor paging. view=deployment: a Function or Site deployment (the latest unless deployment_id is given) with the last 200 build log lines. view=executions: a Function's executions, newest first, optionally one status, with cursor paging; execution_id also opens one with its request and response headers, status code, duration, and the last 200 lines of logs and of errors. view=files: a Storage bucket's files, newest first, with search (file name) and cursor paging; file_id also opens one. view=users: the project's Auth users, newest first, with search (name, email, phone or ID) and cursor paging; user_id also opens one with their ten newest sessions. view=usage: a project's requests, bandwidth (in and out) and executions per interval over range (24h hourly, 7d or 30d daily), with totals and the newest snapshot of its users, resource counts and storage. Read-only.
appwrite_view_write view only (visibility: ["app"]) Runs one of tables_db_update_row, functions_update_deployment_status, sites_update_deployment_status, users_update_status, users_update_labels, users_update_email_verification, only with confirm_write=true. A reason is optional here (a person confirmed the change in the view) and sent as X-Appwrite-Reason when given.
ui://appwrite/view host One HTML document (assets/view.html) that renders every view.

appwrite_show returns a text summary in content, which is what the model and hosts without MCP Apps see, and the data in structuredContent for the view. The view calls appwrite_show again to page, refresh and follow a build (every 3 seconds until it is ready, failed or canceled), and to follow executions while any on the page, or the opened one, is waiting or processing. Appwrite keeps an execution's response body only for the synchronous call that ran it, so the view shows it only when present. An edited row or a cancelled build goes through a confirmation dialog in the view, and only then through appwrite_view_write, as do blocking or unblocking a user, marking their email verified or not, and changing their labels. A successful change and a finished build are passed to the model with ui/update-model-context when the host supports it.

The files view has no network access, so it cannot load a file's preview URL. It calls appwrite_show again with thumbnails: true, and the server renders the page's images through Appwrite's image transformations (storage_get_file_preview, eight at a time) and returns them as data URIs. The model's own call leaves them out, since some hosts put structuredContent in the model's context.

The usage view reads the Usage API (usage_list_events and usage_list_gauges). Appwrite keeps usage history for as long as the plan allows; a range past it returns Appwrite's own error, which the view shows in place of the chart it was switching to.

Who is offered the view

Hosts that declare the extension in their client capabilities get the two tools and the resource. Hosts that declare capabilities without it do not. The hosted transport is stateless, so a 2025-era client's tools/list carries no capabilities; it is offered the view, and a host that cannot render it uses the text summary. 2026-07-28 clients send clientCapabilities with every request, and stdio has the handshake, so both are gated exactly. tools/call is not gated, because the view's own calls reach the server through the host.

Telemetry

On the hosted transport, two counters show which views people use:

  • mcp.apps.views counts appwrite_show calls by view (invalid for a name that is not one), status (success or error), client_id, and origin: model when the model opens a view, view when the view refreshes, pages, polls a build or opens a row on its own. Views opened per view type is origin="model"; how much people then use each view is origin="view".
  • mcp.apps.writes counts appwrite_view_write calls by action (the allowlisted write, or invalid), status and client_id.

The view marks its own calls with "io.appwrite/origin": "view" in the request's _meta. Hosts forward a view's tools/call params as sent; a host that drops _meta makes those calls count as origin="model". Both counters feed the MCP Apps row of the MCP dashboard (appwrite-labs/monitoring dashboards/Cloud/mcp.json).

Security

  • The resource declares no CSP domains, so hosts apply the spec's restrictive default: no network access, inline script and style only. The view never holds a token; every Appwrite call is a tools/call the host proxies to this server with the user's own credentials.
  • Everything the view renders comes from Appwrite. It builds the DOM with textContent and createElement only (the e2e flow fails on innerHTML), because a script injected through that data could call appwrite_view_write. The allowlist bounds what such a script could do, and confirm_write is required as for appwrite_call_write_tool.
  • User documents carry the password hash, prefs and messaging targets, and sessions carry OAuth provider tokens. The users view, and the user writes' results, carry only the fields the view shows.

Trying it in a real host

The ext-apps repository ships basic-host, the reference host. It connects without auth, so point it at a local server whose requests carry a token, for example the e2e harness (tests/e2e/support.py) with its fake Appwrite:

git clone --depth 1 https://github.com/modelcontextprotocol/ext-apps.git
cd ext-apps/examples/basic-host && npm install
NODE_ENV=development npx cross-env INPUT=index.html vite build
NODE_ENV=development npx cross-env INPUT=sandbox.html vite build
SERVERS='["http://localhost:3001/mcp"]' bun serve.ts   # host on :8080

Pick appwrite_show, call it with {"view":"table","project_id":"…","database_id":"…","table_id":"…"}, and the view renders under the tool call. The host's theme toggle switches the view between light and dark.