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.

REST API CLI mcp.md

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

The account's comment tag vocabulary with counts, a 30-day trend and a `reliable` flag (false = too little data). Filter with `q` (name contains) and `source` (HUMAN = a person created it, AI = the browser's model created it). Each tag reports its own `source` and an `aiCount` (assignments the model applied), which is how AI tags are told apart. Same as GET /api/comment-tags.

Argument Type Description
q string Keep tags whose name contains this text
source string HUMAN = created by a person, AI = created by the browser's model

Create a tag in the account's vocabulary. The name is 1-40 characters and unique per account, case-insensitively; a clash is an error. The colour is a hex value like #0d6efd and defaults to grey. Same as POST /api/comment-tags.

Argument Type Description
name required string Tag name (required)
color string Hex colour, e.g. #0d6efd; defaults to grey

Rename and/or recolour one tag; omitted fields are left unchanged and every existing assignment follows a rename. Same as PUT /api/comment-tags/{id}.

Argument Type Description
id required integer Tag id
name string
color string Hex colour, e.g. #0d6efd

Delete a tag and remove it from every comment that carried it. This is not restorable — confirm with the user first. Same as DELETE /api/comment-tags/{id}.

Argument Type Description
id required integer Tag id

Remove every tag assignment the model applied for this account, then any AI-created tag left with no comments. Human tags and human assignments are untouched. Same as DELETE /api/comment-tags/ai.

No arguments.

The tags on one comment, each with its `source` (who applied it). Reading needs access to the campaign; a stranger gets 404. Same as GET /api/comments/{responseId}/tags.

Argument Type Description
responseId required integer Comment (response) id

Replace the whole tag set on one comment: `tagIds` is the complete set, so an empty array clears every tag. Needs editor access to the campaign; a viewer or stranger gets 404 and a tag id outside the account is a 404. Same as PUT /api/comments/{responseId}/tags.

Argument Type Description
responseId required integer Comment (response) id
tagIds required array The complete tag set; [] clears

Add one tag to a comment and keep the tags it already has. Needs editor access; tagging the same tag twice is a no-op. Returns the comment's resulting tags. Same as POST /api/comments/{responseId}/tags/{tagId}.

Argument Type Description
responseId required integer Comment (response) id
tagId required integer Tag id

Remove one tag from a comment and leave its other tags. Removing a tag the comment does not carry is a no-op. Same as DELETE /api/comments/{responseId}/tags/{tagId}.

Argument Type Description
responseId required integer Comment (response) id
tagId required integer Tag id

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