netsuite-saved-search-mcp
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@netsuite-saved-search-mcp detect anomalies in sample_gl_export.xls"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
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.
What an auditable agent run looks like
A condensed exchange reproduced from the claude-eval-harness
NetSuite suite's anomaly_zero_activity_june case (runs/baseline-sonnet-4-6.json).
The agent's tool calls are auditable, the parser's total_supporting_count
is citable, and the model never has to fabricate numbers it can't point at.
user What stands out in this GL? Run detect_anomalies on
sample_gl_export.xls (account_column=Account,
amount_column=Amount, period_column=Period).
agent → detect_anomalies(file_path="sample_gl_export.xls",
account_column="Account",
amount_column="Amount",
period_column="Period")
← {findings: [
{severity:"HIGH", category:"zero_activity_period",
description:"No rows recorded for Jun 2024",
total_supporting_count:0},
{severity:"MEDIUM", category:"ratio_anomaly",
description:"Account 1200 in Sep 2024 totals 319,219.74
— 3.1x the 1200 median of 103,259.01",
supporting_rows:[...10 rows...],
total_supporting_count:17}]}
agent HIGH: no rows posted to June 2024 inside an otherwise continuous
range — likely an extraction gap or skipped close. MEDIUM:
Account 1200 spiked to 3.1× its own median in September across
17 cited rows. supporting_rows trims to 10; total_supporting_count
carries the full count so it's verifiable.The full anomaly response also lives in examples/walkthrough.md.
Related MCP server: mcp-fi
Quick start
uvx netsuite-saved-search-mcp # or: pip install netsuite-saved-search-mcp
export NSMCP_ROOT=/path/to/your/exportsAdd 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"}]
}
}Standalone Python usage
The parser is usable directly without the MCP transport — useful for notebooks, batch scripts, or pytest fixtures that don't want stdio in the loop:
from netsuite_saved_search_mcp.parser import NetSuiteExport
export = NetSuiteExport("tests/fixtures/sample_gl_export.xls")
print(export.headers) # ['Order Type', 'Date', 'Period', ...]
print(len(export.rows)) # 212
print(export.rows[0]["Account"]) # '4000'NetSuiteExport(path) parses the file end-to-end on construction. .rows is a list of dicts keyed by header name; cell values are typed (str, int, float, datetime.date, bool, or None). .parse_warnings exposes any recoverable issues lxml hit on the way through.
Security boundary
For audit and accounting use, the server enforces a tight blast radius on what it can touch. (Reporting channel for vulnerabilities is in SECURITY.md.)
All reads constrained under
NSMCP_ROOT. Every tool resolves its file-path argument relative to this env var (oros.getcwd()if unset). Paths that resolve outside the root raisePathTraversalErrorbefore any I/O.Symlink-escape blocked via realpath comparison.
_resolve_under_rootcallsPath.resolve()on the candidate then checksrelative_to(root).resolve()collapses..segments and follows symlinks to their real target, so a symlink inside the root that points outside it fails the check.No writes. The parser opens
.xlsfiles for reading only. No tool writes to the filesystem.No network calls. Runtime dependencies are
mcp,lxml,python-dateutil,pydantic— none of them dial out during a tool call.Stderr logs are scoped. Startup logs the
NSMCP_ROOTpath. Tool calls log nothing by default; row data, column values, and financial figures never reach the log handler.
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 |
| Scan a directory for .xls files; return one summary per file with row counts, header counts, warning counts, and detected date range. |
|
| Return column headers, their spreadsheet column letters, and the 0-indexed header row. |
|
| Filter rows by a list of predicates (AND-combined), optionally project to a subset of columns, cap results. |
|
| Group rows by one or more columns; compute sum/count/avg/min/max per group. |
|
| Tag every row with a |
|
| Three checks: zero-activity periods (HIGH), ratio anomalies (MEDIUM), document-count variance (MEDIUM). |
|
| Return parse warnings (phantom_column, bad_datetime, encoding_recovery, empty_row_skipped) captured during parsing of the specified file. |
|
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.
detect_anomaliesonly recognises period labels in three formats —Jan 2024,January 2024,2024-01. Quarter labels (Q1 2024) and fiscal-period labels are silently skipped. The ratio and document-count checks also need ≥3 distinct periods to produce a finding.Not optimized for exports larger than 100k rows. The cache holds parsed
NetSuiteExportinstances in memory keyed by(path, mtime)and is unbounded — a long-running session against a large directory will keep every parsed export resident.Coverage tested against three synthesized fixtures that exercise typed cells, lxml recovery, and 14-row-metadata header detection. Real-world saved searches with column layouts beyond those shapes may surface gaps.
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.
Available Tools
7 toolsaggregate_exportA
Group rows from a NetSuite export by one or more columns and compute aggregations per group. Each Measure carries column, op (sum/count/avg/min/max), and optional alias for the output key (defaults to {op}_{column}). Groups are returned in first-seen order. Use this instead of query_export when you want summary statistics rather than raw rows.
Inputs: file_path (required), group_by (required), measures (required). Returns: groups
categorize_by_memoA
Tag every row with a derived _category based on case-insensitive substring matches across one or more memo columns. NetSuite GL exports usually carry both 'Memo (main)' and 'Memo (line)'; pass both so the keyword sweep covers all the prose. rules maps category name to a list of keywords; the first rule whose keyword appears in any memo wins; rows matching nothing fall into 'Uncategorized'. Returns the tagged rows plus a per-category count breakdown.
Inputs: file_path (required), memo_columns (required), rules (required). Returns: rows, breakdown
detect_anomaliesA
Run three anomaly checks against a NetSuite GL-style export and return Findings: (1) zero_activity_period — month gaps inside the observed period range (HIGH); (2) ratio_anomaly — (account, period) total greater than 2x the account's median total across periods (MEDIUM); (3) document_count_variance — period row count more than 2 stdev from the mean across periods (MEDIUM). Each Finding includes severity, description, up to 10 supporting_rows, and total_supporting_count for the true un-truncated count. The period column should contain labels like 'Jan 2024', 'January 2024', or '2024-01'.
Inputs: file_path (required), account_column (required), amount_column (required), period_column (required). Returns: findings
get_headersA
Return the column headers of a NetSuite saved-search export plus their spreadsheet column letters (A, B, ..., AA, AB) and the 0-indexed header_row. Call this before query_export or aggregate_export when you don't already know the column names — every other tool takes column names verbatim and errors on typos with a difflib suggestion.
Inputs: file_path (required). Returns: headers, column_letters, header_row
get_parse_warningsA
Return the parse warnings for the export at file_path, parsing it on demand if it isn't already cached. Warning kinds: phantom_column (cell at a column index beyond the header count), bad_datetime (DateTime cell that wouldn't parse — raw string is preserved in the row), encoding_recovery (lxml had to recover from invalid XML), empty_row_skipped. Call this after any other tool reports a non-zero warning_count to see exactly which rows are affected.
Inputs: file_path (required). Returns: result
list_exportsA
List every NetSuite saved-search export (.xls) in a directory under NSMCP_ROOT. Returns one ExportSummary per file with row count, header count, 0-indexed header_row, warning count, and detected date range. Files that can't be parsed even with lxml recovery come back with parse_error populated and the other fields None. Call this first when you don't already know which exports are available.
Inputs: directory (required). Returns: result
query_exportA
Filter rows from a NetSuite export by a list of predicates (AND-combined; empty list returns everything). Predicate ops: eq/ne, gt/gte/lt/lte, contains/not_contains (case-insensitive by default), regex, date_range (ISO 8601 start/end, inclusive by default). Optionally project to a subset of columns via the columns argument. Implicit limit=1000; pass limit=0 to get total_matched without fetching any rows. Returns rows, total_matched, and a truncated flag.
Inputs: file_path (required), filters, columns, limit. Returns: rows, total_matched, truncated
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 7 tools
Each tool has a clearly distinct purpose: informational (get_headers, list_exports, get_parse_warnings), data retrieval (query_export, aggregate_export), and analysis (categorize_by_memo, detect_anomalies). No overlap in functionality.
All tool names follow a consistent verb_noun pattern (e.g., get_headers, list_exports, query_export). No mixing of conventions or obscure abbreviations.
Seven tools is well-scoped for a saved-search MCP, covering listing, header inspection, querying, aggregation, categorization, anomaly detection, and parse warnings. No tools feel extraneous or missing.
The tool set provides a complete workflow for analyzing NetSuite saved-search exports: discover exports (list_exports), inspect headers (get_headers), fetch raw rows (query_export), compute summaries (aggregate_export), enrich with categories (categorize_by_memo), detect anomalies (detect_anomalies), and diagnose parsing issues (get_parse_warnings). No obvious gaps.
Maintenance
Related MCP Connectors
Read and write NetSuite and run SuiteQL from Claude or ChatGPT. Write tools flagged for approval.
Query your warehouse or a CSV with Claude/ChatGPT over MCP, governed by table-level ACL + audit.
Query and audit AppSheet apps in natural language via Knotrik's pre-scanned definitions.
Read-only by architecture: ask AI about your NetSuite data, across multiple entities at once.
Related MCP Servers
- AlicenseCqualityDmaintenanceEnables conversational data analysis of Excel/CSV files through natural language queries, powered by 395 Excel functions via HyperFormula and multi-provider AI. Supports advanced analytics, bulk operations, financial modeling, and large file processing with intelligent chunking.3543 npm38MIT
- FlicenseNot gradedqualityDmaintenanceQuery databases in plain English using Claude. Supports SQLite, CSV, PostgreSQL, and MySQL.1-
- AlicenseAqualityCmaintenanceEnables read-only analytical access to local CSV, Parquet, JSON files or a DuckDB database through MCP, with table discovery, column profiling, guarded SQL querying, and explain plans for safe use with Claude Desktop and Claude Code.81MIT
- AlicenseNot gradedqualityCmaintenanceEnables querying, searching, and organizing Readmoo ebook highlights and notes from exported CSV files using natural language through Claude or other MCP-compatible tools.MIT