excel-analytics-mcp 0.1.0__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.
- excel_analytics_mcp-0.1.0/.gitignore +36 -0
- excel_analytics_mcp-0.1.0/PKG-INFO +158 -0
- excel_analytics_mcp-0.1.0/README.md +136 -0
- excel_analytics_mcp-0.1.0/SPEC.md +256 -0
- excel_analytics_mcp-0.1.0/excel_mcp/__init__.py +3 -0
- excel_analytics_mcp-0.1.0/excel_mcp/__main__.py +5 -0
- excel_analytics_mcp-0.1.0/excel_mcp/api/__init__.py +0 -0
- excel_analytics_mcp-0.1.0/excel_mcp/api/routes.py +234 -0
- excel_analytics_mcp-0.1.0/excel_mcp/config.py +69 -0
- excel_analytics_mcp-0.1.0/excel_mcp/database.py +207 -0
- excel_analytics_mcp-0.1.0/excel_mcp/ingest.py +197 -0
- excel_analytics_mcp-0.1.0/excel_mcp/sandbox.py +202 -0
- excel_analytics_mcp-0.1.0/excel_mcp/server.py +212 -0
- excel_analytics_mcp-0.1.0/excel_mcp/static/index.html +1376 -0
- excel_analytics_mcp-0.1.0/excel_mcp/tools/__init__.py +0 -0
- excel_analytics_mcp-0.1.0/excel_mcp/tools/core_tools.py +210 -0
- excel_analytics_mcp-0.1.0/excel_mcp/tools/dynamic_loader.py +89 -0
- excel_analytics_mcp-0.1.0/excel_mcp/tools/meta_tools.py +365 -0
- excel_analytics_mcp-0.1.0/install.sh +199 -0
- excel_analytics_mcp-0.1.0/pyproject.toml +37 -0
- excel_analytics_mcp-0.1.0/sample_data/create_demo.py +105 -0
- excel_analytics_mcp-0.1.0/sample_data/demo.xlsx +0 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
__pycache__/
|
|
2
|
+
*.py[cod]
|
|
3
|
+
*$py.class
|
|
4
|
+
*.egg-info/
|
|
5
|
+
dist/
|
|
6
|
+
build/
|
|
7
|
+
.eggs/
|
|
8
|
+
*.egg
|
|
9
|
+
|
|
10
|
+
# Virtual environments
|
|
11
|
+
.venv/
|
|
12
|
+
venv/
|
|
13
|
+
env/
|
|
14
|
+
|
|
15
|
+
# IDE
|
|
16
|
+
.vscode/
|
|
17
|
+
.idea/
|
|
18
|
+
*.swp
|
|
19
|
+
*.swo
|
|
20
|
+
*~
|
|
21
|
+
.DS_Store
|
|
22
|
+
|
|
23
|
+
# uv
|
|
24
|
+
uv.lock
|
|
25
|
+
|
|
26
|
+
# Data (user data stays local)
|
|
27
|
+
*.db
|
|
28
|
+
*.sqlite
|
|
29
|
+
|
|
30
|
+
# Test artifacts
|
|
31
|
+
.pytest_cache/
|
|
32
|
+
.coverage
|
|
33
|
+
htmlcov/
|
|
34
|
+
|
|
35
|
+
# User config (generated at install time)
|
|
36
|
+
config.json
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: excel-analytics-mcp
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Self-evolving Excel analytics toolkit — MCP server + dashboard for Claude Desktop
|
|
5
|
+
Project-URL: Homepage, https://github.com/blakethom8/excel-mcp
|
|
6
|
+
Project-URL: Repository, https://github.com/blakethom8/excel-mcp
|
|
7
|
+
Author: Blake Thomson
|
|
8
|
+
License: MIT
|
|
9
|
+
Keywords: analytics,claude,excel,llm,mcp
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Requires-Python: >=3.10
|
|
14
|
+
Requires-Dist: fastapi>=0.115.0
|
|
15
|
+
Requires-Dist: mcp[cli]>=1.0.0
|
|
16
|
+
Requires-Dist: openpyxl>=3.1.0
|
|
17
|
+
Requires-Dist: pandas>=2.1.0
|
|
18
|
+
Requires-Dist: python-multipart>=0.0.9
|
|
19
|
+
Requires-Dist: tabulate>=0.9.0
|
|
20
|
+
Requires-Dist: uvicorn[standard]>=0.30.0
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
|
|
23
|
+
# Excel Analytics MCP Server
|
|
24
|
+
|
|
25
|
+
A self-evolving data analytics toolkit for Claude Desktop. Drop your Excel files in, ask questions in plain English, and build up a personal library of reusable analysis tools — no coding required.
|
|
26
|
+
|
|
27
|
+
## What It Does
|
|
28
|
+
|
|
29
|
+
- **Upload Excel/CSV files** via a beautiful web dashboard
|
|
30
|
+
- **Ask Claude** questions about your data in natural language
|
|
31
|
+
- **Save analyses** as reusable tools you can run again and again
|
|
32
|
+
- **Create custom tools** that Claude can use on your behalf
|
|
33
|
+
- **Everything stays local** — your data never leaves your machine
|
|
34
|
+
|
|
35
|
+
## Quick Install
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
bash install.sh
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
This will:
|
|
42
|
+
1. Check for Python 3.10+ and install `uv` if needed
|
|
43
|
+
2. Set up the `~/.excel-mcp/` directory
|
|
44
|
+
3. Install all dependencies
|
|
45
|
+
4. Configure Claude Desktop automatically
|
|
46
|
+
|
|
47
|
+
Then restart Claude Desktop and you're ready to go.
|
|
48
|
+
|
|
49
|
+
## How to Use
|
|
50
|
+
|
|
51
|
+
### 1. Upload Your Data
|
|
52
|
+
|
|
53
|
+
Open the dashboard at **http://localhost:8765** (available once Claude Desktop starts the server) and drag your Excel or CSV files into the upload zone.
|
|
54
|
+
|
|
55
|
+
### 2. Ask Claude Questions
|
|
56
|
+
|
|
57
|
+
In Claude Desktop, try prompts like:
|
|
58
|
+
|
|
59
|
+
- *"What datasets do I have?"*
|
|
60
|
+
- *"Describe the sales table"*
|
|
61
|
+
- *"Show me the top 10 customers by revenue"*
|
|
62
|
+
- *"What's the average order value by month?"*
|
|
63
|
+
- *"Find all invoices over $5,000 from last week"*
|
|
64
|
+
|
|
65
|
+
### 3. Save Reusable Analyses
|
|
66
|
+
|
|
67
|
+
When you find a useful query, ask Claude to save it:
|
|
68
|
+
|
|
69
|
+
- *"Save this as a tool called 'Top Customers'"*
|
|
70
|
+
- *"Create a reusable analysis for monthly revenue trends"*
|
|
71
|
+
|
|
72
|
+
### 4. Manage Your Tools
|
|
73
|
+
|
|
74
|
+
Visit the **Tools** tab in the dashboard to:
|
|
75
|
+
- View all your saved analyses and custom tools
|
|
76
|
+
- Edit tool parameters
|
|
77
|
+
- Test tools with different inputs
|
|
78
|
+
- Delete tools you no longer need
|
|
79
|
+
|
|
80
|
+
## Dashboard
|
|
81
|
+
|
|
82
|
+
The web dashboard runs at `http://localhost:8765` and provides:
|
|
83
|
+
|
|
84
|
+
- **Data Manager** — upload files, browse tables, preview data, see column stats
|
|
85
|
+
- **Tool Workshop** — view core tools, manage saved analyses, test tools with auto-generated forms
|
|
86
|
+
|
|
87
|
+
## Architecture
|
|
88
|
+
|
|
89
|
+
```
|
|
90
|
+
Claude Desktop ←→ MCP Server (stdio) ←→ SQLite DB
|
|
91
|
+
↓
|
|
92
|
+
REST API (port 8765) ←→ Web Dashboard
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
The MCP server communicates with Claude Desktop via stdio, while a REST API runs in a background thread to power the dashboard. Both share the same SQLite database and tool registry.
|
|
96
|
+
|
|
97
|
+
## Available Tools
|
|
98
|
+
|
|
99
|
+
### Core Tools (always available)
|
|
100
|
+
|
|
101
|
+
| Tool | Description |
|
|
102
|
+
|------|-------------|
|
|
103
|
+
| `list_datasets` | Show all loaded tables |
|
|
104
|
+
| `describe_dataset` | Column info, types, stats |
|
|
105
|
+
| `query` | Run read-only SQL queries |
|
|
106
|
+
| `summarize` | Statistical summary of tables/columns |
|
|
107
|
+
|
|
108
|
+
### Meta Tools (for building your toolkit)
|
|
109
|
+
|
|
110
|
+
| Tool | Description |
|
|
111
|
+
|------|-------------|
|
|
112
|
+
| `save_analysis` | Save a SQL query as a reusable tool |
|
|
113
|
+
| `create_tool` | Build a custom Python tool (sandboxed) |
|
|
114
|
+
| `list_my_tools` | See all your saved tools |
|
|
115
|
+
| `edit_tool` | Update an existing tool |
|
|
116
|
+
| `delete_tool` | Remove a tool |
|
|
117
|
+
| `test_tool` | Run a tool with test parameters |
|
|
118
|
+
|
|
119
|
+
## Security
|
|
120
|
+
|
|
121
|
+
- **SQL**: Read-only queries only (SELECT). No writes, drops, or schema changes.
|
|
122
|
+
- **Python tools**: Sandboxed execution with restricted imports. No file system access, no network, no dangerous operations.
|
|
123
|
+
- **Local only**: All data stored in `~/.excel-mcp/`. Nothing leaves your machine.
|
|
124
|
+
|
|
125
|
+
## File Locations
|
|
126
|
+
|
|
127
|
+
| Path | Purpose |
|
|
128
|
+
|------|---------|
|
|
129
|
+
| `~/.excel-mcp/data.db` | SQLite database with your data |
|
|
130
|
+
| `~/.excel-mcp/tools/` | Saved analyses and custom tools |
|
|
131
|
+
| `~/.excel-mcp/output/` | Tool output files |
|
|
132
|
+
| `~/.excel-mcp/config.json` | User configuration |
|
|
133
|
+
|
|
134
|
+
## Configuration
|
|
135
|
+
|
|
136
|
+
Edit `~/.excel-mcp/config.json`:
|
|
137
|
+
|
|
138
|
+
```json
|
|
139
|
+
{
|
|
140
|
+
"data_dir": "~/Documents",
|
|
141
|
+
"port": 8765,
|
|
142
|
+
"auto_scan": false
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## Development
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
# Install dependencies
|
|
150
|
+
uv sync
|
|
151
|
+
|
|
152
|
+
# Run the server directly (for testing)
|
|
153
|
+
uv run python -m excel_mcp
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
## License
|
|
157
|
+
|
|
158
|
+
MIT
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
# Excel Analytics MCP Server
|
|
2
|
+
|
|
3
|
+
A self-evolving data analytics toolkit for Claude Desktop. Drop your Excel files in, ask questions in plain English, and build up a personal library of reusable analysis tools — no coding required.
|
|
4
|
+
|
|
5
|
+
## What It Does
|
|
6
|
+
|
|
7
|
+
- **Upload Excel/CSV files** via a beautiful web dashboard
|
|
8
|
+
- **Ask Claude** questions about your data in natural language
|
|
9
|
+
- **Save analyses** as reusable tools you can run again and again
|
|
10
|
+
- **Create custom tools** that Claude can use on your behalf
|
|
11
|
+
- **Everything stays local** — your data never leaves your machine
|
|
12
|
+
|
|
13
|
+
## Quick Install
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
bash install.sh
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
This will:
|
|
20
|
+
1. Check for Python 3.10+ and install `uv` if needed
|
|
21
|
+
2. Set up the `~/.excel-mcp/` directory
|
|
22
|
+
3. Install all dependencies
|
|
23
|
+
4. Configure Claude Desktop automatically
|
|
24
|
+
|
|
25
|
+
Then restart Claude Desktop and you're ready to go.
|
|
26
|
+
|
|
27
|
+
## How to Use
|
|
28
|
+
|
|
29
|
+
### 1. Upload Your Data
|
|
30
|
+
|
|
31
|
+
Open the dashboard at **http://localhost:8765** (available once Claude Desktop starts the server) and drag your Excel or CSV files into the upload zone.
|
|
32
|
+
|
|
33
|
+
### 2. Ask Claude Questions
|
|
34
|
+
|
|
35
|
+
In Claude Desktop, try prompts like:
|
|
36
|
+
|
|
37
|
+
- *"What datasets do I have?"*
|
|
38
|
+
- *"Describe the sales table"*
|
|
39
|
+
- *"Show me the top 10 customers by revenue"*
|
|
40
|
+
- *"What's the average order value by month?"*
|
|
41
|
+
- *"Find all invoices over $5,000 from last week"*
|
|
42
|
+
|
|
43
|
+
### 3. Save Reusable Analyses
|
|
44
|
+
|
|
45
|
+
When you find a useful query, ask Claude to save it:
|
|
46
|
+
|
|
47
|
+
- *"Save this as a tool called 'Top Customers'"*
|
|
48
|
+
- *"Create a reusable analysis for monthly revenue trends"*
|
|
49
|
+
|
|
50
|
+
### 4. Manage Your Tools
|
|
51
|
+
|
|
52
|
+
Visit the **Tools** tab in the dashboard to:
|
|
53
|
+
- View all your saved analyses and custom tools
|
|
54
|
+
- Edit tool parameters
|
|
55
|
+
- Test tools with different inputs
|
|
56
|
+
- Delete tools you no longer need
|
|
57
|
+
|
|
58
|
+
## Dashboard
|
|
59
|
+
|
|
60
|
+
The web dashboard runs at `http://localhost:8765` and provides:
|
|
61
|
+
|
|
62
|
+
- **Data Manager** — upload files, browse tables, preview data, see column stats
|
|
63
|
+
- **Tool Workshop** — view core tools, manage saved analyses, test tools with auto-generated forms
|
|
64
|
+
|
|
65
|
+
## Architecture
|
|
66
|
+
|
|
67
|
+
```
|
|
68
|
+
Claude Desktop ←→ MCP Server (stdio) ←→ SQLite DB
|
|
69
|
+
↓
|
|
70
|
+
REST API (port 8765) ←→ Web Dashboard
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
The MCP server communicates with Claude Desktop via stdio, while a REST API runs in a background thread to power the dashboard. Both share the same SQLite database and tool registry.
|
|
74
|
+
|
|
75
|
+
## Available Tools
|
|
76
|
+
|
|
77
|
+
### Core Tools (always available)
|
|
78
|
+
|
|
79
|
+
| Tool | Description |
|
|
80
|
+
|------|-------------|
|
|
81
|
+
| `list_datasets` | Show all loaded tables |
|
|
82
|
+
| `describe_dataset` | Column info, types, stats |
|
|
83
|
+
| `query` | Run read-only SQL queries |
|
|
84
|
+
| `summarize` | Statistical summary of tables/columns |
|
|
85
|
+
|
|
86
|
+
### Meta Tools (for building your toolkit)
|
|
87
|
+
|
|
88
|
+
| Tool | Description |
|
|
89
|
+
|------|-------------|
|
|
90
|
+
| `save_analysis` | Save a SQL query as a reusable tool |
|
|
91
|
+
| `create_tool` | Build a custom Python tool (sandboxed) |
|
|
92
|
+
| `list_my_tools` | See all your saved tools |
|
|
93
|
+
| `edit_tool` | Update an existing tool |
|
|
94
|
+
| `delete_tool` | Remove a tool |
|
|
95
|
+
| `test_tool` | Run a tool with test parameters |
|
|
96
|
+
|
|
97
|
+
## Security
|
|
98
|
+
|
|
99
|
+
- **SQL**: Read-only queries only (SELECT). No writes, drops, or schema changes.
|
|
100
|
+
- **Python tools**: Sandboxed execution with restricted imports. No file system access, no network, no dangerous operations.
|
|
101
|
+
- **Local only**: All data stored in `~/.excel-mcp/`. Nothing leaves your machine.
|
|
102
|
+
|
|
103
|
+
## File Locations
|
|
104
|
+
|
|
105
|
+
| Path | Purpose |
|
|
106
|
+
|------|---------|
|
|
107
|
+
| `~/.excel-mcp/data.db` | SQLite database with your data |
|
|
108
|
+
| `~/.excel-mcp/tools/` | Saved analyses and custom tools |
|
|
109
|
+
| `~/.excel-mcp/output/` | Tool output files |
|
|
110
|
+
| `~/.excel-mcp/config.json` | User configuration |
|
|
111
|
+
|
|
112
|
+
## Configuration
|
|
113
|
+
|
|
114
|
+
Edit `~/.excel-mcp/config.json`:
|
|
115
|
+
|
|
116
|
+
```json
|
|
117
|
+
{
|
|
118
|
+
"data_dir": "~/Documents",
|
|
119
|
+
"port": 8765,
|
|
120
|
+
"auto_scan": false
|
|
121
|
+
}
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## Development
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
# Install dependencies
|
|
128
|
+
uv sync
|
|
129
|
+
|
|
130
|
+
# Run the server directly (for testing)
|
|
131
|
+
uv run python -m excel_mcp
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## License
|
|
135
|
+
|
|
136
|
+
MIT
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
# Excel MCP Server — Product Spec
|
|
2
|
+
|
|
3
|
+
## Vision
|
|
4
|
+
A self-evolving data analytics toolkit for non-technical users. Users drop Excel files into a dashboard, ask Claude questions in plain English, and build up a personalized library of reusable analysis tools — all without writing code.
|
|
5
|
+
|
|
6
|
+
## Target User
|
|
7
|
+
- Non-technical professional (e.g. "Dave")
|
|
8
|
+
- Has Excel files they analyze regularly
|
|
9
|
+
- Has Claude Desktop installed
|
|
10
|
+
- Comfortable dragging files and talking to AI
|
|
11
|
+
- Does NOT want to: write code, edit config files, use terminal
|
|
12
|
+
|
|
13
|
+
## Architecture
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
Claude Desktop (MCP Client)
|
|
17
|
+
↓ stdio
|
|
18
|
+
MCP Server (Python, FastMCP)
|
|
19
|
+
↓ shared state
|
|
20
|
+
SQLite DB (~/.excel-mcp/data.db) — ingested Excel data
|
|
21
|
+
Tool Registry (~/.excel-mcp/tools/) — saved analyses & custom tools
|
|
22
|
+
↓ REST API
|
|
23
|
+
Frontend (localhost:8765) — dashboard for data + tool management
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Core Components
|
|
27
|
+
|
|
28
|
+
### 1. MCP Server (FastMCP, stdio transport)
|
|
29
|
+
|
|
30
|
+
**Core Tools (always available, not editable):**
|
|
31
|
+
|
|
32
|
+
| Tool | Purpose |
|
|
33
|
+
|------|---------|
|
|
34
|
+
| `list_datasets` | Show all loaded tables with row/column counts |
|
|
35
|
+
| `describe_dataset` | Column names, types, sample values, basic stats for a table |
|
|
36
|
+
| `query` | Run any read-only SQL against the SQLite DB |
|
|
37
|
+
| `summarize` | Quick statistical summary of a table or column |
|
|
38
|
+
|
|
39
|
+
**Meta Tools (for creating/managing user tools):**
|
|
40
|
+
|
|
41
|
+
| Tool | Purpose |
|
|
42
|
+
|------|---------|
|
|
43
|
+
| `save_analysis` | Save a SQL template as a reusable named tool |
|
|
44
|
+
| `create_tool` | Create a custom Python tool (sandboxed) |
|
|
45
|
+
| `list_my_tools` | Show all user-created tools |
|
|
46
|
+
| `edit_tool` | Update an existing saved analysis or custom tool |
|
|
47
|
+
| `delete_tool` | Remove a user-created tool |
|
|
48
|
+
| `test_tool` | Run a tool with given parameters and return results |
|
|
49
|
+
|
|
50
|
+
**Dynamic Tools:**
|
|
51
|
+
- On startup, server reads `~/.excel-mcp/tools/` directory
|
|
52
|
+
- Each JSON file becomes a registered MCP tool
|
|
53
|
+
- Saved analyses = SQL templates with parameter substitution
|
|
54
|
+
- Custom tools = sandboxed Python functions
|
|
55
|
+
|
|
56
|
+
### 2. Frontend (Single-page dashboard, localhost:8765)
|
|
57
|
+
|
|
58
|
+
**Tech:** Single HTML file served by FastAPI. Vanilla JS + minimal CSS (Pico CSS or similar). No build step, no npm.
|
|
59
|
+
|
|
60
|
+
**Pages/Sections:**
|
|
61
|
+
|
|
62
|
+
**Data Manager:**
|
|
63
|
+
- Drag-and-drop upload zone for Excel/CSV files
|
|
64
|
+
- Table list: name, source file, rows, columns, last updated
|
|
65
|
+
- Click table → preview (first 50 rows), column info, basic stats
|
|
66
|
+
- Delete table button
|
|
67
|
+
- Re-upload / refresh button
|
|
68
|
+
|
|
69
|
+
**Tool Workshop:**
|
|
70
|
+
- Three sections: Core Tools (read-only), Saved Analyses (editable), Custom Tools (editable)
|
|
71
|
+
- Each tool shows: name, description, parameter schema, created date
|
|
72
|
+
- Actions per tool: Edit, Delete, Test
|
|
73
|
+
- Test UI: auto-generated form from parameter schema → run → show results
|
|
74
|
+
- "Create New" button (opens a form for saved analysis creation)
|
|
75
|
+
- Saved analyses show the SQL template
|
|
76
|
+
- Custom tools have "View Code" toggle
|
|
77
|
+
|
|
78
|
+
**Activity Log (nice-to-have):**
|
|
79
|
+
- Recent queries and tool runs
|
|
80
|
+
- Helps Dave see what Claude has been doing
|
|
81
|
+
|
|
82
|
+
### 3. Data Ingestion
|
|
83
|
+
|
|
84
|
+
**Excel Ingest Flow:**
|
|
85
|
+
1. User drops file (via frontend upload or configured DATA_DIR scan)
|
|
86
|
+
2. Parse with openpyxl/pandas
|
|
87
|
+
3. Header detection: use first row with >60% non-null values as headers
|
|
88
|
+
4. Clean column names: strip whitespace, lowercase, spaces → underscores
|
|
89
|
+
5. Each sheet → separate SQLite table named `{filename}__{sheet_name}`
|
|
90
|
+
6. Store metadata in `_meta` table (source file, sheet, ingest time, row count)
|
|
91
|
+
7. If table already exists, replace it (re-upload = refresh)
|
|
92
|
+
|
|
93
|
+
**Supported formats:** .xlsx, .xls, .csv
|
|
94
|
+
|
|
95
|
+
### 4. Tool Registry
|
|
96
|
+
|
|
97
|
+
**Storage:** `~/.excel-mcp/tools/` directory, one JSON file per tool.
|
|
98
|
+
|
|
99
|
+
**Saved Analysis schema:**
|
|
100
|
+
```json
|
|
101
|
+
{
|
|
102
|
+
"id": "big_invoices_last_week",
|
|
103
|
+
"type": "saved_analysis",
|
|
104
|
+
"name": "Big Invoices Last Week",
|
|
105
|
+
"description": "Show invoices over a threshold from the past 7 days",
|
|
106
|
+
"created_at": "2026-02-12T17:00:00Z",
|
|
107
|
+
"updated_at": "2026-02-12T17:00:00Z",
|
|
108
|
+
"sql_template": "SELECT * FROM {table} WHERE amount > :min_amount AND date >= date('now', '-7 days')",
|
|
109
|
+
"parameters": {
|
|
110
|
+
"table": {"type": "string", "description": "Table to query", "required": true},
|
|
111
|
+
"min_amount": {"type": "number", "description": "Minimum invoice amount", "default": 5000}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
**Custom Tool schema:**
|
|
117
|
+
```json
|
|
118
|
+
{
|
|
119
|
+
"id": "flag_duplicate_invoices",
|
|
120
|
+
"type": "custom_tool",
|
|
121
|
+
"name": "Flag Duplicate Invoices",
|
|
122
|
+
"description": "Find potential duplicate invoices (same client, amount, within N days)",
|
|
123
|
+
"created_at": "2026-02-12T17:00:00Z",
|
|
124
|
+
"updated_at": "2026-02-12T17:00:00Z",
|
|
125
|
+
"python_code": "def run(db, client_col='client', amount_col='amount', date_col='date', days=3):\n ...",
|
|
126
|
+
"parameters": {
|
|
127
|
+
"table": {"type": "string", "required": true},
|
|
128
|
+
"days": {"type": "integer", "default": 3, "description": "Days proximity threshold"}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### 5. Security & Sandboxing
|
|
134
|
+
|
|
135
|
+
**SQL queries:**
|
|
136
|
+
- Read-only (SELECT only, block INSERT/UPDATE/DELETE/DROP/ALTER)
|
|
137
|
+
- Timeout: 10 seconds
|
|
138
|
+
- Max rows: 10,000
|
|
139
|
+
|
|
140
|
+
**Custom Python tools:**
|
|
141
|
+
- Allowed imports: pandas, numpy, datetime, json, math, statistics, re, collections
|
|
142
|
+
- Blocked: os, subprocess, shutil, pathlib, sys, importlib, eval, exec, __import__
|
|
143
|
+
- No file writes outside `~/.excel-mcp/output/`
|
|
144
|
+
- No network access
|
|
145
|
+
- Execution timeout: 30 seconds
|
|
146
|
+
|
|
147
|
+
### 6. Installation
|
|
148
|
+
|
|
149
|
+
**install.sh script:**
|
|
150
|
+
1. Check for Python 3.10+ (guide to install if missing)
|
|
151
|
+
2. Check for `uv` (install if missing)
|
|
152
|
+
3. Create `~/.excel-mcp/` directory structure
|
|
153
|
+
4. Clone/download the project
|
|
154
|
+
5. Create virtualenv, install dependencies
|
|
155
|
+
6. Detect Claude Desktop config location (macOS vs other)
|
|
156
|
+
7. Inject MCP server config into `claude_desktop_config.json`
|
|
157
|
+
8. Optionally set DATA_DIR if user provides a path
|
|
158
|
+
9. Print success message with next steps
|
|
159
|
+
|
|
160
|
+
**Claude Desktop config injection:**
|
|
161
|
+
```json
|
|
162
|
+
{
|
|
163
|
+
"mcpServers": {
|
|
164
|
+
"excel-analytics": {
|
|
165
|
+
"command": "uv",
|
|
166
|
+
"args": ["run", "--directory", "~/.excel-mcp/excel-mcp", "python", "-m", "excel_mcp"],
|
|
167
|
+
"env": {
|
|
168
|
+
"DATA_DIR": "~/Documents"
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
## Directory Structure
|
|
176
|
+
|
|
177
|
+
```
|
|
178
|
+
excel-mcp/
|
|
179
|
+
├── pyproject.toml
|
|
180
|
+
├── README.md
|
|
181
|
+
├── LICENSE (MIT)
|
|
182
|
+
├── install.sh
|
|
183
|
+
├── excel_mcp/
|
|
184
|
+
│ ├── __init__.py
|
|
185
|
+
│ ├── __main__.py # Entry point
|
|
186
|
+
│ ├── server.py # FastMCP server + FastAPI app
|
|
187
|
+
│ ├── config.py # Paths, constants, settings
|
|
188
|
+
│ ├── database.py # SQLite connection, query execution
|
|
189
|
+
│ ├── ingest.py # Excel/CSV parsing and loading
|
|
190
|
+
│ ├── tools/
|
|
191
|
+
│ │ ├── __init__.py
|
|
192
|
+
│ │ ├── core_tools.py # list_datasets, describe, query, summarize
|
|
193
|
+
│ │ ├── meta_tools.py # save_analysis, create_tool, manage, etc.
|
|
194
|
+
│ │ └── dynamic_loader.py # Load user tools from disk, register with MCP
|
|
195
|
+
│ ├── sandbox.py # Code validation and safe execution
|
|
196
|
+
│ ├── api/
|
|
197
|
+
│ │ ├── __init__.py
|
|
198
|
+
│ │ └── routes.py # REST API for frontend
|
|
199
|
+
│ └── static/
|
|
200
|
+
│ └── index.html # Single-file frontend dashboard
|
|
201
|
+
├── tests/
|
|
202
|
+
│ ├── test_ingest.py
|
|
203
|
+
│ ├── test_tools.py
|
|
204
|
+
│ └── test_sandbox.py
|
|
205
|
+
└── sample_data/
|
|
206
|
+
└── demo.xlsx # Sample file for testing
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
## REST API Endpoints (for frontend)
|
|
210
|
+
|
|
211
|
+
| Method | Path | Purpose |
|
|
212
|
+
|--------|------|---------|
|
|
213
|
+
| GET | `/` | Serve dashboard HTML |
|
|
214
|
+
| GET | `/api/datasets` | List all tables |
|
|
215
|
+
| GET | `/api/datasets/{table}` | Table details + preview |
|
|
216
|
+
| DELETE | `/api/datasets/{table}` | Drop a table |
|
|
217
|
+
| POST | `/api/upload` | Upload Excel/CSV file |
|
|
218
|
+
| GET | `/api/tools` | List all tools (core + user) |
|
|
219
|
+
| GET | `/api/tools/{id}` | Tool details |
|
|
220
|
+
| POST | `/api/tools` | Create new tool |
|
|
221
|
+
| PUT | `/api/tools/{id}` | Update tool |
|
|
222
|
+
| DELETE | `/api/tools/{id}` | Delete tool |
|
|
223
|
+
| POST | `/api/tools/{id}/test` | Run tool with params |
|
|
224
|
+
| GET | `/api/health` | Health check |
|
|
225
|
+
|
|
226
|
+
## Dependencies
|
|
227
|
+
|
|
228
|
+
- `mcp` — MCP SDK
|
|
229
|
+
- `fastapi` — REST API + frontend serving
|
|
230
|
+
- `uvicorn` — ASGI server
|
|
231
|
+
- `pandas` — Data manipulation
|
|
232
|
+
- `openpyxl` — Excel reading
|
|
233
|
+
- `tabulate` — Markdown table formatting
|
|
234
|
+
|
|
235
|
+
## User Config
|
|
236
|
+
|
|
237
|
+
`~/.excel-mcp/config.json`:
|
|
238
|
+
```json
|
|
239
|
+
{
|
|
240
|
+
"data_dir": "~/Documents",
|
|
241
|
+
"port": 8765,
|
|
242
|
+
"auto_scan": false,
|
|
243
|
+
"max_rows_preview": 50,
|
|
244
|
+
"query_timeout_seconds": 10
|
|
245
|
+
}
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
## Success Criteria
|
|
249
|
+
|
|
250
|
+
1. Dave can install with one terminal command (with Blake's help)
|
|
251
|
+
2. Dave can drag Excel files into the dashboard
|
|
252
|
+
3. Dave can ask Claude questions about his data immediately
|
|
253
|
+
4. Dave can tell Claude to save analyses as reusable tools
|
|
254
|
+
5. Dave can see and manage his tools in the dashboard
|
|
255
|
+
6. Dave never needs to write code, SQL, or edit config files
|
|
256
|
+
7. Everything runs locally — Dave's data never leaves his machine
|
|
File without changes
|