Skip to main content
Glama

looping-agent

Lire, modifier et créer des fichiers Looping (.loo, MCD Merise) sans ouvrir Looping : en Python, en ligne de commande, ou depuis une IA (Claude Desktop, Claude Code, Cursor…) grâce à un serveur MCP.

Exemple de demande à une IA :

« Crée-moi un MCD d'une bibliothèque dans biblio.loo, puis donne-moi le MLD, le MPD et le script PostgreSQL. »

Le fichier produit s'ouvre ensuite normalement dans Looping.

Python 3.10+ uniquement, aucune dépendance.

Projet indépendant, sans lien avec l'auteur de Looping. Looping est disponible gratuitement sur looping-mcd.fr et n'est pas inclus dans ce dépôt.

Ce que ça fait

  • Lire un .loo en JSON : entités, attributs (type, identifiant), associations, liens, cardinalités.

  • Modifier : ajouter, renommer, déplacer ou supprimer une entité ou une association ; ajouter, modifier ou supprimer un attribut ; ajouter ou supprimer un lien ; changer une cardinalité.

  • Créer un MCD complet à partir d'un JSON.

  • Générer le MLD, le MPD (tableau des colonnes, types, NULL, PK, FK) et le script SQL (generic, mysql, postgresql, sqlite).

  • Avant la première modification d'un fichier, une copie <fichier>.loo.bak est gardée.

Related MCP server: a5sql-mcp

Installation

pip install git+https://github.com/Dr1mS/looping-agent

Ça installe deux commandes : looping-agent (ligne de commande) et looping-mcp (serveur MCP). Sous Windows, si pip n'est pas reconnu, utilise py -m pip install ....

Sans installation, depuis un clone du dépôt : python3 -m looping_agent ....

Utiliser avec une IA (MCP)

Claude Desktop

Ouvre le fichier de configuration :

  • Windows : %APPDATA%\Claude\claude_desktop_config.json

  • macOS : ~/Library/Application Support/Claude/claude_desktop_config.json

  • Linux : ~/.config/Claude/claude_desktop_config.json

Ajoute dans mcpServers :

{
  "mcpServers": {
    "looping": { "command": "looping-mcp" }
  }
}

Si Claude Desktop ne trouve pas looping-mcp, mets le chemin complet donné par where looping-mcp (Windows) ou which looping-mcp (macOS/Linux).

Quitte complètement Claude Desktop, puis relance-le. Les outils loo_* apparaissent dans le menu des outils.

Où sont les fichiers ? Claude Desktop lance le serveur dans son propre dossier, souvent en lecture seule. Un chemin relatif (biblio.loo) est donc enregistré dans le dossier de travail ~/Documents/Looping (créé au besoin). Chemins complets et ~/... marchent aussi. Chaque résultat donne le chemin complet du fichier à ouvrir dans Looping. Pour changer de dossier :

"looping": { "command": "looping-mcp", "env": { "LOOPING_DIR": "C:\\Users\\moi\\MCD" } }

Claude Code

claude mcp add --scope user looping -- looping-mcp

Le dépôt contient aussi un .mcp.json : en lançant claude dans le dossier du dépôt, le serveur est proposé automatiquement.

Outils disponibles

loo_read, loo_new, loo_apply_spec, loo_add_entity, loo_add_association, loo_add_link, loo_set_card, loo_remove_link, loo_add_attribute, loo_update_attribute, loo_remove_attribute, loo_rename, loo_move, loo_remove, loo_mld, loo_mpd, loo_sql.

Ligne de commande

looping-agent read  modele.loo
looping-agent new   modele.loo --spec spec.json
looping-agent add_entity modele.loo --name Client \
    --attributes '[{"name":"idClient","type":"INT","pk":true},"nom",{"name":"email","type":"VARCHAR(120)"}]'
looping-agent add_association modele.loo --name passer
looping-agent add_link modele.loo --entity Client --association passer --card 0,n
looping-agent set_card modele.loo --entity Client --association passer --card 1,n
looping-agent mld modele.loo
looping-agent mpd modele.loo --dialect postgresql --out mpd.md
looping-agent sql modele.loo --dialect postgresql --out schema.sql
looping-agent --help

Format d'une spec (new, apply_spec), identique à la sortie de read :

{
  "entities": [
    {"name": "Client", "x": 100, "y": 300,
     "attributes": [{"name": "idClient", "type": "INT", "pk": true}, "nom"]},
    {"name": "Commande", "attributes": [{"name": "idCommande", "type": "INT", "pk": true}]}
  ],
  "associations": [{"name": "passer", "attributes": []}],
  "links": [
    {"entity": "Client", "association": "passer", "card": "0,n"},
    {"entity": "Commande", "association": "passer", "card": "1,1"}
  ]
}

Un attribut donné comme simple texte est un VARCHAR(50). Les positions x / y sont facultatives.

En Python

from looping_agent import Model
m = Model.open("modele.loo")
m.add_entity("Produit", [{"name": "idProduit", "type": "INT", "pk": True}, "libelle"])
m.add_association("contenir")
m.add_link("Produit", "contenir", "1,n")
m.save()

Exemples

  • examples/demo_agent.loo : petit MCD (Étudiant, Cours, Enseignant).

  • examples/hopital/ : MCD de 12 entités et 15 associations (dont une ternaire et une réflexive), avec la spec JSON, le MLD, le MPD et les scripts SQL générés.

