Skip to main content
Unlisted page
This page is unlisted. Search engines will not index it, and only users having a direct link can access it.

Build Custom AI Agents with Enigma​

Beta

The Enigma remote MCP server is currently in beta.

Integrate Enigma directly into your custom AI agents and applications. Works with any framework - OpenAI Agents, LangChain, CrewAI, AutoGen, and more.

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​

API Key Authentication (Recommended)

import asyncio
from agents import Agent, Runner
from 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 asyncio
from 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​

LangChain Integration

from langchain_openai import ChatOpenAI
from langchain_core.tools import BaseTool
from 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 agents](#use-in-your-langchain-agents)
llm = ChatOpenAI()
tools = [EnigmaBusinessSearch()]

CrewAI Integration

from crewai import Agent, Task, Crew
from 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​

Get started quickly: Clone our comprehensive examples repository with ready-to-use implementations:

git clone https://github.com/enigma-io/enigma-mcp-examples
cd enigma-mcp-examples
pip install -r requirements.txt

Available 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​

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​

Due Diligence Agents

# [Automate comprehensive business investigations](#automate-comprehensive-business-investigations)
tools = ["search_business", "get_brand_legal_entities",
"search_negative_news", "search_gov_archive"]

Market Research Agents

# [Competitive analysis and market sizing](#competitive-analysis-and-market-sizing)
tools = ["generate_brands_segment", "get_brand_locations",
"get_brand_card_analytics"]

Compliance Monitoring Agents

# [Ongoing business monitoring and risk assessment](#ongoing-business-monitoring-and-risk-assessment)
tools = ["search_kyb", "search_gov_archive", "search_negative_news"]

Troubleshooting​

API Key authentication failing?

  • Verify your API key at Enigma Console
  • Ensure the x-api-key header 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?

Resources​