INSEE数据访问服务

通过SIRENE API、BDM和官方命名法访问INSEE数据的模型上下文协议服务器。

  • by KerryanOPMace
  • Python
  • 本地部署
  • 更新于
在 GitHub 查看 kerryanopmace/mcp-sirene

使用说明

Insee MCP服务器

MCP(模型上下文协议)服务器,用于通过SIRENE API、BDM和官方术语访问INSEE数据。

单线安装

紫外线(推荐)

# Install and launch directly
API_KEY="your_insee_api_key" uv run --with insee-mcp insee-mcp

或者如果你更喜欢使用uvx

# Install and launch directly
API_KEY="your_insee_api_key" uvx insee-mcp insee-mcp

标准MCP配置

将此添加到您的MCP配置中(例如,Claude Desktop或Copilot):

{
  "mcpServers": {
    "insee": {
      "command": "uvx",
      "args": ["insee-mcp", "insee-mcp"],
      "env": {
        "API_KEY": "your_insee_api_key"
      }
    }
  }
}

使用pipx

API_KEY="your_insee_api_key" pipx run --spec git+https://github.com/KerryanOPMace/mcp-insee.git insee-mcp

快速安装

直接安装(推荐)

# Install directly from GitHub
pip install git+https://github.com/KerryanOPMace/mcp-insee.git

# Set your INSEE API key
export API_KEY="your_insee_api_key"

# Start the server
insee-mcp

用管道安装(隔离)

# Install with pipx (isolated environment)
pipx install git+https://github.com/KerryanOPMace/mcp-insee.git

# Set the API key
export API_KEY="your_insee_api_key"

# Start the server
insee-mcp

开发人员安装

# Clone the repository
git clone https://github.com/KerryanOPMace/mcp-insee.git
cd mcp-insee

# Install in development mode
pip install -e .

如果您希望为该项目做出贡献,请创建问题和分支。您可以合并请求,然后主管将在合并前对其进行审核

配置

Insee API密钥

您必须从获取API密钥 Insee API门户 并对其进行配置:

Linux/Mac:

export API_KEY="your_insee_api_key"

Windows(PowerShell):

$env:API_KEY="your_insee_api_key"

Windows(CMD):

set API_KEY=your_insee_api_key

可用工具

  • search_company:在SIRENE数据库中搜索公司
    • 按SIREN、SIRET或公司名称
    • 模糊搜索可用

可流式-HTTP传输

服务器访问

启动后,可以在以下位置访问MCP服务器:

  • 统一资源定位符: http://127.0.0.1:8000/mcp
  • 运输:流式HTTP

客户端测试

from fastmcp import Client
import asyncio

async def test():
    client = Client("http://127.0.0.1:8000/mcp")
    async with client:
        # List tools
        tools = await client.list_tools()
        print(tools)
        
        # Search for a company
        result = await client.call_tool("search_company", {
            "siret": "44302124100072"
        })
        print(result)

asyncio.run(test())

需求

  • Python 3.8+
  • 有效的Insee API密钥
  • API请求的互联网访问

STDIO传输

服务器访问

一旦启动,MCP服务器就会根据标准io协议在本地运行

客户端测试

from fastmcp import Client
import asyncio

async def test():
    client = Client("http://127.0.0.1:8000/mcp")
    async with client:
        # List tools
        tools = await client.list_tools()
        print(tools)
        
        # Search for a company
        result = await client.call_tool("search_company", {
            "siret": "44302124100072"
        })
        print(result)

asyncio.run(test())

需求

  • Python 3.8+
  • 有效的Insee API密钥
  • API请求的互联网访问

许可证

MIT许可证