Metadata-Version: 2.4
Name: banxico-cep-mcp
Version: 1.0.7
Summary: MCP server for querying Banxico CEP (Comprobante Electrónico de Pago)
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: mcp>=1.0.0
Requires-Dist: curl-cffi>=0.7.0
Requires-Dist: parsel>=1.9.0

# banxico-cep-mcp

查询 [Banxico CEP](https://www.banxico.org.mx/cep/)（墨西哥央行电子支付凭证）的 MCP 服务端，用于验证墨西哥银行间转账支付记录。

## 安装

```bash
pip install banxico-cep-mcp
```

需要 Python >= 3.10。

## 使用方式

### 在 MCP 客户端中配置

```json
{
  "mcpServers": {
    "banxico-cep": {
      "command": "banxico-cep-mcp"
    }
  }
}
```

### 直接运行

```bash
banxico-cep-mcp
```

## 工具说明

### `cep_query` — CEP 支付凭证查询

查询 Banxico 的单条 CEP 记录，验证支付是否已完成清算。

| 参数       | 是否必填 | 说明                                                |
| ---------- | :------: | --------------------------------------------------- |
| `fecha`    |    是    | 支付日期，格式 `DD-MM-YYYY`（如 `15-12-2025`）        |
| `criterio` |    是    | CEP 参考号/凭证编号（如 `3843CP04202512154771098591`） |
| `emisor`   |    是    | 付款方银行代码（如 `40072`）                          |
| `receptor` |    是    | 收款方银行代码（如 `40012`）                          |
| `monto`    |    是    | 金额（墨西哥比索 MXN，如 `140`）                      |
| `cuenta`   |    否    | 账户号                                               |

### 返回结果

```json
{
  "status": "liquidado",
  "raw_length": 12345,
  "query": {
    "fecha": "15-12-2025",
    "criterio": "3843CP04202512154771098591",
    "monto": "140",
    "emisor": "40072",
    "receptor": "40012"
  }
}
```

返回状态说明：

- `liquidado` — 支付已清算（验证通过）
- `captcha_error` — 触发验证码拦截（通常为查询频率过高）
- `rate_limited` — 查询次数超限，会话已自动重置
- `unknown` — 未识别的响应内容
- `error` — 请求失败，详见 `message` 字段

## 频率限制

内置限频器：约每 15 秒 4 次查询。使用 `curl-cffi` 伪装浏览器 TLS 指纹，降低被 Banxico WAF 拦截的概率。

## 开发调试

```bash
pip install -e .
banxico-cep-mcp
```
