使用说明
GLEIF MCP服务器
模型上下文协议(MCP)服务器,提供对GLEIF(全球法律实体标识符基金会)REST API的无缝访问。该服务器使AI助手和其他MCP兼容应用程序能够查询法人实体信息,包括LEI记录、发行人详细信息和组织之间的层次关系。
特性
🔍 LEI记录管理
- 搜索和检索:根据各种标准(法定名称、LEI代码、管辖区)查找LEI记录
- 模糊匹配:实体发现的自动完成近似搜索
- 实时数据:实时访问最新的GLEIF数据库
🏢 实体信息
- 法人实体详细信息:完整的法定名称、管辖区、状态和注册信息
- 地址数据:总部和法定地址,包括详细的地理信息
- 实体关系:母子公司关系和所有权结构
🌍 参考数据
- 国家代码:ISO 3166国家代码查找和验证
- 法律文书:实体法律形式(ELF)代码参考数据
- 发卡机构网络:关于LEI发行机构(LOU)的信息
🔧 开发者工具
- 字段元数据:全面的API现场文档和过滤功能
- 分页:高效处理大型结果集
- 类型安全:完整的Python类型提示和Pydantic验证
快速开始
安装
pip install gleif-mcp-server
启动MCP服务器
# Start server on default port (8000)
gleif-mcp-server
# Or specify custom port
gleif-mcp-server --port 8080
用作Python客户端
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集成
此服务器与任何MCP客户端兼容,包括:
- 克劳德桌面:添加到您的
claude_desktop_config.json - Cline/Windsurf:配置为MCP服务器
- 自定义应用程序:使用标准MCP协议
配置示例
{
"mcpServers": {
"gleif": {
"command": "gleif-mcp-server",
"args": []
}
}
}
API覆盖范围
服务器提供对所有主要GLEIF API端点的访问:
| 类别 | 端点 | 描述 |
|---|---|---|
| LEI记录 | /lei-records |
搜索和检索LEI记录 |
| LEI记录 | /lei-records/{lei} |
按代码获取特定的LEI记录 |
| 搜索 | /lei-records/fuzzy-completions |
实体名称的模糊匹配 |
| 搜索 | /lei-records/auto-completions |
自动完成建议 |
| 发行方 | /lei-issuers |
列出认可的LEI发行人 |
| 发行方 | /lei-issuers/{id} |
获取特定发行人详细信息 |
| 参考 | /countries |
ISO 3166国家代码 |
| 参考 | /entity-legal-forms |
ELF代码和描述 |
| 元数据 | /fields |
API字段目录和筛选选项 |
发展
设置开发环境
# 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 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
代码质量
# Format code
black gleif_mcp tests
# Lint code
ruff check gleif_mcp tests
# Type checking
mypy gleif_mcp
例子
按名称查找实体
# 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 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']}")
国家和法律表格查询
# 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']}")
贡献
我们欢迎捐款!请查看我们的 贡献指南 了解详情。
- 分叉存储库
- 创建要素分支(
git checkout -b feature/amazing-feature) - 进行更改并添加测试
- 确保所有测试均已通过,且代码已格式化
- 提交拉取请求
许可证
此项目根据Apache许可证2.0获得许可-请参阅 许可证 文件以获取详细信息。
致谢
支持
备注:这是一个非正式的实施。GLEIF不认可或维护此服务器。
