MCP Server

Connect Claude, Cursor and other AI assistants to SurveyNinja via Model Context Protocol

MCP Server

Model Context Protocol (MCP) is a standard that lets AI models (Claude, Cursor, Copilot, etc.) connect to SurveyNinja and work with your data directly — read surveys, responses, analytics, and perform actions without manual copying.

1. Connection

Getting an API key

  1. Log in to your SurveyNinja account.
  2. Go to SettingsAPI / MCP.
  3. Click "Create API key" and copy it — the key is shown only once.

Endpoint

POST https://mcp.surveyninja.io/mcp/v1

Authentication

Pass the API key in the Authorization header:

Authorization: Bearer 42|xK7mP9nQ2wL5eH8jR3vU6tY0iD4aF1bG

Configuration for Claude Desktop

File claude_desktop_config.json

{ "mcpServers": { "surveyninja": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-fetch"], "env": { "MCP_URL": "https://mcp.surveyninja.io/mcp/v1", "MCP_AUTH_HEADER": "Authorization", "MCP_AUTH_VALUE": "Bearer <your_api_key>" } } } }

Configuration for Cursor / VS Code

{ "mcp.servers": { "surveyninja": { "url": "https://mcp.surveyninja.io/mcp/v1", "headers": { "Authorization": "Bearer <your_api_key>" } } } }

Rate limits

  • 180 requests per minute per user (tools/call, resources/read, etc.)
  • Export links are valid for 1 hour

2. Resources

Resources are read-only. To use them, send a resources/read request with the corresponding URI.

URI Description
User and workspaces
user://meBasic information about the current user
workspace://listList of all user workspaces
Folders and surveys
folder://listList of all user folders
quiz://listList of all available surveys
Survey structure and configuration
quiz://{'{id}'}/structureFull survey widget structure
quiz://{'{id}'}/textsCustom UI labels
quiz://{'{id}'}/variablesHidden variables (extra fields)
quiz://{'{id}'}/hidden_optionsService survey configuration options
quiz://{'{id}'}/widgets_hiddenHidden widget metadata
Responses and analytics
quiz://{'{id}'}/answersPaginated list of respondent answers
quiz://{'{id}'}/summarySummary analytics (funnel, devices, geo)
quiz://{'{id}'}/reportDetailed widget report (with filters)
quiz://{'{id}'}/report_filtersSaved user filters
quiz://{'{id}'}/report/{'{uuid}'}/inputsText responses for input widgets
quiz://{'{id}'}/report/{'{uuid}'}/filesFiles uploaded by respondents
Themes and promo codes
theme://listList of workspace themes
theme://{'{id}'}/detailsDetailed theme settings
promocode://listPromo code group lists
promocode://{'{id}'}/codesCodes in a specific promo code list

3. Tools

Tools are actions executed on the SurveyNinja side upon request from an AI model via the tools/call method.

Tool response format

Each tool returns an object with content fields (array of text blocks) and isError (false — success, true — error). On success, additional data fields are added.

Survey management

Tool Description Required parameters
create_quizCreates a new surveyfolder_id
rename_quizRenames a surveyquiz_id, name
duplicate_quizDuplicates a surveyquiz_id
archive_quizArchives / unarchivesquiz_id, archive
delete_quizDeletes a survey (soft delete)quiz_id
publish_quizPublishes the current versionquiz_id
move_quizMoves survey to another folderquiz_id, folder_id
make_quiz_templateCreates a template from a surveyquiz_id
create_folderCreates a survey folderworkspace_id, name

Survey content and structure

Tool Description Required parameters
update_quiz_widgetsSaves widget structurequiz_id, ids, entities
update_quiz_textsUpdates button and element texts (paid plan)quiz_id, texts
update_quiz_settingsUpdates survey settings (language, limits, theme, scripts, etc.)quiz_id
update_quiz_logicSaves transition logic and scoringquiz_id
update_quiz_noteAdds/updates an internal notequiz_id, notes
upload_quiz_mediaUpload media for the multimedia block (paid plan)quiz_id, type
upload_quiz_widget_imageUpload image for a widget with media optionsquiz_id

Design themes

Tool Description Required parameters
apply_quiz_themeApplies a theme to a surveyquiz_id, theme_id
create_themeCreates a theme and applies it to a survey (paid plan)workspace_id, quiz_id
update_themeUpdates an existing themeworkspace_id, theme_id

Survey variables

Tool Description Required parameters
create_quiz_variableCreates a hidden variable (extra field)quiz_id, name
update_quiz_variableRenames a variablequiz_id, field_id, name
delete_quiz_variableDeletes a variablequiz_id, field_id

Hidden options

Tool Description Required parameters
create_hidden_optionCreates a survey service optionquiz_id, name, value
update_hidden_optionUpdates a survey optionquiz_id, opt_id, name, value
delete_hidden_optionDeletes a survey optionquiz_id, opt_id
create_widget_hidden_optionCreates an option for a specific widgetquiz_id, widget_uuid, name, value
update_widget_hidden_optionUpdates a widget optionquiz_id, opt_id, name, value
delete_widget_hidden_optionDeletes a widget optionquiz_id, opt_id

Responses, analytics and public links

Tool Description Required parameters
toggle_answer_visibilityHides/shows a responsequiz_id, answer_id, is_hide
tag_answerAdds/syncs response tagsquiz_id, answer_id, tags
generate_filtered_reportGenerates a report with filters → report_uuidquiz_id
share_summary_linkPublic link to summaryquiz_id
share_report_linkPublic link to reportquiz_id
share_answers_linkPublic link to answer listquiz_id

Export

All tools accept quiz_id (required). Download link is valid for 1 hour.

Tool Description
export_answers_csvExport answers to CSV
export_answers_xlsxExport answers to XLSX
export_answers_wordExport answers to Word
export_summary_pdfExport summary to PDF
export_filtered_report_pdfExport filtered report to PDF
export_filtered_report_wordExport filtered report to Word

Promo codes (paid plan)

Tool Description Required parameters
create_promocode_groupCreates a promo code listquiz_id, name, codes
add_promocodesAdds codes to an existing listquiz_id, list_id, codes

4. Technical details

Protocol version

2025-06-18

Transport

HTTP POST (JSON-RPC 2.0)

Connection method

POST /mcp/v1

Standard JSON-RPC methods

Method Description
initializeSession initialization, fetching server capabilities
tools/listList all available tools
tools/callCall a tool with parameters
resources/listList all available resources
resources/readRead resource content by URI
prompts/listList prompt templates
prompts/getGet a specific prompt template

Request example

POST https://mcp.surveyninja.io/mcp/v1 Authorization: Bearer 42|xK7mP9nQ2wL5eH8jR3vU6tY0iD4aF1bG Content-Type: application/json { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "rename_quiz", "arguments": { "quiz_id": 123, "name": "New survey name" } } }

Error response format

{ "jsonrpc": "2.0", "id": 1, "error": { "code": -32602, "message": "Invalid params: quiz_id is required" } }

5. Typical scenarios

1. Get list of surveys and structure of a specific one

1. resources/read: quiz://list → get list of surveys with IDs

2. resources/read: quiz://{'{id}'}/structure → get widget structure

2. Working with responses

1. resources/read: quiz://{'{id}'}/answers → get responses (with answer_id)

2. tools/call: tag_answer (add tags) or toggle_answer_visibility (hide/show)

3. Export with filtering

1. tools/call: generate_filtered_report (quiz_id, dateFrom/dateTo d.m.Y format, filters) → report_uuid

⚠ Date format here is d.m.Y (01.01.2024), while the quiz://report resource uses Y-m-d

2. resources/read: quiz://{'{id}'}/report/{'{uuid}'}/files or /inputs

3. tools/call: export_filtered_report_pdf (quiz_id) → PDF link

⚠ export_filtered_report_pdf and _word accept only quiz_id; report_uuid should not be passed

4. Adding promo codes

1. tools/call: create_promocode_group → create a list with initial codes → get list_id

2. tools/call: add_promocodes → add more codes to the list

3. resources/read: promocode://{'{list_id}'}/codes → verify added codes

5. Apply a theme and immediately get the survey structure

1. resources/read: theme://list → get list of themes with IDs

2. tools/call: apply_quiz_theme (quiz_id, theme_id)

→ the response already includes a quiz field with the structure — no extra resources/read needed

Full MCP documentation in markdown format for working with AI:

/static/mcp_user_guide.md — complete reference for resources and tools.