# Connect your model

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 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](https://libremodular.davalan.fr/quickstart/index.md). 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:

```json
{
  "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
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**

```json
{
  "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:

```json
{
  "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
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:

**Script written**

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


and opencode returned the answer of the Hub:

**Hub response**

```json
{
  "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": []
}
```


> **Limit**
>
> One model answered, once the request named the `execute` tool. A request that did not name it did not bring back the answer of the Hub; `qwen2.5-coder:14b`, also local, wrote the call as text and ran nothing; the hosted free models of opencode had reached their usage limit. `opencode mcp list` shows no server although `opencode run` reaches the Hub: the answer of `get_state` is the check.


## Give the model its guide

The [guide for the model](https://github.com/RonanDavalan/LibreModular-MCP/blob/main/docs/GUIDE_LLM.md) 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

> **Limit**
>
> No other MCP client was tried. Which file the entry goes into, and what its keys are called, depends on your client.

