Billy MCP Server
Integrates Billy's accounting system with MCP, providing tools to manage invoices, contacts, products, payments, and more via natural language.
README
Billy MCP Server
A Model Context Protocol (MCP) server for integrating with Billy's accounting system. This server provides tools to interact with Billy's REST API for managing invoices, contacts, products, payments, and other accounting data.
Features
- Contact Management: Create, read, update, and list contacts
- Invoice Management: Create, read, and list invoices with line items
- Product Management: Create, read, and list products with pricing
- Payment Processing: Create payments to mark invoices as paid
- Bill Management: List and manage vendor bills
- Account Management: Access chart of accounts
- Organization Info: Get organization details
Prerequisites
- Node.js 18 or higher
- Billy account with API access
- Billy API access token
Installation
- Clone or download the server code
- Install dependencies:
npm install - Build the TypeScript code:
npm run build
Configuration
Getting a Billy API Token
- Log into your Billy account
- Go to Settings → Access tokens
- Create a new access token
- Copy the token for use in the environment variable
Environment Variables
Set the following environment variable:
export BILLY_ACCESS_TOKEN="your_billy_access_token_here"
MCP Client Configuration
Add the server to your MCP client configuration. For Claude Desktop, add this to your claude_desktop_config.json:
{
"mcpServers": {
"billy": {
"command": "node",
"args": ["/path/to/billy-mcp-server/build/index.js"],
"env": {
"BILLY_ACCESS_TOKEN": "your_billy_access_token_here"
}
}
}
}
Available Tools
Organization
billy_get_organization- Get organization details
Contacts
billy_list_contacts- List contacts with optional filteringbilly_get_contact- Get a specific contact by IDbilly_create_contact- Create a new contactbilly_update_contact- Update an existing contact
Invoices
billy_list_invoices- List invoices with optional filteringbilly_get_invoice- Get a specific invoice by IDbilly_create_invoice- Create a new invoice with line items
Products
billy_list_products- List products with optional filteringbilly_get_product- Get a specific product by IDbilly_create_product- Create a new product with pricing
Payments
billy_list_bank_payments- List bank paymentsbilly_create_payment- Create a payment to mark invoices as paid
Bills
billy_list_bills- List vendor bills
Accounts
billy_list_accounts- List chart of accounts
Usage Examples
Create a Contact
// Using the billy_create_contact tool
{
"name": "Acme Corporation",
"type": "company",
"countryId": "DK",
"street": "Main Street 123",
"city": "Copenhagen",
"zipcode": "1000",
"phone": "+45 12 34 56 78",
"email": "contact@acme.com",
"isCustomer": true,
"paymentTermsDays": 30
}
Create an Invoice
// Using the billy_create_invoice tool
{
"contactId": "contact-id-here",
"entryDate": "2024-01-15",
"currencyId": "DKK",
"paymentTermsDays": 30,
"lines": [
{
"productId": "product-id-here",
"description": "Consulting services",
"quantity": 10,
"unitPrice": 1000
}
],
"state": "approved"
}
Create a Payment
// Using the billy_create_payment tool
{
"entryDate": "2024-01-20",
"cashAmount": 10000,
"cashSide": "debit",
"cashAccountId": "bank-account-id",
"associations": [
{
"subjectReference": "invoice:invoice-id-here"
}
]
}
API Documentation
For detailed information about Billy's API, visit: https://www.billy.dk/api
Development
Running in Development Mode
npm run dev
Building
npm run build
File Structure
src/
index.ts # Main server implementation
build/ # Compiled JavaScript output
package.json # Dependencies and scripts
tsconfig.json # TypeScript configuration
README.md # This file
Error Handling
The server includes comprehensive error handling for:
- Invalid API tokens
- Network connectivity issues
- Invalid request parameters
- Billy API errors
All errors are returned with descriptive messages to help with debugging.
Supported Billy API Features
This MCP server supports the core Billy API functionality including:
- ✅ Organization management
- ✅ Contact management (customers/suppliers)
- ✅ Invoice creation and management
- ✅ Product catalog management
- ✅ Payment processing
- ✅ Bill management (vendor invoices)
- ✅ Chart of accounts access
- ✅ Pagination and filtering
- ✅ Related data inclusion (sideloading/embedding)
- ✅ Error handling and validation
Limitations
- Authentication is limited to access tokens (OAuth not yet supported by Billy)
- Some advanced features like late fees, reminders, and attachments are not yet implemented
- Bank line matching and daybook transactions are not included in this version
Security Considerations
- Store your Billy access token securely
- Use environment variables rather than hardcoding tokens
- Tokens in Billy don't expire but can be revoked from the Billy interface
- Each token is tied to a specific organization
Contributing
To extend this MCP server:
- Add new tools to the
ListToolsRequestSchemahandler - Implement the corresponding API calls in the
BillyClientclass - Add the tool handling logic in the
CallToolRequestSchemahandler - Update this README with the new functionality
Adding a New Tool Example
// 1. Add to tools list
{
name: "billy_new_feature",
description: "Description of the new feature",
inputSchema: {
type: "object",
properties: {
// Define parameters
},
},
}
// 2. Add to BillyClient class
async newFeature(params: any): Promise<any> {
return this.request("GET", "/new-endpoint", params);
}
// 3. Add to request handler
case "billy_new_feature":
const result = await billyClient.newFeature(args);
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
Troubleshooting
Common Issues
-
"BILLY_ACCESS_TOKEN environment variable is required"
- Make sure you've set the environment variable correctly
- Check that your MCP client configuration includes the env section
-
"Billy API Error: 401"
- Your access token is invalid or has been revoked
- Generate a new token from Billy's interface
-
"Billy API Error: 403"
- Your token doesn't have permission for the requested operation
- Check that you're using a company token, not a user token for certain operations
-
"Billy API Error: 404"
- The requested resource (invoice, contact, etc.) doesn't exist
- Check that you're using the correct ID
-
"Billy API Error: 422"
- Invalid data in your request
- Check required fields and data formats (especially dates: YYYY-MM-DD)
Debug Mode
To enable more detailed logging, you can modify the server to log requests:
// Add to the request method in BillyClient
console.error(`Making ${method} request to ${url}`, data);
License
MIT License - feel free to modify and distribute as needed.
Support
For Billy API questions, contact: dev@billy.dk For MCP server issues, please create an issue in your repository.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。