loading…
Search for a command to run...
loading…
Transform LLMs into intelligent interviewers. MCP server for conducting dynamic, conversational surveys with structured data collection. Features skip logic, se
Transform LLMs into intelligent interviewers. MCP server for conducting dynamic, conversational surveys with structured data collection. Features skip logic, session resume, multi-tenancy, and pluggable storage backends.
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).
{
"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
cd survey-mcp-server
bun install
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.
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 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:
# One-time build
bun rebuild
# Run the built server
bun start:http
# or
bun start:stdio
Run checks and tests:
bun devcheck # Lints, formats, type-checks, and more
bun test # Runs the test suite
bun build:worker
bun deploy:dev
bun deploy:prod
| 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.
bun run devcheck
bun test
This project is licensed under the Apache 2.0 License. See the LICENSE file for details.
Выполни в терминале:
claude mcp add survey-mcp-server -- npx -y @cyanheads/survey-mcp-serverpro-tip
Поставил Survey Mcp Server? Скажи Claude: «запомни почему я установил Survey Mcp Server и что хочу попробовать» — попадёт в твой Vault.
как это работает →Безопасность
Низкий рискАвтоматическая эвристика по публичным данным — не гарантия безопасности.