Skip to main content
Version: SDK ยท v1.1.0

Quickstart

Install the ERPBridge SDK, connect to ERPBridge Server, and call a tool by its exact registered name.

Installโ€‹

npm install @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.tools is a lazy proxy over the MCP tools/list result. 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:

ErrorWhen
AuthenticationErrorThe server rejected the request as unauthenticated
AuthorizationErrorThe server rejected the request as unauthorized
NotFoundErrorUnknown tool or resource
RateLimitErrorHTTP 429, carries retryAfter
ClientErrorOther HTTP 4xx, carries status and body
ServerErrorHTTP 5xx, carries status and body
ProtocolErrorProtocol 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โ€‹