Skip to content

Quick Start Guide

Get started with the EurLex MCP Server in just a few minutes.

Step 1: Connect to the Server

Using Claude Desktop

Add the server to your Claude configuration:

{
    "mcpServers": {
        "eurlex": {
            "url": "https://eurlex.lexsocket.ai/mcp"
        }
    }
}

Using Direct API

Connect directly to the API endpoint:

curl -X POST https://eurlex.lexsocket.ai/mcp \
  -H "Content-Type: application/json" \
  -d '{"method": "search_eurlex", "params": {"query": "GDPR"}}'

Step 2: Make Your First Query

{
    "method": "search_eurlex",
    "params": {
        "query": "GDPR compliance",
        "limit": 3
    }
}
{
    "method": "search_eurlex_fts",
    "params": {
        "query": "article 5 GDPR",
        "limit": 5
    }
}
{
    "method": "search_eurlex_semantic",
    "params": {
        "query": "right to be forgotten",
        "limit": 3
    }
}

Step 3: Retrieve a Document

Once you find a document, get the full text:

{
    "method": "get_eurlex_document",
    "params": {
        "file_id": "32016R0679"
    }
}

Step 4: Check Database Info

Get statistics about the legal database:

{
    "method": "get_eurlex_stats",
    "params": {}
}

Connection Examples

Python

import requests

def search_eurlex(query, limit=5):
    url = "https://eurlex.lexsocket.ai/mcp"
    payload = {
        "method": "search_eurlex",
        "params": {
            "query": query,
            "limit": limit
        }
    }

    response = requests.post(url, json=payload)
    return response.json()

# Example usage
results = search_eurlex("data protection")
print(f"Found {len(results['result']['data'])} documents")

JavaScript

async function searchEurlex(query, limit = 5) {
    const url = 'https://eurlex.lexsocket.ai/mcp';
    const response = await fetch(url, {
        method: 'POST',
        headers: { 'Content-Type': 'application/json' },
        body: JSON.stringify({
            method: 'search_eurlex',
            params: { query, limit }
        })
    });

    return await response.json();
}

// Example usage
searchEurlex('GDPR compliance', 3)
    .then(result => console.log(result))
    .catch(error => console.error(error));

cURL

curl -X POST https://eurlex.lexsocket.ai/mcp \
  -H "Content-Type: application/json" \
  -d '{
    "method": "search_eurlex",
    "params": {
        "query": "data protection principles",
        "limit": 5
    }
  }'

Response Format

All responses follow the same format:

{
    "result": {
        "data": [
            {
                "file_id": "32016R0679",
                "title": "REGULATION (EU) 2016/679",
                "content": "General Data Protection Regulation...",
                "score": 0.95,
                "metadata": {
                    "document_type": "regulation",
                    "date": "2016-04-27",
                    "celex_id": "32016R0679"
                }
            }
        ],
        "metadata": {
            "total_results": 150,
            "search_mode": "hybrid",
            "processing_time_ms": 287
        }
    },
    "error": null
}

Error Handling

If something goes wrong, you'll receive an error response:

{
    "error": {
        "code": "INVALID_QUERY",
        "message": "Query parameter is required",
        "details": {
            "missing_param": "query"
        }
    },
    "result": null
}

Next Steps