NetSuite MCP Server
Summary: This MCP server authenticates you to a NetSuite account via OAuth 2.0 (PKCE) and then exposes NetSuite's native MCP tools for querying and managing account data.
Authenticate with NetSuite through a browser-based OAuth 2.0 + PKCE flow (
netsuite_authenticate), using account ID and client ID from env vars or tool argumentsLog out / clear the stored session (
netsuite_logout), with tokens persisted across restarts and auto-refreshed before expiryRun SuiteQL queries against your NetSuite data (
ns_runCustomSuiteQL)List and execute financial reports (
ns_listAllReports,ns_runReport)List and run saved searches (
ns_listSavedSearches,ns_runSavedSearch)Read, create, and update records (
ns_getRecord,ns_createRecord,ns_updateRecord) and other account-specific toolsUse natural language from any MCP client (Claude Code, Cursor, Gemini CLI) — e.g., "show me all customers" or "get sales orders from last month"
Configure once via environment variables (
NETSUITE_ACCOUNT_ID,NETSUITE_CLIENT_ID,OAUTH_CALLBACK_PORT) so credentials need not be repeated
Note: The exposed tool list in this schema is only the auth layer; the actual NetSuite data tools become available after authentication and require the NetSuite AI Connector SuiteApp.
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 MCP Server run a SuiteQL query to get open sales orders"
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 MCP Server
A Model Context Protocol (MCP) server providing access to NetSuite data through OAuth 2.0 with PKCE authentication. Works seamlessly with any MCP-compatible client including Claude Code, Cursor IDE, and Gemini CLI.
This project includes code originally developed by SuiteInsider, licensed under the MIT License from this repo (published to npm as @suiteinsider/netsuite-mcp, vendored here at 1.0.2). Vendored for Qualifyze's supply-chain review: pin by commit instead of npx @latest against an unreviewed third-party publisher with OAuth access to production financials. Default OAUTH_CALLBACK_PORT changed from 8080 to an ephemeral port (55182) to avoid first-run collisions with common local dev servers.
Features
✅ OAuth 2.0 with PKCE - Secure authentication without client secrets
✅ Automatic Token Refresh - Tokens refresh automatically before expiration
✅ Environment Variable Support - Configure credentials once in your MCP config
✅ Session Persistence - Authentication survives server restarts
✅ Universal MCP Integration - Works with Claude Code, Cursor IDE, Gemini CLI, and other MCP clients
✅ NetSuite MCP Tools - Access to all NetSuite MCP capabilities (SuiteQL, Reports, Saved Searches, etc.)
✅ Modular Architecture - Clean, maintainable codebase following single-responsibility principle
Related MCP server: NS MCP China
Quick Start
1. NetSuite Setup
Step 1: Install NetSuite AI Connector SuiteApp
Before creating the integration record, you must install and configure the NetSuite AI Connector SuiteApp:
Important: The NetSuite AI Connector SuiteApp is required for MCP functionality. Without it, the MCP tools will not be available even after authentication.
Step 2: Create OAuth Integration Record
After installing the SuiteApp, create an integration record:
Navigate to Setup > Integration > Manage Integrations > New
Fill in the details:
Name: "MCP Server Integration"
OAuth 2.0: Checked Authorization Code Grant Checked Public Client
Redirect URI:
http://localhost:55182/callback(or your custom port)
Save and copy the Client ID (consumer key)
Note: we dont need client secret (since this is public client and Authorization Code Grant with pkce)
2. MCP Client Configuration
Add to your MCP client's configuration file:
Claude Code: ~/.claude.json
Cursor IDE: .cursor/mcp.json
Gemini CLI: Per Gemini's MCP setup
Option A: Using npx (Recommended - No Installation Required)
{
"mcpServers": {
"netsuite": {
"command": "npx",
"args": ["@suiteinsider/netsuite-mcp@latest"],
"env": {
"NETSUITE_ACCOUNT_ID": "your-account-id",
"NETSUITE_CLIENT_ID": "your-client-id",
"OAUTH_CALLBACK_PORT": "55182"
}
}
}
}Benefits:
No manual installation required
Always uses the latest version with
@latestClean, simple configuration
Works immediately after MCP client restart
Optional Environment Variables:
OAUTH_CALLBACK_PORT- OAuth callback port (default: 55182)
Option B: Local Development Setup
For contributing or local development:
# Clone the repository
git clone https://github.com/dsvantien/netsuite-mcp-server.git
cd netsuite-mcp-server
# Install dependencies
npm install
# Test locally with npm link
npm linkThen configure with absolute path:
{
"mcpServers": {
"netsuite": {
"command": "node",
"args": ["/absolute/path/to/netsuite-mcp-server/src/index.js"],
"env": {
"NETSUITE_ACCOUNT_ID": "your-account-id",
"NETSUITE_CLIENT_ID": "your-client-id",
"OAUTH_CALLBACK_PORT": "55182"
}
}
}
}Option C: Without Environment Variables
{
"mcpServers": {
"netsuite": {
"command": "npx",
"args": ["@suiteinsider/netsuite-mcp@latest"]
}
}
}Note: You'll need to provide credentials when calling netsuite_authenticate
3. Authenticate & Use
Start your MCP client and authenticate:
Authenticate with NetSuiteA browser window opens → Login to NetSuite → Authentication complete!
Important: After authentication, you'll need to restart your chat or reconnect the MCP server to see NetSuite tools. This is normal MCP behavior.
Once authenticated, use natural language queries:
Show me all customers
List available saved searches
Run a SuiteQL query to get sales orders from last month
Execute the "Monthly Revenue" reportArchitecture
MCP Client (Claude Code, Cursor, Gemini, etc.)
│
│ stdio (JSON-RPC)
▼
┌──────────────────────────────┐
│ MCP Server (Node.js) │
│ │
│ ┌────────────────────────┐ │
│ │ OAuth Manager │ │
│ │ - PKCE generation │ │
│ │ - Local HTTP server │ │
│ │ (port 55182 default) │ │
│ │ - Token storage │ │
│ └────────────────────────┘ │
│ │
│ ┌────────────────────────┐ │
│ │ MCP Tools │ │
│ │ - ns_runCustomSuiteQL │ │
│ │ - ns_runReport │ │
│ │ - ns_listSavedSearches │ │
│ └────────────────────────┘ │
└──────────────────────────────┘
│
│ HTTPS + Bearer Token
▼
┌──────────────────────────────┐
│ NetSuite MCP REST API │
└──────────────────────────────┘Project Structure
netsuite-mcp-server/
├── src/
│ ├── index.js # Main MCP server entry point
│ ├── oauth/
│ │ ├── manager.js # OAuth flow orchestrator
│ │ ├── pkce.js # PKCE challenge/verifier generation
│ │ ├── callbackServer.js # HTTP callback server with CSRF protection
│ │ ├── sessionStorage.js # Session file management
│ │ └── tokenExchange.js # Token exchange & refresh operations
│ ├── mcp/
│ │ └── tools.js # NetSuite MCP API client
│ └── utils/
│ └── browserLauncher.js # Cross-platform browser launcher
├── sessions/ # OAuth tokens (gitignored)
├── authenticate.js # Standalone CLI authentication utility
├── package.json
├── .gitignore
└── README.mdModular Design Benefits
The codebase follows the single-responsibility principle:
pkce.js - PKCE utilities (base64 encoding, challenge generation)
callbackServer.js - HTTP callback handling (CSRF protection, HTML pages, timeouts)
sessionStorage.js - Session persistence (save, load, clear, isAuthenticated)
tokenExchange.js - NetSuite OAuth API communication (token exchange/refresh)
browserLauncher.js - Cross-platform URL opening (macOS, Windows, Linux)
This modular structure enables:
✅ Independent testing of each module
✅ Easy maintenance and debugging
✅ Reusability in other projects
✅ Clear separation of concerns
Environment Variable Configuration
Configuration Example
Recommended npx setup:
{
"mcpServers": {
"netsuite": {
"command": "npx",
"args": ["@suiteinsider/netsuite-mcp@latest"],
"env": {
"NETSUITE_ACCOUNT_ID": "123456-sb1",
"NETSUITE_CLIENT_ID": "your-client-id-here",
"OAUTH_CALLBACK_PORT": "55182"
}
}
}
}Local development setup:
{
"mcpServers": {
"netsuite": {
"command": "node",
"args": ["path/to/src/index.js"],
"env": {
"NETSUITE_ACCOUNT_ID": "123456-sb1",
"NETSUITE_CLIENT_ID": "your-client-id-here",
"OAUTH_CALLBACK_PORT": "55182"
}
}
}
}Environment Variables
NETSUITE_ACCOUNT_ID - Your NetSuite account ID (required)
NETSUITE_CLIENT_ID - Your OAuth client ID (required)
OAUTH_CALLBACK_PORT - OAuth callback port (optional, default: 55182)
Resolution Order
Check arguments first: If
accountIdorclientIdprovided as arguments, use themFallback to environment variables: If no arguments, use env vars
Validation: If neither source provides credentials, show error with instructions
Security Best Practices
File Permissions: Ensure config file has restrictive permissions
chmod 600 ~/.claude.jsonNo Secrets: Client secrets not required (PKCE authentication)
Local Token Storage: OAuth tokens stored in
sessions/directoryNever Commit: Don't commit config files with credentials to git
Available NetSuite MCP Tools
Once authenticated, you'll have access to NetSuite's native MCP tools:
ns_runCustomSuiteQL- Execute SuiteQL queriesns_listAllReports- List available financial reportsns_runReport- Execute a specific reportns_listSavedSearches- List saved searchesns_runSavedSearch- Execute a saved searchns_getRecord- Retrieve a specific recordns_createRecord- Create a new recordns_updateRecord- Update an existing recordAnd more...
The exact tools available depend on your NetSuite account configuration.
OAuth Flow
Initiation: User calls
netsuite_authenticatewith credentialsPKCE Generation: Server generates code verifier and SHA-256 challenge
Authorization URL: Server generates NetSuite OAuth URL and starts local callback server
User Login: Browser opens NetSuite login page
Authorization: User approves access
Callback: NetSuite redirects to
http://localhost:55182/callbackwith authorization codeToken Exchange: Server exchanges code for access/refresh tokens (public client pattern)
Session Storage: Tokens stored in
sessions/<NETSUITE_ACCOUNT_ID>/session.json(persists across restarts)Auto-Refresh: Tokens automatically refresh when expiring (5-minute buffer)
Troubleshooting
now uses absolute paths based on script location
Issue: "Port already in use"
Cause: Another application using the OAuth callback port
Solution:
# Check what's using the port (example for port 55182)
lsof -i :55182
# Option 1: Kill the process
# Option 2: Change port via environment variableSet custom port in your MCP config:
{
"env": {
"OAUTH_CALLBACK_PORT": "9000"
}
}Remember to update the redirect URI in your NetSuite integration to match the new port!
Issue: Tools not appearing after authentication
Cause: MCP clients cache tool list at session start
Solution:
Restart chat - Open new conversation
Reconnect MCP - Use
/mcpcommand (Claude Code)Restart app - Close and reopen your IDE
This is normal MCP behavior - tool lists are fetched once per session.
Development
Standalone Authentication
Test authentication without MCP client:
node authenticate.js <accountId> <clientId>Clearing Session
rm -rf sessions/Or use the netsuite_logout tool in your MCP client.
Viewing Logs
All server logs output to stderr. When running in MCP clients, these logs appear in the client's console/logs.
Technical Details
PKCE Implementation
Code Verifier: 32 random bytes, base64url encoded
Code Challenge: SHA-256 hash of verifier, base64url encoded
Challenge Method: S256 (required by NetSuite)
Token Exchange (Public Client Pattern)
POST https://{accountId}.suitetalk.api.netsuite.com/services/rest/auth/oauth2/v1/token
Content-Type: application/x-www-form-urlencoded
grant_type=authorization_code
&code={authorization_code}
&redirect_uri=http://localhost:55182/callback
&client_id={client_id}
&code_verifier={verifier}Important: No Authorization header (public client).
Token Refresh
Tokens automatically refresh when expiring in < 5 minutes:
POST https://{accountId}.suitetalk.api.netsuite.com/services/rest/auth/oauth2/v1/token
Content-Type: application/x-www-form-urlencoded
grant_type=refresh_token
&refresh_token={refresh_token}
&client_id={client_id}Prerequisites
Node.js 18.0.0 or higher
NetSuite Account with MCP access
NetSuite AI Connector SuiteApp (Bundle ID: 522506) installed and configured
NetSuite Integration Record with OAuth 2.0 and PKCE enabled
MCP Client - Any MCP-compatible client (Claude Code, Cursor IDE, Gemini CLI, etc.)
License
MIT
References
Available Tools
2 toolsnetsuite_authenticateA
Authenticate with NetSuite to access MCP tools. Required before using any NetSuite tools. If NETSUITE_ACCOUNT_ID and NETSUITE_CLIENT_ID environment variables are set, they will be used automatically.
Inputs: clientId, accountId.
netsuite_logoutA
Clear NetSuite authentication session
Inputs: no named parameters.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 2 tools
The two tools have completely distinct purposes: one establishes an authenticated session, the other clears it. There is no overlap or ambiguity between them.
Both tools follow the same `netsuite_` prefix with a single clear verb (`authenticate`, `logout`). The pattern is consistent and predictable.
With only authentication and logout, the server is extremely thin for a system named NetSuite MCP Server, which implies broad ERP functionality. Two tools feel insufficient for the apparent scope.
The tool surface covers only authentication lifecycle and exposes no NetSuite data or business operations. Even for auth, there is no session status or refresh capability, leaving the domain severely incomplete.
Related MCP Connectors
One OAuth connector for your team's remote MCP servers, with Tool Packs, guardrails and logs.
Remote MCP server for training, nutrition, wellness, and performance data with OAuth 2.0.
Hosted MCP server with managed OAuth for 15+ toolkits: Google Workspace, Fitbit, Oura, Kalshi, etc.
OAuth MCP for Knotr profiles, skills, knowledge, style guides, and artifacts.
Related MCP Servers
- AlicenseAqualityDmaintenanceA Model Context Protocol (MCP) server providing access to NetSuite data through OAuth 2.0 with PKCE authentication. Works seamlessly with any MCP-compatible client including Claude Code, Cursor IDE, and Gemini CLI.232 npm22MIT
- AlicenseNot gradedqualityBmaintenanceConnects MCP-compatible AI assistants to NetSuite ERP with easy OAuth setup. Provides tools for records, SuiteQL, saved searches, reports, and metadata.1MIT
- AlicenseBqualityCmaintenanceA local, read-only MCP server for querying NetSuite SuiteAnalytics Connect through a user's locally installed ODBC driver, exposing bounded tools for SQL queries, table metadata, and connection status.41Apache 2.0

WoWSQL MCPofficial
FlicenseNot gradedqualityNot gradedmaintenanceEnables MCP clients such as Cursor to connect to the WoWSQL API over authenticated HTTP using OAuth 2.0 with PKCE, with project scoping, read-only mode, and selectable features.3-