Skip to main content

Model Context Protocol (MCP) server for the GLEIF (Global Legal Entity Identifier Foundation) REST API

Project description

GLEIF MCP Server

CI PyPI version Python 3.10+ License: Apache-2.0 Code style: black

A Model Context Protocol (MCP) server that provides seamless access to the GLEIF (Global Legal Entity Identifier Foundation) REST API. This server enables AI assistants and other MCP-compatible applications to query legal entity information, including LEI records, issuer details, and hierarchical relationships between organizations.

Features

🔍 LEI Record Management

  • Search & Retrieve: Find LEI records by various criteria (legal name, LEI code, jurisdiction)
  • Fuzzy Matching: Approximate search with auto-completion for entity discovery
  • Live Data: Real-time access to the most current GLEIF database

🏢 Entity Information

  • Legal Entity Details: Complete legal name, jurisdiction, status, and registration info
  • Address Data: Headquarters and legal addresses with full geographical details
  • Entity Relationships: Parent-subsidiary relationships and ownership structures

🌍 Reference Data

  • Country Codes: ISO 3166 country code lookups and validation
  • Legal Forms: Entity Legal Form (ELF) code reference data
  • Issuer Network: Information about LEI issuing organizations (LOUs)

🔧 Developer Tools

  • Field Metadata: Comprehensive API field documentation and filtering capabilities
  • Pagination: Efficient handling of large result sets
  • Type Safety: Full Python type hints and Pydantic validation

Quick Start

Installation

pip install gleif-mcp-server

Start the MCP Server

# Start server on default port (8000)
gleif-mcp-server

# Or specify custom port
gleif-mcp-server --port 8080

Use as Python Client

from gleif_mcp import client

# Get specific LEI record
lei_data = client.get_lei_record("529900T8BM49AURSDO55")
print(f"Entity: {lei_data['entity']['legalName']}")

# Search for entities
results = client.search_lei_records("entity.legalName", "Citibank")
for record in results['data']:
    print(f"Found: {record['entity']['legalName']}")

# Fuzzy search with suggestions
suggestions = client.fuzzy_completions("entity.legalName", "Apple Inc")

MCP Integration

This server is compatible with any MCP client, including:

  • Claude Desktop: Add to your claude_desktop_config.json
  • Cline/Windsurf: Configure as an MCP server
  • Custom Applications: Use the standard MCP protocol

Configuration Example

{
  "mcpServers": {
    "gleif": {
      "command": "gleif-mcp-server",
      "args": []
    }
  }
}

API Coverage

The server provides access to all major GLEIF API endpoints:

Category Endpoint Description
LEI Records /lei-records Search and retrieve LEI records
LEI Records /lei-records/{lei} Get specific LEI record by code
Search /lei-records/fuzzy-completions Fuzzy matching for entity names
Search /lei-records/auto-completions Auto-complete suggestions
Issuers /lei-issuers List accredited LEI issuers
Issuers /lei-issuers/{id} Get specific issuer details
Reference /countries ISO 3166 country codes
Reference /entity-legal-forms ELF codes and descriptions
Metadata /fields API field catalog and filtering options

Development

Setup Development Environment

# Clone the repository
git clone https://github.com/GenAICPA/gleif-mcp-server.git
cd gleif-mcp-server

# Install in development mode
pip install -e ".[dev]"

# Install pre-commit hooks
pre-commit install

Run Tests

# Run all tests
pytest

# Run tests with coverage
pytest --cov=gleif_mcp

# Skip live API tests (for CI)
pytest -m "not live"

# Run only integration tests
pytest -m integration

Code Quality

# Format code
black gleif_mcp tests

# Lint code  
ruff check gleif_mcp tests

# Type checking
mypy gleif_mcp

Examples

Find Entity by Name

# Search for entities containing "Microsoft"
results = client.search_lei_records("entity.legalName", "*Microsoft*")

for entity in results['data'][:5]:  # Show first 5 results
    print(f"LEI: {entity['lei']}")
    print(f"Name: {entity['entity']['legalName']}")
    print(f"Country: {entity['entity']['jurisdiction']}")
    print("---")

Get Entity Hierarchy

# Get parent company information
lei = "529900T8BM49AURSDO55"  # Example LEI
record = client.get_lei_record(lei)

if record['entity'].get('parent'):
    parent_lei = record['entity']['parent']['lei'] 
    parent_data = client.get_lei_record(parent_lei)
    print(f"Parent: {parent_data['entity']['legalName']}")

Country and Legal Form Lookup

# Get country information
country = client.get_country("US")
print(f"Country: {country['name']} ({country['code']})")

# List available legal forms
legal_forms = client.list_entity_legal_forms()
for form in legal_forms['data'][:10]:
    print(f"{form['code']}: {form['name']}")

Contributing

We welcome contributions! Please see our Contributing Guide for details.

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes and add tests
  4. Ensure all tests pass and code is formatted
  5. Submit a pull request

License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

Acknowledgments

Support


Note: This is an unofficial implementation. GLEIF does not endorse or maintain this server.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gleif_mcp_server-0.1.1.tar.gz (25.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gleif_mcp_server-0.1.1-py3-none-any.whl (14.6 kB view details)

Uploaded Python 3

File details

Details for the file gleif_mcp_server-0.1.1.tar.gz.

File metadata

  • Download URL: gleif_mcp_server-0.1.1.tar.gz
  • Upload date:
  • Size: 25.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for gleif_mcp_server-0.1.1.tar.gz
Algorithm Hash digest
SHA256 d26129605665f8f37ea814da8fdf8a700bde9e5e8817108e03c3404aa620e851
MD5 5f226c8954fd87a4f53ec7b1262f2a40
BLAKE2b-256 09bfacb04742a7c68a65f4ff38df8f477dae5b8edd3df487a735bfc0aaf8e311

See more details on using hashes here.

File details

Details for the file gleif_mcp_server-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for gleif_mcp_server-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 28bc3be69ea025b4ecae38ca3b828f1d09fb824281dbfc125e6c9d9f84e0bb5c
MD5 4e927f19e5d19941445c40259180ee7c
BLAKE2b-256 b2ae373297f11b5e6a400b8ecb50be1ab046afc24a6067fb53bee6b422fbeacc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page