Skip to main content
Glama
Prime MCP Server

Prime MCP Server

by MikahDev

Prime MCP Server

License: MIT TypeScript MCP

MCP (Model Context Protocol) server for the Prime Ecosystem API, providing AI assistants with access to insurance and construction job management functionality.

Features

  • 40+ tools covering all major Prime API functionality

  • Financial analysis tools for comparing estimates, work orders, and invoices

  • Smart search by customer name or address with automatic pagination

  • Rate limiting respects Prime's limits (60 req/min, 5000/day, 5 concurrent)

  • Full JSON:API support with proper request/response handling

  • Zod validation for all tool inputs

  • TypeScript with full type safety

Related MCP server: mcp-servicefusion

Available Tools

Job Management

  • prime_search_jobs - Search and filter jobs with pagination

  • prime_search_jobs_by_address - Search jobs by street, suburb, state, or postcode

  • prime_search_jobs_by_customer - Search jobs by customer name

  • prime_get_job - Get detailed job information by ID

  • prime_create_job - Create a new job

  • prime_update_job - Update job details

  • prime_update_job_status - Change job status

Financial Analysis

  • prime_get_job_allocation_summary - Work order totals grouped by trade

  • prime_get_job_trade_comparison - Compare work orders vs authorized estimates by trade

  • prime_get_job_financial_summary - Full comparison: Estimates vs Work Orders vs AP Invoices with alerts

Contact Management

  • prime_search_contacts - Search contacts by name, email, phone

  • prime_get_contact - Get contact details

  • prime_create_contact - Create new contact (individual or organization)

  • prime_update_contact - Update contact information

Allocation Management

  • prime_list_allocations - List work allocations

  • prime_get_allocation - Get allocation details

  • prime_create_allocation - Create work allocation

  • prime_update_allocation - Update allocation

Estimate Management

  • prime_list_estimates - List estimates (locked or unlocked)

  • prime_get_estimate - Get estimate with line items

  • prime_create_estimate - Create new estimate

  • prime_add_estimate_item - Add line item to estimate

  • prime_update_estimate_item - Update estimate line item

  • prime_delete_estimate_item - Delete estimate line item

Schedule Management

  • prime_get_job_schedule - Get schedule for a job

  • prime_list_schedule_items - List schedule items

  • prime_create_schedule_item - Create schedule item

  • prime_update_schedule_item - Update schedule item

  • prime_delete_schedule_item - Delete schedule item

Invoice Management

  • prime_list_ap_invoices - List accounts payable invoices

  • prime_get_ap_invoice - Get AP invoice details

  • prime_create_ap_invoice - Create AP invoice

  • prime_update_ap_invoice - Update AP invoice

  • prime_update_ap_invoice_status - Update AP invoice status

  • prime_list_ar_invoices - List accounts receivable invoices

  • prime_get_ar_invoice - Get AR invoice details

  • prime_update_ar_invoice_status - Update AR invoice status

Work Order Management

  • prime_list_work_orders - List work orders

  • prime_get_work_order - Get work order details

  • prime_update_work_order - Update work order

Attachment Management

  • prime_list_attachments - List job attachments

  • prime_get_attachment - Get attachment details

  • prime_create_attachment - Create attachment record

  • prime_update_attachment - Update attachment metadata

Notification Management

  • prime_list_notifications - List sent notifications

  • prime_get_notification - Get notification details

  • prime_create_notification - Send notification

  • prime_list_notification_templates - List available templates

  • prime_get_notification_template - Get template details

Reference Data

  • prime_list_job_statuses - List job statuses

  • prime_get_job_status - Get status details

  • prime_list_perils - List peril types (Fire, Flood, Storm, etc.)

  • prime_list_trades - List trade types (Plumbing, Electrical, etc.)

  • prime_list_divisions - List company divisions

  • prime_list_users - List system users

  • prime_get_user - Get user details

  • prime_list_workflows - List workflows

  • prime_list_job_types - List job types

  • prime_list_allocation_statuses - List allocation statuses

  • prime_list_filter_tags - List filter tags

  • prime_rate_limit_status - Check current rate limit status

