- Docs
- Guides
- Build with Enigma
- MCP
AI Agent Frameworks + Enigma
Build custom AI agents with Enigma using direct Model Context Protocol (MCP) integration
Integrate Enigma directly into your custom AI agents and applications. Works with any framework - OpenAI Agents, LangChain, CrewAI, AutoGen, and more.
Prerequisites
Section titled “Prerequisites”- An Enigma API key, which you can find in the Enigma Console under Settings > Account > API keys
- Python development environment
Quick Start with OpenAI Agents
Section titled “Quick Start with OpenAI Agents”API Key Authentication (Recommended)
import asynciofrom agents import Agent, Runnerfrom agents.mcp import MCPServerStreamableHttp
async def main(): async with MCPServerStreamableHttp( params={ "url": "https://mcp.enigma.com/http-key", "headers": {"x-api-key": "your_api_key"} } ) as server: await server.connect()
agent = Agent( name="Business Intelligence Agent", mcp_servers=[server] )
result = Runner.run_streamed( starting_agent=agent, input="Analyze Tacombi's financial performance and expansion strategy" )
asyncio.run(main())Method 2: OAuth Authentication
import asynciofrom agents.mcp import MCPServerStreamableHttp
async def main(): async with MCPServerStreamableHttp( params={"url": "https://mcp.enigma.com/http"} ) as server: await server.connect() # OAuth flow will open automatically
# Your agent code here...
asyncio.run(main())Framework Examples
Section titled “Framework Examples”LangChain Integration
from langchain_openai import ChatOpenAIfrom langchain_core.tools import BaseToolfrom mcp_client import MCPClient
class EnigmaBusinessSearch(BaseTool): name = "search_business" description = "Search for business information"
def _run(self, business_name: str) -> str: # MCP client integration client = MCPClient("https://mcp.enigma.com/http-key", headers={"x-api-key": "your_api_key"}) return client.call_tool("search_business", {"name": business_name})
# Use in your LangChain agentsllm = ChatOpenAI()tools = [EnigmaBusinessSearch()]CrewAI Integration
from crewai import Agent, Task, Crewfrom crewai_tools import BaseTool
class EnigmaTool(BaseTool): name: str = "Enigma Business Intelligence" description: str = "Access comprehensive business data and analytics"
def _run(self, business_name: str) -> str: # Your MCP integration here pass
business_analyst = Agent( role='Business Analyst', goal='Analyze business performance and competitive landscape', backstory='Expert in business intelligence and market analysis', tools=[EnigmaTool()], verbose=True)Complete Examples Repository
Section titled “Complete Examples Repository”Get started quickly: Clone our comprehensive examples repository with ready-to-use implementations:
git clone https://github.com/enigma-io/enigma-mcp-examplescd enigma-mcp-examplespip install -r requirements.txtAvailable examples:
- OpenAI Agents with business intelligence workflows
- LangChain integration for market research
- CrewAI multi-agent business analysis teams
- AutoGen collaborative business planning agents
- Custom REST API wrapper for any framework
Authentication Options
Section titled “Authentication Options”API Key (Recommended for Production)
- More reliable for automated systems
- No browser interaction required
- Better for CI/CD and serverless environments
headers = {"x-api-key": "your_enigma_api_key"}OAuth (Good for Development)
- Browser-based authentication flow
- Uses same credentials as Enigma Console
- Better for local development and testing
Common Use Cases
Section titled “Common Use Cases”Due Diligence Agents
# Automate comprehensive business investigationstools = ["search_business", "get_brand_legal_entities", "search_negative_news", "search_gov_archive_records"]Market Research Agents
# Competitive analysis and market sizingtools = ["generate_brands_segment", "get_brand_locations", "get_brand_card_analytics"]Compliance Monitoring Agents
# Ongoing business monitoring and risk assessmenttools = ["search_kyb", "search_gov_archive_records", "search_negative_news"]Troubleshooting
Section titled “Troubleshooting”API Key authentication failing?
- Verify your API key at Enigma Console
- Ensure the
x-api-keyheader is properly set
OAuth flow not working?
- Check that your development environment can open browser windows
- Verify you’re logged into Enigma Console in your default browser
MCP connection issues?
- Ensure your framework supports HTTP MCP servers
- Check network connectivity to
mcp.enigma.com
Need help with integration?
- Check our examples repository
- Contact us at support@enigma.com