MCP Integration
Myrm supports the Model Context Protocol (MCP) for connecting external tools and services to your agents.What is MCP?
MCP is an open standard that lets AI agents connect to external data sources and tools through a unified protocol. Instead of building custom integrations, you can connect any MCP-compatible server.Service Catalog (One-Click Connect)
The fastest way to connect popular services. Navigate to Settings > Integrations > Service Catalog to browse 29 prebuilt integrations across 9 categories:
Each entry includes:
- Pre-configured connection details (command, args, URL)
- Guided credential input with help links to the provider’s token page
- Keyless zero-config support for select services (e.g., Firecrawl free tier — no API key needed)
- Security scan before connecting (SSRF + malicious package detection)
- Bilingual descriptions (English and Chinese)
Cloud Storage & File Export
Myrm provides 6 paths to sync and export files to any cloud storage service — no dedicated connector required for each provider:
:::tip
Unlike competitors that lock you into a single cloud ecosystem, Myrm’s open architecture lets you connect to any storage service through multiple paths. The Agent automatically chooses the best approach based on your request.
:::
Integration Memory (Workspace Sync)
Any connected MCP server can be automatically used as a knowledge source. Navigate to Settings > Integrations > Integration Memory to sync external data into your AI’s long-term memory.How It Works
- Connect a service via the Service Catalog (e.g., Notion, GitHub, Gmail)
- Click Sync All in the Integration Memory section
- The system automatically:
- Detects the best fetch tool from the MCP server’s catalog
- Pulls data using incremental sync (detects
since/afterparameters) - Deduplicates by
provider::external_id(idempotent re-sync safe) - Embeds content into the vector store
- Builds a tree structure in the knowledge graph
- Extracts high-value profile traits via MemoryExtractor
Key Features
Managing Synced Data
- Status overview: See total providers, indexed items, and tree count
- Per-tree controls: Sync or remove individual data trees
- Sync results: View created/updated/skipped/failed counts per provider
Adding Custom MCP Servers
From the GUI
- Navigate to Settings > Tools > MCP
- Click Add Server
- Enter the server configuration:
- Name: Display name for the server
- Command: The command to start the server (e.g.,
npx @mcp/server-github) - Arguments: Command-line arguments
- Environment Variables: Required environment variables (e.g., API keys)
- Save — the server starts automatically and its tools become available to agents
From Configuration File
Add MCP servers tomcp_servers.json:
Building Custom MCP Servers (AI-Guided)
Don’t want to write an MCP server from scratch? Activate the mcp-builder skill and ask the agent to build one for you.How to Use
- Go to Settings > Agent > Skills and enable the
mcp-builderskill - Start a conversation and describe what you need: “Build an MCP server that connects to Jira for project management”
- The agent follows a structured 4-phase workflow:
Built-in Quality Guarantees
- Security annotations — Read-only operations get
readOnlyHint: true(auto-approve), destructive operations getdestructiveHint: true(warning badge) - Error handling — All HTTP calls have timeouts, retries, and actionable error messages
- Pagination — Large result sets are paginated to prevent token explosion
- Environment variables — Secrets are never hardcoded
Schema Handling
Myrm automatically optimizes MCP tool schemas for LLM compatibility:Connection Management
Persistent Sessions
Each MCP server runs on a single, persistent session that stays warm for the entire agent lifetime. Tool calls are serialized onto the session through an internal queue — no subprocess is spawned per call, and no re-initialization handshake is needed between calls.Execution Timeout Protection
Every MCP tool call is protected by a dual-layer timeout mechanism:- SDK layer —
read_timeout_secondsis passed to the MCP SDK session, preventing hung responses at the transport level - Wrapper layer — An independent
asyncio.timeoutwraps the entire execution (including response normalization), catching tools that stall after transport confirms receipt - Per-server configurable — Each server can set its own
connect_timeout(default 15s) andexecute_timeout(default 120s, max 300s) - Graceful degradation — On timeout, a descriptive error string is returned to the LLM (not an exception), allowing the agent to decide next steps
- Auto-retry on enumeration — Tool discovery retries up to 3 times with 300ms backoff on transient failures
Error Transparency
When an MCP tool reports a failure (isError: true), the full error chain is handled without losing information:
- Server-side error pass-through — The original error text from the MCP server is extracted and forwarded to the LLM exactly as reported
- Security sanitization — Credentials are redacted (
redact_sensitive_text) and structural framing tokens are stripped (sanitize) to prevent prompt injection via error messages - Error classification — Errors are categorized (network_blocked, timeout, sandbox_ro, etc.) enabling circuit-breaker patterns and targeted recovery
- Circuit breaker — Terminal errors (e.g. network permanently blocked) are registered; subsequent calls to the same category fail fast without retrying
- Structured diagnostics — Execution phase, tool name, output previews (head + tail truncation), and recovery hints are recorded for debugging
- Frontend display — Errors surface in the UI as structured progress steps with i18n messages, resolution steps, and recovery actions — not just raw text
Self-Healing Reconnection
When a transport break occurs (subprocess crash, SSE/HTTP drop, idle timeout), the session actor reconnects in place:- Bounded backoff — Up to 5 reconnect attempts with exponential backoff (0.5s to 8s cap)
- Budget refresh — A session that ran stable for 60+ seconds earns a fresh retry budget, so an unrelated blip hours later still gets full retries
- In-flight call fails explicitly — The call that hit the break is failed (no silent auto-retry of non-idempotent tools), but subsequent calls succeed on the fresh session
- Proxy stability — The tool objects held by the agent remain identical across reconnects, preserving prompt prefix cache hits
Transport-Aware Keepalive
Remote transports (SSE, streamable HTTP) sit behind load balancers and NAT that silently drop idle TCP connections. The session actor sends a lightweight in-band ping (list_tools) every 180 seconds to keep the connection warm. Local stdio transports (pipes to subprocesses) never idle-disconnect and are left unprobed.
Connection Pool
- Singleton per server — One warm connection per config-hash prevents resource leaks
- Loop-aware — Connections rebuild automatically on event-loop change
- TTL recycling — Long-idle connections are closed and recreated on demand
- Last-resort rebuild — The pool only rebuilds a connection when the actor’s internal reconnect budget is fully exhausted
CancelledError Protection
A guard prevents PythonCancelledError from leaking through MCP channels, which could otherwise crash the MCP server process.
Metrics
Connection metrics (success rate, latency, error rate) are tracked and available through the diagnostics API.Security
SSRF Prevention
Myrm implements DNS pinning for MCP tool URLs:- Resolved IPs are checked against private ranges (10.x, 172.16-31.x, 192.168.x)
- Localhost and link-local addresses are blocked by default
- URL validation prevents redirect-based SSRF attacks
Malicious Package Detection
When MCP tools install dependencies, the OSV (Open Source Vulnerability) API is consulted in real-time to detect known malicious packages.Runtime Prompt Injection Protection
Every time MCP tools are registered (initial freeze) or dynamically refreshed (afterlist_changed), Myrm runs a runtime surface scan that inspects:
- Server instructions for embedded directives that could hijack agent behavior
- Tool names for deceptive names mimicking built-in tools
- Tool descriptions for injected prompt manipulation patterns
MCPRuntimePostureError — the malicious tools never reach the agent’s context. This prevents a class of attacks where a compromised or malicious MCP server subtly changes its tool descriptions to inject instructions into the agent’s prompt.
Tool Approval
MCP tools follow the same approval flow as built-in tools:- Read-only tools execute automatically
- Write/destructive tools require user approval (unless in YOLO mode)
- Custom approval policies can be configured per MCP server
Per-Tool Filtering
When configuring agents, you can control which tools from each MCP server are available — down to individual tool granularity.How to Use
- Go to Agent Config (click the agent avatar in chat)
- Under MCP Servers, each enabled server shows a Tool Filter toggle
- Expand it to see all available tools with risk annotations
- Toggle individual tools on/off using checkboxes
Risk Annotations
Each tool is automatically classified by risk level:Auto-Disable Dangerous Tools
When you first enable an MCP server on an agent, tools marked as destructive are automatically excluded from the selection. You can manually re-enable them if needed.Filter Summary
The tool filter header shows a count badge (e.g.,5/20) indicating how many tools are active out of the total available.
Multimodal Tool Results
MCP tools can return rich content beyond plain text — screenshots, images, and structured data are all handled natively.Image Content
When an MCP server returnsImageContent (e.g., Playwright screenshots, diagram generators), Myrm renders the image directly in the chat:
- Base64 image data flows through the streaming pipeline and renders in the Tool Image Gallery
- Multiple images per tool result are supported (grid layout with lightbox preview)
- For models that don’t support vision, images are automatically stripped by the media filter — no configuration needed
Structured Content
When an MCP server returnsstructuredContent (JSON metadata alongside text), Myrm extracts and includes it as supplementary context for the LLM, enabling more precise structured reasoning.
Tool Filtering
You can control which tools are exposed per MCP server, per agent:- Include list — Only specified tools are registered (whitelist)
- Exclude list — Specified tools are hidden (blacklist)
- Per-agent granularity — Different agents can enable different tools from the same MCP server (e.g., a “Code Reviewer” agent sees only read-only GitHub tools, while a “DevOps” agent sees all)
- Configure via the GUI in the Agent Config Panel > MCP > Tool Selection
Safety Annotations
MCP tools carry annotation hints that Myrm uses for automatic risk management:Default Safe Set
When you first enable an MCP server for an agent, Myrm inspects tool annotations and automatically builds a safe default selection:- All
readOnlyHinttools are enabled - Tools with
destructiveHintare disabled and flagged with a warning banner (“N destructive tools disabled by default”) - You can always override the defaults in the Tool Selection GUI
Tool Name Isolation
When multiple MCP servers are enabled, tool names can collide (e.g. both a GitHub and GitLab server may exposesearch_repos). Myrm applies server-prefix isolation to every MCP tool:
- Double-underscore delimiters — Unlike single-underscore schemes (which are ambiguous when server names contain underscores), the
__delimiter allows unambiguous parsing back to(server, tool)pairs - Permission safety — Prefixed names never collide with built-in tool names, preventing accidental permission bypass
- Audit traceability — Every tool invocation log entry clearly shows which MCP server the tool belongs to
- Transparent to users — The GUI always displays the friendly original tool name; prefixing is internal to the engine
Dynamic Tool Discovery
When an MCP server adds, removes, or updates its tools at runtime, Myrm detects the change automatically via the standardnotifications/tools/list_changed notification:
- Zero-downtime refresh — The session actor re-fetches the tool list and updates the execution layer without interrupting in-flight calls (serialized through the internal queue, no locks)
- Prompt cache stability — The prompt-facing proxy tools remain frozen; only the internal execution map is updated, so prompt prefix cache hits are never compromised
- Timeout protection — The refresh re-fetch is bounded by the same connect timeout as session initialization, so a hung MCP server cannot deadlock the owner task
- Change logging — Added and removed tools are logged at WARNING level for visibility; no-op refreshes are logged at INFO level
- Transparent to agents — Agents continue using their existing tool references; new tools become callable immediately, removed tools fail explicitly on next invocation
Deferred Loading
To prevent tool schema bloat in the system prompt, MCP tools support deferred loading:- Tools are registered but not included in the initial prompt
- When the agent needs a specific capability, the tool is loaded on demand
- This keeps the system prompt compact and cache-friendly
Reverse MCP Server (Connect)
Myrm can also act as an MCP server, exposing its memory system to external AI agents (Claude Code, Cursor, Codex, Windsurf, Gemini CLI). This means your knowledge persists across all your AI tools.How It Works
Navigate to Settings > Memory > Connect to launch the Connect Wizard:- Choose your Myrm Agent — Select which Agent Profile the external tool should bind to. The external tool will read/write that agent’s memory space, including any shared contexts bound to it.
- Choose your IDE — Select from 5 supported MCP clients
- Generate config — One click generates a Bearer token (carrying the agent scope) and a ready-to-paste config snippet
- Paste into your IDE — Copy the snippet into your IDE’s MCP settings file
- Done — Your external agent now has scoped access to the selected Myrm Agent’s memory
Exposed Tools
Security
- Bearer Token authentication — Each connector gets a unique
myrm_mcp_*token scoped to a specific Agent Profile - Per-agent memory isolation — External tools only access the bound agent’s memory and shared contexts, not other agents’ data
- One-click revoke — Instantly invalidate a connector’s access without affecting others
- HTTP transport — Works over the network (not limited to local stdio)
- Doctor health check — Verify connectivity from the GUI at any time
Supported Clients
Why This Matters
When you work in Cursor on code and then switch to Myrm’s WebUI for research, both agents share the same memory. Project decisions stored by one agent are instantly available to the other — no manual context transfer needed.Enterprise Org MCP (Cloud SaaS)
On cloud-hosted enterprise deployments, IT admins can centrally manage MCP servers for the whole organization:- Navigate to Settings → Enterprise → Org MCP (owner/admin only)
- Add HTTP/SSE MCP servers with name, URL, and optional auth headers
- Changes are pushed automatically to every member sandbox via the control plane
- If a sandbox is sleeping, delivery is queued and replayed on wake (up to 3 retries)
- Employees see org-managed MCP servers as read-only under Settings → MCP — they cannot edit or remove IT-managed entries
- stdio MCP is blocked in cloud sandboxes for security (local process servers are not allowed)
Troubleshooting
Server Won’t Start
- Check the command path is correct and accessible
- Verify required environment variables are set
- Check server logs in Settings > Tools > MCP > Logs
Tools Not Appearing
- Wait 5-10 seconds after server start for tool discovery
- Click Refresh in the MCP settings panel
- Check if the server’s tool list response is valid JSON Schema
Connection Drops
The self-healing reconnect system handles most connection issues transparently — the session actor rebuilds the connection in place without user intervention. If a tool call fails due to a transport break, retry the message and the next call will land on the fresh session. For persistent failures after 5 reconnect attempts, check:- Network connectivity to the MCP server
- Server process health (may need restart)
- Resource limits (file descriptors, memory)
Local Editor MCP Probe Diagnostics
When you connect local-only integrations (for example Unreal Engine or Blender), Myrm runs/api/v1/integrations/mcp/probe before scan/verify. This avoids dead-end setup flows where users click Connect repeatedly without knowing the root cause.
Additional behavior guarantees:
- If
shouldBlockConnect=true, Myrm stops the connect chain immediately (no scan/verify fan-out), reducing noisy failures. - The UI maps
reasonCodeto localized operator-facing messages, so infra and app teams can triage from the same signal. recommendedModeis actionable in one click:start_local_editor_mcp/verify_local_network_and_editortrigger a probe retry and auto-continue connect on success, whilelocal_or_tauriopens local deployment guidance directly.- Compared to competitors that surface generic network errors only, Myrm provides machine-readable diagnostics that can be automated in CI checks and onboarding scripts.
Why this migration path is smoother than CLI-first flows
- In-product remediation, not terminal handoff: Operators can recover from local MCP failures inside the same Connect dialog. In contrast, OpenClaw’s MCP page is explicitly an operator view and asks users to run terminal probe commands (
openclaw mcp doctor --probe) for live proof. - Actionable contract instead of boolean pass/fail: Myrm returns
reasonCode + recommendedMode + shouldBlockConnect, so frontend behavior is deterministic (block fan-out, show localized cause, and provide one-click action). Hermes’/api/mcp/servers/{name}/teststyle response is primarilyok/error/tools, which is useful for diagnostics but less expressive for guided onboarding UX. - Noise reduction by design: When the probe says block, Myrm stops scan/verify fan-out immediately. This prevents avoidable downstream failures and reduces “retry blindly” behavior during migration from legacy MCP setups.
- Unknown-failure safety: Unexpected probe failures return a sanitized operator message while server logs retain debuggable details, avoiding accidental leak of low-level exception internals to end users.
OAuth Token Expiry
When an MCP server’s OAuth token expires (common with GitHub, Linear, Notion, Slack integrations), Myrm detects the failure at runtime and guides you to re-authorize:- Instant detection — When a tool call receives an HTTP 401 from the MCP server, the error is caught immediately (no need to exhaust reconnect retries first)
- User notification — A toast appears: ” requires re-authorization” with a one-click “Reauthorize” button
- One-click fix — Click the button to jump directly to Settings → Extensions where you can re-authorize with OAuth
- Token hot-update — After re-authorization, active sessions automatically pick up the fresh token via the connection pool — no page reload or session rebuild needed. The very next tool call uses the new credentials
Enterprise Private MCP Tunnel (Cloud Only)
:::info Cloud deployment only This feature is available exclusively for cloud-hosted Myrm deployments managed by the control plane. Local and Tauri users connect to MCP servers directly via stdio — no tunnel needed. ::: For enterprise customers whose MCP servers run on private networks (behind firewalls, in VPCs, or on-premises), Myrm provides a reverse tunnel that lets your cloud-hosted AI agent securely access internal MCP servers — without exposing any ports or modifying firewall rules.How It Works
- Deploy tunnel-agent — Install the open-source
myrm-tunnel-agenton any machine inside your private network - Register tunnel — The agent registers with the control plane and receives a secure token
- Outbound-only connection — The tunnel-agent initiates an outbound long-poll connection to the control plane relay — no inbound ports required
- Transparent relay — When your cloud Myrm agent calls an internal MCP tool, the request is relayed through the tunnel to the internal MCP server and the response is returned transparently
Security
Architecture
Setting Up
- Register a tunnel in the org admin panel (Settings → Organization → MCP → Add Tunnel)
- Deploy
myrm-tunnel-agentwith the provided token and internal MCP server endpoint - The tunnel appears as an org-level MCP server — assign it to agents like any other MCP server
Enterprise Managed Auth — IdP Group-Based MCP Access (Cloud Only)
:::info Cloud deployment only This feature is available exclusively for cloud-hosted Myrm deployments with OIDC SSO configured. Local and Tauri users manage MCP access directly in their local settings. ::: For enterprise customers using Identity Providers (Okta, Entra ID, Google Workspace, etc.), Myrm automatically maps IdP group memberships to org MCP server access — so IT administrators can control which teams see which tools, with zero manual per-user configuration.How It Works
- OIDC groups claim — When a user logs in via SSO, Myrm extracts the
groupsclaim from the OIDC response and stores it on the user’s org membership record - Per-MCP group whitelist — Org admins configure an optional
acl_groupslist on each org MCP server (empty = visible to all members) - Automatic filtering — When MCP configurations are pushed to a user’s sandbox, only servers where the user’s IdP groups intersect with the server’s ACL groups are included
- Login refresh — Group memberships are automatically refreshed on every OIDC login — no manual sync needed
Configuring Group-Based Access
- Navigate to Settings → Organization → MCP Servers
- When creating or editing an MCP server, enter IdP group names in the Access Groups field (comma-separated)
- Leave the field empty to make the server visible to all organization members
- Members whose IdP groups match at least one configured group will see and use the server