Installation

# Clone the repository
git clone https://github.com/MikahDev/prime-mcp-server.git
cd prime-mcp-server

# Install dependencies
npm install

# Build
npm run build

Configuration

Environment Variables

# Required: OAuth2 credentials
export PRIME_CLIENT_ID=your-client-id
export PRIME_CLIENT_SECRET=your-client-secret
export PRIME_USERNAME=your-username
export PRIME_PASSWORD=your-password

# Optional: Override API URLs (defaults to production)
export PRIME_API_URL=https://www.primeeco.tech/api.prime/v2
export PRIME_OAUTH_URL=https://www.primeeco.tech/api.prime/v2/oauth/token

# Optional: Log level (debug, info, warn, error)
export LOG_LEVEL=info

Getting OAuth2 Credentials

Contact your Prime administrator to obtain:

  • Client ID - Your application's client identifier

  • Client Secret - Your application's secret key

  • Username - Your Prime user account

  • Password - Your Prime password

The server uses OAuth2 password grant flow and automatically handles token refresh.

Usage

Quick Start with npx

# Run directly without installing
npx prime-mcp-server

With Claude Desktop

Add to your Claude Desktop configuration (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):

{
  "mcpServers": {
    "prime": {
      "command": "npx",
      "args": ["prime-mcp-server"],
      "env": {
        "PRIME_CLIENT_ID": "your-client-id",
        "PRIME_CLIENT_SECRET": "your-client-secret",
        "PRIME_USERNAME": "your-username",
        "PRIME_PASSWORD": "your-password"
      }
    }
  }
}

Or with a local installation:

{
  "mcpServers": {
    "prime": {
      "command": "node",
      "args": ["/path/to/prime-mcp-server/dist/index.js"],
      "env": {
        "PRIME_CLIENT_ID": "your-client-id",
        "PRIME_CLIENT_SECRET": "your-client-secret",
        "PRIME_USERNAME": "your-username",
        "PRIME_PASSWORD": "your-password"
      }
    }
  }
}

With ChatGPT (HTTP Mode)

The server supports Streamable HTTP transport for ChatGPT integration.

1. Start the HTTP server:

# Set credentials
export PRIME_CLIENT_ID=your-client-id
export PRIME_CLIENT_SECRET=your-client-secret
export PRIME_USERNAME=your-username
export PRIME_PASSWORD=your-password

# Start HTTP server (default port 3000)
npm run start:http

# Or with custom port
PORT=8080 npm run start:http

2. Expose to the internet (for testing, use ngrok):

ngrok http 3000

