Skip to main content

MCP Server for Ambivo API endpoints - Natural language queries and direct entity data access

Project description

Ambivo MCP Server

This MCP (Model Context Protocol) server provides access to Ambivo API endpoints for natural language querying of entity data.

Features

  • Natural Language Queries: Execute natural language queries against entity data using the /entity/natural_query endpoint
  • JWT Authentication: Secure access using Bearer token authentication
  • Rate Limiting: Built-in rate limiting to prevent API abuse
  • Token Caching: Efficient token validation with caching
  • Error Handling: Comprehensive error handling with detailed error messages
  • Retry Logic: Automatic retry with exponential backoff for failed requests

Tools

1. set_auth_token

Set the JWT Bearer token for authentication with the Ambivo API.

Parameters:

  • token (string, required): JWT Bearer token

Usage:

{
  "token": "your-jwt-token-here"
}

2. natural_query

Execute natural language queries against Ambivo entity data.

Parameters:

  • query (string, required): Natural language query describing what data you want
  • response_format (string, optional): Response format - "table", "natural", or "both" (default: "both")

Example queries:

  • "Show me leads created this week"
  • "Find contacts with gmail addresses"
  • "List opportunities worth more than $10,000"
  • "Show me leads with attribution_source google_ads from the last 7 days"

Usage:

{
  "query": "Show me leads created this week with attribution_source google_ads",
  "response_format": "both"
}

Installation

  1. Install the required dependencies:
pip install -r requirements.txt
  1. Run the MCP server:
python server.py

Configuration

The server uses the following default configuration:

  • Base URL: https://goferapi.ambivo.com
  • Timeout: 30 seconds
  • Content Type: application/json

You can modify these settings in the AmbivoAPIClient class if needed.

Authentication

  1. First, set your authentication token using the set_auth_token tool
  2. The token will be included in all subsequent API requests as a Bearer token
  3. The token should be a valid JWT token from your Ambivo API authentication

Error Handling

The server provides comprehensive error handling:

  • Authentication errors: Clear messages when token is missing or invalid
  • HTTP errors: Detailed HTTP status codes and response messages
  • Validation errors: Parameter validation with helpful error messages
  • Network errors: Timeout and connection error handling

API Endpoints

This MCP server interfaces with these Ambivo API endpoints:

/entity/natural_query

  • Method: POST
  • Purpose: Process natural language queries for entity data retrieval
  • Authentication: Required (JWT Bearer token)
  • Content-Type: application/json

/entity/data

  • Method: POST
  • Purpose: Direct entity data access with structured parameters
  • Authentication: Required (JWT Bearer token)
  • Content-Type: application/json

Example Workflow

  1. Set Authentication:

    {
      "tool": "set_auth_token",
      "arguments": {
        "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
      }
    }
    
  2. Natural Language Query:

    {
      "tool": "natural_query", 
      "arguments": {
        "query": "Show me all leads created in the last 30 days with phone numbers",
        "response_format": "both"
      }
    }
    
  3. Direct Entity Query:

    {
      "tool": "entity_data",
      "arguments": {
        "entity_type": "contact",
        "filters": {"email": {"$regex": "@gmail.com$"}},
        "limit": 100,
        "sort": {"created_date": -1}
      }
    }
    

Development

To extend this MCP server:

  1. Add new tools: Implement additional tools in the handle_list_tools() and handle_call_tool() functions
  2. Modify API client: Extend the AmbivoAPIClient class to support additional endpoints
  3. Update configuration: Modify default settings in the configuration section

Troubleshooting

Common Issues:

  1. "Authentication required" error: Ensure you've called set_auth_token first
  2. HTTP 401/403 errors: Verify your JWT token is valid and not expired
  3. Connection timeout: Check network connectivity and API endpoint availability
  4. Invalid parameters: Review the tool schemas for required and optional parameters

Logging:

The server logs important events and errors. Check the console output for debugging information.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ambivo_mcp_server-1.0.3.tar.gz (18.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ambivo_mcp_server-1.0.3-py3-none-any.whl (14.3 kB view details)

Uploaded Python 3

File details

Details for the file ambivo_mcp_server-1.0.3.tar.gz.

File metadata

  • Download URL: ambivo_mcp_server-1.0.3.tar.gz
  • Upload date:
  • Size: 18.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.7

File hashes

Hashes for ambivo_mcp_server-1.0.3.tar.gz
Algorithm Hash digest
SHA256 9f2755b71a2bee4aab8eb489bd988f01b67a383670d7c1faf255b56f2cb93e82
MD5 c8de6831c5e65dae122efb4c5640443d
BLAKE2b-256 243493fc7f0494821c0691e4ea8a5a71c10b6f24480fa9e5fa231feb457c458b

See more details on using hashes here.

File details

Details for the file ambivo_mcp_server-1.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for ambivo_mcp_server-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 20fcff11b6fa7beeadabe7eb42185f71a053863dbff8939d24db8efc53533865
MD5 c50cfb0b37ee35b97777c5fd6c534008
BLAKE2b-256 20b51ed4157b6e95d844bf03d51682961084b24d8c78fec95bda07f07cc890c4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page