The full upstream README, mirrored here for reference. Install config, tool schemas, adoption signals, and an original overview live on the Survey MCP Server listing page.
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:
| Tool Name | Description |
|---|---|
survey_list_available | Discover available surveys in the definitions directory. |
survey_start_session | Initialize a new session with complete survey context, all questions, and initial suggested questions. |
survey_get_question | Refresh a specific question's eligibility status after state changes (useful for conditional logic). |
survey_submit_response | Record participant answers with validation, scoring, returning updated progress and next suggested questions. |
survey_get_progress | Check completion status, current score, remaining required/optional questions, and completion eligibility. |
survey_complete_session | Finalize a completed session with final score summary (requires all required questions answered). |
survey_export_results | Export session data in CSV or JSON format with optional filtering by status, date range, etc. |
survey_resume_session | Resume an incomplete session, restoring full context including answered questions and progress. |
survey_list_availableDiscover available surveys loaded from your survey definitions directory.
Key Features:
SURVEY_DEFINITIONS_PATHExample Use Cases:
survey_start_sessionInitialize a new survey session with complete context for LLM-driven conversations.
Key Features:
currentlyEligible flag and eligibilityReason for transparencyguidanceForLLM field with conversational instructionsExample Use Cases:
survey_get_questionRefresh a question's eligibility and details after session state changes.
Key Features:
Example Use Cases:
survey_submit_responseRecord participant answers with validation and get dynamic response guidance.
Key Features:
updatedEligibility array showing newly available conditional questionsnextSuggestedQuestions based on new state (count configurable per survey)guidanceForLLM with context-aware instructionsExample Use Cases:
survey_get_progressCheck session status and completion eligibility.
Key Features:
in-progress, completed, abandonedcanComplete boolean indicating if session can be finalizedcompletionBlockers array explaining what's preventing completionExample Use Cases:
survey_complete_sessionFinalize a completed session when all required questions have been answered.
Key Features:
completed and sets completedAt timestampExample Use Cases:
survey_export_resultsExport session data for analysis and reporting.
Key Features:
Example Use Cases:
survey_resume_sessionResume an incomplete session with full context restoration.
Key Features:
nextSuggestedQuestions for remaining questions (count configurable per survey)guidanceForLLM with welcome-back messaging suggestionsExample Use Cases:
This server is built on the mcp-ts-template and inherits its rich feature set:
McpError system ensures consistent, structured error responses.none, jwt, or oauth modes.in-memory, filesystem, Supabase, Cloudflare KV/R2) without changing business logic.tsyringe for a clean, decoupled, and testable architecture.Plus, specialized features for Survey Management:
AND/OR multi-condition branching with eligibility tracking.free-form, multiple-choice, multiple-select, rating-scale, email, number, boolean, and advanced types like date, datetime, time, and matrix grids.helpText field on questions provides LLMs with context and guidance for asking questions naturally.Add the following to your MCP Client configuration file (e.g., cline_mcp_settings.json).
survey-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.
📖 View detailed specification and examples →
All configuration is centralized and validated at startup in src/config/index.ts. Key environment variables in your .env file include:
| Variable | Description | Default |
|---|---|---|
SURVEY_DEFINITIONS_PATH | Path to directory containing survey JSON files (recursive scan). | ./survey-definitions |
SURVEY_RESPONSES_PATH | Path to directory for storing session responses (filesystem mode). | ./survey-responses |
MCP_TRANSPORT_TYPE | The transport to use: stdio or http. | http |
MCP_HTTP_PORT | The port for the HTTP server. | 3019 |
MCP_AUTH_MODE | Authentication mode: none, jwt, or oauth. | none |
STORAGE_PROVIDER_TYPE | Storage backend: in-memory, filesystem, supabase, cloudflare-kv, r2. | in-memory |
OTEL_ENABLED | Set to true to enable OpenTelemetry. | false |
LOG_LEVEL | The minimum level for logging (debug, info, warn, error). | info |
MCP_AUTH_SECRET_KEY | Required for jwt auth. A 32+ character secret key. | (none) |
OAUTH_ISSUER_URL | Required for oauth auth. URL of the OIDC provider. | (none) |
Build and run the production version:
Run checks and tests:
| Directory | Purpose & Contents |
|---|---|
survey-definitions/ | Survey definitions (JSON files). Nested directories supported for organization. |
survey-responses/ | Session responses (when using filesystem provider). Organized by tenant ID. |
src/mcp-server/tools | Survey tool definitions (survey-*.tool.ts). 8 tools for complete lifecycle. |
src/mcp-server/resources | Resource definitions for survey metadata and discovery. |
src/services/survey/ | Survey service with filesystem provider for loading definitions. |
src/mcp-server/transports | Implementations for HTTP and STDIO transports, including auth middleware. |
src/storage | StorageService abstraction and all storage provider implementations. |
src/container | Dependency injection container registrations and tokens. |
src/utils | Core utilities for logging, error handling, performance, and security. |
src/config | Environment variable parsing and validation with Zod. |
tests/ | Unit and integration tests, mirroring the src/ directory structure. |
docs/ | Detailed specifications and guides (see survey-mcp-server-spec.md). |
For strict rules when using this server with an AI agent, refer to the .clinerules file (or AGENTS.md) in this repository. Key principles include:
try/catch in your tool logic. Throw an McpError instead.RequestContext object through your call stack for logging and tracing.index.ts barrel files within their respective definitions directories.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 the LICENSE file for details.