3. Connect in ChatGPT:

  1. Go to ChatGPT → Settings → Connectors → Create

  2. Enter your public URL (e.g., https://abc123.ngrok.io/mcp)

  3. The connector will auto-discover available tools

Note: ChatGPT MCP support requires a Pro, Plus, or Business account with Developer Mode enabled (Settings → Connectors → Advanced → Developer mode).

Standalone

# Set credentials
export PRIME_CLIENT_ID=your-client-id
export PRIME_CLIENT_SECRET=your-client-secret
export PRIME_USERNAME=your-username
export PRIME_PASSWORD=your-password

# Run stdio transport (for Claude)
npm start

# Run HTTP transport (for ChatGPT)
npm run start:http

Development

# Run with hot reload
npm run dev

# Run tests
npm test

# Type check
npm run typecheck

Rate Limits

The Prime API has the following rate limits:

Limit

Value

Per Minute

60 requests

Per Day

5,000 requests

Concurrent

5 requests

The MCP server automatically handles rate limiting:

  • Tracks tokens and waits when approaching limits

  • Updates from response headers for accuracy

  • Queues concurrent requests exceeding the limit

  • Provides prime_rate_limit_status tool to check current status

Error Handling

All tools return consistent error responses:

{
  "error": true,
  "code": "VALIDATION_ERROR",
  "message": "Description of the error",
  "details": {
    "field": "specific field error"
  }
}

Error codes:

  • RATE_LIMITED - Rate limit exceeded (includes retryAfter)

  • UNAUTHORIZED - Invalid or missing API token

  • FORBIDDEN - Permission denied

  • NOT_FOUND - Resource not found

  • VALIDATION_ERROR - Invalid input parameters

  • SERVER_ERROR - Prime API server error

  • NETWORK_ERROR - Connection failed

  • INTERNAL_ERROR - Unexpected error

Project Structure

prime-mcp-server/
├── src/
│   ├── index.ts              # Entry point
│   ├── server.ts             # MCP server setup
│   ├── client/
│   │   ├── prime-client.ts   # HTTP client
│   │   ├── rate-limiter.ts   # Rate limiting
│   │   └── json-api.ts       # JSON:API utilities
│   ├── config/
│   │   └── index.ts          # Configuration
│   ├── schemas/              # Zod validation schemas
│   ├── tools/                # MCP tool implementations
│   └── utils/
│       ├── error-handler.ts  # Error formatting
│       └── filter-builder.ts # Query filter builder
├── tests/
│   └── unit/                 # Unit tests
├── package.json
├── tsconfig.json
└── vitest.config.ts

Contributing

  1. Fork the repository

  2. Create a feature branch

  3. Make your changes

  4. Run tests: npm test

  5. Submit a pull request

License

MIT

Available Tools

62 tools
prime_add_estimate_itemC

Add a line item to an estimate. Specify quantity, unit price, description, and optional category.

Inputs: unit_price (required), description (required), estimate_id (required), unit, +7 more.

prime_create_allocationC

Create a new work allocation for a job. Requires job_id, allocation_status_id, allocation_type, allocation_number, and label.

Inputs: label (required), job_id (required), allocation_type (required), allocation_number (required), +8 more.

prime_create_ap_invoiceC

Create an accounts payable invoice for a job from a supplier.

Inputs: total (required), job_id (required), subtotal (required), status_id (required), +8 more.

prime_create_attachmentB

Create a new attachment record for a job. Note: File upload may require separate handling.

Inputs: job_id (required), file_name (required), notes, title, +7 more.

prime_create_contactC

Create a new contact (individual or organization). Set is_individual=true for people.

Inputs: is_individual (required), abn, acn, name, +13 more.

prime_create_estimateC

Create a new estimate for a job.

Inputs: job_id (required), name, notes, description.

prime_create_jobB

Create a new job. Requires workflow_id, status_id, and client_id. Optionally creates new customer or links existing.

Inputs: client_id (required), status_id (required), workflow_id (required), notes, +17 more.

prime_create_notificationB

Send a notification for a job. Use a template or provide custom subject/body.

Inputs: job_id (required), body, subject, template_id, +5 more.

prime_create_schedule_itemC

Create a new schedule item (task) with start/end dates and optional assignment.

Inputs: name (required), end_date (required), start_date (required), schedule_id (required), +5 more.

prime_delete_estimate_itemC

Delete an estimate line item.

Inputs: item_id (required).

prime_delete_schedule_itemC

Delete a schedule item.

Inputs: schedule_item_id (required).

prime_get_allocationC

Get detailed allocation information by ID.

Inputs: allocation_id (required), includes.

prime_get_ap_invoiceB

Get accounts payable invoice details by ID.

Inputs: invoice_id (required), includes.

prime_get_ar_invoiceC

Get accounts receivable invoice details by ID.

Inputs: invoice_id (required), includes.

prime_get_attachmentC

Get attachment details by ID.

Inputs: attachment_id (required), includes.

prime_get_contactA

Get detailed contact information by ID. Includes addresses, licences, and relationships.

Inputs: contact_id (required), includes.

prime_get_estimateB

Get estimate details by ID. Set locked=true for snapshot estimates.

Inputs: estimate_id (required), locked, includes.

prime_get_jobB

Get detailed job information by ID. Includes status, division, customer, client, and other relationships.

Inputs: job_id (required), includes.

prime_get_job_allocation_summaryB

Get work order totals grouped by trade for a job. Returns breakdown of allocated amounts per trade category.

Inputs: job_id (required), status_filter, include_cancelled.

prime_get_job_financial_summaryB

Get full financial comparison by trade: Authorized Estimates vs Work Orders vs AP Invoices. Includes alerts for anomalies.

Inputs: job_id (required).

prime_get_job_scheduleC

Get the schedule for a specific job, including all schedule items.

Inputs: job_id (required), includes.

prime_get_job_statusC

Get job status details by ID.

Inputs: status_id (required).

prime_get_job_trade_comparisonC

Compare work order amounts vs authorized estimate amounts by trade. Shows variance between what was estimated and what was allocated.

Inputs: job_id (required), wo_statuses.

prime_get_notificationC

Get notification details by ID.

Inputs: notification_id (required), includes.

prime_get_notification_templateC

Get notification template details by ID.

Inputs: template_id (required).

prime_get_userC

Get user details by ID.

Inputs: user_id (required).

prime_get_work_orderC

Get work order details by ID.

Inputs: work_order_id (required), includes.

prime_list_allocationsB

List work allocations. Filter by job, assigned contact, status, or type. Types include Make Safe, Quote, Restoration, etc.

Inputs: page, job_id, includes, order_by, +8 more.

prime_list_allocation_statusesC

List available allocation statuses.

Inputs: page, per_page.

prime_list_ap_invoicesB

List accounts payable invoices (from suppliers/contractors). Filter by job, supplier, or status.

Inputs: page, job_id, includes, order_by, +6 more.

prime_list_ar_invoicesB

List accounts receivable invoices (to clients/insurers). Filter by job, client, or status.

Inputs: page, job_id, includes, order_by, +6 more.

prime_list_attachmentsC

List attachments for jobs. Filter by job, allocation, or attachment type.

Inputs: page, job_id, includes, order_by, +6 more.

prime_list_divisionsC

List company divisions/branches.

Inputs: page, per_page, is_active, region_id.

prime_list_estimatesB

List estimates for jobs. Set locked=true to get snapshot (read-only) estimates.

Inputs: page, job_id, locked, includes, +5 more.

prime_list_filter_tagsC

List filter tags for categorizing entities.

Inputs: page, per_page, filter_type_id.

prime_list_job_statusesB

List available job statuses. Filter by workflow to get relevant statuses.

Inputs: page, per_page, is_active, workflow_id.

prime_list_job_typesC

List available job types.

Inputs: page, per_page, is_active.

prime_list_notificationsB

List notifications sent for jobs. Filter by job or template.

Inputs: page, job_id, includes, order_by, +5 more.

prime_list_notification_templatesB

List available notification templates. Filter by active status or category.

Inputs: page, category, order_by, per_page, +2 more.

prime_list_perilsB

List peril types (causes of damage like Fire, Flood, Storm, etc.).

Inputs: page, per_page, is_active.

prime_list_schedule_itemsB

List schedule items for a job. Can filter by schedule or date range.

Inputs: job_id (required), page, per_page, schedule_id, +2 more.

prime_list_tradesB

List trade types (Plumbing, Electrical, Carpentry, etc.).

Inputs: page, per_page, is_active.

prime_list_usersB

List system users. Filter by division or active status.

Inputs: page, role, per_page, is_active, +1 more.

prime_list_workflowsC

List available workflows. Workflows define the status flow for jobs.

Inputs: page, per_page, is_active.

prime_list_work_ordersB

List work orders. Filter by job, allocation, assigned contact, or status.

Inputs: page, job_id, status, includes, +7 more.

prime_rate_limit_statusB

Get current rate limit status showing remaining requests per minute and per day.

Inputs: no named parameters.

prime_search_contactsB

Search and filter contacts by name, email, phone, or type. Returns paginated list.

Inputs: name, page, email, phone, +8 more.

prime_search_jobsB

Search and filter jobs with pagination. Returns job list with status, division, customer info.

Inputs: page, query, includes, order_by, +16 more.

prime_search_jobs_by_addressA

Search jobs by address (street, suburb, state, postcode). Paginates through all jobs to find matches since API does not support address filtering directly.

Inputs: state, street, suburb, includes, +2 more.

prime_search_jobs_by_customerA

Search jobs by customer name. First finds matching customers, then retrieves their associated jobs.

Inputs: customer_name (required), includes.

prime_update_allocationC

Update an allocation. Requires allocation_id and version for optimistic locking.

Inputs: version (required), allocation_id (required), label, limit, +7 more.

prime_update_ap_invoiceC

Update an accounts payable invoice. Requires version for optimistic locking.

Inputs: version (required), invoice_id (required), notes, total, +6 more.

prime_update_ap_invoice_statusC

Update the status of an accounts payable invoice.

Inputs: status_id (required), invoice_id (required).

prime_update_ar_invoice_statusC

Update the status of an accounts receivable invoice.

Inputs: status_id (required), invoice_id (required).

prime_update_attachmentC

Update attachment metadata. Requires version for optimistic locking.

Inputs: version (required), attachment_id (required), notes, title, +2 more.

prime_update_contactC

Update contact information. Requires contact_id and version for optimistic locking.

Inputs: version (required), contact_id (required), abn, acn, +14 more.

prime_update_estimateC

Update an estimate. Requires version for optimistic locking.

Inputs: version (required), estimate_id (required), name, notes, +1 more.

prime_update_estimate_itemC

Update an estimate line item. Requires version for optimistic locking.

Inputs: item_id (required), version (required), unit, notes, +8 more.

prime_update_jobC

Update job details. Requires job_id and version for optimistic locking.

Inputs: job_id (required), version (required), notes, address, +13 more.

prime_update_job_statusA

Change the status of a job. Use prime_list_job_statuses to get available status IDs.

Inputs: job_id (required), status_id (required).

prime_update_schedule_itemC

Update a schedule item. Requires version for optimistic locking.

Inputs: version (required), schedule_item_id (required), name, end_date, +5 more.

prime_update_work_orderC

Update a work order. Requires version for optimistic locking.

Inputs: version (required), work_order_id (required), notes, status, +2 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.1/5.0

    Scored across 62 tools

    Disambiguation4/5

    Each tool generally targets a distinct resource+action (jobs, contacts, allocations, estimates, AP/AR invoices, schedules, attachments, notifications, reference lists). The main soft spots are the three job financial analytics tools (allocation_summary vs trade_comparison vs financial_summary) and prime_get_job_schedule vs prime_list_schedule_items, which describe overlapping views. The three job search variants are clearly differentiated by description, so misselection risk is low.

    Naming Consistency5/5

    Every tool uses the same prime_ prefix with a consistent verb_noun snake_case pattern (list_, get_, create_, update_, delete_, search_, add_). Plural/singular use on nouns is predictable and readable across all 62 tools.

    Tool Count2/5

    62 tools is heavy even for a broad job-management/ERP domain, and the reference-data listers (trades, divisions, workflows, job types, allocation statuses, perils, filter tags, job statuses) plus multiple near-duplicate search/summary tools push it further. The surface likely could be consolidated into a handful of parameterized list/search tools rather than one per lookup.

    Completeness3/5

    Core entities have list+get+create+update coverage, but deletion is only exposed for schedule items and estimate items, and notable gaps exist: no create/delete for work orders, no create for AR invoices, no delete for jobs, contacts, allocations, estimates, attachments or notifications. Agents can work around some of this, but a few workflows (e.g. creating a work order, removing a stale job) dead-end.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Connects AI assistants to JoeAPI construction management system, enabling management of clients, contacts, proposals, estimates, action items, project schedules, and financial data through natural language.
      2
      ISC
    • A
      license
      A
      quality
      B
      maintenance
      Enables AI agents to read and create customers, jobs, estimates, invoices, calendar tasks, equipment, technicians, and reference data through the documented Service Fusion REST API, handling OAuth 2.0 and pagination automatically.
      24
      3 npm
      MIT