# @ds-mate/dsmate-mcp

DS-Mate connector for [Accio Work](https://accio.com): browser-based login
(`cli-login` flow) plus the DS-Mate MCP server in one npx-runnable package —
the same shape as the DSers connector.

## Usage

```bash
# Connect your DS-Mate account (opens the browser, stores credentials locally)
npx -y @ds-mate/dsmate-mcp login

# Check the connection
npx -y @ds-mate/dsmate-mcp status

# Log out (remove stored credentials; run login again to switch accounts)
npx -y @ds-mate/dsmate-mcp logout

# No arguments: run the DS-Mate MCP server over stdio
npx -y @ds-mate/dsmate-mcp@latest
```

Your DS-Mate password never passes through this tool — login happens in your
browser on the DS-Mate site. Credentials are stored at `~/.dsmate/credentials`
(owner-only, `0600`). MCP tools read them on every call; if the credential is
missing or revoked, tools return a structured `REAUTH_REQUIRED` error asking
the user to reconnect.

## MCP tools

| Tool                 | What it does                                                                                   |
| -------------------- | ---------------------------------------------------------------------------------------------- |
| `get_dsmate_account` | Returns the connected DS-Mate account (owner email) and the stores available to this connector |

More read tools (store status, order diagnosis, buyer messages, product
sourcing) are on the roadmap and will ship in this same package.

## Environment (optional overrides)

The package is preconfigured for DS-Mate production — no environment variables
are required for normal use.

| Variable                | Purpose                                                     |
| ----------------------- | ----------------------------------------------------------- |
| `DS_MATE_DASHBOARD_URL` | Override the DS-Mate dashboard base URL (custom/dev setups) |
| `DS_MATE_BACKEND_URL`   | Override the DS-Mate API base URL (custom/dev setups)       |
| `DS_MATE_ACCESS_TOKEN`  | Headless/CI: use this token instead of stored credentials   |
| `DS_MATE_USER_EMAIL`    | Headless/CI: account label shown by `status`                |
| `DS_MATE_CONFIG_DIR`    | Override the credential directory (default `~/.dsmate`)     |

This package is operated by DS-Mate (https://ds-mate.com).
