Skip to main content
Glama
@pipeworx/mcp-fr-legifrance

@pipeworx/mcp-fr-legifrance

by pipeworx-io

@pipeworx/fr-legifrance

France's Légifrance API via the state's PISTE gateway — everything on that API that @pipeworx/france-legi (consolidated codes) and @pipeworx/fr-judilibre (Cour de cassation judicial case law) do not already serve: the Journal officiel (JORF), collective-bargaining agreements (KALI), Conseil d'État / administrative case law (the JADE dataset, fond CETAT), Constitutional Council decisions (CONSTIT), and a search spanning those plus circulaires (CIRC), company-level collective agreements (ACCO) and CNIL decisions (CNIL).

Part of Pipeworx — an MCP gateway connecting AI agents to 1875+ live data sources. This is an independent, unofficial integration — not affiliated with, endorsed by, or published by the upstream provider.

Promoted from mcps/_incubator/ (fleet #3943) once the PISTE "pipeworx" application's Client ID/Secret for the "Légifrance Beta" product existed and was wired as PLATFORM_LEGIFRANCE_KEY. The credential itself was confirmed live before promotion (OAuth2 token exchange, /consult/ping, and a real /list/code call all returned real data). The four tools below landed KEY-PENDING (the bounded compromise Bruce ruled for ip-australia, fleet #3605): PACK_SMOKE_KEY_SECRET that lets a pack be smoke-tested with its real credential is CI-only by design (fleet #3333), so no fleet machine can call these tools themselves pre-deploy. Their examples/output shapes are honest, UNMEASURED documentation authored from smoke.json, not a live smoke pass — the mandatory post-deploy reprobe (node scripts/add-pack.mjs fr-legifrance --from 8) is what actually proves them.

Tools

  • fr_legifrance_search(fond, query, date_start?, date_end?, page?, page_size?) — full-text search in one of JORF / KALI / CETAT / CONSTIT / CIRC / ACCO / CNIL. Refuses CODE_DATE/CODE_ETAT/LODA_DATE/LODA_ETAT (use france-legi) and JURI (use fr-judilibre) by name.

  • fr_legifrance_text(id, fond?) — reads one full text by id, routing to the right consult endpoint from the id's prefix (JORFTEXT…, KALITEXT… / KALIARTI… / KALICONT…, CETATEXT…, CONSTEXT…, CNILTEXT…, ACCOTEXT…). A bare numeric circulaire id needs fond:"CIRC" since it has no recognisable prefix. Refuses a JURITEXT… id (points at fr-judilibre) or a LEGITEXT…/LEGIARTI… id (points at france-legi).

  • fr_legifrance_journal_officiel_recent(n?) — the n most recently published Journal officiel issues (default 5, max 30), each with its id, date, JO number and contained texts.

  • fr_legifrance_convention_collective(idcc) — resolves a collective agreement's IDCC number to its title, scope and the KALITEXT ids of its base texts, for when you have an IDCC rather than a raw text id.

Related MCP server: mpc-legifrance

Auth

Platform key (PLATFORM_LEGIFRANCE_KEY, injected as _apiKey). This is OAuth2 client_credentials — "client_id:client_secret" — not the same credential shape as fr-judilibre's single KeyId header, and NOT the same value as PLATFORM_JUDILIBRE_KEY. The same PISTE application can hold both (a KeyId for Judilibre and a client_id/secret for Légifrance), but they are different credential values issued for different API products on the PISTE developer portal, and subscribing to "Légifrance Beta" needs its own CGU acceptance separate from Judilibre's. Each call exchanges the client_id/secret for a short-lived Bearer token via PISTE's OAuth2 client_credentials grant (scope=openid; the token endpoint lives only in src/index.ts, CLAUDE.md 9b) and is not cached across calls, mirroring @pipeworx/euipo's OAuth pattern (project security policy: no provider-pack token caching).

Data sources

  • DILA, Journal officiel de la République française (JORF).

  • DILA, Légifrance — conventions et accords collectifs (KALI).

  • Conseil d'État, jurisprudence administrative (the JADE dataset), served through Légifrance.

  • Conseil constitutionnel, décisions, served through Légifrance.

  • DILA, Légifrance — circulaires et instructions; accords d'entreprise.

  • CNIL, délibérations, served through Légifrance.

Routes live only in src/index.ts (CLAUDE.md 9b). Reuse: Licence Ouverte / Open Licence 2.0, the same licence already governing @pipeworx/france-legi and @pipeworx/fr-judilibre, plus the PISTE portal's own terms of use and the Légifrance-specific terms of reuse published alongside the API (cgu-legifrance-api-vf-15-12-2022.pdf, referenced from the API's own portal page). Live proxy per request — no bulk mirroring.

