Skip to main content
Glama
RunWhen Platform MCP

RunWhen Platform MCP

RunWhen Platform MCP banner

RunWhen Platform MCP

RunWhen Platform MCP lets your coding agent (such as Cursor, Claude, Continue, or Copilot) talk to the RunWhen platform — workspace chat, issues, SLXs, run sessions, and the Tool Builder — over the Model Context Protocol (MCP).

PyPI version Python 3.10+ License: Apache-2.0 MCP

GitHub · PyPI · Tools (below)


Table of contents


Related MCP server: Planwright

Key features

  • Workspace chat: Ask the RunWhen AI assistant about your infrastructure. It has access to issue search, task/SLX search, run sessions, resource discovery, knowledge base, graphing, and Mermaid diagrams. Supports selecting an assistant (persona) via persona_name.

  • Task authoring (Tool Builder): Write bash or Python scripts locally, validate them against the RunWhen contract, run them against live infrastructure, and commit them as SLXs. Use get_workspace_context to load RUNWHEN.md conventions before writing.

  • Direct data access: List workspaces, issues, SLXs, run sessions; get runbooks and config index; search tasks and resources. Plus create and update chat rules and commands.

Requirements

  • Python 3.10 or newer

  • RunWhen account and API token (see Getting a token)

  • Any MCP client (Cursor, Claude Desktop, Continue, etc.)

Getting started

  1. Install the server:

    pip install runwhen-platform-mcp

    Or from source (use a venv and then point your MCP client at the venv’s runwhen-platform-mcp):

    git clone https://github.com/runwhen-contrib/runwhen-platform-mcp.git
    cd runwhen-platform-mcp
    python3 -m venv .venv
    source .venv/bin/activate   # Windows: .venv\Scripts\activate
    pip install -e .
  2. Set environment variables (see Configuration): RW_API_URL, RUNWHEN_TOKEN, and optionally DEFAULT_WORKSPACE.

  3. Add the server to your MCP client using the config below. Replace your-jwt-token and your-workspace with your RunWhen token and workspace name.

Add the following to your MCP client config:

{
  "mcpServers": {
    "runwhen": {
      "command": "runwhen-platform-mcp",
      "env": {
        "RW_API_URL": "https://papi.beta.runwhen.com",
        "RUNWHEN_TOKEN": "your-jwt-token",
        "DEFAULT_WORKSPACE": "your-workspace"
      }
    }
  }
}

If you installed from source into a venv, use the full path to the venv’s runwhen-platform-mcp as command (e.g. /path/to/runwhen-platform-mcp/.venv/bin/runwhen-platform-mcp). Find it with which runwhen-platform-mcp after activating the venv.


MCP client configuration

Configure the RunWhen MCP server in your client as shown below. Use the JSON block from Getting started; only the location of the config differs by client.

Cursor

Go to Cursor Settings → MCP → New MCP Server (or edit .cursor/mcp.json). Paste the config from Getting started. If you use a venv, set command to the full path to .venv/bin/runwhen-platform-mcp.

VS Code (GitHub Copilot)

VS Code supports MCP servers through GitHub Copilot. Add the config to your workspace or user settings:

  • Workspace: .vscode/mcp.json in your project root

  • User: settings.json → "mcp.servers" key

Windows with venv

git clone https://github.com/runwhen-contrib/runwhen-platform-mcp.git
cd runwhen-platform-mcp
python -m venv .venv
.venv\Scripts\activate
pip install -e .

Then add to .vscode/mcp.json:

{
  "mcpServers": {
    "runwhen": {
      "command": "C:\\path\\to\\runwhen-platform-mcp\\.venv\\Scripts\\runwhen-platform-mcp.exe",
      "env": {
        "RW_API_URL": "https://papi.beta.runwhen.com",
        "RUNWHEN_TOKEN": "your-jwt-token",
        "DEFAULT_WORKSPACE": "your-workspace"
      }
    }
  }
}

Replace C:\\path\\to\\ with the actual path where you cloned the repo. To find the exact path, run where runwhen-platform-mcp in a terminal with the venv activated.

Tip: On Windows, pip installs console scripts as .exe files in .venv\Scripts\. Always use the full absolute path with backslashes in the MCP config.

macOS / Linux with venv

{
  "mcpServers": {
    "runwhen": {
      "command": "/path/to/runwhen-platform-mcp/.venv/bin/runwhen-platform-mcp",
      "env": {
        "RW_API_URL": "https://papi.beta.runwhen.com",
        "RUNWHEN_TOKEN": "your-jwt-token",
        "DEFAULT_WORKSPACE": "your-workspace"
      }
    }
  }
}

Claude Desktop

Add the config to:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

  • Windows: %APPDATA%\Claude\claude_desktop_config.json

  • Linux: ~/.config/claude/claude_desktop_config.json

Use the same mcpServers.runwhen block as in Getting started.

Other MCP clients

Any client that supports MCP over stdio can use this server. Register a local MCP server with:

  • Command: runwhen-platform-mcp (or full path to the venv’s runwhen-platform-mcp if you installed from source)

  • Env: RW_API_URL, RUNWHEN_TOKEN, and optionally DEFAULT_WORKSPACE

See your client’s docs for where to add MCP servers (e.g. Continue, Codex, Gemini CLI, etc.).

Remote (HTTP) access

The MCP server supports streamable HTTP so your editor can connect over HTTPS without a local Python install.

RunWhen-hosted MCP (beta)

RunWhen operates a shared endpoint for the beta environment:

https://mcp.beta.runwhen.com/mcp

Use your RunWhen beta JWT or Personal Access Token (same as local mode) in the Authorization header. Official docs: RunWhen MCP Server — Remote server (HTTP).

Example mcpServers block (all remote clients below use this shape):

{
  "mcpServers": {
    "runwhen": {
      "url": "https://mcp.beta.runwhen.com/mcp",
      "headers": {
        "Authorization": "Bearer your-runwhen-token"
      }
    }
  }
}

Important: Use /mcp with no trailing slash. The server redirects /mcp/ → /mcp, which can break some MCP clients.

Workspace: Pass workspace_name on tools that support it when you need a specific workspace. RunWhen’s hosted service is configured for the beta API; self-hosted deployments often set DEFAULT_WORKSPACE in server environment variables.

Self-hosted remote MCP

