A Model Context Protocol (MCP) server that enables AI agents to access FlexPrice invoice and customer data efficiently.
-
getCustomers
- Get all customers
- Returns: List of customers with their IDs and information
-
getCustomerById
- Get a customer by ID
- Required inputs:
customerId
(string): The ID of the customer to retrieve
- Returns: Customer details including subscriptions
-
getCustomerByLookupKey
- Get a customer by lookup key (external ID)
- Required inputs:
lookupKey
(string): The lookup key (external ID) of the customer
- Returns: Customer details
-
getCustomerSubscriptions
- Get a customer's subscriptions
- Required inputs:
customerId
(string): The ID of the customer
- Returns: List of subscriptions for the customer
-
getCustomerEntitlements
- Get a customer's entitlements
- Required inputs:
customerId
(string): The ID of the customer
- Returns: List of entitlements for the customer
-
getCustomerUsageSummary
- Get a customer's usage summary
- Required inputs:
customerId
(string): The ID of the customer
- Returns: Usage summary for the customer
-
getPlans
- Get all plans
- Returns: List of plans with their IDs and information
-
getPlanById
- Get a plan by ID
- Required inputs:
planId
(string): The ID of the plan to retrieve
- Returns: Plan details
-
getPrices
- Get all prices
- Returns: List of prices with their IDs and information
-
getPriceById
- Get a price by ID
- Required inputs:
priceId
(string): The ID of the price to retrieve
- Returns: Price details
-
getSubscriptions
- Get all subscriptions
- Returns: List of subscriptions with their IDs and information
-
getSubscriptionById
- Get a subscription by ID
- Required inputs:
subscriptionId
(string): The ID of the subscription to retrieve
- Returns: Subscription details
-
getSubscriptionUsage
- Get usage for a subscription
- Required inputs:
subscriptionId
(string): The ID of the subscription
- Returns: Usage details for the subscription
-
getSubscriptionPauses
- Get all pauses for a subscription
- Required inputs:
subscriptionId
(string): The ID of the subscription
- Returns: List of pauses for the subscription
-
getWalletById
- Get a wallet by ID
- Required inputs:
walletId
(string): The ID of the wallet to retrieve
- Returns: Wallet details
-
getWalletBalance
- Get the real-time balance of a wallet
- Required inputs:
walletId
(string): The ID of the wallet
- Returns: Balance and currency information
-
getWalletTransactions
- Get transactions for a wallet with pagination
- Required inputs:
walletId
(string): The ID of the wallet
- Optional inputs:
limit
(number): Maximum number of transactions to returnoffset
(number): Number of transactions to skip for pagination
- Returns: List of wallet transactions
-
getWalletsByCustomerId
- Get all wallets for a customer
- Required inputs:
customerId
(string): The ID of the customer
- Returns: List of wallets for the customer
-
getInvoiceById
- Get an invoice by its ID
- Required inputs:
invoiceId
(string): The ID of the invoice to retrieve
- Returns: Invoice details
-
getInvoiceByNumber
- Get an invoice by its number
- Required inputs:
invoiceNumber
(string): The invoice number to retrieve
- Returns: Invoice details
-
getInvoices
- Get invoices with optional filtering
- Optional inputs:
startDate
(string): ISO format date string for filtering from this dateendDate
(string): ISO format date string for filtering until this datestatus
(string): Filter invoices by statuslimit
(number): Maximum number of invoices to returnoffset
(number): Number of invoices to skip for pagination
- Returns: List of invoices matching the filters
-
getInvoicesByCustomerId
- Get all invoices for a specific customer
- Required inputs:
customerId
(string): The ID of the customer
- Returns: List of invoices for the customer
-
getPaymentById
- Get a payment by ID
- Required inputs:
paymentId
(string): The ID of the payment to retrieve
- Returns: Payment details
-
getPayments
- Get payments with optional filtering
- Optional inputs:
customerId
(string): Filter payments by customer IDstatus
(string): Filter payments by status (pending, processed, failed)limit
(number): Maximum number of payments to returnoffset
(number): Number of payments to skip for pagination
- Returns: List of payments matching the filters
getEventsByCustomer
- Get events for a customer
- Required inputs:
externalCustomerId
(string): External ID of the customer
- Optional inputs:
iterFirstKey
(string): Pagination first keyiterLastKey
(string): Pagination last keystartTime
(string): Start time for filtering eventsendTime
(string): End time for filtering events
- Returns: Events for the customer
- Invoice data access
- Get invoice by ID
- Customer data access
- Get customer subscriptions
- Event data access
- Get events by customer
- Get usage statistics for events
- Node.js (v14 or higher)
- npm or yarn
- TypeScript
- FlexPrice API key (obtained from your FlexPrice account)
- Clone the repository:
git clone <repository-url>
cd flexprice-mcp-server
- Install dependencies:
npm install
- Create a
.env
file in the project root with your FlexPrice API credentials:
API_KEY=your_api_key_here
BASE_URL=https://api.cloud.flexprice.io
- Build the project:
npm run build
- Start the server:
npm start
For development with automatic reloading:
npm run dev
- Clone the repository:
git clone <repository-url>
cd flexprice-mcp-server
- Build the Docker image:
docker build -t flexprice-mcp .
- Run the Docker container with your API credentials:
docker run -i -e API_KEY=your_api_key_here -e BASE_URL=https://api.cloud.flexprice.io flexprice-mcp
Add the following to your claude_desktop_config.json
:
First, clone the repository:
git clone <repository-url>
cd flexprice-mcp-server
Then, build the project:
npm run build
Then, add the following to your claude_desktop_config.json
:
{
"mcpServers": {
"flexprice": {
"command": "node",
"args": ["/absolute/path/to/cloned/flexprice-mcp-server/dist/server.js"],
"env": {
"API_KEY": "your_api_key_here",
"BASE_URL": "https://api.cloud.flexprice.io"
}
}
}
}
{
"mcpServers": {
"flexprice": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"API_KEY",
"-e",
"BASE_URL",
"flexprice-mcp"
],
"env": {
"API_KEY": "your_api_key_here",
"BASE_URL": "https://api.cloud.flexprice.io"
}
}
}
}
If you encounter issues with the FlexPrice MCP server, try these troubleshooting steps:
-
Verify API Credentials: Ensure your API key and base URL are correct. You can verify this by:
- Checking the
.env
file for local setup - Verifying environment variables for Docker setup
- Testing the key directly against the FlexPrice API
- Checking the
-
Network Connectivity: Confirm that your server can reach the FlexPrice API endpoints:
curl -H "x-api-key: your_api_key_here" https://api.cloud.flexprice.io/customers
-
Rate Limiting: If you're getting rate limit errors, reduce the frequency of requests or contact FlexPrice support to increase your rate limits.
-
Port Conflicts: If you see an error about port 3000 being in use, you can:
- Change the port in your configuration
- Stop the process using that port:
lsof -i :3000
thenkill -9 PID
-
Missing Dependencies: If you get errors about missing modules:
npm install npm run build
-
Permission Issues: Ensure the proper file permissions:
chmod +x dist/server.js
-
Docker Build Failures:
- Check Docker installation:
docker --version
- Ensure your Docker daemon is running
- Try rebuilding with the
--no-cache
flag
- Check Docker installation:
-
Container Exit: If the container stops unexpectedly:
docker logs $(docker ps -lq)
-
Environment Variables: Verify environment variables are being passed correctly:
docker run -it --rm flexprice-mcp printenv
The project uses Jest for unit testing. The tests are organized to mirror the source code structure:
src/
├── __tests__/ # All test files
│ ├── services/ # Tests for service classes
│ ├── mcp/ # Tests for MCP components
│ │ ├── handlers/ # Tests for MCP handlers
│ │ └── tools/ # Tests for MCP tools
│ └── utils/ # Tests for utility functions
To run the tests:
# Run all tests
npm test
# Run tests in watch mode (for development)
npm run test:watch
# Run tests with coverage report
npm run test:coverage
# Run tests in CI mode
npm run test:ci
For more detailed information about the testing approach and best practices, see the Testing Guide.
This project is licensed under the Apache License 2.0.