Skip to main content
Glama

Ambivo MCP Server

Official
by ambivo-corp
test_real_api.pyโ€ข5.19 kB
#!/usr/bin/env python3 """ Test script for the Ambivo MCP Server with real JWT token """ import asyncio import json import sys import os # Add the current directory to path for imports sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) from server import AmbivoAPIClient from config import ServerConfig # Real JWT token (expires: 2025-05-29) JWT_TOKEN = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiNThmYzBmMDdhYWYwOGU0MGMzNjE5OTUzIiwidGVuYW50X2lkIjoiNWE3N2IwZmI4YjU3ODY0ZDdlMTZkNGJhIiwiZXhwIjoxNzUzOTE3MjQwLCJzY29wZXMiOlsiYWxsIl0sImZpcnN0X2xvZ2luIjpmYWxzZSwibW9kdWxlX2FjY2VzcyI6eyJhbGwiOiIqIn0sImNsaWVudF9jb25uZWN0aW9uX2lkIjoiNjg4OTU1YjgxODBkYzYwZDE4MGEwYTQzIn0.n-5422RQgpPv926TbXEl94fxUJevDfVh4rf0aSxWvHE" async def test_real_api(): """Test the MCP server with real API calls""" print("๐Ÿš€ Testing Ambivo MCP Server with Real API") print("=" * 60) # Initialize client with proper configuration config = ServerConfig() client = AmbivoAPIClient(config) print(f"๐Ÿ“ก API Base URL: {client.base_url}") print(f"๐Ÿ”’ Token validation: {'Enabled' if config.token_validation_enabled else 'Disabled'}") print() try: # Test 1: Set authentication token print("Test 1: Authentication") print("-" * 30) client.set_auth_token(JWT_TOKEN) print("โœ… JWT token set successfully") print(f"๐Ÿ”‘ Token length: {len(JWT_TOKEN)} characters") print() # Test 2: Natural Language Query print("Test 2: Natural Language Query") print("-" * 35) natural_queries = [ {"query": "Show me leads created in the last 7 days", "format": "both"}, {"query": "Find contacts with gmail addresses", "format": "table"}, {"query": "List opportunities worth more than $1000", "format": "natural"} ] for i, test_query in enumerate(natural_queries, 1): print(f"Query {i}: {test_query['query']}") try: result = await client.natural_query( test_query["query"], test_query["format"] ) print(f"โœ… Success! Response type: {type(result)}") if isinstance(result, dict): print(f"๐Ÿ“Š Response keys: {list(result.keys())}") if 'data' in result: data_count = len(result['data']) if isinstance(result['data'], list) else 'N/A' print(f"๐Ÿ“ˆ Data records: {data_count}") print() except Exception as e: print(f"โŒ Error: {str(e)}") print() print("๐ŸŽ‰ API Testing Complete!") except Exception as e: print(f"๐Ÿ’ฅ Critical Error: {str(e)}") import traceback traceback.print_exc() finally: # Clean up await client.close() print("๐Ÿ”Œ HTTP client closed") async def test_mcp_tools(): """Test the MCP tools interface""" print("\n๐Ÿ› ๏ธ Testing MCP Tools Interface") print("=" * 40) # Import MCP server components from server import handle_list_tools, handle_call_tool try: # Test 1: List available tools print("Test 1: List Tools") print("-" * 20) tools = await handle_list_tools() print(f"โœ… Found {len(tools)} tools:") for tool in tools: print(f" ๐Ÿ”ง {tool.name}: {tool.description[:60]}...") print() # Test 2: Set auth token via MCP tool print("Test 2: Set Auth Token (MCP Tool)") print("-" * 38) auth_result = await handle_call_tool("set_auth_token", {"token": JWT_TOKEN}) print(f"โœ… Auth result: {auth_result[0].text}") print() # Test 3: Natural query via MCP tool print("Test 3: Natural Query (MCP Tool)") print("-" * 35) query_result = await handle_call_tool("natural_query", { "query": "Show me recent leads", "response_format": "both" }) print(f"โœ… Query result length: {len(query_result[0].text)} characters") print(f"๐Ÿ“ Result preview: {query_result[0].text[:200]}...") print() print("๐ŸŽ‰ MCP Tools Testing Complete!") except Exception as e: print(f"๐Ÿ’ฅ MCP Tools Error: {str(e)}") import traceback traceback.print_exc() async def main(): """Run all tests""" print("๐Ÿงช Ambivo MCP Server - Real API Test Suite") print("=" * 60) print(f"๐ŸŒ Target API: https://goferapi.ambivo.com") print(f"๐Ÿ”‘ Using real JWT token") print(f"โฐ Test started at: {asyncio.get_event_loop().time()}") print() # Run API tests await test_real_api() # Run MCP tools tests await test_mcp_tools() print("\n" + "=" * 60) print("๐Ÿ All tests completed!") print("โœ… The MCP server is ready for production use") print("๐Ÿ’ก Next step: Configure Claude Code to use this MCP server") if __name__ == "__main__": asyncio.run(main())

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ambivo-corp/ambivo-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server