Implementation notes

  • Verified from the DILA's own OpenAPI 3.0.1 spec ("DILA - Légifrance Beta", served from the PISTE API-tester page and mirrored publicly at github.com/v3rmine/legifrance-api-swagger), not reconstructed from a third-party wrapper. Two things the spec confirms that most third-party wrappers get wrong:

    • The fond enum is JORF, CNIL, CETAT, JURI, CONSTIT, KALI, CODE_DATE, CODE_ETAT, LODA_DATE, LODA_ETAT, ALL, CIRC, ACCO. CETAT (Conseil d'État) is its own fond, not a filtered view of JURI.

    • JURI, CETAT and CONSTIT share one Elasticsearch index server-side (the spec's own ElasticData.usage field: "Consultation et recherche des fonds JURI, CETA et CONSTIT"), so /consult/juri reads a CETATEXT or CONSTEXT id exactly as it does a JURITEXT one, despite the endpoint's summary only naming "Jurisprudence judiciaire".

  • fr_legifrance_search's date filter (facette: "DATE_DECISION") is only applied for fond CETAT/CONSTIT, where it is confirmed by a published working client (sancelot/legifrance-mcpserver). For the other fonds the facette name needed for date filtering is not confirmed, so the tool returns a date_filter_note saying the dates were ignored rather than guessing a facette that could silently filter to zero rows (docs/silent-zero-policy.md).

  • completeness_note on every search result: totalResultNumber counts what that fond's corpus has indexed, not every text/decision ever issued.

  • This pack landed KEY-PENDING (fleet #3943): workers/gateway/src/tool-examples.json entries and output schemas were authored from smoke.json's argument shapes, not measured from a live call — no fleet machine can fetch PLATFORM_LEGIFRANCE_KEY to smoke-test with it (fleet #3333). The mandatory post-deploy reprobe is what actually proves each tool.

  • The User-Agent sent to PISTE deliberately omits the usual (+https://pipeworx.io) suffix other packs use — PISTE's OAuth token endpoint rejected that exact shape; see the comment beside UA in src/index.ts.

Quick Start

Add to your MCP client (Claude Desktop, Cursor, Windsurf, etc.):

{
  "mcpServers": {
    "fr-legifrance": {
      "url": "https://gateway.pipeworx.io/fr-legifrance/mcp"
    }
  }
}

What this endpoint actually serves

tools/list at https://gateway.pipeworx.io/fr-legifrance/mcp returns the tools in the table above plus the shared Pipeworx meta-tools — ask_pipeworx, discover_tools, search_within, remember/recall and the rest of the gateway-wide set. So the tool count you see is larger than this table: a single-pack endpoint currently lists roughly 30 shared tools alongside the pack's own. The connection's initialize response states its exact scope, and is the authoritative answer for a given day.

This is deliberate, not multiplexing by accident. The meta-tools are what let a scoped connection answer a question this pack does not cover — via ask_pipeworx, which routes across the whole catalog — without you adding a second MCP server. There is currently no way to mount a pack endpoint without them; if the extra schemas cost you more context than the routing is worth, connect to the full gateway once rather than to several pack endpoints.

Or connect to the full Pipeworx gateway to get every pack's tools listed directly, instead of just this one's:

{
  "mcpServers": {
    "pipeworx": {
      "url": "https://gateway.pipeworx.io/mcp"
    }
  }
}

Both URLs reach the same gateway and the same 1875+ data sources. The only difference is which pack's tools are listed directly; ask_pipeworx reaches all of them from either one.

No MCP client? Call it over HTTP

curl -X POST https://gateway.pipeworx.io/v1/tools/fr_legifrance_search \
  -H 'Content-Type: application/json' \
  -d '{"fond":"CETAT","query":"excès de pouvoir","page_size":3}'

No account needed for the first calls. Inspect any tool: GET https://gateway.pipeworx.io/v1/tools/fr_legifrance_search. Find one: POST https://gateway.pipeworx.io/v1/tools/search_packs with {"query":"..."}.

Run it from npm

@pipeworx/mcp-fr-legifrance is a local stdio bridge to the Pipeworx gateway: your MCP client starts it with npx, and it forwards every call to the same https://gateway.pipeworx.io/fr-legifrance/mcp endpoint shown above. It needs network access; there is no offline mode.

{
  "mcpServers": {
    "fr-legifrance": {
      "command": "npx",
      "args": ["-y", "@pipeworx/mcp-fr-legifrance"]
    }
  }
}

Without a key it calls anonymously, capped at 50 calls a day. A free account raises that to 200 a day: get a key at https://pipeworx.io/signup and add "env": { "PIPEWORX_API_KEY": "<your key>" } to the server entry. The key is sent as a Bearer token, the same way a hosted connection sends it, so calls are metered and billed exactly as they are there.

It lists only this pack's tools by default. Set PIPEWORX_META_TOOLS=1 to also list ask_pipeworx and the other gateway-wide tools.

Behind an HTTPS proxy: Node's built-in fetch does not read HTTPS_PROXY by default. Newer Node releases honour it when NODE_USE_ENV_PROXY=1 is set; check your Node version's documentation.

Using with ask_pipeworx

Instead of calling tools directly, you can ask questions in plain English — this works on the pack endpoint above as well as on the full gateway:

ask_pipeworx({ question: "your question about Fr Legifrance data" })

The gateway picks the right tool and fills the arguments automatically.

More

License

MIT

Tool Schema Changelog

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

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Provides access to official French legal databases (Légifrance and JudiLibre) to search and retrieve French legislation, legal codes, case law, and judicial decisions through authenticated APIs.
      37
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables legal research by providing unified search across ~3.3 million court decisions (French and European) and ~1.5 million consolidated law articles, with tools for retrieving full texts and historical versions, all without authentication.
      13
      MIT