mcp-win-stdio-excel 0.2.3__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.
@@ -0,0 +1,60 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ *$py.class
4
+ *.so
5
+ .Python
6
+ build/
7
+ develop-eggs/
8
+ dist/
9
+ downloads/
10
+ eggs/
11
+ .eggs/
12
+ lib/
13
+ lib64/
14
+ parts/
15
+ sdist/
16
+ var/
17
+ wheels/
18
+ share/python-wheels/
19
+ *.egg-info/
20
+ .installed.cfg
21
+ *.egg
22
+ MANIFEST
23
+
24
+ *.manifest
25
+ *.spec
26
+ api.txt
27
+ pip-log.txt
28
+ pip-delete-this-directory.txt
29
+ pypi api.txt
30
+ htmlcov/
31
+ .tox/
32
+ .nox/
33
+ .coverage
34
+ .coverage.*
35
+ .cache
36
+ nosetests.xml
37
+ coverage.xml
38
+ *.cover
39
+ *.py,cover
40
+ .hypothesis/
41
+ .pytest_cache/
42
+ cover/
43
+
44
+ *.mo
45
+ *.pot
46
+
47
+ .env
48
+ .venv
49
+ env/
50
+ venv/
51
+ ENV/
52
+ env.bak/
53
+ venv.bak/
54
+
55
+ .idea/
56
+ .vscode/
57
+ *.swp
58
+ *.swo
59
+
60
+ *.log
@@ -0,0 +1,100 @@
1
+ Metadata-Version: 2.5
2
+ Name: mcp-win-stdio-excel
3
+ Version: 0.2.3
4
+ Summary: Windows-optimized Model Context Protocol (MCP) server for Excel: 20 tools for Pandas queries, RapidFuzz reconciliation, cell editing, and native Excel COM automation (PDF export, recalc, pivots, macros).
5
+ Author-email: indala <indala@example.com>
6
+ License-Expression: MIT
7
+ Keywords: ai,claude,excel,llm,mcp,openpyxl,pandas,reconciliation,windows
8
+ Classifier: Development Status :: 4 - Beta
9
+ Classifier: Environment :: Win32 (MS Windows)
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Operating System :: Microsoft :: Windows
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Programming Language :: Python :: 3.14
19
+ Classifier: Topic :: Office/Business :: Financial :: Spreadsheet
20
+ Requires-Python: >=3.10
21
+ Requires-Dist: mcp-win-stdio>=0.2.3
22
+ Requires-Dist: mcp>=1.2.0
23
+ Requires-Dist: openpyxl>=3.1.0
24
+ Requires-Dist: pandas>=2.0.0
25
+ Requires-Dist: pywin32>=306; platform_system == 'Windows'
26
+ Requires-Dist: rapidfuzz>=3.0.0
27
+ Description-Content-Type: text/markdown
28
+
29
+ # mcp-win-stdio-excel
30
+
31
+ Windows-native **Model Context Protocol (MCP)** server for Microsoft Excel: 20 tools combining high-speed Pandas querying, RapidFuzz reconciliation, OpenPyXL editing, and native Windows Excel COM automation.
32
+
33
+ Part of the **`mcp-win-stdio`** Windows-optimized suite.
34
+
35
+ ---
36
+
37
+ ## 🚀 Features (20 Tools)
38
+
39
+ - **Vectorized Data Queries**: High-speed Pandas slicing, filtering, and aggregation on large spreadsheets.
40
+ - **Typo-Tolerant Reconciliation**: Pre-flight key diagnostics (`analyze_reconciliation_keys`) and fuzzy joins (`reconcile_and_merge`) producing clean 3-tab audit workbooks (`Matched`, `Unmatched_Source`, `Unmatched_Target`).
41
+ - **OpenPyXL Direct Editing**: Safe cell updates, row appending, multi-sheet management, formula insertion, CSV/JSON export.
42
+ - **Native Windows Excel COM Automation**: Background/visible Excel process control, formula recalculation, pivot table refreshes, PDF export, and VBA macro execution.
43
+
44
+ ---
45
+
46
+ ## 🛠️ Included Tools (20 Tools)
47
+
48
+ * **Inspection**: `get_workbook_info`, `preview_sheet`, `get_column_values`, `compare_column_values`, `summarize_column`, `search_text`.
49
+ * **Querying & Slices**: `query_rows` (Pandas vectorized expressions), `read_range`, `query_excel_sql`.
50
+ * **Editing & Export**: `create_workbook`, `append_rows`, `update_cells`, `add_sheet`, `rename_sheet`, `delete_sheet`, `export_to_csv`, `export_to_json`.
51
+ * **Reconciliation**: `analyze_reconciliation_keys`, `reconcile_and_merge`.
52
+ * **Windows COM Automation**: `recalculate_and_save`, `export_to_pdf`, `refresh_data_and_pivots`, `run_vba_macro`, `get_active_excel_window`.
53
+
54
+ ---
55
+
56
+ ## 📦 Installation
57
+
58
+ ```powershell
59
+ pip install mcp-win-stdio-excel
60
+ ```
61
+ *(Installing this package automatically installs `mws` CLI orchestrator)*.
62
+
63
+ ---
64
+
65
+ ## 🚀 One-Command Claude Setup
66
+
67
+ ```powershell
68
+ mws setup excel
69
+ # or:
70
+ mws add excel
71
+ ```
72
+
73
+ ### Manual Configuration Example
74
+ In `%APPDATA%\Claude\claude_desktop_config.json`:
75
+ ```json
76
+ {
77
+ "mcpServers": {
78
+ "excel": {
79
+ "command": "python",
80
+ "args": ["-m", "mcp_win_stdio.excel"]
81
+ }
82
+ }
83
+ }
84
+ ```
85
+
86
+ ---
87
+
88
+ ## 📖 CLI Commands & Interactive Guide
89
+
90
+ ```powershell
91
+ mws excel guide # Complete tool reference & prompt recipes
92
+ mws excel doctor # Verify Excel COM automation, Pandas, and OpenPyXL
93
+ mws excel setup # Configure Claude Desktop / Claude Code
94
+ mws excel run # Launch server over stdio
95
+ ```
96
+
97
+ ---
98
+
99
+ ## 📜 License
100
+ MIT License. Copyright (c) 2026 Mohan Kumar Indala.
@@ -0,0 +1,72 @@
1
+ # mcp-win-stdio-excel
2
+
3
+ Windows-native **Model Context Protocol (MCP)** server for Microsoft Excel: 20 tools combining high-speed Pandas querying, RapidFuzz reconciliation, OpenPyXL editing, and native Windows Excel COM automation.
4
+
5
+ Part of the **`mcp-win-stdio`** Windows-optimized suite.
6
+
7
+ ---
8
+
9
+ ## 🚀 Features (20 Tools)
10
+
11
+ - **Vectorized Data Queries**: High-speed Pandas slicing, filtering, and aggregation on large spreadsheets.
12
+ - **Typo-Tolerant Reconciliation**: Pre-flight key diagnostics (`analyze_reconciliation_keys`) and fuzzy joins (`reconcile_and_merge`) producing clean 3-tab audit workbooks (`Matched`, `Unmatched_Source`, `Unmatched_Target`).
13
+ - **OpenPyXL Direct Editing**: Safe cell updates, row appending, multi-sheet management, formula insertion, CSV/JSON export.
14
+ - **Native Windows Excel COM Automation**: Background/visible Excel process control, formula recalculation, pivot table refreshes, PDF export, and VBA macro execution.
15
+
16
+ ---
17
+
18
+ ## 🛠️ Included Tools (20 Tools)
19
+
20
+ * **Inspection**: `get_workbook_info`, `preview_sheet`, `get_column_values`, `compare_column_values`, `summarize_column`, `search_text`.
21
+ * **Querying & Slices**: `query_rows` (Pandas vectorized expressions), `read_range`, `query_excel_sql`.
22
+ * **Editing & Export**: `create_workbook`, `append_rows`, `update_cells`, `add_sheet`, `rename_sheet`, `delete_sheet`, `export_to_csv`, `export_to_json`.
23
+ * **Reconciliation**: `analyze_reconciliation_keys`, `reconcile_and_merge`.
24
+ * **Windows COM Automation**: `recalculate_and_save`, `export_to_pdf`, `refresh_data_and_pivots`, `run_vba_macro`, `get_active_excel_window`.
25
+
26
+ ---
27
+
28
+ ## 📦 Installation
29
+
30
+ ```powershell
31
+ pip install mcp-win-stdio-excel
32
+ ```
33
+ *(Installing this package automatically installs `mws` CLI orchestrator)*.
34
+
35
+ ---
36
+
37
+ ## 🚀 One-Command Claude Setup
38
+
39
+ ```powershell
40
+ mws setup excel
41
+ # or:
42
+ mws add excel
43
+ ```
44
+
45
+ ### Manual Configuration Example
46
+ In `%APPDATA%\Claude\claude_desktop_config.json`:
47
+ ```json
48
+ {
49
+ "mcpServers": {
50
+ "excel": {
51
+ "command": "python",
52
+ "args": ["-m", "mcp_win_stdio.excel"]
53
+ }
54
+ }
55
+ }
56
+ ```
57
+
58
+ ---
59
+
60
+ ## 📖 CLI Commands & Interactive Guide
61
+
62
+ ```powershell
63
+ mws excel guide # Complete tool reference & prompt recipes
64
+ mws excel doctor # Verify Excel COM automation, Pandas, and OpenPyXL
65
+ mws excel setup # Configure Claude Desktop / Claude Code
66
+ mws excel run # Launch server over stdio
67
+ ```
68
+
69
+ ---
70
+
71
+ ## 📜 License
72
+ MIT License. Copyright (c) 2026 Mohan Kumar Indala.
@@ -0,0 +1,45 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "mcp-win-stdio-excel"
7
+ version = "0.2.3"
8
+ description = "Windows-optimized Model Context Protocol (MCP) server for Excel: 20 tools for Pandas queries, RapidFuzz reconciliation, cell editing, and native Excel COM automation (PDF export, recalc, pivots, macros)."
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ license = "MIT"
12
+ authors = [
13
+ { name = "indala", email = "indala@example.com" }
14
+ ]
15
+ keywords = ["mcp", "claude", "excel", "pandas", "openpyxl", "reconciliation", "windows", "ai", "llm"]
16
+ classifiers = [
17
+ "Development Status :: 4 - Beta",
18
+ "Environment :: Win32 (MS Windows)",
19
+ "Intended Audience :: Developers",
20
+ "License :: OSI Approved :: MIT License",
21
+ "Operating System :: Microsoft :: Windows",
22
+ "Programming Language :: Python :: 3",
23
+ "Programming Language :: Python :: 3.10",
24
+ "Programming Language :: Python :: 3.11",
25
+ "Programming Language :: Python :: 3.12",
26
+ "Programming Language :: Python :: 3.13",
27
+ "Programming Language :: Python :: 3.14",
28
+ "Topic :: Office/Business :: Financial :: Spreadsheet",
29
+ ]
30
+
31
+ dependencies = [
32
+ "mcp-win-stdio>=0.2.3",
33
+ "mcp>=1.2.0",
34
+ "pandas>=2.0.0",
35
+ "openpyxl>=3.1.0",
36
+ "rapidfuzz>=3.0.0",
37
+ "pywin32>=306; platform_system == 'Windows'",
38
+ ]
39
+
40
+ [project.scripts]
41
+ mcp-win-stdio-excel = "mcp_win_stdio.excel.cli:main"
42
+ mws-excel = "mcp_win_stdio.excel.cli:main"
43
+
44
+ [tool.hatch.build.targets.wheel]
45
+ packages = ["src/mcp_win_stdio"]
@@ -0,0 +1,5 @@
1
+ """
2
+ mcp-win-stdio-excel: Windows-optimized Excel MCP Server.
3
+ """
4
+
5
+ __version__ = "0.2.3"
@@ -0,0 +1,8 @@
1
+ """
2
+ Direct module execution for mcp_win_stdio.excel.
3
+ """
4
+
5
+ from mcp_win_stdio.excel.server import mcp
6
+
7
+ if __name__ == "__main__":
8
+ mcp.run()
@@ -0,0 +1,186 @@
1
+ """
2
+ CLI entry point for mcp-win-stdio-excel.
3
+ """
4
+
5
+ import argparse
6
+ import json
7
+ import os
8
+ from pathlib import Path
9
+ import shutil
10
+ import subprocess
11
+ import sys
12
+
13
+ from mcp_win_stdio.excel import __version__
14
+ from mcp_win_stdio.excel.guide import print_guide
15
+ from mcp_win_stdio.excel.server import mcp
16
+
17
+
18
+ def get_claude_desktop_config_path() -> Path | None:
19
+ appdata = os.environ.get("APPDATA")
20
+ if appdata:
21
+ p = Path(appdata) / "Claude" / "claude_desktop_config.json"
22
+ if p.exists():
23
+ return p
24
+ default_p = Path.home() / "AppData" / "Roaming" / "Claude" / "claude_desktop_config.json"
25
+ return default_p if default_p.exists() else None
26
+
27
+
28
+ def get_claude_cli_config_path() -> Path | None:
29
+ p = Path.home() / ".claude.json"
30
+ return p if p.exists() else None
31
+
32
+
33
+ def cmd_setup(args: argparse.Namespace) -> None:
34
+ """Setup excel MCP server in Claude Desktop and Claude Code CLI."""
35
+ client = args.client.lower()
36
+ python_exe = sys.executable.replace("\\", "/")
37
+ cmd_args = ["-m", "mcp_win_stdio.excel.server"]
38
+
39
+ print(f"\nSetting up 'excel' MCP server (target: {client})...\n")
40
+
41
+ # 1. Desktop
42
+ if client in ("all", "desktop"):
43
+ desktop_cfg = get_claude_desktop_config_path()
44
+ if desktop_cfg:
45
+ try:
46
+ shutil.copy2(desktop_cfg, desktop_cfg.with_suffix(".json.bak"))
47
+ with open(desktop_cfg, "r", encoding="utf-8") as f:
48
+ data = json.load(f)
49
+ if "mcpServers" not in data:
50
+ data["mcpServers"] = {}
51
+ data["mcpServers"]["excel"] = {
52
+ "command": python_exe,
53
+ "args": cmd_args,
54
+ }
55
+ with open(desktop_cfg, "w", encoding="utf-8") as f:
56
+ json.dump(data, f, indent=2)
57
+ print(f"[OK] Claude Desktop: Configured 'excel' in {desktop_cfg}")
58
+ except Exception as e:
59
+ print(f"[ERROR] Claude Desktop: Failed to configure: {e}")
60
+ else:
61
+ print("[WARN] Claude Desktop configuration not found.")
62
+
63
+ # 2. CLI
64
+ if client in ("all", "cli"):
65
+ added_cli = False
66
+ try:
67
+ res = subprocess.run(
68
+ ["claude", "mcp", "add", "-s", "user", "excel", "--", python_exe] + cmd_args,
69
+ capture_output=True,
70
+ text=True,
71
+ timeout=10,
72
+ )
73
+ if res.returncode == 0:
74
+ added_cli = True
75
+ print("[OK] Claude Code CLI: Configured via `claude mcp add`")
76
+ except Exception:
77
+ pass
78
+
79
+ if not added_cli:
80
+ cli_cfg = get_claude_cli_config_path()
81
+ if cli_cfg:
82
+ try:
83
+ with open(cli_cfg, "r", encoding="utf-8") as f:
84
+ cli_data = json.load(f)
85
+ if "mcpServers" not in cli_data:
86
+ cli_data["mcpServers"] = {}
87
+ cli_data["mcpServers"]["excel"] = {
88
+ "command": python_exe,
89
+ "args": cmd_args,
90
+ }
91
+ with open(cli_cfg, "w", encoding="utf-8") as f:
92
+ json.dump(cli_data, f, indent=2)
93
+ print(f"[OK] Claude Code CLI: Configured directly in {cli_cfg}")
94
+ except Exception as e:
95
+ print(f"[ERROR] Claude CLI: Failed to configure: {e}")
96
+
97
+ print("\nExcel MCP setup complete! Please restart Claude Desktop if active.\n")
98
+
99
+
100
+ def cmd_remove(args: argparse.Namespace) -> None:
101
+ """Remove excel MCP server from Claude Desktop and CLI."""
102
+ desktop_cfg = get_claude_desktop_config_path()
103
+ if desktop_cfg and desktop_cfg.exists():
104
+ try:
105
+ with open(desktop_cfg, "r", encoding="utf-8") as f:
106
+ data = json.load(f)
107
+ if "mcpServers" in data and "excel" in data["mcpServers"]:
108
+ del data["mcpServers"]["excel"]
109
+ with open(desktop_cfg, "w", encoding="utf-8") as f:
110
+ json.dump(data, f, indent=2)
111
+ print(f"[OK] Removed 'excel' from Claude Desktop.")
112
+ except Exception as e:
113
+ print(f"[ERROR] Claude Desktop: {e}")
114
+
115
+ try:
116
+ res = subprocess.run(["claude", "mcp", "remove", "-s", "user", "excel"], capture_output=True, text=True)
117
+ if res.returncode == 0:
118
+ print("[OK] Removed 'excel' from Claude Code CLI.")
119
+ except Exception:
120
+ pass
121
+
122
+
123
+ def cmd_run(args: argparse.Namespace) -> None:
124
+ """Run excel MCP server over stdio."""
125
+ mcp.run()
126
+
127
+
128
+ def cmd_doctor(args: argparse.Namespace) -> None:
129
+ """Check Excel MCP health and dependencies."""
130
+ print(f"\n=== mcp-win-stdio-excel Doctor Diagnostic (v{__version__}) ===\n")
131
+ print(f"[OK] Python: {sys.version.split()[0]} ({sys.executable})")
132
+
133
+ for dep in ("mcp", "pandas", "openpyxl", "rapidfuzz", "win32com"):
134
+ try:
135
+ __import__(dep)
136
+ print(f"[OK] Dependency: {dep:<12}")
137
+ except ImportError:
138
+ print(f"[FAIL] Dependency: {dep:<12} (MISSING)")
139
+
140
+ print("\n--- Excel COM Automation Check ---")
141
+ try:
142
+ import win32com.client
143
+ app = win32com.client.DispatchEx("Excel.Application")
144
+ ver = app.Version
145
+ app.Quit()
146
+ print(f"[OK] Microsoft Excel COM: Available (Version {ver})")
147
+ except Exception as e:
148
+ print(f"[INFO] Microsoft Excel COM: Not detected ({e})")
149
+
150
+ print("\nDiagnostic complete.\n")
151
+
152
+
153
+ def main() -> None:
154
+ parser = argparse.ArgumentParser(
155
+ prog="mcp-win-stdio-excel",
156
+ description="Windows-optimized Excel MCP Server CLI",
157
+ )
158
+ parser.add_argument("--version", "-v", action="version", version=f"%(prog)s {__version__}")
159
+ subparsers = parser.add_subparsers(dest="command", help="Command to execute")
160
+
161
+ sub_setup = subparsers.add_parser("setup", help="Auto-configure into Claude Desktop & CLI")
162
+ sub_setup.add_argument("--client", "-c", choices=["all", "desktop", "cli"], default="all")
163
+ sub_setup.set_defaults(func=cmd_setup)
164
+
165
+ sub_remove = subparsers.add_parser("remove", help="Remove from Claude Desktop & CLI")
166
+ sub_remove.set_defaults(func=cmd_remove)
167
+
168
+ sub_guide = subparsers.add_parser("guide", help="View usage guide and prompt recipes")
169
+ sub_guide.set_defaults(func=lambda args: print_guide())
170
+
171
+ sub_run = subparsers.add_parser("run", help="Run Excel MCP server over stdio")
172
+ sub_run.set_defaults(func=cmd_run)
173
+
174
+ sub_doctor = subparsers.add_parser("doctor", help="Check dependencies and COM automation")
175
+ sub_doctor.set_defaults(func=cmd_doctor)
176
+
177
+ args = parser.parse_args()
178
+ if not args.command:
179
+ parser.print_help()
180
+ sys.exit(0)
181
+
182
+ args.func(args)
183
+
184
+
185
+ if __name__ == "__main__":
186
+ main()
@@ -0,0 +1,69 @@
1
+ """
2
+ Interactive and printable guide for the Excel MCP server.
3
+ """
4
+
5
+ EXCEL_GUIDE = """
6
+ # ================================================================
7
+ # EXCEL MCP (WINDOWS NATIVE + PANDAS) - USER & LLM GUIDE
8
+ # ================================================================
9
+
10
+ The Excel MCP server provides 20 specialized tools for programmatic
11
+ reading, updating, querying, fuzzy reconciling, and automating Excel
12
+ workbooks on Windows.
13
+
14
+ ----------------------------------------------------------------
15
+ 1. TOOL SUMMARY
16
+ ----------------------------------------------------------------
17
+ * Read & Inspect:
18
+ - get_workbook_info(file_path): Sheet names, dimensions, cell counts.
19
+ - preview_sheet(file_path, sheet_name, max_rows): Fast preview.
20
+ - query_rows(file_path, sheet_name, query_expr, columns): Pandas query.
21
+ - read_range(file_path, sheet_name, range_address): Slices (e.g. A1:D50).
22
+ - summarize_column(file_path, sheet_name, column_name): Statistics.
23
+ - search_text(file_path, sheet_name, search_term): Keyword search.
24
+
25
+ * Edit & Manage:
26
+ - create_workbook(file_path, sheet_name, headers, initial_rows): Create xlsx.
27
+ - append_rows(file_path, sheet_name, rows): In-place fast row append.
28
+ - update_cells(file_path, sheet_name, updates): Set values & formulas.
29
+ - add_sheet(file_path, sheet_name, title): Add new worksheet.
30
+ - rename_sheet(file_path, old_name, new_name): Rename worksheet.
31
+ - delete_sheet(file_path, sheet_name): Delete worksheet.
32
+ - export_to_csv(file_path, sheet_name, output_csv_path): CSV export.
33
+
34
+ * Reconciliation & Audit:
35
+ - analyze_reconciliation_keys(wb1, s1, keys1, wb2, s2, keys2):
36
+ PRE-FLIGHT analysis. Checks nulls, duplicate keys, overlap %, and
37
+ candidate fuzzy matches before any merging is performed!
38
+ - reconcile_and_merge(wb1, s1, keys1, wb2, s2, keys2, output_wb, fuzzy_matching=True):
39
+ Generates an automated 3-tab audit workbook:
40
+ [1] Matched (exact + fuzzy with confidence scores & variance)
41
+ [2] Unmatched_Source_1
42
+ [3] Unmatched_Source_2
43
+
44
+ * Native Windows Excel COM Automation (Requires installed Excel):
45
+ - recalculate_and_save(file_path): Forces formula engine calculation.
46
+ - export_to_pdf(file_path, output_pdf_path): Native high-res PDF export.
47
+ - refresh_data_and_pivots(file_path): Refreshes PowerQuery / Pivot tables.
48
+ - run_vba_macro(file_path, macro_name): Executes workbook VBA macros.
49
+ - get_active_excel_window(): Inspects open Excel instances.
50
+
51
+ ----------------------------------------------------------------
52
+ 2. EXAMPLE PROMPTS FOR CLAUDE
53
+ ----------------------------------------------------------------
54
+ * Pre-flight Check:
55
+ "Analyze the reconciliation keys between orders.xlsx (sheet: Sheet1,
56
+ keys: PO_Number, Vendor) and sap_report.xlsx (sheet: PR_Data,
57
+ keys: SAP_PO, Vendor_ID) and tell me match rate and fuzzy candidates."
58
+
59
+ * Reconcile:
60
+ "Reconcile those workbooks into audit_result.xlsx with fuzzy matching
61
+ enabled and show me the unmatched items."
62
+
63
+ * COM Automation:
64
+ "Recalculate formulas in audit_result.xlsx and export it to PDF."
65
+ # ================================================================
66
+ """
67
+
68
+ def print_excel_guide() -> None:
69
+ print(EXCEL_GUIDE.strip())