Skip to main content

Overview

This guide demonstrates how to use AgentSource MCP (Model Context Protocol) with OpenAI’s API. MCP enables your AI agents to seamlessly access Explorium’s data through a standardized protocol, allowing for dynamic tool discovery and execution.

Prerequisites

  • Python 3.8 or higher
  • OpenAI API key
  • AgentSource API key
  • Basic understanding of OpenAI’s API

Installation

First, install the required package:
Bash

Quick Start

1. Initialize the OpenAI Client

Python

2. Configure AgentSource MCP

Create a response with MCP tools configured:
Python

3. Basic Example

Here’s a complete example that searches for companies:
Python

Common Use Cases

Finding Companies with Specific Criteria

Python

Finding Contacts at Specific Companies

Python

Analyzing Specific Departments

Python

Understanding the Response

The MCP integration automatically handles:
  • Tool discovery and listing
  • Parameter formatting
  • API calls to AgentSource
  • Response parsing
Your agent will receive structured data that it can process and present in a user-friendly format.

Advanced Configuration

Multi-turn Conversations

For follow-up queries in the same context:
Python

Tool Approval Settings

You can control whether tools require approval before execution:
  • "never" - Tools execute automatically
  • "always" - Tools require user approval
  • "on_error" - Approval required only on errors

Debugging and Monitoring

Response Tracing

To understand the execution flow, you can inspect the response object which contains:
  • Tool calls made
  • Input parameters sent
  • Responses received
  • Agent’s interpretation

Example Response Structure

Python

Best Practices

  1. API Key Security: Never hardcode API keys in your code. Use environment variables:
    Python
  2. Clear Queries: Be specific in your queries for better results:
    • “Find 20 CTOs at fintech companies in New York with 50-200 employees”
    • “Find some tech people”
  3. Handle Rate Limits: Implement appropriate error handling and retries
  4. Optimize Requests: Batch related queries when possible to reduce API calls

Available Tools

Through MCP, your agent automatically has access to all AgentSource tools including:
  • Company Search: Find businesses based on various criteria
  • Contact Discovery: Locate professionals with specific roles
  • Email Enrichment: Get contact information
  • Company Matching: Match and enrich company data
  • Prospect Matching: Match and enrich prospect data
  • And more: The full suite of AgentSource capabilities
The beauty of MCP is that tools are discovered dynamically - you don’t need to explicitly define them.

Error Handling

Python

Next Steps

  • Explore the complete AgentSource MCP documentation
  • Check out implementations using other frameworks (LangGraph, Python SDK)
  • Learn about advanced filtering and search capabilities
  • Understand rate limits and quotas

Support

If you encounter any issues or have questions: Note: Remember to replaceYOUR_AGENTSOURCE_API_KEY and your-openai-api-key with your actual API keys.