Overview
This guide demonstrates how to use AgentSource MCP with the Python MCP SDK. The SDK provides a native Python interface for connecting to MCP servers, making it ideal for building custom applications, data pipelines, and automation tools.Prerequisites
- Python 3.8 or higher
- AgentSource API key
- Basic understanding of asynchronous Python programming
Installation
Install the MCP Python SDK:Bash
Python
Quick Start
1. Import Required Libraries
Python
2. Basic Connection Example
Python
Common Use Cases
Matching Businesses
Find business IDs for companies by name or domain:Python
Finding Prospects at Companies
Search for employees with specific roles:Python
Enriching Contact Information
Get email addresses and phone numbers for prospects:Python
Advanced Patterns
Using Autocomplete for Valid Filter Values
Many filters require valid values from the autocomplete tool:Python
Comprehensive Company Analysis
Combine multiple enrichment tools for detailed insights:Python
Error Handling
Implement robust error handling for production use:Python
Best Practices
1. Environment Variables
Always use environment variables for API keys:Python
2. Connection Management
Use context managers to ensure proper connection cleanup:Python
3. Result Parsing
Always validate and parse results safely:Python
4. Batch Operations
When processing multiple items, use appropriate page sizes:Python
Available Tools Reference
The MCP SDK provides access to all AgentSource tools:- Business Tools:
match_businesses
,fetch_businesses
,enrich_businesses_*
- Prospect Tools:
match_prospects
,fetch_prospects
,enrich_prospects_*
- Utility Tools:
autocomplete
,fetch_businesses_events
,fetch_prospects_events
session.list_tools()
to discover all available tools and their parameters.
Debugging Tips
Enable verbose logging to troubleshoot issues:Python
Next Steps
- Explore the complete AgentSource MCP documentation
- Check out the OpenAI implementation guide for AI agent integration
- Learn about advanced filtering and search capabilities
- Build production-ready data pipelines with MCP
Support
If you encounter any issues or have questions:- Check the AgentSource MCP reference
- Contact our support team at support@explorium.ai
Note:Remember to replace
'your-api-key-here'
with your actual AgentSource API key.