MCP server exposing NetSuite saved search exports as a structured query interface for Claude
Project description
netsuite-saved-search-mcp
NetSuite saved search exports look like Excel files but are actually XML SpreadsheetML with a .xls extension — Excel opens them, pandas trips on them, and most teams writing Claude integrations against NetSuite end up rebuilding the same parser by hand. This MCP server exposes those exports as a structured query interface for Claude: discover files, inspect columns, filter and aggregate rows, categorize by memo keywords, surface anomalies. Seven tools wrap a parser that handles the format's real quirks — entity-encoded text, empty cells flagged with ss:Index, drifting column layouts between saved searches, DateTime cells that won't parse. The parser runs in lxml's recovery mode and reports broken cells as structured warnings rather than crashing on them.
Quick start
uvx netsuite-saved-search-mcp # or: pip install netsuite-saved-search-mcp
export NSMCP_ROOT=/path/to/your/exports
Add to Claude Desktop's config (full version in examples/claude_desktop_config.json):
{
"mcpServers": {
"netsuite-saved-search": {
"command": "uvx",
"args": ["netsuite-saved-search-mcp"],
"env": {"NSMCP_ROOT": "/path/to/your/exports"}
}
}
}
Then any tool call lands directly:
{
"tool": "query_export",
"arguments": {
"file_path": "Q3_GL.xls",
"filters": [{"op": "eq", "column": "Account", "value": "4000"}]
}
}
Why this exists
NetSuite saved search exports use XML SpreadsheetML, not Excel binary, despite the .xls extension. Column layouts drift between saved searches, so code that hardcodes column letters breaks on the next export. Empty cells are silently omitted from each row with ss:Index attributes marking where they were, which trips naive sequential parsers. Every finance team using Claude with NetSuite ends up rebuilding the same parser. This server solves it once.
Tools
| Tool | Description | Key parameters |
|---|---|---|
list_exports |
Scan a directory for .xls files; return one summary per file with row counts, header counts, warning counts, and detected date range. | directory |
get_headers |
Return column headers, their spreadsheet column letters, and the 0-indexed header row. | file_path |
query_export |
Filter rows by a list of predicates (AND-combined), optionally project to a subset of columns, cap results. | file_path, filters, columns?, limit? |
aggregate_export |
Group rows by one or more columns; compute sum/count/avg/min/max per group. | file_path, group_by, measures |
categorize_by_memo |
Tag every row with a _category derived from case-insensitive keyword rules across one or more memo columns. |
file_path, memo_columns, rules |
detect_anomalies |
Three checks: zero-activity periods (HIGH), ratio anomalies (MEDIUM), document-count variance (MEDIUM). | file_path, account_column, amount_column, period_column |
get_parse_warnings |
Return parse warnings (phantom_column, bad_datetime, encoding_recovery, empty_row_skipped) captured during parsing of the specified file. | file_path |
Predicates are a discriminated union keyed on op. Example query with two predicates:
{
"file_path": "deferred_commissions_2024.xls",
"filters": [
{"op": "eq", "column": "Account", "value": "1321"},
{"op": "date_range", "column": "Date", "start": "2024-01-01", "end": "2024-12-31"}
],
"columns": ["Date", "Document Number", "Amount", "Memo (line)"],
"limit": 100
}
Measures for aggregate_export:
[{"column": "Amount", "op": "sum", "alias": "total"}, {"column": "Document Number", "op": "count"}]
Example walkthrough
See examples/walkthrough.md for an end-to-end example using the included sanitized fixtures.
Limitations
- Only handles saved search exports, not raw transaction-level XML from SuiteScript or RESTlets.
- All-string exports with no typed columns may misidentify the header row; an explicit
header_rowoverride is planned. - Memo categorization uses case-insensitive substring matching against US-English keywords. No stemming, no fuzzy matching.
- Not optimized for exports larger than 100k rows. The cache holds parsed
NetSuiteExportinstances in memory keyed by(path, mtime). - v0.1. The MCP tool schemas and the parser's
Predicate/Measuremodels may change before v1.0.
Contributing
Issues and PRs welcome. Run uv run pytest, uv run mypy src, and uv run ruff check src tests before submitting; all three should be clean. Commits follow Conventional Commits. New tools require a Pydantic response model, a happy-path test against the included GL fixture, a failure-path test (missing file or unknown column), and an entry in the table above.
License
MIT. See LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file netsuite_saved_search_mcp-0.1.1.tar.gz.
File metadata
- Download URL: netsuite_saved_search_mcp-0.1.1.tar.gz
- Upload date:
- Size: 102.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1be171d324fdd3ab6a7b1bdc4ab24e91fac3b90a4147b41609b9ecc76e8ee970
|
|
| MD5 |
4f99ec0f3fb1115cc39cbf2e9fdef02c
|
|
| BLAKE2b-256 |
dab92d11634a67249d44a45a83e87be587b3dd25144ef02202d4c87e637d8e57
|
File details
Details for the file netsuite_saved_search_mcp-0.1.1-py3-none-any.whl.
File metadata
- Download URL: netsuite_saved_search_mcp-0.1.1-py3-none-any.whl
- Upload date:
- Size: 22.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0f8c953c2a507c2b26191d725dcb8f31c3821f8feced0fc2135c7272953a33a3
|
|
| MD5 |
d6a654be984fcb0a42f4ab85d6b34b8b
|
|
| BLAKE2b-256 |
efd4783ab90c10e49675dc2665353cca1e37cfd913dac5607c655aa56177dff7
|