Skip to main content
Glama

Xero MCP Server

Official
MIT License
293
128
  • Apple
  • Linux
create-xero-tracking-option.handler.ts1.36 kB
import { xeroClient } from "../clients/xero-client.js"; import { XeroClientResponse } from "../types/tool-response.js"; import { formatError } from "../helpers/format-error.js"; import { getClientHeaders } from "../helpers/get-client-headers.js"; import { TrackingOption } from "xero-node"; async function createTrackingOption( trackingCategoryId: string, name: string ): Promise<TrackingOption | undefined> { xeroClient.authenticate(); const response = await xeroClient.accountingApi.createTrackingOptions( xeroClient.tenantId, trackingCategoryId, { name: name }, undefined, // idempotencyKey getClientHeaders() ); const createdTrackingOption = response.body.options?.[0]; return createdTrackingOption; } export async function createXeroTrackingOptions( trackingCategoryId: string, optionNames: string[] ): Promise<XeroClientResponse<TrackingOption[]>> { try { const createdOptions = await Promise.all( optionNames.map(async optionName => await createTrackingOption(trackingCategoryId, optionName)) ); return { result: createdOptions .filter(Boolean) .map(option => option as TrackingOption), isError: false, error: null }; } catch (error) { return { result: null, isError: true, error: formatError(error) }; } }

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/XeroAPI/xero-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server