Skip to content

Latest commit

 

History

History
61 lines (43 loc) · 1.92 KB

File metadata and controls

61 lines (43 loc) · 1.92 KB

HTTP Client Setup for Separate Deployment

Overview

The mcp-server has been refactored to use HTTP requests instead of direct imports from Appimate-Business. This allows both services to be deployed separately.

Changes Made

  1. Created HTTP Client (src/lib/http-client.ts)

    • Handles all HTTP requests to Appimate-Business API endpoints
    • Supports authentication via access tokens
    • Provides methods for all entity queries
  2. Refactored Query Executor (src/lib/ai-assistant/query-executor.ts)

    • Removed all direct imports from Appimate-Business
    • All queries now use HTTP client instead
    • No more path alias resolution issues

Configuration

Set the following environment variable:

APPIMATE_BUSINESS_URL=http://localhost:3000

For production:

APPIMATE_BUSINESS_URL=https://your-appimate-business-domain.com

API Endpoints Used

The mcp-server calls these Appimate-Business API endpoints:

  • /api/invoices?action=list - List invoices
  • /api/quotes?action=list - List quotes
  • /api/products?action=list - List products
  • /api/financials?action=list - List financial statements
  • /api/assets?action=list - List assets
  • /api/payroll?action=list - List employees
  • /api/organisations?action=list - List organisations

Authentication

The HTTP client automatically includes the accessToken from the session context in:

  • Authorization header: Bearer {token}
  • Query parameter: accessToken={token} (for compatibility)

Benefits

Separate Deployment: Services can be deployed independently
No Path Alias Issues: No more @/ path resolution problems
Scalability: Each service can scale independently
Clear Separation: Clean API boundaries between services

Testing

  1. Set APPIMATE_BUSINESS_URL environment variable
  2. Ensure Appimate-Business is running and accessible
  3. Test queries through mcp-server - they should work via HTTP