Uses .ENV files to securely store API credentials and configuration needed to access the Legifrance API.
Allows installation directly from GitHub repository using pip or uv package managers.
Leverages Python for implementing the MCP server, with support for Python 3.9+ environments and package management.
mcp-server-legifrance
Experimental MCP Model Context Protocol server allowing querying of French legal bases via the Legifrance API in compatible LLMs such as Claude.
Description
This project implements an MCP server that provides access to French legal resources (legal texts, codes, case law) directly from a Large Language Model. It facilitates legal research by making Legifrance data accessible via interactive tools.
It is necessary following the creation of the pylegifrance package.
What is MCP?
The Model Context Protocol (MCP) is a standardized protocol developed by Anthropic that allows language models like Claude to interact in a structured way with external tools and services. This is an exciting step forward in LLM interoperability because it establishes a common framework for data exchange and function execution between models and third-party APIs. Until now, specific function calls had to be developed for each service.
Interoperability via MCP
The importance of MCP lies in its ability to create a standardized interface between LLMs and external systems. This standardization has several advantages:
- Modular architecture : Developers can create specialized tools that are easily integrated with different protocol-compatible LLMs.
- Increased security : MCP limits model access to only explicitly defined features, reducing security risks.
- Simplified maintenance : Updates to external tools can be made independently of the model, facilitating system evolution.
- Capability Expansion : LLMs can access real-time data and perform complex operations that they could not perform alone.
mcp-server-legifrance?
The idea is to harness the power of language models like Claude to perform processing on official legal content via Légifrance, and eventually, other public databases like the RNE, the BODACC, etc. The initial results are very promising and help overcome some of the limitations of the traditional statistical research offered by Légifrance. The service is continuously improving, but you can already see some examples of research below.
The server supports the following features:
- Search in legal texts (laws, ordinances, decrees, orders)
- Consultation of articles of French legal codes
- Research in judicial case law
The other Legifrance funds will soon be implemented.
If you want to directly access the Legifrance API to connect your own MCP server, click here: https://lab.dassignies.law or linkedin
Prerequisites
- Python 3.9+
- API key for Legifrance (obtainable from lab.dassignies.law )
- A model compatible with the MCP protocol (like Claude desktop)
Facility
- Create a virtual environment and activate it:
- Install via pip:
- Install via UV
- Create a
.env
file at the root of the project with your credentials:
To get your test API keys, please contact me via LinkedIn
Use
Integration with Claude
This is the "simplest" integration.
- Use the following configuration file to integrate the MCP server into Claude Desktop. To find this file, go to Settings > Developer > Edit Configuration (links to the configuration file in .json format).
There is also a command line procedure via uv which will be documented later.
Here is an example of use:
- Start Claude desktop, you should see tool icons appear:
Available tools
1. search_in_legal_text
Search for articles in legal texts (laws, ordinances, decrees, orders).
Settings:
- text_id : Text identifier (e.g. "78-17" for the Data Protection Act)
- search : Keywords or article number
- field : Search zone ("ALL", "TITLE", "TABLE", "NUM_ARTICLE", "ARTICLE")
- search_type : Search mode ("ALL_WORDS_IN_A_FIELD", "EXACT_EXPRESSION", "AT_LEAST_ONE_WORD")
- page_size : Number of results (max 100)
For details, see https://lab.dassignies.law/api/docs
Example: To search for article 7 of law 78-17:
2. search_code
Search for articles in French legal codes.
For example: "Write me a summary of the legal regime of the PACS"
Settings:
- search : Search terms
- code_name : Name of the code (e.g. "Civil Code", "Labor Code")
- field : Search area
- sort : Sorting results
- search_type : Search mode
- page_size : Number of results
- fetch_all : Whether all results should be fetched
Example: To search for information on PACS in the Civil Code, the language model will send the following query:
For details, see https://lab.dassignies.law/api/docs
3. search_judicial_case law
Search the judicial case law database. You can use the power of language models to search for case law directly in Legifrance.
Example 1 Overview of the latest news articles on a particular theme (e.g. "Find me the latest news articles on the sudden breakdown of established commercial relations and write me a summary table").
Example 2 From a particular known decision (appeal number 23-23.382), we can carry out analyses in stages:
- We find the stop and Claude generates the stop sheet
- He is asked to extract the articles in question and find them in Legifrance
- He is asked to find similar jp
- etc ...
Settings:
- search : Terms or case number
- publication_bulletin : Whether published in the bulletin ["T"] or not ["F"]
- sort : Sorting results
- field : Search area
- search_type : Search mode
- page_size : Number of results
- fetch_all : Whether all results should be fetched
- juri_keys : Response fields to extract
- judicial_jurisdiction : List of jurisdictions
For details, see https://lab.dassignies.law/api/docs
Predefined prompts
The server can include predefined prompts to facilitate use. Currently, only one prompt has been implemented as an example. It is possible to implement much more detailed prompts, particularly for performing deep search operations or extracting from multiple documents.
expert legal agent
Creates an expert legal agent who:
- Systematically cites your sources
- Uses relevant tools to search for information
- Provides step-by-step analysis
- Includes official links to legal texts
Use:
Limitations
- Requests are limited to 10 per second to comply with API limits
- An internet connection is required to access the legal bases
- The server does not cache results, each request queries the API
Contribution
Contributions are welcome! Please open an issue or submit a pull request for any improvements or fixes.
License
This server cannot be installed
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
A server implementing the Model Context Protocol to allow direct access to French legal resources (laws, codes, case law) from compatible Large Language Models like Claude, enabling interactive legal research through the Legifrance API.
Related MCP Servers
- -securityAlicense-qualityA Model Context Protocol server that enables Claude and other LLMs to make HTTP requests with realistic browser fingerprinting, bypassing common anti-bot measures and interacting with websites more naturally.Last updated -3PythonMIT License
- -securityAlicense-qualityA Model Context Protocol server that enables Claude to perform advanced web research with intelligent search queuing, enhanced content extraction, and deep research capabilities.Last updated -53TypeScriptMIT License
- -securityAlicense-qualityA Model Context Protocol server that enables large language models like Claude to perform comprehensive interactions with Firebase Firestore databases, supporting full CRUD operations, complex queries, and advanced features like transactions and TTL management.Last updated -482JavaScriptMIT License
- -securityFlicense-qualityA Model Context Protocol server for law office database management that enables tracking clients, cases, billable time, and invoices.Last updated -Python