Ce qui est vérifié

  • Relecture/réécriture à l'octet près de 4 vrais fichiers Looping (version de fichier 47, 40 à 128 objets, héritage compris).

  • Les fichiers générés s'ouvrent dans Looping (version du 06/03/2025, testé sous Wine 9 sur Linux) avec les entités, types, liens et cardinalités corrects.

  • Le script de examples/hopital s'exécute sans erreur sur SQLite et PostgreSQL. MySQL n'a pas été testé.

Limites

  • Versions de fichier 42 à 51 seulement. Un fichier plus ancien : l'ouvrir et l'enregistrer une fois dans Looping.

  • Pas encore décodés : titres, textes libres, formes, images, crayon, CIF, contraintes, règles, flèches. Un fichier qui en contient renvoie une erreur claire et n'est pas modifié.

  • L'héritage est conservé dans le fichier, mais il n'apparaît pas dans le JSON et le SQL l'ignore.

  • Types écrits nativement : VARCHAR(n), TEXT, INT, DECIMAL(p,s), DATE. Les autres (DATETIME, BOOLEAN…) sont écrits en « type libre » Looping avec le texte donné.

  • Identification relative (R) non gérée.

  • Le MLD/SQL est calculé par cet outil selon les règles Merise classiques, pas par Looping. Pour le résultat officiel, utilise le bouton MLD et l'export SQL de Looping.

Comment ça marche

Le format .loo est une sérialisation MFC CArchive. Il a été décodé par rétro-ingénierie de Looping.exe avec Ghidra, dans un but d'interopérabilité. Le détail champ par champ, avec les adresses des fonctions de l'exe, est dans les docstrings de looping_agent/archive.py et looping_agent/model.py.

Tests

python3 -m unittest discover -s tests -t .

Pour tester aussi la relecture à l'octet près sur tes propres fichiers, mets des .loo dans tests/fixtures/ avant de lancer la commande.

Licence

MIT

Available Tools

17 tools
loo_add_associationC

Add an association (relation).

Inputs: name (required), path (required), x, y, +1 more.

loo_add_attributeC

Add an attribute to an entity or association.

Inputs: name (required), path (required), owner (required), pk, +2 more.

loo_add_entityD

Add an entity.

Inputs: name (required), path (required), x, y, +1 more.

loo_apply_specC

Add every object of a spec (same shape as new) to an existing file.

Inputs: path (required), spec (required).

loo_mldC

Return the logical model (MLD) as text.

Inputs: path (required).

loo_moveC

Move an entity (top-left corner) or association (centre).

Inputs: x (required), y (required), name (required), path (required).

loo_mpdB

Return the physical model (MPD) as Markdown; also write it to out when given.

Inputs: path (required), out, dialect.

loo_newB

Create a new .loo file, optionally filled from a spec {entities:[{name, attributes, x?, y?}], associations:[...], links:[{entity, association, card}]}.

Inputs: path (required), spec, overwrite.

loo_readA

Read a .loo file and return entities, associations, links as JSON.

Inputs: path (required).

loo_removeC

Delete an entity or association and its links.

Inputs: name (required), path (required).

loo_remove_attributeD

Remove an attribute.

Inputs: name (required), path (required), owner (required).

loo_renameC

Rename an entity or association.

Inputs: new (required), old (required), path (required).

loo_set_cardC

Change the cardinality of an existing link.

Inputs: card (required), path (required), entity (required), association (required).

loo_sqlB

Return the SQL DDL script; also write it to out when given.

Inputs: path (required), out, dialect.

loo_update_attributeC

Rename an attribute or change its type / primary key flag.

Inputs: name (required), path (required), owner (required), pk, +2 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    C2.7/5.0

    Scored across 17 tools

    Disambiguation4/5

    Most tools have a clearly distinct target: add/remove/update for entities, associations, links, and attributes are cleanly separated, and the model-export tools (loo_mld, loo_mpd, loo_sql) are unambiguous. The only real overlap is loo_new versus loo_apply_spec, since a new file can already be populated from a spec, and loo_set_card sits close to loo_add_link, but the descriptions distinguish them adequately.

    Naming Consistency4/5

    All 17 tools share a single loo_ prefix and snake_case body, with a strong verb_noun pattern (loo_add_entity, loo_remove_link, loo_update_attribute, loo_apply_spec). A handful of names drop the verb form (loo_new, loo_read, loo_mld, loo_mpd, loo_sql), which are noun-like but still readable and predictable given the domain.

    Tool Count4/5

    17 tools is slightly above the ideal 3-15 band but is justified by a genuinely broad editor surface covering four object types (entity, association, link, attribute) plus three model exports. Each tool maps to one concrete operation, so nothing feels padded, though a couple of operations could be merged.

    Completeness4/5

    The lifecycle is well covered: create opening a file, full add/update/remove for entities, associations, links, and attributes, plus read-back and derived MLD/MPD/SQL output. Minor gaps remain—no file deletion or listing, no bulk edit/clear, and no way to change entity/association properties beyond rename or move.

    Maintenance

    ActivityMaintained
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Reads A5:SQL Mk-2 ER diagrams and SQL files locally, making them accessible to AI tools via the MCP protocol without executing SQL or writing to databases.
      1
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI agents to read and modify Mendix application models through MCP tools for creating modules, entities, pages, microflows, deploying, and querying runtime data.
      1
      ISC
    • A
      license
      C
      quality
      B
      maintenance
      Enables AI agents to operate PowerDesigner 16.5 through COM Automation, providing 55+ tools for database modeling, schema inspection, validation, native DDL generation, and CDM/LDM/PDM workflows with dry-run and rollback safety.
      60
      2
      MIT