To run the server yourself (Docker, Kubernetes, etc.), set url to your own hostname (for example https://mcp.your-domain.com/mcp) and the same Bearer token pattern. See Running the server in HTTP mode yourself below.

Cursor (remote)

  1. Open Cursor Settings → MCP → New MCP Server, or edit .cursor/mcp.json in your project (or user config, depending on how you scope MCP).

  2. Add the mcpServers.runwhen block above (https://mcp.beta.runwhen.com/mcp for hosted beta, or your self-hosted URL) and Bearer token.

  3. Reload MCP / restart Cursor if the client does not pick up changes immediately.

Remote MCP support depends on your Cursor version; if url + headers are not accepted, use the local command install instead.

VS Code (GitHub Copilot) (remote)

  1. Add the same mcpServers entry to .vscode/mcp.json (workspace) or to user settings.json under the key your VS Code build uses for MCP servers (for example mcp.servers — check VS Code MCP documentation for the current schema).

  2. Use url and headers as in the JSON block above.

Availability of remote MCP in VS Code evolves with Copilot; confirm in release notes if url-based servers are enabled for your version.

Claude Desktop (remote)

  1. Edit the Claude Desktop config file:

    • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

    • Windows: %APPDATA%\Claude\claude_desktop_config.json

    • Linux: ~/.config/claude/claude_desktop_config.json

  2. Merge the mcpServers.runwhen object from the JSON block above (hosted or self-hosted URL) into the top-level mcpServers map (alongside any other servers you already have).

  3. Fully quit and restart Claude Desktop.

Other MCP clients

Any client that supports remote or HTTP MCP (streamable HTTP) can use the same url + headers pattern. For a local-only client, use the stdio command + env setup in Getting started.

Running the server in HTTP mode yourself:

Using Docker:

docker run -p 8000:8000 \
  -e RW_API_URL=https://papi.beta.runwhen.com \
  ghcr.io/runwhen-contrib/runwhen-platform-mcp:latest

Or locally:

export MCP_TRANSPORT=http
export MCP_HOST=0.0.0.0
export MCP_PORT=8000
export FASTMCP_STATELESS_HTTP=true
export RW_API_URL=https://papi.beta.runwhen.com
runwhen-platform-mcp

The server exposes:

  • /mcp/ — Streamable HTTP MCP endpoint (POST for tool calls, GET for SSE)

  • /health — Health check (200 OK with version info)

  • /livez — Kubernetes liveness probe

Authentication in HTTP mode: Each client sends credentials with the request — typically Authorization: Bearer <token> (JWT or Personal Access Token). The server validates tokens against the RunWhen API. No RUNWHEN_TOKEN env var is required on the server when clients supply Bearer tokens; each user authenticates with their own token.

OAuth (browser sign-in) — When the server is configured with MCP_BASE_URL plus RunWhen OAuth client credentials (see OAuth for remote HTTP deployments below), MCP clients that support remote OAuth can complete sign-in in the browser instead of embedding a long-lived token. Bearer authentication remains supported for clients that do not use OAuth. Hosted beta exposes discovery at https://mcp.beta.runwhen.com/.well-known/oauth-authorization-server.

Variable

Required

Description

MCP_TRANSPORT

Yes

Set to http to enable remote mode (default: stdio).

MCP_HOST

No

Bind address (default: 0.0.0.0).

MCP_PORT

No

Listen port (default: 8000).

FASTMCP_STATELESS_HTTP

No

Set to true for horizontal scaling behind a load balancer.

MCP_ALLOWED_HOSTS

No

Comma-separated Host allowlist for FastMCP's HostOriginGuardMiddleware. Only needed when the public hostname differs from MCP_BASE_URL's hostname (which is auto-added). Without a match, external requests are rejected with 421 Misdirected Request.

MCP_HOST_ORIGIN_PROTECTION

No

Set to false to disable the Host/Origin guard middleware (defer to the ingress). Defaults to enabled.

RW_API_URL

Yes

RunWhen API base URL. Used for token verification and API calls.

Note — 421 Misdirected Request troubleshooting. FastMCP 3.4+ ships a Host/Origin guard middleware whose default allow-list is loopback-only (127.0.0.1, localhost, ::1). Any request whose Host header doesn't match returns 421 Misdirected Request — including OAuth handshakes, which surfaces in Cursor as [Shared MCP process] Streamable HTTP error: Error POSTing to endpoint: Misdirected Request. This server automatically appends the MCP_BASE_URL hostname to the allow-list, so the OAuth-configured install works out of the box. If the public hostname on your ingress differs from MCP_BASE_URL (rare), set MCP_ALLOWED_HOSTS explicitly.

OAuth for remote HTTP deployments

Enable interactive OAuth alongside Bearer tokens by registering a confidential OAuth client with your RunWhen environment and pointing the MCP server at it.

  1. MCP_BASE_URL — Public origin of this MCP server (no path), e.g. https://mcp.beta.runwhen.com. Required for OAuth redirects and discovery (/.well-known/oauth-authorization-server is served from this base).

  2. RunWhen OAuth client — Create a confidential client whose authorization server matches your RW_API_URL (OpenID configuration at {RW_API_URL}/.well-known/openid-configuration). Register the redirect URI:

    • {MCP_BASE_URL}/auth/callback
      Example: https://mcp.beta.runwhen.com/auth/callback

  3. Token endpoint auth — Use client secret post (client_secret_post), matching the server’s OIDC proxy configuration.

  4. Set on the MCP server:

    • MCP_PAPI_OAUTH_CLIENT_ID — client ID from step 2

    • MCP_PAPI_OAUTH_CLIENT_SECRET — client secret from step 2

If these are unset, the server runs in JWKS + PAT/JWT verification only mode (Bearer tokens still work; no browser OAuth).

Legacy Auth0 path — Older deployments may set MCP_AUTH0_CONFIG_URL, MCP_AUTH0_CLIENT_ID, MCP_AUTH0_CLIENT_SECRET, and MCP_AUTH0_AUDIENCE instead of the RunWhen-native client variables above. Prefer RunWhen OAuth when available.

The consent screen shown during OAuth uses RunWhen branding (runwhen_platform_mcp/consent_ui.py).

Multiple environments

If you work across multiple RunWhen environments (e.g. beta and production, or separate workspaces), you can register multiple MCP servers. Important: only enable one at a time unless you specifically need cross-environment workflows — multiple active servers with identical tool names confuse LLM agents.

Use MCP_SERVER_LABEL to give each server a clear identity:

{
  "mcpServers": {
    "runwhen": {
      "command": "runwhen-platform-mcp",
      "env": {
        "RW_API_URL": "https://papi.app.runwhen.com",
        "RUNWHEN_TOKEN": "your-prod-token",
        "DEFAULT_WORKSPACE": "my-prod-workspace",
        "MCP_SERVER_LABEL": "prod"
      }
    },
    "runwhen-beta": {
      "command": "runwhen-platform-mcp",
      "env": {
        "RW_API_URL": "https://papi.beta.runwhen.com",
        "RUNWHEN_TOKEN": "your-beta-token",
        "DEFAULT_WORKSPACE": "my-beta-workspace",
        "MCP_SERVER_LABEL": "beta"
      }
    }
  }
}

The server includes its label, environment, and workspace in its name and instructions so agents can route tool calls to the correct instance. See mcp-multi-env.json for a full example.


Your first prompt

After the server is connected, try:

What workspaces do I have access to?

or:

Summarize the current issues in my workspace.

Your client should call list_workspaces or get_workspace_issues and show the result. For the full chat experience, try:

Using workspace chat, what tasks are watching my production namespace?

Tools

The server exposes these tools, grouped by use case.

  • Workspace intelligence (10 tools)

    • workspace_chat — Ask the RunWhen AI assistant about your infrastructure (issues, tasks, run sessions, resources, knowledge base). Optional persona_name to select an assistant.

    • list_workspaces — List workspaces you have access to.

    • get_workspace_chat_config — Get resolved chat rules and commands (metadata). Optional persona_name.

    • get_workspace_issues — Current issues; optional severity filter (1–4).

    • get_workspace_slxs — List SLXs (health checks and tasks).

    • get_run_sessions — Recent run session results.

    • get_workspace_config_index — Workspace config and resource relationships.

    • get_issue_details — Details for a specific issue by ID.

    • get_slx_runbook — Runbook definition for an SLX.

    • search_workspace — Search tasks, resources, and config by keyword.

  • Chat rules and commands (8 tools)

    • list_chat_rules — List chat rules (optional filters: scope_type, scope_id, is_active).

    • get_chat_rule — Get a chat rule by ID (full content).

    • create_chat_rule — Create a rule (name, ruleContent, scopeType, scopeId, isActive).

    • update_chat_rule — Update a rule by ID.

    • list_chat_commands — List chat commands (slash-commands).

    • get_chat_command — Get a command by ID (full content).

    • create_chat_command — Create a command (name, commandContent, scopeType, scopeId). Supports scheduling via cron_schedule, sink_configs, run_as_user, and assistant_name.

    • update_chat_command — Update a command by ID (including schedule fields).

    • update_chat_command — Update a command by ID.

  • AI assistants (personas) (5 tools)

    • list_assistants — List AI assistants (personas) in a workspace.

    • get_assistant — Get a single assistant's full config by short name.

    • create_assistant — Create an assistant (its short_name is the persona_name for workspace_chat). Upsert.

    • update_assistant — Partially update an existing assistant (fetch-merge-write).

    • delete_assistant — Soft-delete an assistant. Persona-scoped rules/commands are not removed automatically.

  • CodeBundle Registry (3 tools)

    • search_registry — Search the public CodeBundle Registry for reusable automation. Always check before writing custom scripts.

    • get_registry_codebundle — Get full details of a specific codebundle (tasks, SLIs, env vars, source URL).

    • deploy_registry_codebundle — Deploy a registry codebundle as an SLX. Generates native codebundle YAML (different from commit_slx which embeds inline scripts).

  • Task authoring — Tool Builder (9 tools)

    • get_workspace_context — Load RUNWHEN.md from the project. Call before writing scripts so the agent follows your conventions.

    • validate_script — Validate a script against the RunWhen contract (main, issue format, FD 3 for bash).

    • run_script — Run a script on a RunWhen runner; returns run ID.

    • get_run_status — Status of a run (RUNNING, SUCCEEDED, FAILED).

    • get_run_output — Parsed output (issues, stdout, stderr, report).

    • run_script_and_wait — Run script and wait for full results (run + poll + output).

    • commit_slx — Commit a tested script as an SLX (task + optional SLI; supports sli_script or cron_schedule).

    • get_workspace_secrets — List secret keys (e.g. kubeconfig).

    • get_workspace_locations — List runner locations. Location auto-resolves for run_script, commit_slx, etc.; this tool is only needed when multiple workspace runners exist and you need to choose.


Configuration

Environment variables

Variable

Required

Description

RW_API_URL

Yes

RunWhen API base URL (e.g. https://papi.beta.runwhen.com). Agent URL is derived (subdomain papi → agentfarm).

RUNWHEN_TOKEN

Yes

RunWhen API token (JWT or Personal Access Token). Used for both API and Agent.

DEFAULT_WORKSPACE

No

Default workspace so tools don’t need workspace_name every time.

MCP_SERVER_LABEL

No

Human-readable label for this server instance (e.g. prod, beta). Included in server name and instructions for multi-environment setups. Auto-derived from RW_API_URL if not set.

RUNWHEN_CONTEXT_FILE

No

Override path to RUNWHEN.md; otherwise auto-discovered from cwd.

RUNWHEN_REGISTRY_URL

No

CodeBundle Registry URL (default: https://registry.runwhen.com). Public API, no auth required.

RUNWHEN_AIRGAP

No

Set to true for airgapped environments. search_registry / get_registry_codebundle return a structured "registry disabled" response instead of attempting an outbound HTTPS call to the registry.

RUNWHEN_REGISTRY_TIMEOUT_S

No

HTTP timeout (seconds) for registry calls. Default 10. Lowered from the PAPI default so an unreachable registry fails fast and is reported gracefully.

RUNWHEN_SCRIPT_SOFT_MAX_BYTES

No

Soft warning threshold for script payload size. Default 10240 (10KB). Scripts above this size produce an advisory warning in validate_script / run_script_and_wait — MCP HTTP intermediaries often truncate base64 payloads above ~13KB.

RUNWHEN_SCRIPT_HARD_MAX_BYTES

No

Hard cap for script payload size. Default 65536 (64KB). commit_slx / run_script* reject scripts above this with an error and suggest using a registry codebundle, script_gzip_base64, or script_path.

MCP_GENERIC_CODECOLLECTION_REPO_URL

No

Force a specific rw-generic-codecollection mirror URL for Tool Builder runbooks + SLIs, overriding workspace auto-detection. Typically only needed when the workspace lookup should be bypassed (e.g. testing a fork). See Tool Builder repo resolution below.

MCP_GENERIC_CODECOLLECTION_REF

No

Git ref for the generic codecollection mirror (default: main).

MCP_TOOL_BUILDER_RUNBOOK_*

No

Override Tool Builder runbook code bundle (REPO_URL, REF, PATH).

MCP_TOOL_BUILDER_SLI_*

No

Override Tool Builder SLI code bundle (REPO_URL, REF, PATH).

MCP_CRON_SLI_*

No

Override cron-scheduler SLI code bundle (REPO_URL, REF, PATH; default repo: rw-workspace-utils).

MCP_POLL_INTERVAL_S

No

Seconds between script run status polls (default: 5).

MCP_MAX_POLL_DURATION_S

No

Max seconds to wait for a script run (default: 300).

MCP_ARTIFACT_SETTLE_DELAY_S

No

Delay before fetching run artifacts (default: 2).

MCP_GENERIC_SLX_ICON

No

Default SLX icon URL when none is provided at commit time.

HTTP / OAuth only (when MCP_TRANSPORT=http; see OAuth for remote HTTP deployments):

Variable

Required

Description

MCP_BASE_URL

For OAuth

Public URL of the MCP server (origin only).

MCP_PAPI_OAUTH_CLIENT_ID

For OAuth

RunWhen OAuth client ID (preferred).

MCP_PAPI_OAUTH_CLIENT_SECRET

For OAuth

RunWhen OAuth client secret (preferred).

MCP_AUTH0_*

Legacy

Auth0 OIDC alternative if RunWhen OAuth client vars are not used.

See .env.example in the repo.

Airgap deployments

The MCP is designed to run in airgapped clusters with minimal configuration. In most installs the only variable operators need to set is:

RUNWHEN_AIRGAP=true

This turns off the CodeBundle Registry (search_registry / get_registry_codebundle return a structured "registry disabled" response instead of attempting an outbound HTTPS call).

Every other airgap-sensitive knob has a workspace-aware default and only needs to be set for override / debugging purposes.

How Tool Builder resolves code-bundle URLs

commit_slx and render_codecollection_skill embed a codeBundle.repoUrl into every runbook / SLI they produce. PAPI clones that URL on ingestion to index tasks, so it must be reachable from the PAPI cluster — on airgap installs that means the internal mirror registered with the platform (e.g. http://rw-airgap-cc-catalog-svc.<namespace>:8080/git/rw-generic-codecollection.git), not github.com.

The MCP resolves the URL for rw-generic-codecollection (Tool Builder runbook + SLI) and rw-workspace-utils (cron-scheduler SLI) in this order:

  1. Explicit call argument — generic_runtime_repo_url on render_codecollection_skill.

  2. Env override — MCP_GENERIC_CODECOLLECTION_REPO_URL / MCP_TOOL_BUILDER_*_REPO_URL / MCP_CRON_SLI_REPO_URL (see table below).

  3. Workspace lookup — the MCP queries GET /api/v3/codecollections (the same list the platform UI's picker uses) and, if the workspace has an entry named rw-generic-codecollection (or rw-workspace-utils), uses that URL. Results are cached in-process for 5 minutes.

  4. Hardcoded github.com default.

Both commit_slx and render_codecollection_skill return generic_repo_url + generic_repo_resolved_from (explicit / env / workspace / default) in their response so you can see which source won at a glance.

Airgap operators typically need no code-bundle env vars — once the internal mirror is registered with PAPI (which the platform-airgap install does automatically), the workspace lookup finds it on every commit_slx / render_codecollection_skill call.

Airgap env-var reference

Set only what you need to override.

Variable

When to set

Description

RUNWHEN_AIRGAP

Always in airgap.

Set to true. Disables outbound registry calls (search_registry, get_registry_codebundle).

RW_API_URL

Always.

Internal PAPI URL, e.g. http://papi.<namespace>.svc.cluster.local or https://papi.<airgap-domain>. Agent URL is auto-derived (papi → agentfarm).

RUNWHEN_APP_URL

If RW_API_URL is an internal .svc.cluster.local URL.

Public UI origin used in workspace_chat responses so the returned chatUrl opens in the browser.

MCP_BASE_URL

HTTP transport with OAuth.

Public origin of the MCP server (e.g. https://mcp.<airgap-domain>) — used for OAuth discovery + redirect.

MCP_GENERIC_CODECOLLECTION_REPO_URL

Rarely.

Force a specific rw-generic-codecollection mirror URL for both Tool Builder runbooks and SLIs. Only needed when you want to bypass the workspace lookup (e.g. targeting a fork or a URL not yet registered with PAPI).

MCP_GENERIC_CODECOLLECTION_REF

Rarely.

Git ref for the generic codecollection mirror. Default: main.

MCP_TOOL_BUILDER_RUNBOOK_REPO_URL / _REF / _PATH

Rarely.

Per-bundle override for Tool Builder runbook. _PATH defaults to codebundles/tool-builder/runbook.robot. Takes precedence over MCP_GENERIC_CODECOLLECTION_*.

MCP_TOOL_BUILDER_SLI_REPO_URL / _REF / _PATH

Rarely.

Per-bundle override for Tool Builder SLI. _PATH defaults to codebundles/tool-builder/sli.robot. Takes precedence over MCP_GENERIC_CODECOLLECTION_*.

MCP_CRON_SLI_REPO_URL / _REF / _PATH

Rarely.

Per-bundle override for the cron-scheduler SLI (rw-workspace-utils). The workspace lookup auto-selects the mirror by default, so only set this to force a fork.

MCP_GENERIC_SLX_ICON

Optional.

Default SLX icon shown in the platform UI. Point at an internal HTTPS/GCS-equivalent URL if the default asset host isn't reachable.

MCP_SERVER_LABEL

Optional.

Human-readable label baked into the MCP server name (e.g. airgap, beta). Helps agents distinguish which server targets which environment when several are configured side-by-side.

Getting a token

  • Personal Access Token (recommended, up to 180 days): RunWhen UI → Profile → Personal Tokens.

  • Email/password (short-lived): POST {RW_API_URL}/api/v3/token/ with {"email": "...", "password": "..."}.

  • Browser: Dev Tools → Network → copy Authorization: Bearer ... from any API request.

Access control and "Run with Assistant"

Workspace roles: readonly, readandrun, readandrunwithassistant, readwrite, admin.

  • Read and Run with Assistant (readandrunwithassistant): Run tasks only when tied to an assistant (persona) you’re allowed to use. Applies to run sessions (e.g. Run button in the UI), not Tool Builder script runs.

  • Workspace chat: Use persona_name in workspace_chat / get_workspace_chat_config to use chat in the context of an assistant you’re allowed to use.

  • Tool Builder run (run_script, run_script_and_wait): Uses author/run API; currently admin only. No "run with assistant" for MCP script execution today.

  • commit_slx: Requires admin or readwrite.


Concepts

How it works

  • Workspace chat: The server forwards workspace_chat to the RunWhen Agent (AgentFarm), which has many internal tools. You ask in natural language; optional persona_name selects the assistant.

  • Tool Builder flow: Search registry (search_registry) → load context (get_workspace_context) → write script → validate → get secrets/locations → test with run_script_and_wait → iterate → commit_slx → verify with get_workspace_slxs.

  • Knowledge base: Full CRUD via list_knowledge_base_articles, create_knowledge_base_article, update_knowledge_base_article, delete_knowledge_base_article. Search also works inside workspace_chat.

  • CodeBundle Registry: Search for existing automation before building custom. The registry at registry.runwhen.com is public and requires no authentication.

Infrastructure context (RUNWHEN.md)

Put a RUNWHEN.md in your project root with infrastructure rules (DBs, naming, severity, etc.). The server discovers it by walking up from the current working directory. Agents should call get_workspace_context before writing scripts.

  • Template: runwhen_platform_mcp/docs/RUNWHEN.md.template

  • Example: runwhen_platform_mcp/docs/RUNWHEN.md.example

  • Flow and SLI patterns: runwhen_platform_mcp/docs/tool-builder-flow.md


What’s in this repo

Component

Path

Description

MCP server

runwhen_platform_mcp/

Python package; run via runwhen-platform-mcp or python -m runwhen_platform_mcp.server.

Docs

runwhen_platform_mcp/docs/

Tool Builder flow, RUNWHEN.md template/example.

Tests

tests/

Pytest tests; run with pytest tests/ -v (see requirements-dev.txt).

Skills

skills/

Reusable AI workflow skills (SKILL.md). Filesystem-discovered by Cursor / Copilot / Claude via .github/skills/ & .claude/skills/ symlinks, AND exposed to every MCP client as runwhen-skill://<name> resources (plus list_skills / get_skill tool fallbacks for clients that under-surface resources).

Rules & agents

rules/, agents/

Optional Cursor rules and agent personas.

Docker

Dockerfile

Container image for remote HTTP deployment. Published to ghcr.io/runwhen-contrib/runwhen-platform-mcp.

Cursor plugin

.cursor-plugin/, mcp.json

Plugin metadata and example MCP config.

Copilot instructions

.github/copilot-instructions.md

Always-on instructions for GitHub Copilot.

The MCP server is client-agnostic; client-specific pieces (.cursor-plugin/, .github/copilot-instructions.md) are optional.


Skills (progressive disclosure for any MCP client)

skills/<name>/SKILL.md files are RunWhen's progressive-disclosure surface — short, task-focused guides agents load on demand instead of bundling everything into tool docstrings.

How each agent type sees them:

Client

Discovery path

Mechanism

Cursor / Claude Code / Copilot

.cursor-plugin/, .claude/skills/, .github/skills/ (symlinks to skills/)

Native filesystem skill loading

Goose, Continue, Cline, OpenAI Codex CLI, any other compliant MCP client

runwhen-skill://<name> MCP resources

Standard MCP resources/list + resources/read

Clients that surface tools only (some OpenAI / Gemini function-callers)

list_skills() + get_skill(name) tool shims

Fallback path with identical content

The single source of truth is skills/<name>/SKILL.md. Frontmatter description is the trigger an agent reads to decide whether to load the body — keep it 1-2 sentences with explicit "Use when:" clauses.

Authoring rule of thumb: if you find yourself growing a tool docstring past ~30 lines, lift the content into a new skill and reference its URI from the docstring instead. Tool-side guidance should be short; depth goes in skills.


Development and testing

pip install -e .
pip install -r requirements-dev.txt
pytest tests/ -v

Local MCP against staging (no container rebuild)

To iterate on MCP server code against a live environment (e.g. staging) without pushing Docker images, run the server in stdio mode from your checkout and point Cursor (or any MCP client) at the local binary:

cd runwhen-platform-mcp
pip install -e .
export RW_API_URL="https://papi.staging.shared.runwhen.com"
export RUNWHEN_TOKEN="<your PAT or JWT>"
export DEFAULT_WORKSPACE="stg-test"   # optional default
runwhen-platform-mcp

Cursor mcp.json example (use the venv binary path after pip install -e .):

{
  "mcpServers": {
    "runwhen-staging-local": {
      "command": "/path/to/runwhen-platform-mcp/.venv/bin/runwhen-platform-mcp",
      "env": {
        "RW_API_URL": "https://papi.staging.shared.runwhen.com",
        "RUNWHEN_TOKEN": "<PAT or JWT>",
        "DEFAULT_WORKSPACE": "stg-test"
      }
    }
  }
}

Changes to runwhen_platform_mcp/server.py take effect after restarting the MCP server in Cursor (disable/re-enable the server or reload the window). Only deploy a remote HTTP MCP container when you need OAuth or a shared team endpoint.

Token: RunWhen UI → Profile → Personal Tokens, or POST {RW_API_URL}/api/v3/token/.

Optional Git hooks (Ruff check + format, same as CI):

pip install pre-commit   # or install with: pip install -e ".[dev]"
pre-commit install
pre-commit run --all-files   # first-time / manual check

CI runs tests on push and PRs to main (.github/workflows/ci.yaml).

Optional repository secrets RUNWHEN_MCP_URL (full streamable HTTP MCP URL, e.g. https://mcp.<env>.runwhen.com/mcp, no trailing slash) and RUNWHEN_TOKEN (same Bearer token as MCP clients) enable a remote MCP HTTP smoke step that exercises initialize, tools/list, list_workspaces, and get_workspace_issues for workspace t-oncall (the workflow sets RW_SMOKE_WORKSPACE=t-oncall). If either secret is unset, that step is skipped with a notice.


PyPI and container images

PyPI — On every push to main (including merges), .github/workflows/pypi.yaml publishes to PyPI via runwhen-contrib/github-actions/publish-pypi with date-based versioning (YYYY.MM.DD.N). Configure PYPI_TOKEN (and optionally SLACK_BOT_TOKEN / slack_channel) in repo secrets.

Docker (GHCR and GCP) — Pull requests that touch image-related paths (see .github/workflows/docker.yaml) build and push a preview image (pr-{branch}-{sha}). Pushes to main use .github/workflows/release.yml: the workflow runs on each merge to main, and a new image is built and pushed only if that merge changes the same image-related paths (package code, Dockerfile, pyproject.toml, requirements.txt, or docker.yaml). README-only (or other non-image) merges skip the Docker job so latest and version tags are not republished for doc-only changes. Run Actions → Release → Run workflow to force a full run including Docker regardless of paths.


License

Apache-2.0

Available Tools

47 tools
commit_slxCommit SlxA

Commit a tested script as an SLX to the workspace Git repo.

Skills:

  • runwhen-skill://build-runwhen-task (authoring workflow)

  • runwhen-skill://discover-secrets (secret_vars mapping)

  • runwhen-skill://discover-locations (location selection)

  • runwhen-skill://configure-hierarchy (hierarchy/resource_path)

Creates a new SLX with the script as a Task (runbook) and/or SLI. The script should already be tested via run_script or run_script_and_wait.

This writes slx.yaml + runbook.yaml (for tasks) or slx.yaml + sli.yaml (for SLIs) to the workspace repository.

Script-source parameter matrix (provide exactly one task variant; SLI variants mirror the names):

Variant

Best for

Mode

script

Small scripts <~5KB, readable

any

script_base64

Any size; safe JSON escaping

any

script_gzip_base64

>5KB; 3-5x denser than b64

any

script_path

Local file, raw text

stdio only

script_base64_path

Local file with base64 blob

stdio only

For very large scripts (combined task+SLI >~50KB) prefer publishing as a registry codebundle and using deploy_registry_codebundle.

To commit BOTH a task AND an SLI on the same SLX:

  1. Custom SLI script (preferred): set task_type="task" and provide a separate lightweight sli_script that emits ONE float between 0 and 1 (e.g. failing_pods / total_pods). The SLI script MUST be its own small probe — DO NOT duplicate the task body. The server rejects identical task+SLI content.

  2. Cron-scheduler SLI: set task_type="task" and provide cron_schedule with a cron expression (e.g. "0 */2 * * *"). The SLI will trigger the task's runbook on that schedule. No sli_script needed.

Output contracts (the two scripts are NOT interchangeable):

  • Task (interpreter, task_type='task'): returns/writes a List[Dict] of issues with keys 'issue title', 'issue description', 'issue severity' (1-4), 'issue next steps'.

  • SLI (sli_interpreter, implied task_type='sli'): returns/writes ONE float between 0 and 1.

Script-content footguns:

  • Bash scripts must NOT include main "$@" at the bottom. The runner sources the script and invokes main() itself with FD 3 wired to a run_output.json file. A trailing main "$@" triggers a preflight invocation with FD 3 read-only, producing misleading "Bad file descriptor" errors. Just define main() and stop there.

  • secret_vars entries are injected at runtime as env vars whose VALUE is a FILE PATH on the runner — not the secret value itself. Tools that read paths natively (kubectl/KUBECONFIG, gcloud/ GOOGLE_APPLICATION_CREDENTIALS) work unchanged. For tokens/passwords the script must cat "$VAR" (bash) or open(os.environ["VAR"]).read() (python) to get the actual value.

Inputs: alias (required), slx_name (required), statement (required), workspace_name (required), +31 more. Returns: result

create_assistantCreate AssistantA

Create a new AI assistant (persona) in a workspace.

Skill: runwhen-skill://create-ai-assistant (full setup workflow).

An assistant is a persona that tailors how the RunWhen AI investigates and acts — e.g. an "Azure DevOps Helper" focused on a specific tech stack. The short_name you choose becomes the persona_name for workspace_chat.

After creating the assistant, shape its behavior by attaching persona-scoped rules and commands:

create_chat_rule(scope_type="persona", scope_id=short_name, ...)
create_chat_command(scope_type="persona", scope_id=short_name, ...)

This is an UPSERT — calling it again with an existing short_name REPLACES the assistant's full configuration (omitted fields reset to defaults). To change a few fields on an existing assistant, use update_assistant.

Inputs: short_name (required), workspace_name (required), avatar_url, run_config, +9 more. Returns: result

create_chat_commandCreate Chat CommandA

Create a chat command (slash-command). Name must be alphanumeric, underscore, or hyphen only.

Skill: runwhen-skill://manage-commands (scoping, scheduling, sinks).

Commands are invoked in chat as /label.

To run a command on a schedule, set cron_schedule plus sink_configs, run_as_user, and assistant_name. Results are delivered to each sink (email or Slack) when the cron fires.

Inputs: name (required), scope_type (required), workspace_name (required), command_content (required), +10 more. Returns: result

create_chat_ruleCreate Chat RuleC

Create a chat rule. Uses AgentFarm internal API.

Skill: runwhen-skill://manage-rules (scoping + wording guidance).

Inputs: name (required), scope_type (required), rule_content (required), workspace_name (required), +2 more. Returns: result

create_knowledge_base_articleCreate Knowledge Base ArticleA

Create a new Knowledge Base article in a workspace.

Skill: runwhen-skill://manage-knowledge (article scoping + lifecycle).

KB articles are indexed into the Knowledge Overlay Graph and become searchable by the workspace AI assistant and other tools.

Content should be informative operational knowledge — architecture notes, troubleshooting guides, runbook context, dependency documentation, etc.

Inputs: content (required), workspace_name (required), title, resource_paths, +1 more. Returns: result

delete_assistantDelete AssistantA

Delete (soft-delete) an AI assistant (persona) from a workspace.

Persona-scoped rules and commands attached to this assistant are not removed automatically — clean them up separately if no longer needed.

Inputs: assistant_name (required), workspace_name (required). Returns: result

delete_knowledge_base_articleDelete Knowledge Base ArticleB

Delete a Knowledge Base article.

Removes the article from the workspace and the Knowledge Overlay Graph index.

Inputs: note_id (required), workspace_name (required). Returns: result

delete_slxDelete SlxA

Soft-delete an SLX from the workspace via the v4 short-name endpoint.

Uses DELETE /api/v4/workspaces/{ws}/slxs/{slx_short_name}, which tombstones the SLX row (deleted_by / deleted_at) and lets the corestate reconcile loop clean up the corresponding runbook and SLI rows. This is the same endpoint the UI hits, so behaviour matches what users see in the platform.

Deletion is workspace-global — it is not scoped to a Git branch. The v4 endpoint tombstones the SLX row in PAPI; there is no per-branch variant. Callers previously wired to a Git-oriented delete path should stop passing branch / commit_message (both removed) and rely on the workspace-scoped soft delete.

Inputs: slx_name (required), workspace_name (required). Returns: result

deploy_registry_codebundleDeploy Registry CodebundleA

Deploy a registry codebundle as an SLX to a workspace.

Unlike commit_slx (which embeds inline scripts via the Tool Builder codebundle), this deploys a pre-built codebundle from its own codecollection repository. The runbook.robot / sli.robot live in the codebundle's git repo — no inline script is needed.

Use search_registry + get_registry_codebundle to find the right codebundle, then call this tool with the values from the registry.

Inputs: alias (required), location (required), repo_url (required), slx_name (required), +19 more. Returns: result

get_assistantGet AssistantB

Get a single AI assistant (persona) by its short name (full config).

Inputs: assistant_name (required), workspace_name (required). Returns: result

get_chat_commandGet Chat CommandB

Get a single chat command by ID (full content).

Inputs: command_id (required), workspace_name (required). Returns: result

get_chat_ruleGet Chat RuleA

Get a single chat rule by ID (full content).

Inputs: rule_id (required), workspace_name (required). Returns: result

get_issue_detailsGet Issue DetailsA

Get detailed information about a specific issue (structured JSON).

NOTE: Prefer workspace_chat for investigative questions about an issue (e.g. root cause, related resources, next steps). Use this tool only when you already have an issue ID and need raw JSON.

Inputs: issue_id (required), workspace_name (required). Returns: result

get_knowledge_base_articleGet Knowledge Base ArticleB

Get a specific Knowledge Base article by ID.

Inputs: note_id (required), workspace_name (required). Returns: result

get_registry_codebundleGet Registry CodebundleA

Get full details of a specific codebundle from the registry.

Use after search_registry to get complete information including configuration templates, environment variables, and deployment instructions.

Inputs: codebundle_slug (required), collection_slug (required). Returns: result

get_run_outputGet Run OutputA

Get the output artifacts from a completed script run.

Returns parsed, human-readable results including:

  • issues: list of issues found by the script (title, severity, details, nextSteps)

  • stdout: script stdout output

  • stderr: script stderr output

  • status: run status (SUCCEEDED, FAILED, RUNNING)

Inputs: run_id (required), workspace_name (required), fetch_logs. Returns: result

get_run_sessionsGet Run SessionsA

Get recent run sessions for a workspace (structured JSON).

Run sessions are executions of SLX runbooks — they contain the output of health checks, troubleshooting tasks, and automation runs.

NOTE: For investigative questions like "what ran recently for service X?" or "show me recent failures", prefer workspace_chat — it can search, filter, and correlate run sessions with issues and resources. Use this tool only when you need raw JSON for programmatic processing.

Inputs: workspace_name (required), limit. Returns: result

get_run_statusGet Run StatusA

Check the status of a script run.

Poll this after run_script to check if execution has completed. Status values: RUNNING, SUCCEEDED, FAILED.

Inputs: run_id (required), workspace_name (required). Returns: result

get_skillGet SkillB

Return the full body of a skill by name.

Returns {name, description, uri, body, path} on success or {error, available} when the name is unknown so the agent can self- correct without a second round-trip.

Inputs: name (required), reload. Returns: result

get_slx_runbookGet Slx RunbookA

Get the runbook for a specific SLX (structured JSON).

Returns the runbook definition including what tasks it runs, how they're configured, and what they check.

NOTE: For questions like "what does this SLX do?" or "what tasks does it run?", prefer workspace_chat — it provides contextual explanations. Use this tool when you need the raw runbook YAML/JSON (e.g. for task authoring or programmatic inspection).

Inputs: slx_name (required), workspace_name (required). Returns: result

get_workspace_chat_configGet Workspace Chat ConfigA

Get resolved chat rules and commands for a workspace.

Returns the list of rules and commands that apply to the workspace (and optional persona). These are the same rules and commands the workspace chat assistant sees. Response includes metadata only (id, name, scope); full rule/command content is not included in this endpoint.

Inputs: workspace_name (required), persona_name. Returns: result

get_workspace_config_indexGet Workspace Config IndexA

Get the workspace configuration index (structured JSON).

Returns an overview of all configured resources, SLXs, and their relationships in the workspace. Useful for understanding what's monitored and how things are connected.

This tool accepts only workspace_name. It does NOT accept resource_path, slx_name, filter, or other parameters — those fail with unexpected_keyword_argument. To set resource_path on an SLX, use commit_slx or deploy_registry_codebundle. To find SLXs at a path, use workspace_chat or search_workspace.

NOTE: For questions like "what's monitored in namespace X?" or "how are resources connected?", prefer workspace_chat — it can traverse the resource graph and provide contextual answers. Use this tool only when you need the raw configuration index for programmatic processing.

Inputs: workspace_name (required). Returns: result

get_workspace_contextGet Workspace ContextA

Get domain-specific context for building RunWhen tasks.

Reads the project's RUNWHEN.md file, which contains infrastructure conventions, database access rules, naming patterns, architectural knowledge, and other constraints that scripts must follow.

The file is auto-discovered by walking up from the current working directory. Override with the RUNWHEN_CONTEXT_FILE env var if needed.

IMPORTANT: Call this BEFORE writing any task or script to understand the target environment's rules and relationships.

Inputs: reload. Returns: result

get_workspace_issuesGet Workspace IssuesA

Get current issues for a workspace (structured JSON).

Issues represent detected problems in your infrastructure that RunWhen has identified through automated health checks.

NOTE: For questions like "issues related to neo4j" or "what's failing in namespace X", prefer workspace_chat — it has semantic search and keyword filtering that produce materially better results. Use this tool only when you need raw JSON for programmatic processing.

Inputs: workspace_name (required), limit, since, severity. Returns: result

get_workspace_locationsGet Workspace LocationsA

List runner locations with auto-resolution guidance and recommendations.

Returns a structured payload that tells the agent which location to use (or to omit the parameter entirely when auto-resolution can pick). The raw list is preserved in locations for backward compatibility.

Response shape::

{ "workspace": "", "count": , "locations": [], "private": [], # workspace-type runners (preferred) "public": [], # shared runners (fallback) "recommended": "<name|null>", "auto_resolves": , # True when run_*/commit_slx can pick alone "disambiguation_hint": "...", "skill_reference": "runwhen-skill://discover-locations", }

recommended is the name run_script / run_script_and_wait / commit_slx WILL pick when the location parameter is omitted. When auto_resolves is True the agent should NOT pass a location argument at all.

Inputs: workspace_name (required). Returns: result

get_workspace_secretsGet Workspace SecretsA

List available secret keys with platform grouping and mapping guidance.

Returns a structured payload that helps agents pick the right secret_vars mapping for a task. The raw key list is preserved in secrets for backward compatibility.

Response shape::

{ "workspace": "", "secrets": [], "platform_groups": { "kubernetes": ["kubeconfig"], "azure": [...], ... }, "recommended_secret_vars": { "kubernetes": { "kubeconfig": "kubeconfig" }, "azure": { "AZURE_CLIENT_ID": "...", ... }, ... }, "runtime_semantics": "", "skill_reference": "runwhen-skill://discover-secrets", }

Critical for agents: workspace secrets are injected into scripts as FILE PATHS, not literal values. See the discover-secrets skill for the read_secret helper pattern.

Inputs: workspace_name (required). Returns: result

get_workspace_slxsGet Workspace SlxsA

List ALL SLXs in a workspace (structured JSON). No filtering.

SLXs are the fundamental unit of work in RunWhen — each represents a health check, task, or automation runbook for a piece of infrastructure.

The underlying PAPI endpoint is paginated (100 SLXs per page); this tool auto-paginates internally, following next until exhausted, so the returned results are the complete list for the workspace — never just the first page. count reflects the true total and next is always null (there is nothing left to page).

It accepts only workspace_name. It does NOT accept slx_name, filter, alias, tag, or any other filtering parameter — those would fail with unexpected_keyword_argument.

For other shapes:

  • One specific SLX (runbook detail): get_slx_runbook(workspace_name=..., slx_name=...)

  • Search / filter by topic (e.g. "neo4j health checks"): workspace_chat

  • Search by resource (e.g. "what monitors namespace X"): workspace_chat

Use this raw-list tool only when you need to enumerate every SLX for programmatic processing (counting, batch operations, etc).

Inputs: workspace_name (required). Returns: result

list_assistantsList AssistantsA

List AI assistants (personas) configured in a workspace.

An assistant is a persona — its shortName is the value you pass as persona_name to workspace_chat. Use this to discover which assistants already exist before creating a new one.

Inputs: workspace_name (required). Returns: result

list_chat_commandsList Chat CommandsC

List chat commands (slash-command instructions).

Inputs: workspace_name (required), page, scope_id, is_active, +2 more. Returns: result

list_chat_rulesList Chat RulesC

List chat rules (workspace chat rules).

Uses AgentFarm internal API; may require network access.

Inputs: workspace_name (required), page, scope_id, is_active, +2 more. Returns: result

list_discovery_platformsList Discovery PlatformsA

List supported generation-rule platforms and default render settings.

Skills:

  • runwhen-skill://commit-to-codecollection

  • runwhen-skill://author-generation-rules

Call this before render_codecollection_skill when the user has not confirmed whether they want workspace-scoped output (runwhen) or per-resource cloud/Kubernetes discovery (kubernetes, azure, aws, gcp). Ask the user to pick a platform and scope, then look up valid resource_types with list_indexed_resource_types(search=...). All catalog data is bundled offline — no docs.runwhen.com access required.

Inputs: no named parameters. Returns: result

list_indexed_resource_typesList Indexed Resource TypesA

Search bundled indexer catalogs for valid generation-rule resourceTypes.

Skills:

  • runwhen-skill://author-generation-rules

  • runwhen-skill://commit-to-codecollection

Fully offline — reads catalogs/indexed-resource-types.json (or bundled markdown catalogs) shipped with the MCP package. No network access required.

For azure/aws/gcp, search must be at least 2 characters (large catalogs). Kubernetes CRD types use plural.group[/version] syntax when not listed.

Inputs: platform (required), limit, search. Returns: result

list_knowledge_base_articlesList Knowledge Base ArticlesA

List Knowledge Base articles (notes) in a workspace (structured JSON).

Returns KB articles that feed the workspace's Knowledge Overlay Graph. Articles can contain operational knowledge, runbook context, architecture notes, or any information useful for troubleshooting.

NOTE: For questions like "what do we know about service X?", prefer workspace_chat — it searches KB articles semantically. Use this tool for programmatic KB management (listing, filtering by status).

Inputs: workspace_name (required), limit, search, status. Returns: result

list_skillsList SkillsA

List every progressive-disclosure skill the server exposes.

Returns [{name, description, uri}]. Use this when you want to know what guidance is available before running a tool — read the description to decide whether you need the full body, then fetch it with get_skill(name) (or, if your client supports MCP resources directly, read the uri via the resource read API).

Cross-vendor note: this is the same information that list_resources returns for the runwhen-skill:// family. Clients that surface MCP resources should prefer that path; this tool is the explicit fallback.

Inputs: no named parameters. Returns: result

list_workspacesList WorkspacesA

List all workspaces you have access to.

Returns workspace names, display names, and basic metadata.

Inputs: no named parameters. Returns: result

render_codecollection_skillRender Codecollection SkillA

Render a tested tool-builder task as a private Custom Discovery CodeCollection.

Skills:

  • runwhen-skill://commit-to-codecollection (GitOps workflow)

  • runwhen-skill://build-runwhen-task (authoring + testing first)

Emits the standard codecollection layout (generation rule + Jinja templates) for workspace-builder discovery. Templates delegate runtime to rw-generic-codecollection/codebundles/tool-builder with base64 GEN_CMD.

Also writes .runwhen/SKILL_TEMPLATE.md with the decoded script summary and .runwhen/raw_script.{py,sh} with the full decoded script so PR reviewers and automated systems never need to base64-decode TaskSet templates.

This tool does not push to git or mutate the workspace — it renders files locally (or returns them inline) for you to git add / commit / push.

Default generation rule uses platform: runwhen and resourceTypes: [workspace]. For cloud/Kubernetes discovery, set platform to kubernetes, azure, aws, or gcp and pass resource_types / match_rules / slx_qualifiers from the bundled indexer catalogs (list_indexed_resource_types). Discovery SLX templates include the platform tag/hierarchy includes (e.g. kubernetes-tags.yaml).

Requires runwhen-local with the matching platform indexer enabled.

Inputs: alias (required), statement (required), bundle_name (required), workspace_name (required), +31 more. Returns: result

run_scriptRun ScriptA

Execute a script on a RunWhen runner for testing.

Sends the script to the workspace's runner at the specified location. Returns a run ID that can be used with get_run_status and get_run_output to monitor execution and retrieve results.

The script must follow the RunWhen contract:

  • Python task: define main() returning List[Dict] with keys 'issue title', 'issue description', 'issue severity' (1-4), 'issue next steps'.

  • Python SLI: define main() returning a float 0-1.

  • Bash task: define main() writing issue JSON array to FD 3 (>&3).

  • Bash SLI: define main() writing a metric float to FD 3.

Provide exactly one of: script | script_base64 | script_gzip_base64 | script_path (stdio) | script_base64_path (stdio). Use script_gzip_base64 for scripts >5KB to maximise transport headroom.

Use validate_script first to check compliance.

Inputs: workspace_name (required), script, env_vars, location, +7 more. Returns: result

run_script_and_waitRun Script And WaitA

Execute a script and wait for results (combines run + poll + output).

This is a convenience tool that runs a script, polls until completion, and returns the full output — all in one call. Use this instead of calling run_script + get_run_status + get_run_output separately.

The script must follow the RunWhen contract:

  • Python task: define main() returning List[Dict] with keys 'issue title', 'issue description', 'issue severity' (1-4), 'issue next steps'.

  • Python SLI: define main() returning a float 0-1.

  • Bash task: define main() writing issue JSON array to FD 3 (>&3).

  • Bash SLI: define main() writing a metric float to FD 3.

Provide exactly one of: script | script_base64 | script_gzip_base64 | script_path (stdio) | script_base64_path (stdio). Use script_gzip_base64 for scripts >5KB to maximise transport headroom.

Bash scripts must NOT include main "$@" at the bottom. The runner sources the script and invokes main() itself with FD 3 wired to a run_output.json file. A trailing main "$@" triggers a preflight invocation with FD 3 read-only and produces misleading "Bad file descriptor" errors.

secret_vars entries are injected as env vars whose VALUE is a FILE PATH on the runner — not the secret value itself. kubectl/KUBECONFIG and gcloud/GOOGLE_APPLICATION_CREDENTIALS work unchanged. For tokens/ passwords the script must cat "$VAR" (bash) or open(os.environ["VAR"]).read() (python) to get the actual value.

Inputs: workspace_name (required), script, env_vars, location, +8 more. Returns: result

run_slxRun SlxA

Run an existing SLX's runbook tasks on the workspace runner.

Skill: runwhen-skill://run-existing-slx — and default task_titles="*" (a literal resolved title produces empty passedTitles).

This triggers execution of a previously committed SLX (not an ad-hoc script). Use this when you want to run a health check, troubleshooting task, or automation that already exists in the workspace.

IMPORTANT: This is different from run_script / run_script_and_wait, which execute ad-hoc scripts. Use run_slx to trigger SLXs that are already committed and configured in the workspace.

NOTE: workspace_chat CANNOT run tasks directly — it can only search for and describe them. Use this tool to actually execute an SLX.

The tool creates a RunSession with the run request, polls until completion, and returns the results including pass/fail status and any issues found.

Inputs: slx_name (required), workspace_name (required), task_titles, runtime_var_overrides. Returns: result

search_registrySearch RegistryA

Search the RunWhen CodeBundle Registry for reusable automation.

Skill: runwhen-skill://find-and-deploy-codebundle (search → deploy workflow).

Use this BEFORE writing a custom script — there may already be a production-ready codebundle for the task. Returns codebundles with their tasks, SLIs, required env vars, and deployment metadata.

Inputs: search (required), tags, platform, max_results. Returns: result

search_workspaceSearch WorkspaceA

Search for tasks, resources, and configuration in a workspace.

Uses the workspace's task search / autocomplete to find matching items.

NOTE: Prefer workspace_chat for most search queries — it uses semantic search and keyword grep across issues, resources, SLXs, and run sessions with much richer results. Use this tool only as a lightweight autocomplete fallback.

Inputs: query (required), workspace_name (required). Returns: result

update_assistantUpdate AssistantA

Partially update an existing AI assistant (persona).

Fetches the current configuration, applies only the fields you provide (leaving everything else intact), then writes the merged result back. Use this instead of create_assistant when you only want to change a few settings without resetting the rest.

Inputs: assistant_name (required), workspace_name (required), avatar_url, run_config, +9 more. Returns: result

update_chat_commandUpdate Chat CommandA

Update an existing chat command by ID.

Omitted fields are left unchanged. Schedule fields (cron_schedule, sink_configs, run_as_user, assistant_name, etc.) follow the same partial-update semantics as the PAPI. Use clear_max_runs=True to remove an existing run cap (MCP cannot send bare null for max_runs).

Inputs: command_id (required), workspace_name (required), name, max_runs, +13 more. Returns: result

update_chat_ruleUpdate Chat RuleC

Update an existing chat rule by ID.

Inputs: rule_id (required), workspace_name (required), name, scope_id, +3 more. Returns: result

update_knowledge_base_articleUpdate Knowledge Base ArticleA

Update an existing Knowledge Base article.

Only provided fields are updated; omitted fields remain unchanged.

Inputs: note_id (required), workspace_name (required), title, status, +4 more. Returns: result

validate_scriptValidate ScriptA

Validate a script against the RunWhen contract before running it.

Checks that the script follows the required structure (main function, correct output format, etc.) and extracts referenced environment variables.

Task scripts must return/write issues with keys: 'issue title', 'issue description', 'issue severity' (1-4), 'issue next steps', and optionally 'issue observed at'.

Script-source parameter matrix (provide exactly one):

Variant

Best for

Mode

script

Small scripts <~5KB, readable

any

script_base64

Any size; safe JSON escaping

any

script_gzip_base64

>5KB; 3-5x denser than b64

any

script_path

Local file, raw text

stdio only

script_base64_path

Local file containing base64 blob

stdio only

Skill: runwhen-skill://build-runwhen-task (full authoring workflow).

Inputs: script, task_type, interpreter, script_path, +3 more. Returns: result

workspace_chatWorkspace ChatA

Ask the RunWhen AI assistant about your infrastructure.

This is the PRIMARY tool for investigating infrastructure. It sends your message to the RunWhen workspace AI agent, which searches (keyword, semantic, and fuzzy), navigates and correlates across resources, SLXs, issues, run sessions, and the knowledge base, and returns rich markdown reports, diagrams, and tables.

PREFER THIS TOOL over direct read/query tools (get_workspace_issues, get_workspace_slxs, search_workspace, etc.) for any question that involves searching by topic, keyword, or context — e.g. "issues related to neo4j", "what's failing in namespace X?", "health of the watcher cluster". workspace_chat produces materially better answers because it can search, filter, and correlate across all workspace data internally.

Use direct tools instead ONLY for: executing tasks (run_slx), task authoring, registry operations, chat config CRUD, KB mutations, or when you specifically need raw structured JSON for programmatic processing.

Returns: JSON with message, sessionId, widgets, chatUrl (full browser URL to continue this session in the RunWhen UI — run tasks, review history), and chatExportLink (shareable chat-export path when available).

Inputs: message (required), workspace_name (required), session_id, persona_name. Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.5/5.0

    Scored across 47 tools

    Disambiguation4/5

    Most tools target distinct resources and actions, and the descriptions go out of their way to explain when to prefer workspace_chat over the raw JSON read tools (get_workspace_issues, get_workspace_slxs, search_workspace). Some residual overlap remains in the read/query cluster (search_workspace vs workspace_chat vs get_workspace_config_index) and among run_script vs run_script_and_wait vs run_slx, but the guidance largely resolves it.

    Naming Consistency4/5

    Nearly all tools follow a predictable snake_case verb_noun pattern (get_*, list_*, create_*, update_*, delete_*, run_*, search_*). The main deviation is workspace_chat, which uses a noun_verb shape with no verb prefix, plus minor inconsistencies in the domain prefixing (get_workspace_chat_config vs list_chat_rules).

    Tool Count2/5

    At 47 tools this is well past the point where a set feels heavy; several clusters could be consolidated (run_script + run_script_and_wait + get_run_status + get_run_output; the nine chat-rule/command tools; multiple overlapping workspace read tools). The domain is broad, but the surface is bloated beyond what each sub-area needs.

    Completeness4/5

    Coverage is strong: full CRUD for assistants, knowledge-base articles, and chat rules/commands, plus runs, registry, and discovery/codecollection workflows. Minor gaps exist (no create/update/delete for workspaces, only list_workspaces; no delete for chat rules) but the core lifecycles are represented.

    Maintenance

    ActivityInactive
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      A
      maintenance
      Enables AI assistants like Claude, Cursor, VS Code, and Windsurf to manage workspaces, projects, tasks, and AI agents through natural language, with a hosted OAuth server or a local stdio package. Also supports generating MCP tools from any OpenAPI spec.
      2,203 npm
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables AI coding agents and humans to collaborate on local, evidence-driven planning by exposing MCP tools for plan listing and binding, workflow catalog/run operations, and task tracking with human-reviewed decisions.
      2
      AGPL 3.0
    • A
      license
      Not graded
      quality
      A
      maintenance
      Enables AI clients such as Claude, Cursor, VS Code, and Windsurf to list and manage workspaces, projects, tasks, AI agents, and automations through a hosted OAuth-secured endpoint or a local stdio package. Also generates MCP tools from any OpenAPI spec.
      2,203 npm
      MIT
    • A
      license
      Not graded
      quality
      A
      maintenance
      Exposes a governed suite of 38 OAuth-gated tools over one MCP endpoint, letting web-based AI chat clients read and edit files, run whitelisted shell commands, search, and use Git, SQLite, browser automation, DevTools, background tasks, ports, clipboard, notifications, and localhost services on the user's own machine. It also allows local IDEs and automation tools to connect directly over localhost for offline, low-latency access.
      MIT