NPI注册表查询服务

一个提供国家提供商标识符(NPI)注册表查询工具的MCP服务器,支持通过NPI号码、姓名和州搜索医疗保健提供者和组织。

  • by dccakes
  • Python
  • 本地部署
  • 更新于
在 GitHub 查看 dccakes/npi-mcp

使用说明

NPI MCP服务器

MCP(模型上下文协议)服务器,提供用于搜索国家提供商标识符(NPI)注册表的工具。该服务器使AI助手能够从NPPES数据库中查找医疗服务提供者和组织。

部署

服务器部署在: https://dc-npi-mcp.fastmcp.app/mcp

概述

NPI注册表由CMS(医疗保险和医疗补助服务中心)维护,包含美国所有医疗服务提供者的信息。此MCP服务器包装公共NPI注册表API,并提供三种用于搜索提供商数据的工具:

  • lookup_npi_number -通过10位NPI号码查找提供商
  • 搜索_个人_供应商 -按名称和州搜索单个提供商
  • 搜索组织 -按名称和州搜索医疗机构

工具

lookup_npi_number

通过NPI号码查找特定提供商。

参数:

  • npi_number (string):10位NPI编号

例子:

{
  "npi_number": "1234567890"
}

搜索_个人_供应商

按姓名和州搜索个人医疗服务提供者。

参数:

  • first_name (string):提供者的名字
  • last_name (string):提供者的姓氏
  • state (string):美国各州缩写(例如“NY”、“CA”)

例子:

{
  "first_name": "John",
  "last_name": "Smith",
  "state": "NY"
}

搜索组织

按名称和州搜索医疗机构。

参数:

  • organization_name (string):组织名称
  • state (string):美国各州缩写(例如“NY”、“CA”)

例子:

{
  "organization_name": "Acme Health",
  "state": "CA"
}

发展

需求

  • Python 3.12或更高版本
  • 依赖关系通过以下方式管理 pyproject.toml

安装

# Clone the repository
git clone <repository-url>
cd npi-mcp

# Install dependencies
pip install -e .

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

本地运行

# Run the MCP server in development mode with the inspector
fastmcp dev src/main.py

# Or run in production mode
fastmcp run src/main.py

测试

# Run tests
pytest

# Run tests with coverage
pytest --cov=src tests/

API 参考

此服务器使用公共NPPES NPI注册表API:

  • 基础网址: https://npiregistry.cms.hhs.gov/api/
  • 认证:无需
  • 速率限制:无文件限制(尊重政府资源)
  • API版本: 2.1

有关API的详细文档,请参阅 docs/02-npi-api-reference.md.

响应格式

所有工具返回a SearchResponse 提供结果或 ErrorResponse 如果搜索失败。

搜索响应:

{
  "result_count": 15,
  "results": [
    {
      "number": "1234567890",
      "enumeration_type": "NPI-1",
      "basic": {
        "first_name": "JOHN",
        "last_name": "SMITH",
        "credential": "MD"
      },
      "addresses": [...],
      "taxonomies": [...]
    }
  ]
}

错误响应:

{
  "Errors": [
    {
      "description": "No valid search criteria provided",
      "field": "generic",
      "number": "04"
    }
  ]
}

项目结构

npi-mcp/
├── src/
│   ├── main.py           # MCP server definition and tools
│   ├── client.py         # NPI Registry API client
│   └── domain/
│       ├── models.py     # Pydantic models for requests/responses
│       └── enums.py      # Enumerations (states, taxonomy, etc.)
├── tests/
│   ├── unit/             # Unit tests
│   └── integration/      # Integration tests
├── docs/                 # Additional documentation
└── pyproject.toml        # Project dependencies and metadata

贡献

  1. 创建要素分支
  2. 进行更改
  3. 运行测试并确保其通过
  4. 提交拉取请求

许可证

该项目根据 GNU Affero通用公共许可证v3.0(AGPL-3.0).

资源