Using Metapad via MCP (Claude Desktop / Claude Code)

Advanced

Using Metapad via MCP (Claude Desktop / Claude Code)

Metapad implements the Model Context Protocol (MCP), allowing external AI tools like Claude Desktop and Claude Code to read and modify your models.

What is MCP?

MCP is a standard protocol that lets AI assistants interact with external data sources. Metapad's MCP API exposes 15 tools for querying and mutating models.

Prerequisites

  1. Pro plan or higher
  2. Claude Desktop or Claude Code installed
  3. Either an API token (see "API Tokens and External Access") or an OAuth login (see "Connecting MCP via OAuth")

Authentication Options

Metapad supports two ways to authenticate MCP connections:

  • OAuth (recommended for interactive use): Just log in with your Metapad credentials — no token needed. See "Connecting MCP via OAuth" for details.
  • API tokens: Create an mpt_... token for scripts, CI/CD, or automation. See "API Tokens and External Access".

Connecting Claude Desktop

  1. Open Claude Desktop settings
  2. Find the MCP Servers configuration
  3. Add a new MCP server with:
    • Type: HTTP
    • URL: Your Metapad MCP endpoint
    • Authentication: OAuth (automatic) or Bearer token (mpt_...)
  4. Save and restart Claude Desktop
  5. If using OAuth, a login window will open — sign in with your Metapad credentials
  6. Claude can now query and modify your model

Connecting Claude Code

  1. Configure the MCP server in your project's .claude/settings.json or via CLI
  2. Use the same endpoint URL and API token
  3. Claude Code can now interact with your model during coding sessions

Available MCP Tools

The MCP API provides:

Read tools:

  • get_metamodel — understand the model's schema
  • search_nodes — find nodes by type, name, or properties
  • get_node_details — get full details for specific nodes
  • get_relationships — find connections between nodes
  • get_statistics — model stats and counts
  • find_similar_nodes — detect potential duplicates

Write tools:

  • create_nodes, update_nodes, delete_nodes, merge_nodes
  • create_relationships, delete_relationships
  • add_node_type, add_relationship_type, add_allowed_connection

Tips

  • Start with get_metamodel to understand the model's structure
  • All mutations are applied in real-time — browser users see changes immediately
  • MCP access respects the same model data as the web UI
  • OAuth connections show your name to collaborators; API tokens show "mcp-api"