# ECM MCP Server (Customer)

MCP server for B2C ECM. Helps your AI coding assistant understand ECM while you build your integration.

## Setup

### Claude Code / Cursor / Windsurf

Add to your MCP client config (e.g., `.mcp.json`):

```json
{
	"mcpServers": {
		"scoreapi": {
			"command": "npx",
			"args": ["@crscreditapi/b2c-mcp-customer"],
			"env": {
				"SCOREAPI_PROD_BASE_URL": "https://your-prod-ecm-host/api",
				"SCOREAPI_PROD_CUSTOMER_USERNAME": "your_prod_username",
				"SCOREAPI_PROD_CUSTOMER_PASSWORD": "your_prod_password",
				"SCOREAPI_DEV_BASE_URL": "https://your-dev-ecm-host/api",
				"SCOREAPI_DEV_CUSTOMER_USERNAME": "your_dev_username",
				"SCOREAPI_DEV_CUSTOMER_PASSWORD": "your_dev_password"
			}
		}
	}
}
```

### Environment variables

| Variable                          | Required | Purpose                                                   |
| --------------------------------- | -------- | --------------------------------------------------------- |
| `SCOREAPI_PROD_BASE_URL`         | Yes      | Base URL of your production ECM (e.g. `https://.../api`)  |
| `SCOREAPI_PROD_CUSTOMER_USERNAME` | Yes      | Production customer credentials                           |
| `SCOREAPI_PROD_CUSTOMER_PASSWORD` | Yes      | Production customer password                               |
| `SCOREAPI_DEV_BASE_URL`          | No       | Base URL of your dev ECM (falls back to prod if omitted)  |
| `SCOREAPI_DEV_CUSTOMER_USERNAME`  | No       | Dev customer credentials (falls back to prod if omitted)  |
| `SCOREAPI_DEV_CUSTOMER_PASSWORD`  | No       | Dev customer password (falls back to prod if omitted)     |
| `SCOREAPI_TIMEOUT_MS`            | No       | Request timeout in ms (default: 30000)                    |

Dev environment is optional. If `SCOREAPI_DEV_*` variables are omitted, dev requests fall back to the production environment.

### HTTP mode

```bash
SCOREAPI_PROD_BASE_URL=https://your-prod-ecm-host/api \
SCOREAPI_PROD_CUSTOMER_USERNAME=... \
SCOREAPI_PROD_CUSTOMER_PASSWORD=... \
MCP_TRANSPORT=http MCP_PORT=3001 \
npx @crscreditapi/b2c-mcp-customer
```

Endpoints:

- `POST /` and `POST /mcp` — MCP Streamable HTTP transport
- `GET /health` — Health check
