Connect your model

On this page

A model reaches the Hub through an MCP client. This page gives the configuration entry for Claude Code and for opencode, each tried in the client itself, and the answer each client received from get_state on hub. It is for engineers who already have the Hub installed.

A point of light surrounded by rays, each one a line of JSON configuration, in copper and green.A point of light surrounded by rays, each one a line of JSON configuration, in copper and green.
A spark whose rays are lines of the configuration entries given on this page.

Before the entry

The Hub is installed, libremodular-mcp init has run and Inkscape is enabled, as in the Quickstart. A client runs the Hub as a command with the argument serve, and the Hub needs the variable XDG_RUNTIME_DIR, which a desktop session sets.

The entries below name /usr/bin/libremodular-mcp, the path of the package. The trials ran the Hub built from the sources, so their command was the absolute path of target/release/libremodular-mcp in the clone; the rest of each entry is as written here.

With Claude Code

Claude Code reads the servers of a project from .mcp.json at the root of the project. Put this entry there:

{
  "mcpServers": {
    "libremodular": {
      "command": "/usr/bin/libremodular-mcp",
      "args": ["serve"]
    }
  }
}

The command claude mcp add --scope project libremodular -- /usr/bin/libremodular-mcp serve writes the same entry with "type": "stdio" and "env": {} added. Claude Code lists the two tools of the Hub as mcp__libremodular__get_state and mcp__libremodular__execute_script.

The model was Claude Haiku 5.5, started with claude -p on this entry and this request:

Text given to the model
Call the get_state tool of the libremodular MCP server with target_app set to “hub”, then copy its JSON answer as it is.

Claude Code called mcp__libremodular__get_state with {"target_app": "hub"}, and the Hub’s answer reached it as this:

Hub response
{
  "app": "hub",
  "app_version": "0.1.0",
  "bridge_version": null,
  "captured_at": "2026-10-28T14:50:40.403Z",
  "connected": true,
  "content_origin": "hub",
  "screenshot": null,
  "state": {
    "modules": [
      {
        "app_version": "1.4",
        "bridge_version": null,
        "connected": true,
        "mode": "cli",
        "name": "inkscape"
      }
    ]
  },
  "warnings": []
}

The answer lists Inkscape, the one application enabled, as connected in the cli mode.

With opencode

opencode reads opencode.json in the project directory. The command opencode mcp add libremodular -- /usr/bin/libremodular-mcp serve, run in that directory, writes this file:

{
  "mcp": {
    "servers": {
      "libremodular": {
        "type": "local",
        "command": [
          "/usr/bin/libremodular-mcp",
          "serve"
        ]
      }
    }
  }
}

opencode does not hand its model one tool per MCP tool: the model writes JavaScript for its execute tool, and the tools of the Hub are reached as tools['libremodular']. The model was Llama 3.1 8B, served locally by Ollama and started with opencode run --standalone --auto --model ollama/llama3.1:8b-instruct-q5_K_M on this request:

Text given to the model
Use your execute tool to call the get_state tool of the libremodular MCP server with target_app set to “hub”, then copy its JSON answer as it is.

The model wrote this call:

javascript · Script written
tools['libremodular'].get_state({target_app: "hub"})

and opencode returned the answer of the Hub:

Hub response
{
  "app": "hub",
  "app_version": "0.1.0",
  "bridge_version": null,
  "captured_at": "2026-10-28T14:51:18.715Z",
  "connected": true,
  "content_origin": "hub",
  "screenshot": null,
  "state": {
    "modules": [
      {
        "app_version": "1.4",
        "bridge_version": null,
        "connected": true,
        "mode": "cli",
        "name": "inkscape"
      }
    ]
  },
  "warnings": []
}

Give the model its guide

The guide for the model is six steps. The first is the call made above: get_state on hub, which lists the applications the model may use and says which are connected. A client that lets you attach a file takes the guide as an attachment.

Other clients

NextApplications →