Skip to main content

netsuite-saved-search-mcp

PyPI version

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_row override 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 NetSuiteExport instances in memory keyed by (path, mtime).
  • v0.1. The MCP tool schemas and the parser's Predicate/Measure models 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.

Metadata

Release files for netsuite-saved-search-mcp 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for netsuite-saved-search-mcp 0.1.1
File Size Uploaded Provenance
netsuite_saved_search_mcp-0.1.1.tar.gz 102.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for netsuite-saved-search-mcp 0.1.1
File Interpreter ABI Platform
netsuite_saved_search_mcp-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 125.0 kB

Release files / netsuite_saved_search_mcp-0.1.1.tar.gz

Download URL netsuite_saved_search_mcp-0.1.1.tar.gz
Size 102.4 kB
Tags Source
SHA-256 checksum
How to use checksums
1be171d324fdd3ab6a7b1bdc4ab24e91fac3b90a4147b41609b9ecc76e8ee970
BLAKE2b-256 checksum
How to use checksums
dab92d11634a67249d44a45a83e87be587b3dd25144ef02202d4c87e637d8e57
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.12

Release files / netsuite_saved_search_mcp-0.1.1-py3-none-any.whl

Download URL netsuite_saved_search_mcp-0.1.1-py3-none-any.whl
Size 22.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0f8c953c2a507c2b26191d725dcb8f31c3821f8feced0fc2135c7272953a33a3
BLAKE2b-256 checksum
How to use checksums
efd4783ab90c10e49675dc2665353cca1e37cfd913dac5607c655aa56177dff7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.12

Security for netsuite-saved-search-mcp 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page