Quickstart
Install the ERPBridge SDK, connect to ERPBridge Server, and call a tool by its exact registered name.
Installโ
- npm
- pnpm
npm install @erpbridge/sdk
pnpm add @erpbridge/sdk
First tool callโ
import { createClient } from '@erpbridge/sdk'
const client = createClient({ baseUrl: 'http://localhost:8080' })
await client.mcp.connect()
const result = await client.tools.list_employees({ department: 'engineering' })
console.log(result.content)
This flow creates the client, connects the MCP session, calls a tool by its exact registered name, and reads the result.
client.toolsis a lazy proxy over the MCPtools/listresult. Each property is a registered tool with its exact name. Tool calls validate their arguments against the tool input schema before they leave the client.- Call
client.close()when the application finishes to close the MCP session.
Errors are typedโ
Every failure is an ErpbridgeError subclass:
| Error | When |
|---|---|
AuthenticationError | The server rejected the request as unauthenticated |
AuthorizationError | The server rejected the request as unauthorized |
NotFoundError | Unknown tool or resource |
RateLimitError | HTTP 429, carries retryAfter |
ClientError | Other HTTP 4xx, carries status and body |
ServerError | HTTP 5xx, carries status and body |
ProtocolError | Protocol or session failure, carries a numeric code |
import { ErpbridgeError, NotFoundError } from '@erpbridge/sdk'
try {
await client.tools.list_employees({})
} catch (error) {
if (error instanceof NotFoundError) {
console.error(`tool missing: ${error.message}`)
} else if (error instanceof ErpbridgeError) {
console.error(`erpbridge: ${error.message}`)
}
}
Next stepsโ
- MCP tools โ the MCP client and tool proxy
- Logs and metrics โ log streaming, metrics, health, and cache