AIRONIK MCP
# AIRONIK MCP
[Русский](README.ru.md)
An MCP server for companies that build bots for **your clients**. It lets an assistant request a bot connection by email, check consent status and list your clients' bots connected through your integrator account. AIRONIK is an AI2 product.
Uses the official `@modelcontextprotocol/sdk` and **stdio**. Requires **Node.js 18 or later** and npm. Configuration comes only from environment variables. There are exactly three tools; message delivery, bot replies, consent decisions and payments are outside this server's scope.
## Get your key
In your AIRONIK account, select **your company → Settings → Integrator** and enable the integrator. A company owner can do this without approval. Save the `airi_` key: it is shown once. It consists of `airi_` and 64 lowercase hexadecimal characters. Replacing it immediately revokes the previous key.
For message delivery, separately save your HTTPS server URL and optional receiving token in the same AIRONIK settings. That token and each request's `webhook_secret` are separate from the integrator key.
## Run
Directly from GitHub (built on install):
```sh
npx -y github:ai2-platform/aironik-mcp
```
After the package is published to npm:
```sh
export AIRONIK_INTEGRATOR_KEY='airi_REPLACE_WITH_YOUR_64_LOWERCASE_HEX_CHARACTERS'
export AIRONIK_REGION='ru'
npx -y aironik-mcp
```
Replace the placeholder with your real key. The process waits for MCP input on stdin; no banner appears on stdout. Your MCP application normally starts this command for you. Alternatively, install with `npm install -g aironik-mcp` and run `aironik-mcp`.
| Variable | Meaning |
| --- | --- |
| `AIRONIK_INTEGRATOR_KEY` | Required integrator key, `airi_` + 64 lowercase hex characters. |
| `AIRONIK_REGION` | `ru` (default), `kz` or `intl`. Select the region where your integrator company is registered. |
| `AIRONIK_API_BASE` | Optional explicit API base, overriding the regional URL. Include `/api` where required. A trailing slash is removed; `/api` is never added automatically. |
The addresses match the regional test stand's `config.php` and `stand_api_base()` used by `lib.php`:
| Region | API base | Protocol documentation |
| --- | --- | --- |
| `ru` | `https://ai2.ru/api` | [test.aironik.ru](https://test.aironik.ru/index.php?page=protocols) |
| `kz` | `https://ai2dating.kz/api` | [test.aironik.kz](https://test.aironik.kz/index.php?page=protocols) |
| `intl` | `https://ai2.dating/api` | [test.aironik.ai](https://test.aironik.ai/index.php?page=protocols) |
For example, `AIRONIK_API_BASE=https://ai2dating.kz/api` takes precedence over `AIRONIK_REGION=ru`. Custom bases require HTTPS, without URL credentials, query parameters or fragments. HTTP is allowed only on loopback (`localhost`, `127.0.0.1`, `[::1]`) for local development. No `.env` file or command-line configuration flags are read.
## Claude Desktop, Claude Code and Cursor
Use this JSON, replacing the key placeholder and choosing your region:
```json
{
"mcpServers": {
"aironik": {
"command": "npx",
"args": ["-y", "aironik-mcp"],
"env": {
"AIRONIK_INTEGRATOR_KEY": "airi_REPLACE_WITH_YOUR_64_LOWERCASE_HEX_CHARACTERS",
"AIRONIK_REGION": "ru"
}
}
}
}
```
- **Claude Desktop:** merge the `aironik` entry into `claude_desktop_config.json`. Open it through **Settings → Developer → Edit Config**. Typical locations: `~/Library/Application Support/Claude/claude_desktop_config.json` on macOS and `%APPDATA%\Claude\claude_desktop_config.json` on Windows. Restart Claude Desktop.
- **Claude Code:** save as `.mcp.json` in your project root (project scope), then open the project and use `/mcp` to check the connection. Claude Code may ask you to trust the project's MCP configuration.
- **Cursor:** save as `.cursor/mcp.json` in your project or `~/.cursor/mcp.json` for your user. Enable the server in Cursor's MCP settings.
If your application cannot find `npx`, set `command` to its absolute path. On Windows, use `npx.cmd`; if the host requires a command shell, set `command` to `cmd` and `args` to `["/c", "npx", "-y", "aironik-mcp"]`. Put an optional `AIRONIK_API_BASE` inside `env` as well. The server receives all settings through its process environment.
Keep configuration containing your key out of Git. This repository ignores `.env` files, but your editor's MCP configuration needs its own exclusion if it contains credentials. The key is never logged or included in tool results; echoed keys in API responses and errors are redacted. Successful API responses can include `webhook_secret`, which is intentionally available to your MCP application and assistant. Treat it as confidential.
## Tools
| Tool | API route, relative to the API base | Input |
| --- | --- | --- |
| `aironik_create_connection_request` | `POST /public/aironik/integrator/requests` | `email`, `bot_name`, `external_bot_id`; optional `description` |
| `aironik_get_connection_request` | `GET /public/aironik/integrator/requests/{request}` | `request_id`: the UUID in the creation response's `id` |
| `aironik_list_connected_bots` | `GET /public/aironik/integrator/bots` | None |
Creation fields follow the API: `email` is a valid email of up to 254 bytes; `bot_name` is nonempty and up to 100 characters; `external_bot_id` is nonempty and up to 191 characters; `description` is a string of up to 4000 characters, defaulting to an empty string on AIRONIK. AIRONIK lowercases the email and trims the bot name. For example:
```json
{
"email": "client@example.com",
"bot_name": "Client support",
"external_bot_id": "client-bot-001",
"description": "Support bot for your clients"
}
```
Repeating a POST for the same integrator, email and `external_bot_id` returns the existing request without changing its name or description. For `not_registered`, repeat the POST after your clients register: this moves the request to `pending` and queues an email. Reading status does not make that transition. Rejected and disconnected requests are not reopened by repeating the POST.
Successful tools return the API JSON envelope (`success`, `message`, `data`) as text. Create and status responses contain `id`, `status`, `external_bot_id`, `bot_name`, `description`, `bot_row_guid`, `created_at`, `decided_at` and `webhook_secret`. When `bot_row_guid` exists, `reply_url` is added. Dates are UTC ISO 8601; absent values are `null`. Save the request ID and webhook secret for your own message/event handler.
| Status | Meaning |
| --- | --- |
| `not_registered` | Your clients' email is not registered in AIRONIK. For a Delta Key registration, creation returns `id: null` and `webhook_secret: null`, without a consent request. |
| `pending` | Waiting for your clients' consent. |
| `accepted` | Your clients approved the connection. |
| `rejected` | Your clients declined. |
| `disconnected` | Your clients revoked the connection; `bot_row_guid` remains in the response. |
The bot list is `data.items`, with `request_id`, `external_bot_id`, `status`, `created_at`, `decided_at`, `bot_row_guid`, `bot_name` and `company_name`. It includes entries with an existing bot, including disconnected ones. Check `status === "accepted"` for active connections. There are no pagination or filter parameters.
## What your clients see
Your registered clients receive an email naming your company and bot and see a request in their AIRONIK account. They may reject it or approve message transfer by choosing a company they own. **Your clients' consent is always required.** The bot is created in their account and remains theirs.
Your clients pay for AIRONIK from **their AIRONIK wallet**, at the usual external bot rate. They can disconnect the integrator; the bot remains theirs and the previous delivery secret is revoked. This MCP server cannot approve requests for them or charge their wallet.
## Signing and errors
All three routes send `Authorization: Bearer <airi_key>`, `X-AI2-Timestamp` (Unix seconds, digits) and `X-AI2-Signature`:
```text
canonical = timestamp + "\n" + exact_raw_body
signature = "sha256=" + lowercase_hex(HMAC_SHA256(canonical, complete_airi_key))
```
The key is used as a string, without hex decoding. Method and path are not in the signature. GET has an empty body. The timestamp must be within ±300 seconds of the API clock; the body limit is 64000 bytes. The shared API limit is 60 requests per integrator per server calendar minute.
Repeated timestamp/signature pairs are rejected for 600 seconds within a scope specific to the integrator, current key, method and normalized path. This process waits for a new clock second before sending an identical request again. Separate running processes do not coordinate; if they collide, retry in a later second. The server does not retry failed API calls automatically. Each fetch has an 18-second timeout, and redirects are refused.
API errors are tool text with `isError: true`, the API code and HTTP status, for example:
```text
AIRONIK error [not_found] (HTTP 404): The connection request was not found for this integrator.
```
| HTTP | API codes |
| --- | --- |
| 401 | `invalid_credentials`, `bad_signature`, `stale`, `replay` |
| 403 | `integrator_unavailable` |
| 404 | `not_found` |
| 409 | `integrator_disabled` |
| 413 | `payload_too_large` |
| 422 | `bad_settings`, `encryption_unavailable`, `email_unavailable`, `protocol_guard_unavailable` |
| 429 | `rate_limited` |
| 503 | `integrator_unavailable` |
Both `code` and `error_code` are supported; unknown API codes are preserved. Local failures use `invalid_input`, `invalid_response` or `network_error`. The MCP SDK may reject invalid tool arguments before an API request. Configuration errors go to stderr and terminate the process; stdout is reserved for MCP.
## Develop and run before publication
```sh
npm install
npm run build
npm test
```
Build output is in `dist`. With your environment set, run `node dist/index.js` or `npm start`. For a local MCP configuration, use `"command": "node"` and `"args": ["/absolute/path/to/aironik-mcp/dist/index.js"]` with the same `env` block. This works before the first npm publication.
Tests use `node:test` and mock fetch, with no API network calls or real keys. They cover PHP-generated HMAC fixtures, request construction, errors, key redaction, replay timing and official MCP client integration, including stdio. PHP is only needed to regenerate the fixtures; see [tests/README.md](tests/README.md). `npm pack --dry-run` builds and previews the package; only `dist`, the two READMEs, package metadata and the license are shipped.
Implementation follows the AIRONIK PHP routes, `AironikIntegratorRequestsController`, `AironikIntegratorRequests`, `AironikIntegratorGuard`, `AironikProtocolGuard` and the regional stand's integrator protocol documentation.
MIT © AI2. See [LICENSE](LICENSE).
TDQS
Scored across 3 tools
The three tools target clearly separate actions/resources: creating a request, fetching one request by id, and listing connected bots. The descriptions reinforce these boundaries, so an agent should not confuse them.
All tools use the same aironik_ prefix followed by a consistent snake_case verb_noun pattern: create_connection_request, get_connection_request, list_connected_bots. The resource name variation reflects the actual resource rather than inconsistent naming.
Three tools is reasonable for this narrow integration surface, and none appear redundant. However, the surface is quite thin, and the domain may reasonably need a fourth operation such as revocation/disconnection.
The server covers request creation, request lookup, and bot listing, which are core read/create operations. It lacks an explicit disconnect/revoke operation, and the list tool has no pagination or filtering, which are notable gaps for lifecycle management.