Remote MCP server for read-only Xero access, deployed on Cloudflare Workers.
- Federated one-shot auth for connector setup (
/authorizeredirects directly to Xero). - MCP endpoint secured with
@cloudflare/workers-oauth-provider. - Durable Object-backed auth state with encrypted token storage.
- Cross-chat/session identity continuity via Xero principal ID.
- Read-only finance/reporting toolset for accountant workflows.
Scope reference: SCOPES.md
- Connector setup flow:
/authorize-> Xero consent ->/callback-> OAuth completion ->/mcp. - Ongoing auth expansion:
add_xero_organisationtriggers extra tenant consent later. - Durable Objects:
MCP_OBJECTfor MCP session/runtime behavior.AUTH_STOREfor principal auth records and pending OAuth handoff state.
- MCP:
https://<worker-name>.<subdomain>.workers.dev/mcp - Health:
https://<worker-name>.<subdomain>.workers.dev/health - OAuth authorize:
https://<worker-name>.<subdomain>.workers.dev/authorize - OAuth callback:
https://<worker-name>.<subdomain>.workers.dev/callback
Prerequisites:
- Node.js 20+
- Cloudflare account with Wrangler auth
- Xero OAuth app with callback set to
https://<worker-name>.<subdomain>.workers.dev/callback
Install and run locally:
npm install
cp .dev.vars.example .dev.vars
npm run devValidation commands:
npm run type-check
npm run test
curl -i http://localhost:8787/healthSet secrets once per environment:
npx wrangler secret put XERO_CLIENT_ID
npx wrangler secret put XERO_CLIENT_SECRET
npx wrangler secret put TOKEN_ENCRYPTION_KEYDeploy:
npx wrangler deployWhen helping users set up this repo, follow this exact order:
- Install dependencies with
npm install. - Copy
.dev.vars.exampleto.dev.vars. - Ask the user to provide values for
XERO_CLIENT_ID,XERO_CLIENT_SECRET, andTOKEN_ENCRYPTION_KEY. - Run
npm run type-checkandnpm run testbefore starting dev/deploy steps. - Start local dev with
npm run dev. - For deployment, ensure Wrangler auth works, then run
npx wrangler deploy.
Rules for LLM agents:
- Never invent or hardcode credentials.
- Never commit
.dev.varsor real secrets. - Keep
wrangler.jsoncplaceholders intact in public branches.
- Add your MCP URL in client settings.
- Complete Xero consent in browser.
- In chat, run
auth_statusorlist_tenants. - Use
switch_tenantto choose an active org. - Run read-only tools.
- Some Xero endpoints may be entitlement-gated by app/account tier.
- This project is intentionally read-only for safety.
- Scope bundle and tool mapping:
SCOPES.md - Security policy:
SECURITY.md - Contribution guide:
CONTRIBUTING.md