Skip to main content
Glama
NetSuite MCP Server

NetSuite MCP Server

by kpatton-dev

NetSuite MCP Server

A powerful Model Context Protocol (MCP) server for NetSuite integration, providing comprehensive access to NetSuite's REST APIs with enhanced features for data management, search, and bulk operations.

Features

Core Capabilities

  • Full CRUD Operations: Create, read, update, and delete NetSuite records

  • Advanced Search: Multiple search methods including SuiteQL and advanced search builder

  • Bulk Operations: Efficiently handle multiple records in single operations

  • Sublist Management: Read and modify sublists (addresses, contacts, etc.)

  • File Operations: Upload and download files from NetSuite File Cabinet

  • Custom Records: Support for company-specific custom record types

  • Smart Field Handling: Automatic boolean conversion and field validation

Search Options

  1. SuiteQL: Write Oracle SQL queries for complex data retrieval

  2. Basic Search: Simple record searches with filters

  3. Advanced Search: Complex searches with multiple operators and conditions

  4. Search Templates: Pre-built queries for common use cases

Related MCP server: netsuite-mcp-server

Installation

# Clone the repository
git clone https://github.com/your-org/mcp-netsuite.git
cd mcp-netsuite

# Install dependencies
pip install -e .

Configuration

Environment Variables

Create a .env file with your NetSuite credentials:

NETSUITE_ACCOUNT_ID=your_account_id
NETSUITE_CONSUMER_KEY=your_consumer_key
NETSUITE_CONSUMER_SECRET=your_consumer_secret
NETSUITE_TOKEN_ID=your_token_id
NETSUITE_TOKEN_SECRET=your_token_secret
NETSUITE_BASE_URL=https://your_account_id.suitetalk.api.netsuite.com

Claude Desktop Configuration

Add to your Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json):

{
  "mcpServers": {
    "netsuite": {
      "command": "python",
      "args": ["-m", "mcp_server_netsuite"],
      "env": {
        "NETSUITE_ACCOUNT_ID": "your_account_id",
        "NETSUITE_CONSUMER_KEY": "your_consumer_key",
        "NETSUITE_CONSUMER_SECRET": "your_consumer_secret",
        "NETSUITE_TOKEN_ID": "your_token_id",
        "NETSUITE_TOKEN_SECRET": "your_token_secret",
        "NETSUITE_BASE_URL": "https://your_account_id.suitetalk.api.netsuite.com"
      }
    }
  }
}

Available Tools

Basic Operations

netsuite_get_record

Get a single NetSuite record by type and ID.

record_type: "vendor"
internal_id: "123"
expand_sub_resources: false

netsuite_create_record

Create a new NetSuite record with proper field validation.

record_type: "vendor"
fields: {
  "companyname": "Acme Corp",
  "subsidiary": "1",
  "isperson": false  // Note: Use boolean, not "F"/"T"
}

netsuite_update_record

Update an existing record.

record_type: "vendor"
internal_id: "123"
fields: {"email": "newemail@example.com"}

netsuite_delete_record

Delete a NetSuite record (requires permissions).

Search Tools

netsuite_suiteql

Execute Oracle SQL queries against NetSuite data.

-- Find vendor bills by memo
SELECT * FROM transaction 
WHERE UPPER(memo) LIKE '%INVOICE%' 
AND type = 'VendBill' 
AND rownum <= 10

-- Note: Use rownum, not LIMIT
-- Use LIKE for dates: trandate LIKE '%2024%'

Build complex searches with multiple filters.

record_type: "transaction"
filters: [
  {"field": "type", "operator": "is", "value": "VendBill"},
  {"field": "amount", "operator": "greaterthan", "value": 1000}
]
columns: ["tranid", "trandate", "amount"]
sort_by: "trandate"
sort_order: "desc"

netsuite_search_templates

Get pre-built query templates for common searches.

template_name: "vendor_bills_by_person"
parameters: {"person_name": "John Smith"}

Bulk Operations

netsuite_bulk_create

Create multiple records efficiently.

record_type: "vendor"
records: [
  {"companyname": "Vendor 1", "subsidiary": "1"},
  {"companyname": "Vendor 2", "subsidiary": "1"}
]
continue_on_error: true

netsuite_bulk_update

Update multiple records at once.

record_type: "vendor"
records: [
  {"id": "123", "email": "new1@example.com"},
  {"id": "456", "email": "new2@example.com"}
]

Sublist Management

netsuite_get_sublist

Read sublist data from a record.

record_type: "vendor"
internal_id: "123"
sublist_name: "addressBook"

netsuite_sublist_operations

Add, update, or remove sublist items.

record_type: "vendor"
internal_id: "123"
sublist_name: "addressBook"
operation: "add"
items: [{
  "addr1": "123 Main St",
  "city": "Boston",
  "state": "MA",
  "zip": "02101"
}]

File Operations

netsuite_file_upload

Upload files to NetSuite File Cabinet.

file_name: "invoice_123.pdf"
folder_id: "456"  // Optional
content: "base64_encoded_content"
is_available_online: false

netsuite_file_download

Download files from NetSuite.

file_id: "789"

Record Transformation

netsuite_transform_record

Transform a record into another type (e.g., PO → Vendor Bill, SO → Invoice).

source_type: "purchaseorder"
source_id: "12345"
target_type: "vendorbill"
fields: {"memo": "Invoice #INV-001"}  // optional overrides

