spss-mcp 1.1.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. spss_mcp-1.1.1/.env.example +28 -0
  2. spss_mcp-1.1.1/.gitignore +52 -0
  3. spss_mcp-1.1.1/CHANGELOG.md +95 -0
  4. spss_mcp-1.1.1/LICENSE +21 -0
  5. spss_mcp-1.1.1/PKG-INFO +164 -0
  6. spss_mcp-1.1.1/QUICK_START.md +45 -0
  7. spss_mcp-1.1.1/README.en.md +61 -0
  8. spss_mcp-1.1.1/README.md +128 -0
  9. spss_mcp-1.1.1/docs/ecosystem.md +81 -0
  10. spss_mcp-1.1.1/docs/method_verification.json +210 -0
  11. spss_mcp-1.1.1/docs/method_verification.md +104 -0
  12. spss_mcp-1.1.1/docs/poc_chart_pipeline.md +103 -0
  13. spss_mcp-1.1.1/docs/release_notes_v1.0.md +48 -0
  14. spss_mcp-1.1.1/docs/result_parsing.md +71 -0
  15. spss_mcp-1.1.1/docs/security.md +47 -0
  16. spss_mcp-1.1.1/docs/technical_report.md +129 -0
  17. spss_mcp-1.1.1/docs/tool_verification.json +79 -0
  18. spss_mcp-1.1.1/docs/tutorial.md +441 -0
  19. spss_mcp-1.1.1/examples/README.md +55 -0
  20. spss_mcp-1.1.1/examples/data/experiment_study.sav +0 -0
  21. spss_mcp-1.1.1/examples/data/long_study.sav +0 -0
  22. spss_mcp-1.1.1/examples/data/longitudinal_study.sav +0 -0
  23. spss_mcp-1.1.1/examples/data/mediation_study.sav +0 -0
  24. spss_mcp-1.1.1/examples/data/survey_study.sav +0 -0
  25. spss_mcp-1.1.1/examples/data/survival_study.sav +0 -0
  26. spss_mcp-1.1.1/install.bat +63 -0
  27. spss_mcp-1.1.1/install.ps1 +74 -0
  28. spss_mcp-1.1.1/pyproject.toml +85 -0
  29. spss_mcp-1.1.1/scripts/archive_sample_charts.py +182 -0
  30. spss_mcp-1.1.1/scripts/make_sample_data.py +264 -0
  31. spss_mcp-1.1.1/scripts/method_verification.py +311 -0
  32. spss_mcp-1.1.1/scripts/poc_chart_pipeline.py +140 -0
  33. spss_mcp-1.1.1/scripts/tool_verification.py +159 -0
  34. spss_mcp-1.1.1/src/spss_mcp/__init__.py +5 -0
  35. spss_mcp-1.1.1/src/spss_mcp/_version.py +1 -0
  36. spss_mcp-1.1.1/src/spss_mcp/chart_service.py +133 -0
  37. spss_mcp-1.1.1/src/spss_mcp/chart_spec.py +175 -0
  38. spss_mcp-1.1.1/src/spss_mcp/chart_templates.py +247 -0
  39. spss_mcp-1.1.1/src/spss_mcp/claude_config.py +125 -0
  40. spss_mcp-1.1.1/src/spss_mcp/cli.py +189 -0
  41. spss_mcp-1.1.1/src/spss_mcp/codex_config.py +123 -0
  42. spss_mcp-1.1.1/src/spss_mcp/config.py +469 -0
  43. spss_mcp-1.1.1/src/spss_mcp/method_registry.py +175 -0
  44. spss_mcp-1.1.1/src/spss_mcp/method_templates.py +259 -0
  45. spss_mcp-1.1.1/src/spss_mcp/method_validation.py +185 -0
  46. spss_mcp-1.1.1/src/spss_mcp/oms_image.py +275 -0
  47. spss_mcp-1.1.1/src/spss_mcp/output_parser.py +172 -0
  48. spss_mcp-1.1.1/src/spss_mcp/poc_chart.py +169 -0
  49. spss_mcp-1.1.1/src/spss_mcp/result_parser.py +814 -0
  50. spss_mcp-1.1.1/src/spss_mcp/sav_reader.py +207 -0
  51. spss_mcp-1.1.1/src/spss_mcp/security.py +124 -0
  52. spss_mcp-1.1.1/src/spss_mcp/server.py +1 -0
  53. spss_mcp-1.1.1/src/spss_mcp/spss_engine.py +458 -0
  54. spss_mcp-1.1.1/src/spss_mcp/spss_runner.py +792 -0
  55. spss_mcp-1.1.1/tests/fixtures/reproduction_manifest.json +143 -0
  56. spss_mcp-1.1.1/tests/fixtures/spss_outputs/anova.txt +51 -0
  57. spss_mcp-1.1.1/tests/fixtures/spss_outputs/corr.txt +32 -0
  58. spss_mcp-1.1.1/tests/fixtures/spss_outputs/crosstabs_chisq.txt +51 -0
  59. spss_mcp-1.1.1/tests/fixtures/spss_outputs/descriptives.txt +26 -0
  60. spss_mcp-1.1.1/tests/fixtures/spss_outputs/factor.txt +91 -0
  61. spss_mcp-1.1.1/tests/fixtures/spss_outputs/frequencies.txt +38 -0
  62. spss_mcp-1.1.1/tests/fixtures/spss_outputs/kruskal_wallis.txt +38 -0
  63. spss_mcp-1.1.1/tests/fixtures/spss_outputs/logistic_regression.txt +96 -0
  64. spss_mcp-1.1.1/tests/fixtures/spss_outputs/mann_whitney.txt +37 -0
  65. spss_mcp-1.1.1/tests/fixtures/spss_outputs/normality.txt +40 -0
  66. spss_mcp-1.1.1/tests/fixtures/spss_outputs/paired_ttest.txt +47 -0
  67. spss_mcp-1.1.1/tests/fixtures/spss_outputs/regression.txt +78 -0
  68. spss_mcp-1.1.1/tests/fixtures/spss_outputs/reliability.txt +50 -0
  69. spss_mcp-1.1.1/tests/fixtures/spss_outputs/ttest.txt +50 -0
  70. spss_mcp-1.1.1/tests/fixtures/spss_outputs/unianova.txt +66 -0
  71. spss_mcp-1.1.1/tests/fixtures/spss_outputs/wilcoxon.txt +39 -0
  72. spss_mcp-1.1.1/tests/test_case_selection_context.py +26 -0
  73. spss_mcp-1.1.1/tests/test_chart_templates.py +190 -0
  74. spss_mcp-1.1.1/tests/test_claude_config.py +88 -0
  75. spss_mcp-1.1.1/tests/test_codex_config.py +68 -0
  76. spss_mcp-1.1.1/tests/test_mac_spss_detection.py +143 -0
  77. spss_mcp-1.1.1/tests/test_method_registry.py +30 -0
  78. spss_mcp-1.1.1/tests/test_method_templates.py +44 -0
  79. spss_mcp-1.1.1/tests/test_method_validation.py +34 -0
  80. spss_mcp-1.1.1/tests/test_oms_image.py +170 -0
  81. spss_mcp-1.1.1/tests/test_output_parser_errors.py +23 -0
  82. spss_mcp-1.1.1/tests/test_reproduction_manifest.py +81 -0
  83. spss_mcp-1.1.1/tests/test_result_parser.py +217 -0
  84. spss_mcp-1.1.1/tests/test_runner_result_classification.py +64 -0
  85. spss_mcp-1.1.1/tests/test_runtime_config.py +35 -0
  86. spss_mcp-1.1.1/tests/test_security.py +74 -0
  87. spss_mcp-1.1.1/tests/test_server_cold_methods.py +113 -0
