Skip to main content
Glama

Xero MCP Server

Official
list-xero-contacts.handler.ts1.24 kB
import { xeroClient } from "../clients/xero-client.js"; import { Contact } from "xero-node"; import { XeroClientResponse } from "../types/tool-response.js"; import { formatError } from "../helpers/format-error.js"; import { getClientHeaders } from "../helpers/get-client-headers.js"; async function getContacts(page?: number, searchTerm?: string): Promise<Contact[]> { await xeroClient.authenticate(); const contacts = await xeroClient.accountingApi.getContacts( xeroClient.tenantId, undefined, // ifModifiedSince undefined, // where undefined, // order undefined, // iDs page, // page undefined, // includeArchived true, // summaryOnly searchTerm, // searchTerm undefined, // pageSize getClientHeaders(), ); return contacts.body.contacts ?? []; } /** * List all contacts from Xero */ export async function listXeroContacts(page?: number, searchTerm?: string): Promise< XeroClientResponse<Contact[]> > { try { const contacts = await getContacts(page, searchTerm); return { result: contacts, isError: false, error: null, }; } catch (error) { return { result: null, isError: true, error: formatError(error), }; } }

Latest Blog Posts

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