
Survey Mcp Server
io.github.cyanheads由 GitHub 帳號 cyanheads 發布v1.0.6更新於 Oct 25, 2026
MCP server for conducting dynamic, conversational surveys with structured data collection.
概覽
一個本機 MCP 伺服器,讓助理進行對話式問卷:建立工作階段、提問、記錄經驗證的回答、追蹤進度並匯出結果
- 可以做什麼
- 探索問卷,並以完整問題脈絡與建議的後續問題啟動或恢復工作階段,支援租戶篩選與中繼資料記錄。在已有回答後重新整理單一問題,檢查條件邏輯是否使其可用。提交回答並進行驗證、計分與進度更新,查看完成狀態、剩餘必答問題與完成阻礙。所有必答問題完成後結束工作階段,並依問卷、狀態與日期範圍篩選,以 CSV 或 JSON 匯出工作階段資料。
- 適用情境
- 適合讓助理以自然對話方式進行結構化訪談、回饋表、測驗或評估,同時把回答保存在一致且經驗證的資料中。也適用於以 JSON 檔案定義、支援多租戶或可中斷續答的問卷流程。
- 執行需求
- 透過 bunx 以 stdio 本機程序執行,需要 Bun v1.2.0 或更高版本。需設定 SURVEY_DEFINITIONS_PATH 與 SURVEY_RESPONSES_PATH 指向問卷 JSON 檔案與回答儲存目錄;選用設定包括傳輸方式、HTTP 主機/連接埠/路徑、日誌等級、儲存後端與驗證模式。JWT 驗證需要 MCP_AUTH_SECRET_KEY,OAuth 需要 OAUTH_ISSUER_URL。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Survey Mcp Server,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
@cyanheads/survey-mcp-server
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.
🛠️ Tools Overview
This server provides eight powerful tools for managing the complete survey lifecycle with LLM-driven interactions:
survey_list_available
Discover available surveys loaded from your survey definitions directory.
Key Features:
- Lists all surveys discovered via recursive directory scan of
SURVEY_DEFINITIONS_PATH - Returns survey metadata: ID, title, description, estimated duration, and question count
- Optional tenant filtering for multi-tenant deployments
Example Use Cases:
- "Show me all available surveys"
- "What surveys can participants take?"
- "List surveys for tenant X"
survey_start_session
Initialize a new survey session with complete context for LLM-driven conversations.
Key Features:
- 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 includes
currentlyEligibleflag andeligibilityReasonfor transparency - Provides
guidanceForLLMfield with conversational instructions - Supports session metadata for tracking source, user agent, etc.
Example Use Cases:
- "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"
survey_get_question
Refresh a question's eligibility and details after session state changes.
Key Features:
- 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
Example Use Cases:
- "Has question q2 become available yet?"
- "Check if the follow-up question is now eligible"
- "Refresh question details after the participant answered the dependency"
survey_submit_response
Record participant answers with validation and get dynamic response guidance.
Key Features:
- 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)
- Returns
updatedEligibilityarray showing newly available conditional questions - Provides refreshed
nextSuggestedQuestionsbased on new state (count configurable per survey) - Includes
guidanceForLLMwith context-aware instructions
Example Use Cases:
- "Submit answer 'very-satisfied' for question q1"
- "Record the participant's email: [email protected]"
- "Save free-form response with validation"
survey_get_progress
Check session status and completion eligibility.
Key Features:
- 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 finalizedcompletionBlockersarray explaining what's preventing completion
Example Use Cases:
- "How much of the survey is complete?"
- "What required questions are still unanswered?"
- "Can we complete the survey now?"
survey_complete_session
Finalize a completed session when all required questions have been answered.
Key Features:
- Validates that all required questions (including conditionally required) are answered
- Updates session status to
completedand setscompletedAttimestamp - Returns summary with total questions answered, session duration, and final score (if scoring enabled)
- Prevents duplicate completion
Example Use Cases:
- "Complete the survey session"
- "Finalize session sess_abc123"
- "Mark the survey as finished"
survey_export_results
Export session data for analysis and reporting.
Key Features:
- 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
Example Use Cases:
- "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"
survey_resume_session
Resume an incomplete session with full context restoration.
Key Features:
- Restores complete survey context and session state
- Returns all previously answered questions with responses
- Provides refreshed
nextSuggestedQuestionsfor remaining questions (count configurable per survey) - Shows elapsed time since last activity
- Current progress summary (percentage, remaining questions, current score)
- Includes
guidanceForLLMwith welcome-back messaging suggestions
Example Use Cases:
- "Resume session sess_abc123"
- "Continue the survey where the participant left off"
- "Restore session state for participant to finish later"
✨ Features
This server is built on the mcp-ts-template and 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 unified
McpErrorsystem ensures consistent, structured error responses. - Pluggable Authentication: Secure your server with zero-fuss support for
none,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 with
tsyringefor 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 for Survey 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 complex
AND/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: A
helpTextfield 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.
🚀 Getting Started
MCP Client Settings/Configuration
Add the following to your MCP Client configuration file (e.g., cline_mcp_settings.json).
Prerequisites
- Bun v1.2.0 or higher.
Installation
- Clone the repository:
- Navigate into the directory:
- Install dependencies:
- Explore example surveys:
The
survey-definitions/directory contains example JSON files demonstrating various question types and features. Use these as a starting point for creating your own surveys.
🛠️ Core Capabilities: Survey Tools
This server equips AI agents with specialized tools to conduct dynamic, conversational surveys while maintaining structured data collection.
Example Interaction Flow
📖 View detailed specification and examples →
⚙️ Configuration
All configuration is centralized and validated at startup in src/config/index.ts. Key environment variables in your .env file include:
▶️ Running the Server
Local Development
-
Build and run the production version:
-
Run checks and tests:
Cloudflare Workers
- Build the Worker bundle:
- Run locally with Wrangler:
- Deploy to Cloudflare:
📂 Project Structure
🧑💻 Agent Development Guide
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:
- Logic Throws, Handlers Catch: Never use
try/catchin your toollogic. Throw anMcpErrorinstead. - Pass the Context: Always pass the
RequestContextobject through your call stack for logging and tracing. - Use the Barrel Exports: Register new tools and resources only in the
index.tsbarrel files within their respectivedefinitionsdirectories.
🤝 Contributing
Issues and pull requests are welcome! If you plan to contribute, please run the local checks and tests before submitting your PR.
📜 License
This project is licensed under the Apache 2.0 License. See the LICENSE file for details.
來源:README.md,提交 345882f
工具
0版本歷史
1- v1.0.6最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分