Common transformations:

  • purchaseorder → vendorbill (receive a PO as a bill)

  • purchaseorder → itemreceipt (receive items)

  • salesorder → invoice (bill a sales order)

  • salesorder → itemfulfillment (ship an order)

  • estimate → salesorder (convert quote to SO)

External ID Lookup

netsuite_get_record_by_external_id

Fetch a record by its external ID — critical for integration lookups.

record_type: "vendor"
external_id: "EXT-VENDOR-122"

Look up a saved search and query its record type.

search_id: "1104"                    // internal ID or script ID
record_type: "transaction"           // auto-detected from search metadata
limit: 50

Note: The REST API cannot execute saved searches directly (filters/columns are not applied). This tool retrieves search metadata and queries the underlying table. Use netsuite_suiteql with specific filters to replicate saved search logic.

Workflow Actions

netsuite_workflow_action

Approve, reject, submit, cancel, close, or reopen records.

record_type: "vendorbill"
internal_id: "98765"
action: "approve"

Actions: approve, reject, submit, cancel, close, reopen

Reject with reason:

record_type: "purchaseorder"
internal_id: "123"
action: "reject"
reason: "Missing documentation"

Query Builder

netsuite_query_builder

Build SuiteQL from structured parameters — eliminates raw SQL syntax errors.

table: "transaction"
columns: ["id", "tranid", "memo"]
filters: [
  {"field": "type", "operator": "equals", "value": "VendBill"},
  {"field": "memo", "operator": "contains", "value": "invoice"}
]
joins: [{"table": "vendor", "columns": ["companyname"]}]
order_by: "id"
order_dir: "desc"
limit: 50
execute: true

Set execute: false to just generate the SQL without running it.

Vendor Bill Matching

netsuite_match_vendor_bill

Find purchase orders that match a vendor bill.

vendor_id: "12345"
bill_amount: 500.00

Returns PO candidates scored by match confidence (high/medium/low).

Batch Queries

netsuite_batch_suiteql

Run multiple SuiteQL queries in one call.

queries: [
  {"name": "vendors", "query": "SELECT COUNT(*) as cnt FROM vendor WHERE isinactive = 'F'"},
  {"name": "open_bills", "query": "SELECT id, tranid FROM transaction WHERE type = 'VendBill' AND rownum <= 5"}
]

Record History

netsuite_record_history

Get the audit trail for a record — who changed what, when.

record_type: "vendorbill"
internal_id: "98765"
field_filter: "approvalStatus"

Reference Lookups

netsuite_reference_lookup

Quick lookups for currencies, subsidiaries, departments, classifications, locations, accounts.

lookup_type: "currency"
lookup_type: "account"
lookup_type: "subsidiary"

Upsert (Create-or-Update)

netsuite_upsert

Create or update a record by external ID — the #1 integration pattern.

record_type: "vendor"
external_id: "EXT-VENDOR-999"
fields: {"companyName": "New Vendor Corp", "subsidiary": {"id": "1"}}

If external ID exists, updates. If not, creates. Atomic and idempotent.

Record Attachments

netsuite_attach_detach

Attach or detach records (files, contacts, etc.) to other records.

action: "attach"
source_type: "contact"
source_id: "456"
target_type: "vendor"
target_id: "67890"

Get all related data for an entity in one call.

record_type: "vendor"
internal_id: "12345"
include: "transactions,contacts,balances"

RESTlet Caller

netsuite_restlet

Call custom SuiteScript RESTlets — unlocks anything the REST API can't do natively.

script_id: "1234"
deploy_id: "1"
method: "POST"
payload: {"searchId": "customsearch_open_vbs"}

Transaction Lines

netsuite_transaction_lines

Get line-level detail for any transaction.

transaction_id: "98765"
include_main_line: false
columns: "foreignamount,memo,item,quantity,rate"

Utility Tools

netsuite_get_metadata

Get metadata about a record type's structure.

netsuite_get_required_fields

Get required fields and tips for creating records.

netsuite_discover_fields

Discover available fields and relationships for SuiteQL queries.

netsuite_integration_status

Check API limits and integration health.

netsuite_permission_check

Check if operations are allowed for current credentials.

Best Practices

Boolean Fields

Always use proper boolean values, not strings:

  • ✅ "isperson": false

  • ❌ "isperson": "F"

SuiteQL Queries

  1. Use rownum <= N instead of LIMIT N

  2. Use LIKE '%2024%' for date filtering instead of >= '2024-01-01'

  3. Avoid complex JOINs with GROUP BY

  4. Test simple queries before adding complexity

Error Handling

The server provides detailed error messages with suggestions:

  • Field name corrections

  • Syntax fixes for SuiteQL

  • Permission requirements

Performance

  1. Use bulk operations for multiple record changes

  2. Limit SuiteQL results to necessary data

  3. Use field discovery before writing queries

Common Issues and Solutions

Issue: Boolean field errors

Solution: The server automatically converts "T"/"F" to true/false

Issue: SuiteQL GROUP BY errors

Solution: Use subqueries or aggregate in application code

Issue: Date comparison failures

Solution: Use LIKE '%YYYY%' pattern instead of comparison operators

Issue: Search criteria validation

Solution: Use the advanced search tool for complex criteria

Development

Running Tests

pytest tests/

Adding New Features

  1. Add parameter models to types.py

  2. Implement client methods in client.py

  3. Add tool definition in server.py

  4. Update documentation

License

MIT License - see LICENSE file for details

Support

For issues or questions:

  1. Check the error messages - they often include solutions

  2. Use the field discovery tools to understand data structure

  3. Refer to NetSuite's REST API documentation

  4. Open an issue on GitHub

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers