MCP server
Let an AI agent drive Niotio directly — Claude, ChatGPT connectors, Cursor, n8n, or your own agent runtime — over the Model Context Protocol. The same 35 tools as the API and the CLI, the same data, the same rules.
https://niotio.dk/mcp — JSON-RPC 2.0 over HTTP.
Auth is the same API token the API and CLI use: create one under
Settings → API tokens (shown once).
There is no session state: every request stands alone.
Connect a client
Clients that speak remote MCP (Claude, ChatGPT connectors, agent frameworks)
Enter the endpoint and a Bearer header with your API token. Nothing else.
URL: https://niotio.dk/mcp\nHeader: Authorization: Bearer <API_TOKEN>
Desktop clients that only launch stdio servers
Bridge it with mcp-remote. The same block works in Claude Desktop (claude_desktop_config.json) and Cursor (~/.cursor/mcp.json).
{
"mcpServers": {
"niotio": {
"command": "npx",
"args": ["-y", "mcp-remote", "https://niotio.dk/mcp",
"--header", "Authorization: Bearer ${NPS_TOKEN}"]
}
}
}
Try it with curl
curl -s https://niotio.dk/mcp \
-H "Authorization: Bearer $NPS_TOKEN" -H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call",
"params":{"name":"campaigns_list","arguments":{"test":true}}}'
initialize is optional: the server is stateless and answers tools/call straight away.
A tool result carries the REST body as text in content[0].text and as an object in
structuredContent; failures come back with isError: true and the REST error text
(e.g. 404: Campaign not found).
What an agent can actually do
A typical loop, where you only write plain language — the agent picks the tools:
| You say | The agent calls |
|---|---|
| "Set up the Q4 check-in as a test campaign with those 12 customers." | campaigns_create + campaigns_respondent_add |
| "Try it with realistic responses so we can see the score." | campaigns_simulate → campaigns_metrics |
| "Looks right — send it for real." | campaigns_activate + campaigns_send |
| "Who should we call?" | campaigns_metrics + campaigns_respondents + campaigns_activity |
| "Pick up the unhappy customers and close them out with an outcome." | cases_list → cases_assign → cases_note_add → cases_status |
| "Are we close to the email allowance this month?" | usage_email |
Every call is the same as an API call, so the audit log shows exactly what the agent did. The help articles cover the practical setup.
Tools
Every tool calls the same controller method as the equivalent REST request, so behaviour and permissions are identical. Arguments marked required must be supplied.
List the caller's campaigns (real and test). Both types are returned unless `test` filters them. Same data as GET /api/campaigns.
| Argument | Type | Description |
|---|---|---|
test
|
boolean | true = only test campaigns, false = only real campaigns, omit for both |
Fetch one campaign by id. Returns the campaign object, or an error when the caller cannot see it. Same as GET /api/campaigns/{id}.
| Argument | Type | Description |
|---|---|---|
id
required
|
integer | Campaign id |
Create a campaign in DRAFT status. Set `test: true` (or `campaignType: "TEST"`) for a sandbox campaign: test campaigns can be simulated but never send real email. Same as POST /api/campaigns.
| Argument | Type | Description |
|---|---|---|
name
required
|
string | Campaign name (required) |
description
|
string | |
closeOn
|
string | Auto-close timestamp, ISO-8601 local date-time |
test
|
boolean | Create as a test campaign (default false) |
campaignType
|
string | Explicit alternative to `test` |
autoAnonymizeEnabled
|
boolean | |
autoAnonymizeDays
|
integer |
Update name/description/close date/anonymisation settings. Omitted fields are left unchanged (a name-only update does not reset description, close date or auto-anonymize). The campaign type is fixed at creation: repeating the current type is fine, changing it is rejected. Same as PUT /api/campaigns/{id}.
| Argument | Type | Description |
|---|---|---|
id
required
|
integer | Campaign id |
name
required
|
string | |
description
|
string | |
closeOn
|
string | ISO-8601 local date-time |
test
|
boolean | Must match the existing type if sent |
campaignType
|
string | |
autoAnonymizeEnabled
|
boolean | |
autoAnonymizeDays
|
integer |
Move a campaign to the trash (soft delete, restorable for the retention window). Same as DELETE /api/campaigns/{id}.
| Argument | Type | Description |
|---|---|---|
id
required
|
integer | Campaign id |
Restore a trashed campaign. Same as POST /api/campaigns/{id}/restore.
| Argument | Type | Description |
|---|---|---|
id
required
|
integer | Campaign id |
Activate a campaign so it can send surveys. Same as POST /api/campaigns/{id}/activate.
| Argument | Type | Description |
|---|---|---|
id
required
|
integer | Campaign id |
Deactivate (close) a campaign. Same as POST /api/campaigns/{id}/deactivate.
| Argument | Type | Description |
|---|---|---|
id
required
|
integer | Campaign id |
Send the campaign's pending survey emails. Returns sent/failed/blocked/total. A monthly email-quota refusal comes back as an error with `error: monthly_email_limit_reached`. Same as POST /api/campaigns/{id}/send.
| Argument | Type | Description |
|---|---|---|
id
required
|
integer | Campaign id |
NPS score, response counts and promoter/passive/detractor breakdown for one campaign. Same as GET /api/campaigns/{id}/metrics.
| Argument | Type | Description |
|---|---|---|
id
required
|
integer | Campaign id |
Paged respondent list for a campaign, optionally filtered by search text and status. Same as GET /api/campaigns/{id}/respondents.
| Argument | Type | Description |
|---|---|---|
id
required
|
integer | Campaign id |
page
|
integer | |
size
|
integer | |
search
|
string | Match email or name |
status
|
string | Respondent status filter |
Add one respondent (email) to a campaign. Owner or editor only. Same as POST /api/campaigns/{id}/respondents.
| Argument | Type | Description |
|---|---|---|
id
required
|
integer | Campaign id |
email
required
|
string | |
name
|
string | Defaults to the email |
language
|
string | Defaults to the request locale |
The campaign's audit log (who did what, when). Same as GET /api/campaigns/{id}/activity.
| Argument | Type | Description |
|---|---|---|
id
required
|
integer | Campaign id |
Generate simulated responses on a TEST campaign: `counts` maps rating (0-10) to how many responses to create, `spreadDays` backdates them, `danishPercent` sets how many get Danish comments. Same as POST /api/campaigns/{id}/simulate.
| Argument | Type | Description |
|---|---|---|
id
required
|
integer | Campaign id |
counts
|
object | Rating (0-10) to response count |
spreadDays
|
integer | |
danishPercent
|
integer |
Remove the simulated data from a test campaign. Same as POST /api/campaigns/{id}/simulate/clear.
| Argument | Type | Description |
|---|---|---|
id
required
|
integer | Campaign id |
Aggregate NPS metrics across the caller's real campaigns that are included in the score. TEST campaigns are excluded, matching the dashboard and GET /api/metrics.
No arguments.
Survey-email usage this month against the plan allowance and when it resets. Add `include: "campaigns"` for the per-campaign breakdown. Same as GET /api/v1/usage/email.
| Argument | Type | Description |
|---|---|---|
include
|
string | Include the per-campaign breakdown |
Submit a response using the respondent's survey token (from the survey link). Like every MCP tool, this still needs Authorization: Bearer <API_TOKEN> on /mcp — the survey token identifies the respondent, it does not replace the API token. A respondent whose campaign is in the trash is 410 campaign_not_open (kind api, status 410). Same as POST /api/responses.
| Argument | Type | Description |
|---|---|---|
token
required
|
string | Respondent survey token |
rating
required
|
integer | |
comment
|
string | Optional free-text comment |
The follow-up case inbox, across every campaign the caller can reach: detractor responses open a case, and someone has to work it. Filter by status (OPEN by default, or a status name, or ALL), by assignee (MINE default, ALL, UNASSIGNED) and by campaign. Same as GET /api/cases.
| Argument | Type | Description |
|---|---|---|
status
|
string | OPEN (default), NEW, IN_PROGRESS, RESOLVED, NOT_POSSIBLE or ALL |
assignee
|
string | Defaults to MINE |
campaignId
|
integer | Narrow to one campaign |
overdue
|
boolean | Only cases past their SLA due date |
Open / overdue / mine / unassigned counts for the inbox header. Same as GET /api/cases/counts.
No arguments.
One case with the respondent, rating, comment, assignee, status, outcome and due date. Same as GET /api/cases/{id}.
| Argument | Type | Description |
|---|---|---|
id
required
|
integer | Case id |
The case's internal notes (never shown to the respondent), oldest first. Same as GET /api/cases/{id}/notes.
| Argument | Type | Description |
|---|---|---|
id
required
|
integer | Case id |
Append an internal note to a case (max 2000 characters) — what was agreed with the customer, who you talked to. Same as POST /api/cases/{id}/notes.
| Argument | Type | Description |
|---|---|---|
id
required
|
integer | Case id |
body
required
|
string | Note text (required) |
Give the case to a user who has access to its campaign (they get notified), or unassign it with `unassign: true`. Same as POST /api/cases/{id}/assign.
| Argument | Type | Description |
|---|---|---|
id
required
|
integer | Case id |
assigneeId
|
integer | User who has access to the campaign |
unassign
|
boolean | Remove the assignee instead |
Set the status (NEW, IN_PROGRESS, RESOLVED, NOT_POSSIBLE); closing also records the outcome (RETAINED, LOST, UNKNOWN) and reopening clears the close date. Same as POST /api/cases/{id}/status.
| Argument | Type | Description |
|---|---|---|
id
required
|
integer | Case id |
status
required
|
string | |
outcome
|
string | Only meaningful when closing |
Search comments across every campaign the caller can reach. Filter by `q` (text in the comment), `tag` (tag name) or `tagId` (not both), `source` (HUMAN/AI: comments carrying a human- or model-applied tag), rating range, category, campaign and date range. Paged with `page`/`size`. Every comment carries its `tags[]` with each tag's own `source`. Same as GET /api/comments.
| Argument | Type | Description |
|---|---|---|
q
|
string | Text that must appear in the comment |
tag
|
string | Tag name inside the caller's vocabulary |
tagId
|
integer | Tag id (instead of tag) |
source
|
string | Only comments carrying a human- or model-applied tag |
minRating
|
integer | |
maxRating
|
integer | |
categories
|
string | promoter,passive,detractor (comma-separated) |
campaignId
|
integer | |
dateFrom
|
string | YYYY-MM-DD |
dateTo
|
string | YYYY-MM-DD |
page
|
integer | |
size
|
integer |
Limits and safety
| Calls per minute | 120 per API token. Past that the server answers 429 with Retry-After, so a well-behaved agent can back off by itself. Answers also carry X-RateLimit-Limit, -Remaining and -Reset. |
|---|---|
| Size | Max 64 KB per request and at most 50 messages per batch — otherwise 413 / -32600. |
| Caching | Every answer is sent with Cache-Control: no-store: tool results contain customer data and must not be cached by an intermediary. |
| Audit trail | Every tool call is logged with the token owner, tool, outcome and duration — argument values are not logged (they carry email addresses and comments). Metrics: mcp.tool.calls and mcp.tool.duration. |
Rules that also apply here
- One token is one account. Every tool acts as the token's owner — there is no cross-account access.
- Test campaigns are a sandbox:
campaigns_createwithtest: truenever sends real mail, andcampaigns_simulateonly works on them. campaigns_sendsends real email and the monthly quota applies — a refusal comes back as409: monthly_email_limit_reached.campaigns_trashis a restorable soft delete.- Same auth rules as the API: a missing, invalid or revoked token is 401 JSON; a campaign you cannot access is 404.
- Revoke the token in Settings → API tokens to cut an agent off immediately — the endpoint re-checks it on every request.