@@ -0,0 +1,28 @@
1
+ # SPSS MCP Server Configuration
2
+ # Copy this file to .env and fill in values as needed
3
+
4
+ # Path to IBM SPSS Statistics installation directory (or the stats binary).
5
+ # If not set, the server auto-detects via registry (Windows) or /Applications (macOS).
6
+ #
7
+ # Windows:
8
+ # SPSS_INSTALL_PATH=C:\Program Files\IBM\SPSS Statistics\31
9
+ # macOS:
10
+ # SPSS_INSTALL_PATH=/Applications/IBM SPSS Statistics 27
11
+ # SPSS_INSTALL_PATH=
12
+
13
+ # Directory for temporary intermediate files (runner .py and OMS text output)
14
+ # Defaults to %TEMP%\spss-mcp (Windows) or /tmp/spss-mcp (macOS/Linux)
15
+ # SPSS_TEMP_DIR=
16
+
17
+ # Directory for persistent SPSS outputs (.spv viewer files and executed .sps syntax files)
18
+ # Defaults to <SPSS_TEMP_DIR>/results
19
+ # SPSS_RESULTS_DIR=
20
+
21
+ # Maximum seconds to wait for an SPSS analysis to complete
22
+ # SPSS_TIMEOUT=120
23
+
24
+ # Maximum seconds to wait for the persistent SPSS Python engine to start
25
+ # SPSS_STARTUP_TIMEOUT=300
26
+
27
+ # Set to 1 to force pyreadstat-only mode even if SPSS is installed
28
+ # SPSS_NO_SPSS=0
@@ -0,0 +1,52 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *.pyo
5
+ *.pyd
6
+ *.so
7
+
8
+ # Build artifacts
9
+ build/
10
+ dist/
11
+ *.egg-info/
12
+ src/*.egg-info/
13
+
14
+ # Virtual environments
15
+ .venv/
16
+ venv/
17
+
18
+ # Local config and secrets
19
+ .env
20
+ .env.*
21
+ !.env.example
22
+
23
+ # Test/cache
24
+ .pytest_cache/
25
+ .mypy_cache/
26
+ .ruff_cache/
27
+ .coverage
28
+ htmlcov/
29
+
30
+ # SPSS runtime outputs
31
+ spss_output_*.txt
32
+ spss_runner_*.py
33
+ spss_viewer_*.spv
34
+ spss_syntax_*.sps
35
+ oms_*.txt
36
+
37
+ # OS/editor
38
+ .DS_Store
39
+ Thumbs.db
40
+ .vscode/
41
+ .idea/
42
+ .claude/
43
+ .cursor/
44
+
45
+ # Audit logs & local tooling
46
+ logs/
47
+ graphify-out/
48
+
49
+ # Local workspace artifacts
50
+ 作业/
51
+ _tmp_*/
52
+ .playwright-cli/
@@ -0,0 +1,95 @@
1
+ # Changelog
2
+
3
+ ## [1.1.1] - 2026-10-30
4
+
5
+ ### Changed
6
+ - 项目 / PyPI / CLI 统一改名为 **`spss-mcp`**(Python 包仍为 `spss_mcp`)
7
+ - GitHub 仓库:`kinginsun/spss-mcp`
8
+ - 推荐安装:`uvx --from git+https://github.com/kinginsun/spss-mcp.git spss-mcp`
9
+
10
+ ## [1.1.0] - 2026-10-30
11
+
12
+ macOS / SPSS 27 fork release(基于上游 1.0.0)。
13
+
14
+ ### Added
15
+ - **macOS 引擎探测与启动**:自动发现 `/Applications/IBM SPSS Statistics *`,定位
16
+ `Contents/MacOS/stats` 与 `Resources/Python3`,注入 `SPSS_HOME` / `DYLD_*`
17
+ - **JPEG→PNG 出图归一化**:macOS SPSS HTML 内嵌 JPEG 时自动转为 PNG 再做 300 dpi 后处理
18
+ - Mac 探测与 Error SS 误判的单元测试
19
+
20
+ ### Fixed
21
+ - 相对数据路径在 macOS SPSS 上触发 Error #61:统一解析为绝对路径(保留 Windows 盘符路径)
22
+ - ANOVA 表 `Error` 平方和行被误识别为 `Error #nnnn`
23
+ - 纵向样例宽表/长表分数错位;`COMPARE(within_factor)` EMMEANS 语法
24
+ - 持久引擎跨多个 `asyncio.run` 时的 event-loop / Lock 失效
25
+
26
+ ### Changed
27
+ - README / 元数据标明 macOS + Windows;项目 URL 指向本 fork
28
+
29
+ ## [1.0.0] - 2026-08-05
30
+
31
+ 首个正式版。在 0.3.1 的基础上把真机验证范围拉满,并补齐 Agent 侧消费契约。
32
+
33
+ ### Added
34
+ - **论文级出图补齐到 11 类** `spss_chart_*`:直方图 / 正态密度叠加 / 散点 / 分类均值条形 /
35
+ 条形+95%CI / 折线 / 面积 / 分组箱线 / 误差条 / Q-Q / Kaplan-Meier 曲线,
36
+ 统一 PNG / TIFF / EMF 导出(1950×1500 @300dpi),返回文件路径可直接投稿
37
+ - **中介与调节**:`spss_mediation`(Baron & Kenny 三步回归 + Sobel)、
38
+ `spss_moderation`(中心化交互回归)
39
+ - **统一返回结构** `{markdown, json, files, warnings}`,便于 Agent 编程消费
40
+ - **安全执行层**:危险命令拦截、数据路径白名单、`dry_run` 预检、JSONL 审计日志
41
+
42
+ ### Fixed
43
+ - SPSS 32 移除 `OMS FORMAT=IMAGE` / `IMAGEROOT`,改用 HTML 内嵌 PNG + DOCX 内嵌 EMF 双链路
44
+ - 修复 8 处 SPSS 32 语法兼容问题,37+ 工具(26 个分析方法 + 11 个补充工具)全部真机验收通过
45
+
46
+ ### Changed
47
+ - 版本号从 `0.3.1` 直接跳到 `1.0.0`:能力范围(出图 + 中介调节 + 安全层 + 结构化返回)
48
+ 与真机验收覆盖度已构成完整产品形态,不再以 0.x 迭代
49
+
50
+ ## [0.3.1] - 2026-08-05
51
+
52
+ ### Fixed
53
+ - `spss_chart_boxplot`:GGRAPH `ELEMENT: schema` 在 SPSS 32 对真实数据报
54
+ `outlier was found inside fences`(个案值恰落在箱须线上),且 DOCX/EMF 导出为
55
+ 0 字节;改为 `EXAMINE /PLOT BOXPLOT` 传统图模板,PNG/TIFF/EMF 均真机验证通过
56
+ (EMF 18996 字节非零)。修复由实战作业验证触发,见项目规划 5.3。
57
+
58
+ ## [0.3.0] - 2026-08-05
59
+
60
+ ### Added
61
+ - P3 方法验证:26 个分析方法真机验收 + `scripts/method_verification.py`
62
+ - 中介/调节工具:`spss_mediation`(三步回归 + Sobel)、`spss_moderation`(中心化交互)
63
+ - P4 安全层:`security.py`(危险拦截/路径白名单/dry_run/审计 JSONL)
64
+ - 补充工具验收:文件类 6 件 + 状态/语法/结构化 + `spss_genlin`(`scripts/tool_verification.py`)
65
+ - 11 类图 × TIFF 全格式验证
66
+ - 文档:教程、技术报告、生态收录/发布准备
67
+
68
+ ### Fixed
69
+ - `spss_correlations`:`TAILS(2)` → `TWOTAIL`
70
+ - `spss_compute_scale_score`:`MEAN`/`NVALID` 参数逗号分隔
71
+ - `spss_twostep_cluster`:子命令去 `=`、距离默认 LIKELIHOOD、删无效 OUTLIERS/PRINT
72
+ - `spss_discriminant` / `spss_manova`:因子/组值范围;MANOVA 删废弃 METHOD
73
+ - `spss_ordinal_regression`:删无效 `TEST=PARALLEL`
74
+ - `spss_genlinmixed`:subject 名义化、删无效 PRINT
75
+ - `spss_genlin`:`DISTRIBUTION` 并入 MODEL、`PRINT` 无等号
76
+
77
+ ## [0.2.0] - 2026-08-04
78
+
79
+ ### Added
80
+ - P1 出图管线:11 类图 spec + GGRAPH 模板 + `spss_chart_*` 工具
81
+ - OMS 导出双链路:HTML→base64 PNG 提取、DOCX→EMF 提取(SPSS 32 兼容)
82
+ - 图片后处理:Pillow 缩放 1950×1500 + 300 dpi 元数据
83
+ - P2 结果解析:`result_parser.py`(表格 JSON + 16 类统计摘要)
84
+ - `spss_structured_result` 统一返回结构
85
+ - 样例数据与归档:`examples/`(问卷/实验/生存/中介/纵向)
86
+
87
+ ### Fixed
88
+ - GGRAPH 模板:末尾换行、`VARIABLES=x y`、bar 预计算 MEAN/MEANCI、line `color.interior`
89
+ - `poc_chart` 样例数据补 DESCRIPTIVES(INPUT PROGRAM 无输出问题)
90
+
91
+ ## [0.1.0] - 2026-08-04
92
+
93
+ ### Added
94
+ - P0 基座:复用 MIT 引擎/runner/CLI、37 工具基线
95
+ - 项目改名 `spss-mcp`、`configure-codex`、CI(black/isort/pytest)
spss_mcp-1.1.1/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 SPSS-MCP Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,164 @@
1
+ Metadata-Version: 2.5
2
+ Name: spss-mcp
3
+ Version: 1.1.1
4
+ Summary: MCP server for IBM SPSS Statistics (macOS + Windows): paper-ready charts, deep result parsing, and safe syntax execution
5
+ Project-URL: Homepage, https://github.com/kinginsun/spss-mcp
6
+ Project-URL: Repository, https://github.com/kinginsun/spss-mcp
7
+ Project-URL: Documentation, https://github.com/kinginsun/spss-mcp/tree/main/docs
8
+ Project-URL: Upstream, https://github.com/flupke91/spss-studio-mcp
9
+ Author: spss-mcp Contributors
10
+ License: MIT
11
+ License-File: LICENSE
12
+ Keywords: chart,data-analysis,macos,mcp,psychology,social-science,spss,statistics
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Operating System :: MacOS
15
+ Classifier: Operating System :: Microsoft :: Windows
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Topic :: Scientific/Engineering :: Information Analysis
21
+ Requires-Python: >=3.10
22
+ Requires-Dist: fastmcp>=2.14.0
23
+ Requires-Dist: mcp>=1.2.0
24
+ Requires-Dist: pandas>=2.0.0
25
+ Requires-Dist: pillow>=10.0.0
26
+ Requires-Dist: pydantic>=2.0.0
27
+ Requires-Dist: pyreadstat>=1.2.0
28
+ Requires-Dist: python-dotenv>=1.0.0
29
+ Requires-Dist: tabulate>=0.9.0
30
+ Provides-Extra: dev
31
+ Requires-Dist: black>=23.0.0; extra == 'dev'
32
+ Requires-Dist: isort>=5.12.0; extra == 'dev'
33
+ Requires-Dist: pytest-asyncio>=0.23.0; extra == 'dev'
34
+ Requires-Dist: pytest>=7.0.0; extra == 'dev'
35
+ Description-Content-Type: text/markdown
36
+
37
+ # spss-mcp (macOS + Windows)
38
+
39
+ > 让 SPSS 成为 Agent 的「统计引擎 + 制图工厂」:论文级图片、深度结果解析、方法真机验证、安全执行。
40
+
41
+ **简体中文** | [English](README.en.md)
42
+
43
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
44
+ [![Python](https://img.shields.io/badge/Python-3.10%2B-blue.svg)]()
45
+ [![Platform](https://img.shields.io/badge/platform-macOS%20%7C%20Windows-blue.svg)]()
46
+
47
+ 面向 **IBM SPSS Statistics** 的 MCP(Model Context Protocol)服务器,供 Cursor / Claude Code / Codex 等 Agent 调用本机 SPSS。
48
+
49
+ 本仓库基于上游 [`flupke91/spss-studio-mcp`](https://github.com/flupke91/spss-studio-mcp)(MIT),在其能力之上增加了 **macOS / SPSS 27+** 适配与若干兼容性修复,并在 **macOS + IBM SPSS Statistics 27** 真机验证通过。
50
+
51
+ ## 能力概览
52
+
53
+ - **论文级出图**:11 类 `spss_chart_*`,PNG / TIFF / EMF(1950×1500 @300 dpi)
54
+ - **深度结果解析**:OMS 文本 → Markdown + JSON + 统计摘要
55
+ - **分析方法**:描述 / t / ANOVA / 回归 / 因子 / 信度 / 生存 / 混合模型 / 中介调节等
56
+ - **安全执行**:危险命令拦截、路径白名单、`dry_run`、审计日志
57
+ - **跨平台引擎**:Windows(`stats.exe`)与 macOS(`SPSS Statistics.app` + 捆绑 Python3 XD)
58
+
59
+ ## 本 fork 相对上游的主要改动
60
+
61
+ | 项 | 说明 |
62
+ |----|------|
63
+ | macOS 探测 | 自动发现 `/Applications/IBM SPSS Statistics *` |
64
+ | XD 启动 | 设置 `SPSS_HOME`、`DYLD_*`,修复捆绑 `libpython` 加载 |
65
+ | 出图 | macOS HTML 内嵌 JPEG → 自动转 PNG,再缩放至 300 dpi |
66
+ | 路径 | 相对路径解析为绝对路径,避免 SPSS Error #61 |
67
+ | 解析 | 避免把 ANOVA 表中的 Error SS 误判为 `Error #` |
68
+ | 样例数据 | 宽表 / 长表纵向数据对齐,便于 RM-ANOVA 与 MIXED |
69
+
70
+ ## 系统要求
71
+
72
+ - Python 3.10+
73
+ - 本机已授权的 **IBM SPSS Statistics**(已在 **27(macOS)** 验证;上游在 **32(Windows)** 验证)
74
+ - macOS:安装包内需含 `Resources/Python3`(XD API)
75
+
76
+ ## 快速开始(macOS)
77
+
78
+ ```bash
79
+ cd spss-mcp
80
+ pip install -e ".[dev]"
81
+ spss-mcp status # 应显示 SPSS batch / python: OK
82
+ ```
83
+
84
+ 可选:在 `.env` 中指定安装目录:
85
+
86
+ ```bash
87
+ SPSS_INSTALL_PATH=/Applications/IBM SPSS Statistics 27
88
+ ```
89
+
90
+ 配置 Cursor(`~/.cursor/mcp.json`):
91
+
92
+ ```json
93
+ {
94
+ "mcpServers": {
95
+ "spss-mcp": {
96
+ "command": "uvx",
97
+ "args": [
98
+ "--from",
99
+ "git+https://github.com/kinginsun/spss-mcp.git",
100
+ "spss-mcp",
101
+ "serve",
102
+ "--transport",
103
+ "stdio"
104
+ ],
105
+ "env": {
106
+ "SPSS_INSTALL_PATH": "/Applications/IBM SPSS Statistics 27"
107
+ }
108
+ }
109
+ }
110
+ }
111
+ ```
112
+
113
+ 也可用:
114
+
115
+ ```bash
116
+ spss-mcp configure-claude
117
+ spss-mcp configure-codex
118
+ spss-mcp setup-info
119
+ ```
120
+
121
+ ## 自然语言示例
122
+
123
+ ```text
124
+ 对 examples/data/experiment_study.sav 做独立样本 t 检验(group 分组,posttest)
125
+ 用 examples/data/mediation_study.sav 做中介分析:autonomy → satisfaction → performance
126
+ 画 examples/data/survey_study.sav 学习投入总分的直方图(带正态密度),PNG 300dpi
127
+ 对 examples/data/long_study.sav 做混合模型:score ~ group + time,随机截距 subject=id
128
+ ```
129
+
130
+ 纵向数据约定:
131
+
132
+ - 重复测量 ANOVA(宽表):`examples/data/longitudinal_study.sav`(`time1`/`time2`/`time3`)
133
+ - MIXED(长表):`examples/data/long_study.sav`(`id`/`time`/`score`)
134
+
135
+ ## 架构
136
+
137
+ ```text
138
+ MCP 客户端(Cursor / Claude Code / Codex)
139
+ │ MCP 协议(stdio)
140
+ ▼
141
+ 工具层 50+ 工具:文件/元数据 · 分析方法 · 图表 · 中介/调节
142
+ ▼
143
+ 语法构建 方法模板 + Pydantic 校验 | 安全层
144
+ ▼
145
+ 引擎层 SPSS Python3 XD 持久会话(StartSPSS / Submit)
146
+ ▼
147
+ 输出层 OMS TEXT → Markdown/JSON | HTML → PNG/TIFF | DOCX → EMF
148
+ ▼
149
+ IBM SPSS Statistics(本机授权;macOS 或 Windows)
150
+ ```
151
+
152
+ ## 文档
153
+
154
+ - [Agent 使用教程](docs/tutorial.md)
155
+ - [技术报告](docs/technical_report.md)
156
+ - [结果解析](docs/result_parsing.md)
157
+ - [安全层](docs/security.md)
158
+ - [更新日志](CHANGELOG.md)
159
+
160
+ ## 致谢与许可证
161
+
162
+ - 上游:[`flupke91/spss-studio-mcp`](https://github.com/flupke91/spss-studio-mcp)(MIT)
163
+ - 更早上游:`Exekiel179/SPSS-MCP`(MIT)
164
+ - 本仓库同样以 **MIT** 发布
@@ -0,0 +1,45 @@
1
+ # spss-mcp 快速开始
2
+
3
+ > 3 步完成部署(已在 macOS + IBM SPSS Statistics 27 真机验证;上游亦在 Windows + SPSS 32 验证)
4
+
5
+ ---
6
+
7
+ ## 第 1 步:安装
8
+
9
+ ```bash
10
+ cd spss-mcp
11
+ pip install -e ".[dev]"
12
+ spss-mcp status # 应显示 SPSS batch / python: OK
13
+ ```
14
+
15
+ macOS 若未自动发现安装,可设置:
16
+
17
+ ```bash
18
+ export SPSS_INSTALL_PATH="/Applications/IBM SPSS Statistics 27"
19
+ ```
20
+
21
+ ## 第 2 步:配置 MCP 客户端
22
+
23
+ ```bash
24
+ spss-mcp configure-codex # Codex
25
+ spss-mcp configure-claude # Claude Code
26
+ spss-mcp setup-info # 打印手动配置片段(含 Cursor)
27
+ ```
28
+
29
+ Cursor:把 `setup-info` 输出写入 `~/.cursor/mcp.json` 的 `mcpServers`,然后 Reload MCP。
30
+
31
+ ## 第 3 步:使用
32
+
33
+ ### 统计分析
34
+
35
+ - `对 examples/data/survey_study.sav 做描述统计和可靠性分析`
36
+ - `用 examples/data/experiment_study.sav 做独立样本 t 检验(group 分组,posttest)`
37
+ - `对 examples/data/mediation_study.sav 做中介分析:autonomy → satisfaction → performance`
38
+ - `对 examples/data/long_study.sav 做混合模型:score ~ group + time,subject=id`
39
+
40
+ ### 论文级出图
41
+
42
+ - `画 examples/data/survey_study.sav 学习投入总分的直方图(带正态密度),PNG 300dpi`
43
+ - `用 examples/data/survival_study.sav 画按 treatment 分组的 KM 生存曲线`
44
+
45
+ 图表工具返回 1950×1500 @300dpi 文件路径,可直接用于投稿。
@@ -0,0 +1,61 @@
1
+ # spss-mcp (macOS + Windows)
2
+
3
+ > Turn IBM SPSS Statistics into an Agent-ready stats engine and chart factory.
4
+
5
+ **English** | [简体中文](README.md)
6
+
7
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
8
+ [![Python](https://img.shields.io/badge/Python-3.10%2B-blue.svg)]()
9
+ [![Platform](https://img.shields.io/badge/platform-macOS%20%7C%20Windows-blue.svg)]()
10
+
11
+ An MCP server for **IBM SPSS Statistics**, usable from Cursor / Claude Code / Codex.
12
+
13
+ This repository is a fork of [`flupke91/spss-studio-mcp`](https://github.com/flupke91/spss-studio-mcp) (MIT) with **macOS / SPSS 27+** engine detection, XD startup fixes, JPEG→PNG chart normalization, path handling, and parser fixes. Verified on **macOS + IBM SPSS Statistics 27**.
14
+
15
+ ## Highlights
16
+
17
+ - Paper-ready charts (`spss_chart_*`, PNG/TIFF/EMF @300 dpi)
18
+ - Deep OMS result parsing (Markdown + JSON + statistical summaries)
19
+ - Broad method coverage (t-tests, ANOVA, regression, survival, mixed models, mediation/moderation, …)
20
+ - Safety layer (dangerous syntax blocklist, path allowlist, `dry_run`, audit log)
21
+ - Cross-platform engine (Windows `stats.exe` and macOS app-bundle + bundled Python3 XD)
22
+
23
+ ## Quick start (macOS)
24
+
25
+ ```bash
26
+ pip install -e ".[dev]"
27
+ spss-mcp status
28
+ ```
29
+
30
+ Optional:
31
+
32
+ ```bash
33
+ SPSS_INSTALL_PATH=/Applications/IBM SPSS Statistics 27
34
+ ```
35
+
36
+ Cursor `~/.cursor/mcp.json`:
37
+
38
+ ```json
39
+ {
40
+ "mcpServers": {
41
+ "spss-mcp": {
42
+ "command": "uvx",
43
+ "args": [
44
+ "--from",
45
+ "git+https://github.com/kinginsun/spss-mcp.git",
46
+ "spss-mcp",
47
+ "serve",
48
+ "--transport",
49
+ "stdio"
50
+ ],
51
+ "env": {
52
+ "SPSS_INSTALL_PATH": "/Applications/IBM SPSS Statistics 27"
53
+ }
54
+ }
55
+ }
56
+ }
57
+ ```
58
+
59
+ ## License
60
+
61
+ MIT. Upstream: [`flupke91/spss-studio-mcp`](https://github.com/flupke91/spss-studio-mcp); earlier: `Exekiel179/SPSS-MCP`.
@@ -0,0 +1,128 @@
1
+ # spss-mcp (macOS + Windows)
2
+
3
+ > 让 SPSS 成为 Agent 的「统计引擎 + 制图工厂」:论文级图片、深度结果解析、方法真机验证、安全执行。
4
+
5
+ **简体中文** | [English](README.en.md)
6
+
7
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
8
+ [![Python](https://img.shields.io/badge/Python-3.10%2B-blue.svg)]()
9
+ [![Platform](https://img.shields.io/badge/platform-macOS%20%7C%20Windows-blue.svg)]()
10
+
11
+ 面向 **IBM SPSS Statistics** 的 MCP(Model Context Protocol)服务器,供 Cursor / Claude Code / Codex 等 Agent 调用本机 SPSS。
12
+
13
+ 本仓库基于上游 [`flupke91/spss-studio-mcp`](https://github.com/flupke91/spss-studio-mcp)(MIT),在其能力之上增加了 **macOS / SPSS 27+** 适配与若干兼容性修复,并在 **macOS + IBM SPSS Statistics 27** 真机验证通过。
14
+
15
+ ## 能力概览
16
+
17
+ - **论文级出图**:11 类 `spss_chart_*`,PNG / TIFF / EMF(1950×1500 @300 dpi)
18
+ - **深度结果解析**:OMS 文本 → Markdown + JSON + 统计摘要
19
+ - **分析方法**:描述 / t / ANOVA / 回归 / 因子 / 信度 / 生存 / 混合模型 / 中介调节等
20
+ - **安全执行**:危险命令拦截、路径白名单、`dry_run`、审计日志
21
+ - **跨平台引擎**:Windows(`stats.exe`)与 macOS(`SPSS Statistics.app` + 捆绑 Python3 XD)
22
+
23
+ ## 本 fork 相对上游的主要改动
24
+
25
+ | 项 | 说明 |
26
+ |----|------|
27
+ | macOS 探测 | 自动发现 `/Applications/IBM SPSS Statistics *` |
28
+ | XD 启动 | 设置 `SPSS_HOME`、`DYLD_*`,修复捆绑 `libpython` 加载 |
29
+ | 出图 | macOS HTML 内嵌 JPEG → 自动转 PNG,再缩放至 300 dpi |
30
+ | 路径 | 相对路径解析为绝对路径,避免 SPSS Error #61 |
31
+ | 解析 | 避免把 ANOVA 表中的 Error SS 误判为 `Error #` |
32
+ | 样例数据 | 宽表 / 长表纵向数据对齐,便于 RM-ANOVA 与 MIXED |
33
+
34
+ ## 系统要求
35
+
36
+ - Python 3.10+
37
+ - 本机已授权的 **IBM SPSS Statistics**(已在 **27(macOS)** 验证;上游在 **32(Windows)** 验证)
38
+ - macOS:安装包内需含 `Resources/Python3`(XD API)
39
+
40
+ ## 快速开始(macOS)
41
+
42
+ ```bash
43
+ cd spss-mcp
44
+ pip install -e ".[dev]"
45
+ spss-mcp status # 应显示 SPSS batch / python: OK
46
+ ```
47
+
48
+ 可选:在 `.env` 中指定安装目录:
49
+
50
+ ```bash
51
+ SPSS_INSTALL_PATH=/Applications/IBM SPSS Statistics 27
52
+ ```
53
+
54
+ 配置 Cursor(`~/.cursor/mcp.json`):
55
+
56
+ ```json
57
+ {
58
+ "mcpServers": {
59
+ "spss-mcp": {
60
+ "command": "uvx",
61
+ "args": [
62
+ "--from",
63
+ "git+https://github.com/kinginsun/spss-mcp.git",
64
+ "spss-mcp",
65
+ "serve",
66
+ "--transport",
67
+ "stdio"
68
+ ],
69
+ "env": {
70
+ "SPSS_INSTALL_PATH": "/Applications/IBM SPSS Statistics 27"
71
+ }
72
+ }
73
+ }
74
+ }
75
+ ```
76
+
77
+ 也可用:
78
+
79
+ ```bash
80
+ spss-mcp configure-claude
81
+ spss-mcp configure-codex
82
+ spss-mcp setup-info
83
+ ```
84
+
85
+ ## 自然语言示例
86
+
87
+ ```text
88
+ 对 examples/data/experiment_study.sav 做独立样本 t 检验(group 分组,posttest)
89
+ 用 examples/data/mediation_study.sav 做中介分析:autonomy → satisfaction → performance
90
+ 画 examples/data/survey_study.sav 学习投入总分的直方图(带正态密度),PNG 300dpi
91
+ 对 examples/data/long_study.sav 做混合模型:score ~ group + time,随机截距 subject=id
92
+ ```
93
+
94
+ 纵向数据约定:
95
+
96
+ - 重复测量 ANOVA(宽表):`examples/data/longitudinal_study.sav`(`time1`/`time2`/`time3`)
97
+ - MIXED(长表):`examples/data/long_study.sav`(`id`/`time`/`score`)
98
+
99
+ ## 架构
100
+
101
+ ```text
102
+ MCP 客户端(Cursor / Claude Code / Codex)
103
+ │ MCP 协议(stdio)
104
+ ▼
105
+ 工具层 50+ 工具:文件/元数据 · 分析方法 · 图表 · 中介/调节
106
+ ▼
107
+ 语法构建 方法模板 + Pydantic 校验 | 安全层
108
+ ▼
109
+ 引擎层 SPSS Python3 XD 持久会话(StartSPSS / Submit)
110
+ ▼
111
+ 输出层 OMS TEXT → Markdown/JSON | HTML → PNG/TIFF | DOCX → EMF
112
+ ▼
113
+ IBM SPSS Statistics(本机授权;macOS 或 Windows)
114
+ ```
115
+
116
+ ## 文档
117
+
118
+ - [Agent 使用教程](docs/tutorial.md)
119
+ - [技术报告](docs/technical_report.md)
120
+ - [结果解析](docs/result_parsing.md)
121
+ - [安全层](docs/security.md)
122
+ - [更新日志](CHANGELOG.md)
123
+
124
+ ## 致谢与许可证
125
+
126
+ - 上游:[`flupke91/spss-studio-mcp`](https://github.com/flupke91/spss-studio-mcp)(MIT)
127
+ - 更早上游:`Exekiel179/SPSS-MCP`(MIT)
128
+ - 本仓库同样以 **MIT** 发布
@@ -0,0 +1,81 @@
1
+ # 生态收录与 Release v1.0 准备
2
+
3
+ > 2026-08-05 | 提交类操作需发布账号,本文件给出可直接使用的条目与说明。
4
+
5
+ ## 1. 项目速览(用于收录/发布)
6
+
7
+ - **名称**:spss-mcp
8
+ - **一句话**:让 SPSS 成为 Agent 的"统计引擎 + 制图工厂":论文级图片、深度结果解析、方法真机验证、安全执行。
9
+ - **类别**:data-analysis / statistics / mcp-server
10
+ - **标签**:`spss` `statistics` `mcp` `chart` `result-parsing` `psychology` `social-science`
11
+ - **核心能力(来自技术报告)**:
12
+ - 11 类论文级图表(PNG/TIFF/EMF,300 dpi)
13
+ - 16 类分析统计摘要(t/F/r/B/Wald/p/效应量)
14
+ - 37+ 工具全量真机验收(SPSS 32)
15
+ - 中介/调节工具(Baron & Kenny + Sobel)
16
+ - 安全层(拦截/白名单/dry_run/审计)
17
+
18
+ ## 2. LobeHub 收录条目
19
+
20
+ 平台:LobeHub(Lobe Chat MCP/插件市场)。提交方式:通常为 GitHub 仓库提交
21
+ 描述文件或 PR。可复制以下条目:
22
+
23
+ - 仓库:https://github.com/flupke91/spss-studio-mcp
24
+ - LobeHub 插件市场提交入口:https://github.com/lobehub/lobe-chat-plugins
25
+ (创建 `plugins/<plugin-name>/` 目录,含 `plugin.json` + `README.md`)
26
+
27
+ ```yaml
28
+ # lobehub 条目示例
29
+ name: spss-mcp
30
+ description: >-
31
+ SPSS Studio MCP:论文级图表导出(11 类图 PNG/TIFF/EMF @300dpi)、深度结果
32
+ 解析(Markdown+JSON+统计摘要)、37+ 方法真机验证、中介/调节分析与安全执行
33
+ (危险拦截/白名单/dry_run/审计)。适用于心理学/管理学/社科研究。
34
+ category: data-analysis
35
+ tags: [spss, statistics, chart, mcp]
36
+ ```
37
+
38
+ ## 3. PulseMCP 收录条目
39
+
40
+ 平台:PulseMCP(MCP 服务器目录)。提交方式:站点表单或 GitHub PR。
41
+ 建议填写:
42
+
43
+ - 提交入口:https://www.pulsemcp.com/submit
44
+ - 仓库:https://github.com/flupke91/spss-studio-mcp
45
+
46
+ - **Name**: spss-mcp
47
+ - **Short description**: Paper-ready charts, deep result parsing and safe execution for IBM SPSS Statistics via MCP.
48
+ - **Long description**: 引用 `README.md` 的功能清单与 `docs/technical_report.md` 摘要。
49
+ - **Transport**: stdio
50
+ - **Auth**: none(本地 SPSS 授权)
51
+ - **OS**: Windows
52
+
53
+ ## 4. GitHub Release v1.0 草稿
54
+
55
+ 见 `docs/release_notes_v1.0.md`(可直接粘贴到 Release 页面)。
56
+
57
+ ## 5. 提交前检查清单
58
+
59
+ - [x] 功能与验证:37 工具真机验收(26 方法 + 11 工具)、11 类图 × PNG/EMF/TIFF
60
+ - [x] boxplot 全格式修复(0.3.1):EMF 非零(约 19 KB),PNG/TIFF 正常
61
+ - [x] 文档:README / QUICK_START / docs(教程、技术报告、出图、解析、验证、安全)
62
+ - [x] 安全:拦截/白名单/dry_run/审计 + `docs/security.md`
63
+ - [x] CI:`.github/workflows/ci.yml`(lint + pytest)
64
+ - [x] 许可证:MIT(含上游说明)
65
+ - [x] 样例图:`examples/charts/*.png` 已用 0.3.1 模板重新归档(11 张,含修复后的 boxplot)
66
+ - [ ] 发布账号操作:创建 GitHub release、提交 LobeHub/PulseMCP 条目
67
+ - [ ] (建议)GitHub 仓库公开前检查:无敏感路径、无本地日志入库(`logs/` 已 gitignore)
68
+
69
+ ## 7. GitHub 发布步骤(发布账号操作)
70
+
71
+ - [x] 创建公开仓库 `flupke91/spss-studio-mcp` 并推送 `master`(2026-08-05);
72
+ - [x] 打 tag `v1.0.0` 并创建 Release(正文 = `docs/release_notes_v1.0.md`);
73
+ - [ ] 提交 LobeHub 条目(lobe-chat-plugins PR);
74
+ - [ ] 提交 PulseMCP 条目(pulsemcp.com/submit 表单)。
75
+
76
+ ## 6. 对外材料(②的成果,可直接引用)
77
+
78
+ - 技术报告(论文稿):`docs/technical_report.md`
79
+ - 使用教程:`docs/tutorial.md`
80
+ - 样例图:`examples/charts/*.png`(可作 README/收录页截图)
81
+ - 验证记录:`docs/method_verification.md`、`docs/tool_verification.json`