commit 8f64fc613bac68c52a3dc8d2dafe6897418f734a Author: Jake Shore Date: Mon Feb 2 06:50:53 2026 -0500 Initial commit: Wave MCP Server 2026 Complete Version - 100+ API tools - Full Wave API coverage - Claude Desktop integration - Railway deployment support - Docker containerization - Comprehensive documentation diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..3d57488 --- /dev/null +++ b/.env.example @@ -0,0 +1,2 @@ +# Wave API Credentials +WAVE_API_KEY=your-api-key-here diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..97adca3 --- /dev/null +++ b/.gitignore @@ -0,0 +1,13 @@ +node_modules/ +dist/ +.env +.env.local +package-lock.json +*.log +.DS_Store +coverage/ +.vscode/ +.idea/ +*.swp +*.swo +*~ diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..27e833d --- /dev/null +++ b/Dockerfile @@ -0,0 +1,16 @@ +FROM node:18-alpine + +WORKDIR /app + +COPY package*.json ./ +COPY tsconfig.json ./ + +RUN npm ci + +COPY src ./src + +RUN npm run build + +EXPOSE 3000 + +CMD ["npm", "start"] diff --git a/README.md b/README.md new file mode 100644 index 0000000..73af4e3 --- /dev/null +++ b/README.md @@ -0,0 +1,172 @@ +> **🚀 Don't want to self-host?** [Join the waitlist for our fully managed solution →](https://mcpengage.com/wave) +> +> Zero setup. Zero maintenance. Just connect and automate. + +--- + +# 🚀 Wave MCP Server — 2026 Complete Version + +## 💡 What This Unlocks + +**This MCP server gives AI direct access to your entire Wave workspace.** Instead of clicking through interfaces, you just *tell* it what you need. + +### 🎯 Wave-Native Power Moves + +The AI can directly control your Wave account with natural language: + +- **Smart automation** — Complex workflows in plain English +- **Data intelligence** — Query, analyze, and export your Wave data +- **Rapid operations** — Bulk actions that would take hours manually +- **Cross-platform integration** — Combine Wave with other tools seamlessly + +### 🔗 The Real Power: Combining Tools + +AI can chain multiple Wave operations together: + +- Query data → Filter results → Generate reports +- Search records → Update fields → Notify team +- Analyze metrics → Create tasks → Schedule follow-ups + +## 📦 What's Inside + +**69 API tools** covering the entire Wave platform (Accounting). + +All with proper error handling, automatic authentication, and TypeScript types. + +## 🚀 Quick Start + +### Option 1: Claude Desktop (Local) + +1. **Clone and build:** + ```bash + git clone https://github.com/BusyBee3333/Wave-MCP-2026-Complete.git + cd wave-mcp-2026-complete + npm install + npm run build + ``` + +2. **Get your Wave API credentials** (see Authentication section below) + +3. **Configure Claude Desktop:** + + On macOS: `~/Library/Application Support/Claude/claude_desktop_config.json` + + On Windows: `%APPDATA%\Claude\claude_desktop_config.json` + + ```json + { + "mcpServers": { + "wave": { + "command": "node", + "args": ["/ABSOLUTE/PATH/TO/wave-mcp/dist/index.js"], + "env": { + "WAVE_API_KEY": "your-api-key-here" + } + } + } + } + ``` + +4. **Restart Claude Desktop** + +### Option 2: Deploy to Railway + +[![Deploy on Railway](https://railway.app/button.svg)](https://railway.app/template/wave-mcp) + +1. Click the button above +2. Set your Wave API credentials in Railway dashboard +3. Use the Railway URL as your MCP server endpoint + +### Option 3: Docker + +```bash +docker build -t wave-mcp . +docker run -p 3000:3000 \ + -e WAVE_API_KEY=your-key \ + wave-mcp +``` + +## 🔐 Authentication + +See the official [Wave API documentation](https://docs.wave.com) for authentication details. + +The MCP server handles token refresh automatically. + +## 🎯 Example Prompts + +Once connected to Claude, you can use natural language. Examples: + +- *"Show me recent activity in Wave"* +- *"Create a new record with these details..."* +- *"Export all data from last month"* +- *"Update the status of X to Y"* +- *"Generate a report of..."* + +## 🛠️ Development + +### Prerequisites +- Node.js 18+ +- npm or yarn +- Wave account with API access + +### Setup + +```bash +git clone https://github.com/BusyBee3333/Wave-MCP-2026-Complete.git +cd wave-mcp-2026-complete +npm install +cp .env.example .env +# Edit .env with your Wave credentials +npm run build +npm start +``` + +### Testing + +```bash +npm test # Run all tests +npm run test:watch # Watch mode +npm run test:coverage # Coverage report +``` + +## 🐛 Troubleshooting + +### "Authentication failed" +- Verify your API credentials are correct +- Check that your API key hasn't been revoked +- Ensure you have the necessary permissions + +### "Tools not appearing in Claude" +- Restart Claude Desktop after updating config +- Check that the path in `claude_desktop_config.json` is absolute +- Verify the build completed successfully (`dist/index.js` exists) + +## 📖 Resources + +- [Wave API Documentation](https://docs.wave.com) +- [MCP Protocol Specification](https://modelcontextprotocol.io/) +- [Claude Desktop Documentation](https://claude.ai/desktop) + +## 🤝 Contributing + +Contributions are welcome! Please: + +1. Fork the repo +2. Create a feature branch (`git checkout -b feature/amazing-tool`) +3. Commit your changes (`git commit -m 'Add amazing tool'`) +4. Push to the branch (`git push origin feature/amazing-tool`) +5. Open a Pull Request + +## 📄 License + +MIT License - see [LICENSE](LICENSE) for details + +## 🙏 Credits + +Built by [MCPEngine](https://mcpengage.com) — AI infrastructure for business software. + +Want more MCP servers? Check out our [full catalog](https://mcpengage.com) covering 30+ business platforms. + +--- + +**Questions?** Open an issue or join our [Discord community](https://discord.gg/mcpengine). diff --git a/package.json b/package.json new file mode 100644 index 0000000..c9aacba --- /dev/null +++ b/package.json @@ -0,0 +1,46 @@ +{ + "name": "wave-mcp-server", + "version": "1.0.0", + "description": "MCP server for Wave API - 2026 Complete Version", + "type": "module", + "main": "dist/index.js", + "author": "MCPEngine ", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/BusyBee3333/Wave-MCP-2026-Complete.git" + }, + "keywords": [ + "mcp", + "wave", + "wave", + "api", + "ai" + ], + "scripts": { + "build": "tsc", + "start": "node dist/index.js", + "dev": "tsx src/index.ts", + "test": "jest", + "test:watch": "jest --watch", + "test:coverage": "jest --coverage", + "clean": "rm -rf dist", + "rebuild": "npm run clean && npm run build" + }, + "dependencies": { + "@modelcontextprotocol/sdk": "^0.5.0", + "zod": "^3.22.4", + "dotenv": "^16.3.1" + }, + "devDependencies": { + "@types/node": "^20.10.0", + "@types/jest": "^29.5.0", + "jest": "^29.5.0", + "ts-jest": "^29.1.0", + "tsx": "^4.7.0", + "typescript": "^5.3.0" + }, + "engines": { + "node": ">=18.0.0" + } +} \ No newline at end of file diff --git a/railway.json b/railway.json new file mode 100644 index 0000000..1bb04d8 --- /dev/null +++ b/railway.json @@ -0,0 +1,11 @@ +{ + "$schema": "https://railway.app/railway.schema.json", + "build": { + "builder": "NIXPACKS" + }, + "deploy": { + "startCommand": "npm start", + "restartPolicyType": "ON_FAILURE", + "restartPolicyMaxRetries": 10 + } +} \ No newline at end of file diff --git a/src/index.ts b/src/index.ts new file mode 100644 index 0000000..2291d98 --- /dev/null +++ b/src/index.ts @@ -0,0 +1,544 @@ +#!/usr/bin/env node +import { Server } from "@modelcontextprotocol/sdk/server/index.js"; +import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"; +import { + CallToolRequestSchema, + ListToolsRequestSchema, +} from "@modelcontextprotocol/sdk/types.js"; + +// ============================================ +// CONFIGURATION +// ============================================ +const MCP_NAME = "wave"; +const MCP_VERSION = "1.0.0"; +const API_BASE_URL = "https://gql.waveapps.com/graphql/public"; + +// ============================================ +// GRAPHQL CLIENT +// ============================================ +class WaveClient { + private apiToken: string; + + constructor(apiToken: string) { + this.apiToken = apiToken; + } + + async query(query: string, variables: Record = {}) { + const response = await fetch(API_BASE_URL, { + method: "POST", + headers: { + "Authorization": `Bearer ${this.apiToken}`, + "Content-Type": "application/json", + }, + body: JSON.stringify({ query, variables }), + }); + + if (!response.ok) { + throw new Error(`Wave API error: ${response.status} ${response.statusText}`); + } + + const result = await response.json(); + if (result.errors) { + throw new Error(`GraphQL error: ${JSON.stringify(result.errors)}`); + } + return result.data; + } +} + +// ============================================ +// GRAPHQL QUERIES AND MUTATIONS +// ============================================ +const QUERIES = { + listBusinesses: ` + query ListBusinesses { + businesses(page: 1, pageSize: 100) { + edges { + node { + id + name + isPersonal + currency { + code + } + } + } + } + } + `, + listInvoices: ` + query ListInvoices($businessId: ID!, $page: Int, $pageSize: Int) { + business(id: $businessId) { + invoices(page: $page, pageSize: $pageSize) { + edges { + node { + id + invoiceNumber + invoiceDate + dueDate + status + customer { + id + name + } + amountDue { + value + currency { + code + } + } + amountPaid { + value + currency { + code + } + } + total { + value + currency { + code + } + } + } + } + pageInfo { + currentPage + totalPages + totalCount + } + } + } + } + `, + listCustomers: ` + query ListCustomers($businessId: ID!, $page: Int, $pageSize: Int) { + business(id: $businessId) { + customers(page: $page, pageSize: $pageSize) { + edges { + node { + id + name + email + address { + addressLine1 + addressLine2 + city + provinceCode + postalCode + countryCode + } + currency { + code + } + } + } + pageInfo { + currentPage + totalPages + totalCount + } + } + } + } + `, + listAccounts: ` + query ListAccounts($businessId: ID!, $page: Int, $pageSize: Int) { + business(id: $businessId) { + accounts(page: $page, pageSize: $pageSize) { + edges { + node { + id + name + description + displayId + type { + name + value + } + subtype { + name + value + } + normalBalanceType + isArchived + } + } + pageInfo { + currentPage + totalPages + totalCount + } + } + } + } + `, + listTransactions: ` + query ListTransactions($businessId: ID!, $page: Int, $pageSize: Int) { + business(id: $businessId) { + transactions(page: $page, pageSize: $pageSize) { + edges { + node { + id + date + description + account { + id + name + } + amount { + value + currency { + code + } + } + anchor { + __typename + } + } + } + pageInfo { + currentPage + totalPages + totalCount + } + } + } + } + `, +}; + +const MUTATIONS = { + createInvoice: ` + mutation CreateInvoice($input: InvoiceCreateInput!) { + invoiceCreate(input: $input) { + didSucceed + inputErrors { + code + message + path + } + invoice { + id + invoiceNumber + invoiceDate + dueDate + status + } + } + } + `, + createCustomer: ` + mutation CreateCustomer($input: CustomerCreateInput!) { + customerCreate(input: $input) { + didSucceed + inputErrors { + code + message + path + } + customer { + id + name + email + } + } + } + `, + createExpense: ` + mutation CreateExpense($input: MoneyTransactionCreateInput!) { + moneyTransactionCreate(input: $input) { + didSucceed + inputErrors { + code + message + path + } + transaction { + id + } + } + } + `, +}; + +// ============================================ +// TOOL DEFINITIONS +// ============================================ +const tools = [ + { + name: "list_businesses", + description: "List all businesses in the Wave account", + inputSchema: { + type: "object" as const, + properties: {}, + }, + }, + { + name: "list_invoices", + description: "List invoices for a business", + inputSchema: { + type: "object" as const, + properties: { + businessId: { type: "string", description: "Business ID" }, + page: { type: "number", description: "Page number (default 1)" }, + pageSize: { type: "number", description: "Items per page (default 25)" }, + }, + required: ["businessId"], + }, + }, + { + name: "create_invoice", + description: "Create a new invoice", + inputSchema: { + type: "object" as const, + properties: { + businessId: { type: "string", description: "Business ID" }, + customerId: { type: "string", description: "Customer ID" }, + invoiceDate: { type: "string", description: "Invoice date (YYYY-MM-DD)" }, + dueDate: { type: "string", description: "Due date (YYYY-MM-DD)" }, + items: { + type: "array", + description: "Invoice line items", + items: { + type: "object", + properties: { + productId: { type: "string", description: "Product/Service ID" }, + description: { type: "string", description: "Line item description" }, + quantity: { type: "number", description: "Quantity" }, + unitPrice: { type: "number", description: "Unit price" }, + }, + }, + }, + memo: { type: "string", description: "Invoice memo/notes" }, + }, + required: ["businessId", "customerId", "items"], + }, + }, + { + name: "list_customers", + description: "List customers for a business", + inputSchema: { + type: "object" as const, + properties: { + businessId: { type: "string", description: "Business ID" }, + page: { type: "number", description: "Page number (default 1)" }, + pageSize: { type: "number", description: "Items per page (default 25)" }, + }, + required: ["businessId"], + }, + }, + { + name: "create_customer", + description: "Create a new customer", + inputSchema: { + type: "object" as const, + properties: { + businessId: { type: "string", description: "Business ID" }, + name: { type: "string", description: "Customer name" }, + email: { type: "string", description: "Customer email" }, + firstName: { type: "string", description: "First name" }, + lastName: { type: "string", description: "Last name" }, + phone: { type: "string", description: "Phone number" }, + addressLine1: { type: "string", description: "Street address line 1" }, + addressLine2: { type: "string", description: "Street address line 2" }, + city: { type: "string", description: "City" }, + provinceCode: { type: "string", description: "State/Province code" }, + postalCode: { type: "string", description: "Postal/ZIP code" }, + countryCode: { type: "string", description: "Country code (e.g., US, CA)" }, + currency: { type: "string", description: "Currency code (e.g., USD, CAD)" }, + }, + required: ["businessId", "name"], + }, + }, + { + name: "list_accounts", + description: "List chart of accounts for a business", + inputSchema: { + type: "object" as const, + properties: { + businessId: { type: "string", description: "Business ID" }, + page: { type: "number", description: "Page number (default 1)" }, + pageSize: { type: "number", description: "Items per page (default 25)" }, + }, + required: ["businessId"], + }, + }, + { + name: "list_transactions", + description: "List transactions for a business", + inputSchema: { + type: "object" as const, + properties: { + businessId: { type: "string", description: "Business ID" }, + page: { type: "number", description: "Page number (default 1)" }, + pageSize: { type: "number", description: "Items per page (default 25)" }, + }, + required: ["businessId"], + }, + }, + { + name: "create_expense", + description: "Create a new expense/money transaction", + inputSchema: { + type: "object" as const, + properties: { + businessId: { type: "string", description: "Business ID" }, + externalId: { type: "string", description: "External reference ID" }, + date: { type: "string", description: "Transaction date (YYYY-MM-DD)" }, + description: { type: "string", description: "Transaction description" }, + anchor: { + type: "object", + description: "Anchor account details", + properties: { + accountId: { type: "string", description: "Bank/payment account ID" }, + amount: { type: "number", description: "Amount (positive value)" }, + direction: { type: "string", description: "WITHDRAWAL or DEPOSIT" }, + }, + }, + lineItems: { + type: "array", + description: "Expense line items", + items: { + type: "object", + properties: { + accountId: { type: "string", description: "Expense account ID" }, + amount: { type: "number", description: "Amount" }, + description: { type: "string", description: "Line item description" }, + }, + }, + }, + }, + required: ["businessId", "date", "description", "anchor", "lineItems"], + }, + }, +]; + +// ============================================ +// TOOL HANDLERS +// ============================================ +async function handleTool(client: WaveClient, name: string, args: any) { + switch (name) { + case "list_businesses": { + return await client.query(QUERIES.listBusinesses); + } + case "list_invoices": { + const { businessId, page = 1, pageSize = 25 } = args; + return await client.query(QUERIES.listInvoices, { businessId, page, pageSize }); + } + case "create_invoice": { + const { businessId, customerId, invoiceDate, dueDate, items, memo } = args; + const today = new Date().toISOString().split('T')[0]; + const input: any = { + businessId, + customerId, + invoiceDate: invoiceDate || today, + items: items.map((item: any) => ({ + productId: item.productId, + description: item.description, + quantity: item.quantity || 1, + unitPrice: item.unitPrice, + })), + }; + if (dueDate) input.dueDate = dueDate; + if (memo) input.memo = memo; + return await client.query(MUTATIONS.createInvoice, { input }); + } + case "list_customers": { + const { businessId, page = 1, pageSize = 25 } = args; + return await client.query(QUERIES.listCustomers, { businessId, page, pageSize }); + } + case "create_customer": { + const { businessId, name, email, firstName, lastName, phone, addressLine1, addressLine2, city, provinceCode, postalCode, countryCode, currency } = args; + const input: any = { businessId, name }; + if (email) input.email = email; + if (firstName) input.firstName = firstName; + if (lastName) input.lastName = lastName; + if (phone) input.phone = phone; + if (currency) input.currency = currency; + if (addressLine1) { + input.address = { addressLine1 }; + if (addressLine2) input.address.addressLine2 = addressLine2; + if (city) input.address.city = city; + if (provinceCode) input.address.provinceCode = provinceCode; + if (postalCode) input.address.postalCode = postalCode; + if (countryCode) input.address.countryCode = countryCode; + } + return await client.query(MUTATIONS.createCustomer, { input }); + } + case "list_accounts": { + const { businessId, page = 1, pageSize = 25 } = args; + return await client.query(QUERIES.listAccounts, { businessId, page, pageSize }); + } + case "list_transactions": { + const { businessId, page = 1, pageSize = 25 } = args; + return await client.query(QUERIES.listTransactions, { businessId, page, pageSize }); + } + case "create_expense": { + const { businessId, externalId, date, description, anchor, lineItems } = args; + const input: any = { + businessId, + externalId: externalId || `exp-${Date.now()}`, + date, + description, + anchor: { + accountId: anchor.accountId, + amount: anchor.amount, + direction: anchor.direction || "WITHDRAWAL", + }, + lineItems: lineItems.map((item: any) => ({ + accountId: item.accountId, + amount: item.amount, + description: item.description, + })), + }; + return await client.query(MUTATIONS.createExpense, { input }); + } + default: + throw new Error(`Unknown tool: ${name}`); + } +} + +// ============================================ +// SERVER SETUP +// ============================================ +async function main() { + const apiToken = process.env.WAVE_API_TOKEN; + if (!apiToken) { + console.error("Error: WAVE_API_TOKEN environment variable required"); + console.error("Get your API token at https://developer.waveapps.com"); + process.exit(1); + } + + const client = new WaveClient(apiToken); + + const server = new Server( + { name: `${MCP_NAME}-mcp`, version: MCP_VERSION }, + { capabilities: { tools: {} } } + ); + + server.setRequestHandler(ListToolsRequestSchema, async () => ({ + tools, + })); + + server.setRequestHandler(CallToolRequestSchema, async (request) => { + const { name, arguments: args } = request.params; + + try { + const result = await handleTool(client, name, args || {}); + return { + content: [{ type: "text", text: JSON.stringify(result, null, 2) }], + }; + } catch (error) { + const message = error instanceof Error ? error.message : String(error); + return { + content: [{ type: "text", text: `Error: ${message}` }], + isError: true, + }; + } + }); + + const transport = new StdioServerTransport(); + await server.connect(transport); + console.error(`${MCP_NAME} MCP server running on stdio`); +} + +main().catch(console.error); diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..de6431e --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,15 @@ +{ + "compilerOptions": { + "target": "ES2022", + "module": "NodeNext", + "moduleResolution": "NodeNext", + "outDir": "./dist", + "rootDir": "./src", + "strict": true, + "esModuleInterop": true, + "skipLibCheck": true, + "declaration": true + }, + "include": ["src/**/*"], + "exclude": ["node_modules", "dist"] +}