Xero Mcp 服务器
概览
什么是 xero-mcp-server?
xero-mcp-server 是一个与模型上下文协议(MCP)集成的服务器实现。该服务器允许开发人员构建能够有效通信的应用程序,利用 MCP 促进不同系统之间的数据交换和交互。MCP 旨在提供一种标准化的方式,使应用程序能够共享上下文和数据,从而更容易开发互联服务。
xero-mcp-server 的特点
- 与 MCP 集成:该服务器旨在与模型上下文协议无缝集成,确保开发人员的兼容性和易用性。
- 公共代码库:xero-mcp-server 作为公共代码库提供,允许开发人员访问源代码、贡献和协作改进。
- MIT 许可证:该项目采用 MIT 许可证,允许免费使用、修改和分发软件。
- 活跃社区:随着越来越多的星标和分支,xero-mcp-server 拥有一个活跃的社区,为其开发和支持做出贡献。
如何使用 xero-mcp-server
-
克隆代码库:首先,通过以下命令从 GitHub 克隆 xero-mcp-server 代码库到本地机器:
git clone https://github.com/XeroAPI/xero-mcp-server.git
-
安装依赖:导航到项目目录并安装任何必要的依赖。这通常涉及运行:
npm install
-
运行服务器:安装依赖后,可以使用以下命令启动服务器:
npm start
-
与您的应用程序集成:使用服务器的 API 将其与您的应用程序集成,遵循代码库中提供的文档。
-
贡献:如果您想为该项目做出贡献,请随意分叉代码库,进行更改并提交拉取请求。
常见问题解答
什么是模型上下文协议(MCP)?
模型上下文协议(MCP)是一种旨在促进应用程序之间共享上下文和数据的协议。它为不同系统之间的通信提供了一种标准化的方式,使开发互联服务变得更加容易。
xero-mcp-server 是免费使用的吗?
是的,xero-mcp-server 采用 MIT 许可证,允许免费使用、修改和分发。
我如何为 xero-mcp-server 项目做出贡献?
您可以通过分叉代码库、进行更改并提交拉取请求来贡献。社区欢迎增强服务器功能和可用性的贡献。
我在哪里可以找到 xero-mcp-server 的文档?
xero-mcp-server 的文档通常可以在代码库的 README 文件中或代码库内的专用文档文件夹中找到。
我如何报告 xero-mcp-server 中的问题或错误?
您可以通过导航到 xero-mcp-server GitHub 代码库的“问题”部分,提交一个新问题并详细说明您遇到的问题来报告问题或错误。
详情
Xero MCP Server
This is a Model Context Protocol (MCP) server implementation for Xero. It provides a bridge between the MCP protocol and Xero's API, allowing for standardized access to Xero's accounting and business features.
Features
- Xero OAuth2 authentication with custom connections
- Contact management
- Chart of Accounts management
- Invoice creation and management
- MCP protocol compliance
Prerequisites
- Node.js (v18 or higher)
- npm or pnpm
- A Xero developer account with API credentials
Docs and Links
- Xero Public API Documentation
- Xero API Explorer
- Xero OpenAPI Specs
- Xero-Node Public API SDK Docs
- Developer Documentation
Setup
Create a Xero Account
If you don't already have a Xero account and organisation already, can create one by signing up here using the free trial.
We recommend using a Demo Company to start with because it comes with some pre-loaded sample data. Once you are logged in, switch to it by using the top left-hand dropdown and selecting "Demo Company". You can reset the data on a Demo Company, or change the country, at any time by using the top left-hand dropdown and navigating to My Xero.
NOTE: To use Payroll-specific queries, the region should be either NZ or UK.
Authentication
There are 2 modes of authentication supported in the Xero MCP server:
1. Custom Connections
This is a better choice for testing and development which allows you to specify client id and secrets for a specific organisation. It is also the recommended approach if you are integrating this into 3rd party MCP clients such as Claude Desktop.
Configuring your Xero Developer account
Set up a Custom Connection following these instructions: https://developer.xero.com/documentation/guides/oauth2/custom-connections/
Currently the following scopes are required for all sessions: scopes
Integrating the MCP server with Claude Desktop
To add the MCP server to Claude go to Settings > Developer > Edit config and add the following to your claude_desktop_config.json file:
{
"mcpServers": {
"xero": {
"command": "npx",
"args": ["-y", "@xeroapi/xero-mcp-server@latest"],
"env": {
"XERO_CLIENT_ID": "your_client_id_here",
"XERO_CLIENT_SECRET": "your_client_secret_here"
}
}
}
}
NOTE: If you are using Node Version Manager "command": "npx"
section change it to be the full path to the executable, ie: your_home_directory/.nvm/versions/node/v22.14.0/bin/npx
on Mac / Linux or "your_home_directory\\.nvm\\versions\\node\\v22.14.0\\bin\\npx"
on Windows
2. Bearer Token
This is a better choice if you are to support multiple Xero accounts at runtime and allow the MCP client to execute an auth flow (such as PKCE) as required. In this case, use the following configuration:
{
"mcpServers": {
"xero": {
"command": "npx",
"args": ["-y", "@xeroapi/xero-mcp-server@latest"],
"env": {
"XERO_CLIENT_BEARER_TOKEN": "your_bearer_token"
}
}
}
}
NOTE: The XERO_CLIENT_BEARER_TOKEN
will take precedence over the XERO_CLIENT_ID
if defined.
Available MCP Commands
list-accounts
: Retrieve a list of accountslist-contacts
: Retrieve a list of contacts from Xerolist-credit-notes
: Retrieve a list of credit noteslist-invoices
: Retrieve a list of invoiceslist-items
: Retrieve a list of itemslist-organisation-details
: Retrieve details about an organisationlist-profit-and-loss
: Retrieve a profit and loss reportlist-quotes
: Retrieve a list of quoteslist-tax-rates
: Retrieve a list of tax rateslist-payments
: Retrieve a list of paymentslist-trial-balance
: Retrieve a trial balance reportlist-profit-and-loss
: Retrieve a profit and loss reportlist-bank-transactions
: Retrieve a list of bank account transactionslist-payroll-employees
: Retrieve a list of Payroll Employeeslist-report-balance-sheet
: Retrieve a balance sheet reportlist-payroll-employee-leave
: Retrieve a Payroll Employee's leave recordslist-payroll-employee-leave-balances
: Retrieve a Payroll Employee's leave balanceslist-payroll-employee-leave-types
: Retrieve a list of Payroll leave typeslist-payroll-leave-periods
: Retrieve a list of a Payroll Employee's leave periodslist-payroll-leave-types
: Retrieve a list of all avaliable leave types in Xero Payrolllist-aged-receivables-by-contact
: Retrieves aged receivables for a contactlist-aged-payables-by-contact
: Retrieves aged payables for a contactlist-contact-groups
: Retrieve a list of contact groupscreate-contact
: Create a new contactcreate-credit-note
: Create a new credit notecreate-invoice
: Create a new invoicecreate-payment
: Create a new paymentcreate-quote
: Create a new quotecreate-credit-note
: Create a new credit notecreate-payroll-timesheet
: Create a new Payroll Timesheetupdate-contact
: Update an existing contactupdate-invoice
: Update an existing draft invoiceupdate-quote
: Update an existing draft quoteupdate-credit-note
: Update an existing draft credit noteupdate-payroll-timesheet-line
: Update a line on an existing Payroll Timesheetapprove-payroll-timesheet
: Approve a Payroll Timesheetrevert-payroll-timesheet
: Revert an approved Payroll Timesheetadd-payroll-timesheet-line
: Add new line on an existing Payroll Timesheetdelete-payroll-timesheet
: Delete an existing Payroll Timesheetget-payroll-timesheet
: Retrieve an existing Payroll Timesheet
For detailed API documentation, please refer to the MCP Protocol Specification.
For Developers
Installation
### Using npm
npm install
### Using pnpm
pnpm install
Run a build
### Using npm
npm run build
### Using pnpm
pnpm build
Integrating with Claude Desktop
To link your Xero MCP server in development to Claude Desktop go to Settings > Developer > Edit config and add the following to your claude_desktop_config.json
file:
NOTE: For Windows ensure the args
path escapes the \
between folders ie. "C:\\projects\xero-mcp-server\\dist\\index.js"
{
"mcpServers": {
"xero": {
"command": "node",
"args": ["insert-your-file-path-here/xero-mcp-server/dist/index.js"],
"env": {
"XERO_CLIENT_ID": "your_client_id_here",
"XERO_CLIENT_SECRET": "your_client_secret_here"
}
}
}
}
License
MIT
Security
Please do not commit your .env
file or any sensitive credentials to version control (it is included in .gitignore
as a safe default.)
Server配置
{
"mcpServers": {
"xero-mcp-server": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"ghcr.io/metorial/mcp-container--xeroapi--xero-mcp-server--xero-mcp-server",
"node ./dist/index.js"
],
"env": {
"XERO_CLIENT_ID": "xero-client-id",
"XERO_CLIENT_SECRET": "xero-client-secret"
}
}
}
}