基于AI的调查评论分析MCP服务器,生成美观的交互式仪表板。
自动分析公司内部调查中的自由评论栏,并生成精美的HTML仪表板的MCP服务器。
<img src="images/report-01.png" width="45%" alt="执行摘要"> <img src="images/report-02.png" width="45%" alt="词云">
<img src="images/report-03.png" width="45%" alt="关键词排名"> <img src="images/report-04.png" width="45%" alt="分析轴别图表">
<img src="images/report-05.png" width="45%" alt="AI问题分析"> <img src="images/report--06.png" width="45%" alt="改进建议">
</div>基本安装(无AI分析):
claude mcp add --transport stdio survey-insight --scope user -- \
uvx --from git+https://github.com/sinjorjob/survey-insight-mcp.git survey-insight-mcp
包含AI分析 - 使用Claude Code订阅(推荐):
claude mcp add --transport stdio survey-insight --scope user \
-e USE_CLAUDE_CODE_SUBSCRIPTION=true -- \
uvx --from git+https://github.com/sinjorjob/survey-insight-mcp.git survey-insight-mcp
包含AI分析 - 使用Anthropic Claude API:
claude mcp add --transport stdio survey-insight --scope user \
-e LLM_PROVIDER=anthropic \
-e LLM_API_KEY=sk-ant-api03-your_key_here \
-e LLM_MODEL=claude-3-5-sonnet-20241022 -- \
uvx --from git+https://github.com/sinjorjob/survey-insight-mcp.git survey-insight-mcp
包含AI分析 - 使用Google Gemini API:
claude mcp add --transport stdio survey-insight --scope user \
-e LLM_PROVIDER=google \
-e LLM_API_KEY=your_google_api_key_here \
-e LLM_MODEL=gemini-2.0-flash-exp -- \
uvx --from git+https://github.com/sinjorjob/survey-insight-mcp.git survey-insight-mcp
安装后,请重启Claude Code。
编辑配置文件(Windows: %USERPROFILE%\.claude.json,macOS/Linux: ~/.claude.json):
基本设置(无AI分析):
{
"mcpServers": {
"survey-insight": {
"command": "uvx",
"args": [
"--from",
"git+https://github.com/sinjorjob/survey-insight-mcp.git",
"survey-insight-mcp"
]
}
}
}
包含AI分析 - 使用Claude Code订阅:
{
"mcpServers": {
"survey-insight": {
"command": "uvx",
"args": [
"--from",
"git+https://github.com/sinjorjob/survey-insight-mcp.git",
"survey-insight-mcp"
],
"env": {
"USE_CLAUDE_CODE_SUBSCRIPTION": "true"
}
}
}
}
包含AI分析 - 使用Anthropic Claude API:
{
"mcpServers": {
"survey-insight": {
"command": "uvx",
"args": [
"--from",
"git+https://github.com/sinjorjob/survey-insight-mcp.git",
"survey-insight-mcp"
],
"env": {
"LLM_PROVIDER": "anthropic",
"LLM_API_KEY": "sk-ant-api03-your_key_here",
"LLM_MODEL": "claude-3-5-sonnet-20241022"
}
}
}
}
包含AI分析 - 使用Google Gemini API:
{
"mcpServers": {
"survey-insight": {
"command": "uvx",
"args": [
"--from",
"git+https://github.com/sinjorjob/survey-insight-mcp.git",
"survey-insight-mcp"
],
"env": {
"LLM_PROVIDER": "google",
"LLM_API_KEY": "your_google_api_key_here",
"LLM_MODEL": "gemini-2.0-flash-exp"
}
}
}
}
设置完成后,请重启Claude Code。
如果需要更改LLM提供商:
方法A: 重新注册命令
# 1. 删除现有设置
claude mcp remove survey-insight
# 2. 使用新提供商重新注册
# 更改为Google Gemini:
claude mcp add --transport stdio survey-insight --scope user \
-e LLM_PROVIDER=google \
-e LLM_API_KEY=your_new_key_here \
-e LLM_MODEL=gemini-2.0-flash-exp -- \
uvx --from git+https://github.com/sinjorjob/survey-insight-mcp.git survey-insight-mcp
# 更改为Anthropic Claude:
claude mcp add --transport stdio survey-insight --scope user \
-e LLM_PROVIDER=anthropic \
-e LLM_API_KEY=sk-ant-api03-your_new_key_here \
-e LLM_MODEL=claude-3-5-sonnet-20241022 -- \
uvx --from git+https://github.com/sinjorjob/survey-insight-mcp.git survey-insight-mcp
# 3. 重启Claude Code
方法B: 直接编辑配置文件
编辑~/.claude.json中的env部分,然后重启Claude Code。
在Claude Code上请求如下:
分析examples/sample_survey.csv,并生成按部门和年龄分组的报告。
MCP工具将自动调用,并生成HTML报告和词云。
.csvcp932 (Excel日语 / Shift-JIS)shift-jisutf-8-sig (带BOM的UTF-8)utf-8language参数明确指定("ja" 或 "en")必需元素:
comment_column参数明确指定可选元素:
analysis_axes参数明确指定数据清洗:
日语:
部门,年龄,评论
销售,30代,服务很礼貌,很好
技术,40代,等待时间有点长
英语:
Department,Age_Group,Comments_Feedback
Sales,30s,The service was very polite and helpful
Technical,40s,The waiting time was a bit long
示例文件:
examples/sample_survey.csvexamples/healthcare_service_survey_en.csv无AI分析:
包含AI分析:
USE_CLAUDE_CODE_SUBSCRIPTION=true(Claude Code订阅)LLM_PROVIDER + LLM_API_KEY(Anthropic/Google API)编辑配置文件(Windows: %USERPROFILE%\.gemini\settings.json,macOS/Linux: ~/.gemini/settings.json):
基本设置(无AI分析):
{
"mcpServers": {
"survey-insight": {
"command": "uvx",
"args": [
"--from",
"git+https://github.com/sinjorjob/survey-insight-mcp.git",
"survey-insight-mcp"
]
}
}
}
包含AI分析(推荐使用Google Gemini API):
{
"mcpServers": {
"survey-insight": {
"command": "uvx",
"args": [
"--from",
"git+https://github.com/sinjorjob/survey-insight-mcp.git",
"survey-insight-mcp"
],
"env": {
"LLM_PROVIDER": "google",
"LLM_API_KEY": "your_google_api_key_here",
"LLM_MODEL": "gemini-2.0-flash-exp"
}
}
}
}
设置完成后,请重启Gemini CLI。
任何符合MCP规范的客户端都可以使用:
uvx["--from", "git+https://github.com/sinjorjob/survey-insight-mcp.git", "survey-insight-mcp"]Survey Insight MCP Server支持日语和英语的调查。
en_core_web_sm) 进行词法分析自动识别(推荐):
从评论列文本中自动识别语言。
分析examples/customer_feedback_en.csv。
手动指定:
可以通过language参数明确指定。
{
"csv_path": "examples/survey_data.csv",
"language": "en" # "ja" 或 "en"
}
全自动设置:
首次分析英语CSV时,spacy的英语模型 (en_core_web_sm) 将全自动下载。用户无需事先设置。
uv pip install| 处理 | 日语 (janome) | 英语 (spacy) |
|---|---|---|
| 词法分析 | ✅ | ✅ |
| 关键词提取 | 使用表层形式 | 使用词根(基本形式) |
| 复合名词提取 | ✅ 支持 | ❌ 不支持(仅单词) |
| 词性过滤 | 名词、动词、形容词 | NOUN、VERB、ADJ |
| 最小字符数 | 至少1个字符 | 至少3个字符 |
| 停用词 | 日语停用词列表 | 英语停用词列表 |
analyze_survey从CSV文件中执行调查分析,并生成HTML报告和词云。
参数:
csv_path (必需): CSV文件路径comment_column (可选): 自由评论列名称(未指定时自动检测)analysis_axes (可选): 分析轴列表(例如: ["部门", "年龄", "职位"])output_path (可选): 输出HTML路径(默认: output/survey_report.html)enable_ai_analysis (可选): 启用AI问题分析(默认: true)language (可选): 语言代码("ja" 或 "en",未指定时自动检测评论列语言)使用示例:
分析examples/healthcare_service_survey.csv,并生成按诊疗科和年龄层分组的报告。
英语CSV分析示例:
分析examples/customer_feedback_en.csv。
# 克隆仓库
git clone https://github.com/sinjorjob/survey-insight-mcp.git
cd survey-insight-mcp
# 创建uv虚拟环境
uv venv
# 安装依赖包
uv pip install -e .
cp .env.example .env
# 编辑.env文件以设置LLM
# 从本地运行MCP服务器
uvx --from . survey-insight-mcp
# 或者使用MCP Inspector进行测试
npm install -g @modelcontextprotocol/inspector
mcp-inspector uvx --from . survey-insight-mcp
# 单元测试
pytest
# 代码检查
ruff check --line-length=127
ruff format --check --diff --line-length=127
survey-insight-mcp/
├── pyproject.toml # 包设置
├── README.md # 此文件
├── LICENSE # MIT许可证
├── .env.example # 环境变量模板
├── src/survey_insight/
│ ├── server.py # 入口点
│ ├── mcp_server.py # MCP服务器实现
│ ├── csv_loader.py # CSV加载
│ ├── text_analyzer.py # 词法分析
│ ├── chart_generator.py # 图表生成
│ ├── ai_analyzer.py # AI问题分析
│ └── templates/
│ └── dashboard.html # HTML模板
├── tests/ # 测试代码
└── examples/ # 示例CSV文件
获取最新版本:
# 清除uvx缓存
uv cache clean
# 重启Claude Code / Gemini CLI
uvx会自动获取最新的提交。
解决办法:
~/.claude.json)原因: 环境变量设置不正确
解决办法:
USE_CLAUDE_CODE_SUBSCRIPTION=trueLLM_PROVIDER 和 LLM_API_KEY解决办法:
# 清除uvx缓存
uv cache clean --force
# 重启Claude Code
MIT License
🤖 提供商:Claude AI