# Finwise Finance MCP Service 该包将 Finwise Pro 的 `/api/finance/*` 接口封装为 Model Context Protocol (MCP) 工具,方便 Codex、Claude 等 MCP 客户端直接调用财务能力。 ## 使用步骤 1. 安装依赖 ```bash pnpm install ``` 2. 构建服务 ```bash (本服务为纯 Node.js 实现,如无额外需求可跳过构建) ``` 3. 启动服务(示例) ```bash FINANCE_BASIC_USERNAME=atai \ FINANCE_BASIC_PASSWORD=wengewudi666808 \ node apps/finance-mcp-service/src/index.js ``` 可选环境变量: | 变量 | 含义 | | --- | --- | | `FINANCE_API_BASE_URL` | 默认 `http://172.16.74.149:5666`,如需变更可重设。 | | `FINANCE_API_KEY` | 将作为 Bearer Token 附加在请求头。 | | `FINANCE_API_TIMEOUT` | 请求超时(毫秒)。 | | `FINANCE_BASIC_USERNAME` / `FINANCE_BASIC_PASSWORD` | 使用 HTTP Basic Auth 访问后端。 | 如需在 Codex 中自动启动该 MCP 服务,可在 `config.json` 中加入以下配置片段(路径默认位于 `~/.config/codex/config.json`): ```json { "mcpServers": { "finwise-finance": { "command": "node", "args": ["apps/finance-mcp-service/src/index.js"], "env": { "FINANCE_BASIC_USERNAME": "atai", "FINANCE_BASIC_PASSWORD": "wengewudi666808" }, "cwd": "/Users/fuwuqi/Projects/web-apps/finwise-pro" } } } ``` 配置完成后,重启 Codex 即可在 MCP 面板中看到 `finwise-finance`,并通过工具调用各类财务接口。 工具清单与入参定义详见 `src/index.ts`。