MuviaDevelopers
Guides: MCP server

MCP server

Muvia runs an MCP (Model Context Protocol) server so that AI assistants and agents can use Muvia directly: look up a project, read its data, run queries and propose changes. It is the richest way in; the REST API is the simple, read-only one.

Endpoint

https://api.muviabi.com/mcp/v1

The transport is MCP's streamable HTTP, without sessions: every request is one JSON-RPC 2.0 message sent with POST, and nothing is kept between requests. Send Content-Type: application/json and Accept: application/json, text/event-stream; the answer arrives as a server-sent event with one data: line holding the JSON-RPC response.

The server speaks the protocol versions 2025-11-25, 2025-06-18, 2025-03-26 and 2024-11-05: initialize answers the version the client asks for, or the latest when it asks for another. A complete exchange is in the Agent quickstart, which also lists the address of each Muvia environment.

Authentication

Who How
A person's assistant (Claude, ChatGPT, an IDE) OAuth. The person adds the URL as a connector, signs in to Muvia and grants scopes. The assistant acts as that person.
An integration or agent without a person An mvk_ API key, sent as Authorization: Bearer mvk_.... It acts as the key, on the key's one project, within the key's scopes.

API keys are the same keys the REST API reads from X-Api-Key; see Authentication and Scopes. A key reaches the project it was issued for and no other.

A missing, wrong, expired or revoked credential answers HTTP 401. For a key the body says what to check:

{
  "error": "invalid_token",
  "error_description": "The API key was not accepted.",
  "hint": "Send the key as 'Authorization: Bearer mvk_...'; check it has not expired or been revoked in Settings > API keys. A key works only on the Muvia environment that issued it: https://developers.muviabi.com/guides/agent-quickstart.md lists each one's address."
}

OAuth

An assistant finds the authorization server from the standard discovery documents at the root of the API host: /.well-known/oauth-protected-resource, /.well-known/oauth-authorization-server and /.well-known/openid-configuration. It registers itself through dynamic client registration or a client ID metadata document, and authenticates as a public client (with PKCE, S256) or with a client secret (client_secret_post or client_secret_basic).

The person signs in to Muvia and ticks the scopes to grant:

Scope Grants
muvia.read Read projects, signals, alarms, analyses and documents. Always granted.
muvia.sql Run read-only SQL queries on the projects' data (query_sql).
muvia.write Read flows, and propose or make changes: flows and their functions, analyses, dashboards, threshold alarms on tags, notes and documents, datasets, queries, notebooks, project bundles, reports sent by email.
muvia.nodes Change nodes: their configuration, commands, software and data limits.
muvia.sources Change data sources.
muvia.alarms Change alarm channels and subscriptions, acknowledge alarms and add notes to them.
muvia.admin Company-wide settings.

muvia.nodes, muvia.sources, muvia.alarms and muvia.admin are never ticked in advance: the person picks them. A connection never does more than the person may: what it can do is what the granted scopes allow and the person's own roles allow. While the company's licence has lapsed, it reads only.

An access token lasts one hour and a refresh token 30 days. The person can disconnect an assistant in Muvia at any time; its next call answers «This connection to Muvia is no longer valid. Connect the assistant to Muvia again.»

When the company refuses assistants

