# LibreModular-MCP

## Universal MCP server written in Rust, with a Hub that exposes only two tools

If a model drives a desktop application with one tool per gesture, every gesture is a round trip. The Hub exposes two tools: one script does the whole job in one call. GIMP, Krita, Blender, Inkscape and LibreOffice work today, each through a module and a bridge; the Hub is built for as many applications as possible in one server.

## A script sent, the Hub's answer

This script draws a three-bar chart in an Inkscape document. A client sent it in one `execute_script` call, and the block under it is the Hub's answer. The [Demonstration](https://libremodular.davalan.fr/demonstration/index.md) gives a client of 25 lines and every step to replay a run like this one.

**Script written**

```python
import json
import os

import inkex

document = inkex.load_svg(os.environ["LMM_DOCUMENT"])
layer = document.getroot().add(inkex.Layer.new("Chart"))
for index, value in enumerate([3, 7, 5]):
    layer.add(inkex.Rectangle.new(20 + index * 30, 100 - value * 10, 20, value * 10))
document.write(os.environ["LMM_DOCUMENT"])
print("LMM_RESULT: " + json.dumps({"bars": len(layer)}))
```

**Hub response**

```json
{
  "app": "inkscape",
  "duration_ms": 151,
  "error": null,
  "result": {
    "bars": 3
  },
  "status": "ok",
  "stderr": "",
  "stdout": "",
  "truncated": false
}
```


Inkscape 1.4 ran it in the `cli` mode, with no window: the Hub started one Python process for the script and returned the value the script printed after `LMM_RESULT: ` as `result`.

## Two tools, one module per application

This is LibreModular-MCP. The Hub is one Rust binary that gives the model exactly two tools. `execute_script` runs a complete Python script in an application and returns what the script printed, its `result`, or the application's own error trace. `get_state` returns what is open in the application. A module on the Hub side and a bridge on the application side reach GIMP, Krita, Blender, Inkscape and LibreOffice; the Hub itself knows none of their interfaces.

These five applications are the ones tried, not the scope of the Hub: another application is added through a module, a bridge and its guide, as [CONTRIBUTING.md](https://github.com/RonanDavalan/LibreModular-MCP/blob/main/CONTRIBUTING.md) describes, and the code is MIT-licensed.

The [Quickstart](https://libremodular.davalan.fr/quickstart/index.md) creates the configuration of the Hub, [Connect your model](https://libremodular.davalan.fr/clients/index.md) declares it in Claude Code or in opencode, and [Installation](https://libremodular.davalan.fr/installation/index.md) gives the package for each Linux family.

