Notes / AI agents and MCP

· 3 min read

Connecting AI agents to NetSuite with MCP

Finance and purchasing teams lose hours every week to checks that are repetitive but not quite mechanical. This is how I put an AI agent in front of two of them, and what I would do the same way again.

The work worth handing over

Two tasks came up in almost every conversation with the finance team. The first was bank reconciliation: matching imported bank lines to NetSuite transactions, where most lines match on amount and date but a meaningful share need a second look. The second was purchase approvals: checking a purchase order against budget, vendor status, and item setup before an approver even sees it.

Both tasks share a shape. Most cases are obvious, a few are not, and a person has to look at every one of them to find out which is which. That shape is exactly where an agent earns its keep: it can do the obvious ones end to end and bring only the exceptions to a human.

The architecture

Business userchat / requestAI agentClaude + MCP serverNetSuiteRESTletsReact dashboardactions & progress

The Model Context Protocol, or MCP, is an open standard that lets a language model call tools exposed by a server. I wrote a small MCP server whose tools map one to one onto RESTlets in NetSuite. Claude runs the reasoning, the MCP server is the only path to the ERP, and a React dashboard shows what each agent did and where every workflow stands.

Keeping NetSuite behind RESTlets instead of giving the model a general API matters. Each RESTlet does one narrow thing, such as "find transactions matching this amount and date range" or "return the budget line for this department and period". The model cannot run arbitrary searches or updates. It can only ask the questions I wrote endpoints for.

What the agent is allowed to do

  • Read freely. Search transactions, read a vendor record, pull a budget line. These calls are safe and cheap.
  • Propose, not commit. For a bank line, the agent returns its best match and a confidence score. For a purchase order, it returns a recommendation and the reasons behind it.
  • Write only behind a gate. Matches above a confidence threshold and purchase orders that pass every check go through automatically. Everything else lands in a review queue on the dashboard with the agent's reasoning attached.

The gate is the whole design. The agent is good at the first pass. The person is good at the judgement call. Neither does the other's job.

Lessons that stuck

Narrow tools beat clever prompts. Early on I tried one flexible search tool and a long prompt explaining how to use it. The model found creative ways to misuse it. Replacing it with six boring, specific tools removed most of the bad behaviour without touching the prompt.

Return structured data, not prose. RESTlets should return JSON with fixed fields. When a tool returned a human-readable summary, the model sometimes reasoned about the summary instead of the data.

Log every action, in NetSuite. Each agent decision is written to a custom record with the inputs, the output, and the confidence. That record is what the dashboard reads, and it is what an auditor would ask for.

Respect governance. RESTlets have usage limits. The agent batches its reads and never loops over records one at a time. A tool that can time out is a tool the model will eventually call in a loop.

Start with reads. The first version wrote nothing. It only proposed matches and people accepted or rejected them on the dashboard. That gave the team a few weeks to see the agent's judgement before it was allowed to act on its own.

Where to start

Pick one task where most cases are obvious and a person still reviews all of them. Write two or three RESTlets that answer the questions a reviewer would ask. Put a model in front of them in read-only mode and show the proposals in a list. If the proposals are right often enough that the reviewers start trusting them, add the gate and let the easy ones through.

That is the entire method. The tooling changes every few months. The shape of the problem does not.

← All notes Talk about a project