Every tool call checks the company's settings, for keys and people alike. A call that cannot go through answers a tool error with one of:

  • «AI connectors are not part of this company's plan.»
  • «AI connectors are switched off for this company. An administrator can switch them on in Settings.»
  • «This company does not allow this assistant. An administrator chooses the allowed assistants in Settings.» (a person's assistant only)

Listing tools

Send tools/list. Every tool has a name, a title, a description, an inputSchema (JSON Schema) and annotations. Call whoami first, then list_projects: every other tool acts inside one project and takes its project_id.

tools/list answers only the tools this connection may call: those its permissions allow and the company's modules include. A key without «Can write through assistants» still sees the write tools its scopes allow; calling one answers why it cannot write (see Writes by a key). MCP tools lists every tool of the server, by area: what it does, whether it reads or writes, its write mode and its arguments. The schema tools/list serves is the same, kept short: an argument whose name says it all has no description.

If your client cannot search a long list, find_tools helps: without arguments it answers the areas and how many tools each holds; with query (task words, such as alarm channel) or area it answers the matching tools, whether each reads or writes, and what the area is for.

Tools return their result as structuredContent (an object) and as text in content. Tables are {"columns": [...], "rows": [[...]]}; a list that was cut short says so, as list_projects does with "truncated": true. A tool that cannot run answers a result with isError: true and a sentence saying why, not an HTTP error.

Annotations: reads and writes

Every tool carries annotations:

Annotation Meaning
readOnlyHint: true The tool only reads. Safe to call freely.
destructiveHint: false The tool writes: it creates or adds something, and removes or overwrites nothing.
destructiveHint: true The tool writes and deletes or overwrites something. Ask the person before calling it.
openWorldHint true when the tool reaches past Muvia, false when it acts on Muvia only.

Every write tool states destructiveHint, true or false; a read tool has readOnlyHint: true instead. Five tools carry openWorldHint: true: command_node (sends a command to a node at the plant), send_report_now (sends email), and browse_account, inventory_account and run_source (reach a data source's own system). Every other tool carries openWorldHint: false.

Writes

A write tool files a proposal. What happens next is the company's autonomy for that kind of change, chosen by an administrator in Settings › Company › AI connectors › Autonomy: «Ask for confirmation», «Run at once», or switched off, in which case the tool answers a tool error and proposes nothing.

  • Pending. Nothing has changed. A person opens approve_url in Muvia and approves or discards the proposal. Give them the link and the message; do not retry.

    {
      "status": "pending",
      "action_id": "<action_id>",
      "approve_url": "https://app.muviabi.com/approvals/<action_id>?project=<project_id>",
      "message": "<what to do next>",
      "summary": "<what it would change>",
      "needs_admin": false
    }
    

    Some kinds add what a person needs to decide: checked (what Muvia verified), runs, recipients or contents.

  • Applied. The change is made; id is what it made or changed and url opens it in Muvia. Some kinds add a note, warnings and their own result.

    {
      "status": "applied",
      "action_id": "<action_id>",
      "id": "<id>",
      "url": "https://app.muviabi.com/..."
    }
    

«Run at once» is the company's choice for each kind, not a promise for every call: a change still waits for a person when it deletes or overwrites something, unless the administrator also chose «Run at once even when the change replaces something»; when the assistant read a file or a page in Muvia before asking it, unless they chose «Run at once even after the assistant has read a file or a page»; when it needs an administrator (needs_admin: true), until one approves it; and when it is a kind only a person decides.

Retries are safe. Muvia recognises the same call — the same connection, tool and arguments in the same project:

  • while the first is still being applied, it answers {"status": "applying", "action_id": "<action_id>"};
  • within 30 seconds of the first being applied, it answers the applied answer again, and changes nothing twice;
  • while the first waits for a person, it answers that same proposal.

get_action with the action_id tells what became of a proposal. A pending one answers as above; otherwise {"status", "result", "reason"}, where status is applying, applied (with result: id, url and the kind's own fields), failed (with a reason), discarded, expired (nobody decided within seven days, or before the key that asked it expired) or stale (what it would change has changed since).

Writes by a key

A key writes only when both hold:

  • an administrator has turned on «Can write through assistants» on it, in Settings › Company › API keys (off by default);
  • the key holds a scope that permits writing; a write still needs the scope of what it changes (analysis_annotate to annotate, for example), and a key writes no more than a person could let an assistant write.

whoami answers both as one boolean, writes. Without the switch, a write tool answers isError: true with this text, and reads are unaffected:

This API key can only read. To propose or make changes through an assistant, an administrator must turn on «Can write through assistants» on the key, in Settings › Company › API keys.

Three write modes, shown for each tool on MCP tools:

  • Proposal — most write tools: the company's autonomy applies as above.
  • Confirmed in Muvia — the change records who made it, so a key always proposes it, whatever the autonomy, and the person who confirms it applies it and owns the result. These are: acknowledging, noting and shelving alarms and ending a shelf, marking an alarm as no anomaly and undoing it, alarm tasks and declared windows (acknowledge_alarm, note_alarm, shelve_alarm, end_alarm_shelf, mark_not_anomaly, undo_anomaly_mark, save_alarm_task, declare_window, my_alarm_work); creating and editing analyses and what follows from one (create_analysis, edit_analysis, follow_pattern, analysis_to_notebook); annotations (annotate_signal, set_annotation_cause); simulate_flow; history imports (save_history_import, run_history_import); retune_monitor; and create_project.
  • Not for keys — the change acts as a person on what is theirs: set_analysis_visibility, delete_analysis, edit_annotation and delete_annotation. A key answers «Only a person can do this: connect the assistant with your own account.»

A change a key makes appears in Muvia as authored by «API key» and the key's name. A proposal that a person confirms is applied as that person. A person's OAuth assistant writes within the scopes the person granted and the person's roles, and its proposals are theirs.

whoami

This tool answers who the connection acts as and what it may do. The REST GET /v1/whoami answers the same writes for a key, as mcp.writes.

Field Meaning
kind api_key for a key, oauth for a person's assistant.
company {id, name} of the company.
user {id, email} of the person, or null for a key.
client {client_id, name} of the assistant application, or null for a key.
key For a key only: {name, created_by}, created_by being the address of the person who issued it.
scopes For a key, the scopes it may use now, sorted: its own, capped by the modules the company runs, with the ones they imply, and only its reads while the company's licence has lapsed. For a person's assistant, the muvia.* scopes granted, in no set order.
permissions What those scopes allow, as permissions, sorted.
writes Whether this connection may write through MCP. For a key: «Can write through assistants» on and a scope that permits writing.
{
  "kind": "api_key",
  "company": { "id": "<company_id>", "name": "<company name>" },
  "user": null,
  "client": null,
  "key": { "name": "<key name>", "created_by": "<email>" },
  "scopes": ["datasets_read", "settings_read"],
  "permissions": ["datasets_read", "settings_read"],
  "writes": false
}

Limits and errors

A key's MCP calls count on a counter of their own, apart from REST: 120 calls per minute per key by default, and no daily budget. Its writes are also limited to 30 per minute per key; a retry answered by its own waiting proposal does not count. Past a limit the tool answers isError: true with «This key made too many requests in a minute: try again in N seconds.» or «This key made too many changes in a minute: try again in N seconds.» Wait that long. A person's OAuth assistant is not counted by these limits. See Rate limits.

A call that cannot run answers isError: true with the reason; a malformed JSON-RPC request, or an unknown method, answers a JSON-RPC error; a missing or refused credential answers HTTP 401.