survey-mcp-server

by cyanheads

Not rated
GitHub

About

Conversational surveys Browse Survey MCP Server for Claude, Cursor, VS Code, and other AI agents.

Details

Author
cyanheads
Categories
Productivity, Other

Setup

Install survey-mcp-server in your MCP client (Claude Desktop, Cursor, Windsurf, and others).

Repository: https://github.com/cyanheads/survey-mcp-server

Follow the installation instructions in the repository README, then restart your MCP client.

Transform LLMs into intelligent interviewers. A production-grade MCP server for conducting dynamic, conversational surveys with structured data collection. Features skip logic, session resume, multi-tenancy, and pluggable storage backends.

This server provides eight powerful tools for managing the complete survey lifecycle with LLM-driven interactions:

Discover available surveysloaded from your survey definitions directory.

- Lists all surveys discovered via recursive directory scan ofSURVEY_DEFINITIONS_PATH
- Returns survey metadata: ID, title, description, estimated duration, and question count
- Optional tenant filtering for multi-tenant deployments

- "Show me all available surveys"
- "What surveys can participants take?"
- "List surveys for tenant X"

Initialize a new survey sessionwith complete context for LLM-driven conversations.

- Creates new session with unique session ID and participant tracking
- Loads complete survey definition with all questions upfront
- Returns initial suggested questions based on survey settings (configurable min/max, defaults to 3-5) based on eligibility (unconditional questions first, required before optional)
- Each question includescurrentlyEligibleflag andeligibilityReasonfor transparency
- ProvidesguidanceForLLMfield with conversational instructions
- Supports session metadata for tracking source, user agent, etc.

- "Start the customer satisfaction survey for participant ABC123"
- "Begin a new session for the Q1 feedback survey"
- "Initialize survey session with metadata: source=web, userAgent=Claude"

Refresh a question's eligibilityand details after session state changes.

- Returns current eligibility status based on latest session state
- Provides eligibility reason (e.g., "Conditional logic satisfied", "Always available")
- Indicates if question was already answered
- Useful for checking if conditional questions became available after previous answers

- "Has question q2 become available yet?"
- "Check if the follow-up question is now eligible"
- "Refresh question details after the participant answered the dependency"

Record participant answerswith validation and get dynamic response guidance.

- Validates responses against question constraints (min/max length, patterns, required fields, etc.)
- Calculates and returns score for response (if scoring is enabled on question options)
- Returns validation errors with specific, actionable feedback
- Updates session progress (percentage complete, questions answered, time remaining estimate, current score)
- ReturnsupdatedEligibilityarray showing newly available conditional questions
- Provides refreshednextSuggestedQuestionsbased on new state (count configurable per survey)
- IncludesguidanceForLLMwith context-aware instructions

- "Submit answer 'very-satisfied' for question q1"
- "Record the participant's email:user@example.com"
- "Save free-form response with validation"

Check session statusand completion eligibility.

- Returns completion status:in-progress,completed,abandoned
- Progress metrics: total questions, answered count, required remaining, percentage complete, current score
- Lists all unanswered required questions (with eligibility status)
- Lists all unanswered optional questions (with eligibility status)
- canCompleteboolean indicating if session can be finalized
- completionBlockersarray explaining what's preventing completion

- "How much of the survey is complete?"
- "What required questions are still unanswered?"
- "Can we complete the survey now?"

Finalize a completed sessionwhen all required questions have been answered.

- Validates that all required questions (including conditionally required) are answered
- Updates session status tocompletedand setscompletedAttimestamp
- Returns summary with total questions answered, session duration, and final score (if scoring enabled)
- Prevents duplicate completion

- "Complete the survey session"
- "Finalize session sess_abc123"
- "Mark the survey as finished"

Export session datafor analysis and reporting.

- Export in CSV or JSON format
- Filter by survey ID, status, date range, and custom criteria
- Returns formatted data with record count and generation timestamp
- CSV format includes one row per session with flattened question responses
- JSON format preserves full session structure

- "Export all completed responses for survey customer-satisfaction-q1-2025 as CSV"
- "Get JSON export of sessions completed in January 2025"
- "Export in-progress sessions for analysis"

Resume an incomplete sessionwith full context restoration.

- Restores complete survey context and session state
- Returns all previously answered questions with responses
- Provides refreshednextSuggestedQuestionsfor remaining questions (count configurable per survey)
- Shows elapsed time since last activity
- Current progress summary (percentage, remaining questions, current score)
- IncludesguidanceForLLMwith welcome-back messaging suggestions

- "Resume session sess_abc123"
- "Continue the survey where the participant left off"
- "Restore session state for participant to finish later"

This server is built on themcp-ts-templateand inherits its rich feature set:

- Declarative Tools: Define capabilities in single, self-contained files. The framework handles registration, validation, and execution.
- Robust Error Handling: A unifiedMcpErrorsystem ensures consistent, structured error responses.
- Pluggable Authentication: Secure your server with zero-fuss support fornone,jwt, oroauthmodes.
- Abstracted Storage: Swap storage backends (in-memory,filesystem,Supabase,Cloudflare KV/R2) without changing business logic.
- Full-Stack Observability: Deep insights with structured logging (Pino) and optional, auto-instrumented OpenTelemetry for traces and metrics.
- Dependency Injection: Built withtsyringefor a clean, decoupled, and testable architecture.
- Edge-Ready: Write code once and run it seamlessly on your local machine or at the edge on Cloudflare Workers.

Plus, specialized features forSurvey Management:

- LLM-Driven Surveys: Tools provide rich context (progress, next suggested questions, validation results, scores) to guide natural conversation flow.
- Hybrid Flow Control: Guided mode with configurable suggested questions (defaults to 3-5) + flexible ordering based on conversation context.
- Scoring System: Support for quizzes and assessments with optional score fields on question options. Automatic score calculation and accumulation per session.
- Advanced Conditional Logic: Support for simple skip logic and complexAND/ORmulti-condition branching with eligibility tracking.
- JSON-Based Survey Definitions: Define surveys in simple JSON files with recursive directory scanning.
- Multiple Question Types:free-form,multiple-choice,multiple-select,rating-scale,email,number,boolean, and advanced types likedate,datetime,time, andmatrixgrids.
- Validation Engine: Min/max length, patterns, required fields, custom constraints, and date/time rules with extensible validator map pattern.
- Session Resume: Built-in state management allows participants to pause and continue later.
- Help Text: AhelpTextfield on questions provides LLMs with context and guidance for asking questions naturally.
- Pagination Support: Scalable data retrieval with configurable pagination for session queries and exports.

Add the following to your MCP Client configuration file (e.g.,cline_mcp_settings.json).

{ "mcpServers": { "survey-mcp-server": { "command": "bunx", "args": ["@cyanheads/survey-mcp-server@latest"], "env": { "MCP_LOG_LEVEL": "info", "SURVEY_DEFINITIONS_PATH": "./survey-definitions", "SURVEY_RESPONSES_PATH": "./survey-responses" } } } }
git clone https://github.com/cyanheads/survey-mcp-server.git

- Explore example surveys:Thesurvey-definitions/directory contains example JSON files demonstrating various question types and features. Use these as a starting point for creating your own surveys.

This server equips AI agents with specialized tools to conduct dynamic, conversational surveys while maintaining structured data collection.

1. LLM calls survey_start_session → Receives full survey context, all questions, and first 3-5 suggested questions 2. LLM asks questions naturally in conversation → Follows suggestions but can adapt order based on context → Uses natural language while ensuring survey questions are covered 3. For each answer, LLM calls survey_submit_response → Receives validation feedback (re-prompts if needed) → Gets score for response (if scoring enabled): "+5 points (Total: 45)" → Gets progress update (50% complete, 2 of 4 questions answered) → Refreshed suggestions with newly eligible conditional questions 4. LLM can check survey_get_progress anytime → Knows exactly what's required vs optional → Understands what remains before completion is possible 5. When all required questions answered, LLM calls survey_complete_session → Session finalized with timestamp, summary, and final score → Ready for export via survey_export_results

📖View detailed specification and examples →

All configuration is centralized and validated at startup insrc/config/index.ts. Key environment variables in your.envfile include:

# One-time build bun rebuild # Run the built server bun start:http # or bun start:stdio
bun devcheck # Lints, formats, type-checks, and more bun test # Runs the test suite

For strict rules when using this server with an AI agent, refer to the.clinerulesfile (orAGENTS.md) in this repository. Key principles include:

- Logic Throws, Handlers Catch: Never usetry/catchin your toollogic. Throw anMcpErrorinstead.
- Pass the Context: Always pass theRequestContextobject through your call stack for logging and tracing.
- Use the Barrel Exports: Register new tools and resources only in theindex.tsbarrel files within their respectivedefinitionsdirectories.

Issues and pull requests are welcome! If you plan to contribute, please run the local checks and tests before submitting your PR.

This project is licensed under the Apache 2.0 License. See theLICENSEfile for details.

Automated document processing and extraction

Great Question is an Agentic UX research platform for product builders. Its MCP lets AI agents create studies directly from any AI tool, surface insights, find the right research candidates, and query your entire research repository.

Create and edit Tally forms and analyze submissions

An MCP server for ActivityWatch, allowing interaction with your personal time tracking data.

AI2Fin | Intelligent Financial Management

Tools for expense tracking, tax deductions, bill management, and financial analysis.

Manage personal finances, track transactions, and create budgets with Budgetsco.

A simple calculator server for performing basic arithmetic operations.

Math evaluation, simplification, derivatives

A powerful server for Excel file processing, data analysis, and visualization, leveraging Python and Go for high performance.

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.