Skip to main content

Python SDK for Canonical company search — find companies using natural language

Project description

canonical-search

Python SDK and MCP server for Canonical company search. Find companies using natural language.

Install

SDK only (for use in your Python code)

pip install canonical-search

MCP server (for Claude Desktop, Cursor, Windsurf, Claude Code)

We recommend pipx which installs in an isolated environment and avoids conflicts with system Python:

pipx install "canonical-search[mcp]"

Alternatively, with pip:

pip install "canonical-search[mcp]"

Quick Start

from canonical_search import CanonicalClient

client = CanonicalClient(api_key="sk_your_key")

# Sync
results = client.search("AI healthcare startups")
for company in results.results:
    print(f"{company.name}{company.domain}")

# Async
results = await client.asearch("B2B fashion tech companies")

Parameters

Parameter Type Default Description
query str required Natural language search query
top_k int 20 Number of results (1-100)
verified bool False LLM verification for higher accuracy (uses 2 credits)

Environment-Based Config

Instead of passing api_key directly, you can use environment variables:

export CANONICAL_API_KEY=sk_your_key
export CANONICAL_API_BASE_URL=https://trycanonical.ai  # optional
export CANONICAL_TIMEOUT=30.0  # optional
from canonical_search.config import client_from_env

client = client_from_env()
results = client.search("fintech companies in Europe")

MCP Server

For AI tools that support MCP (Claude Desktop/Cowork, Cursor, Windsurf, Claude Code).

First, find the absolute path to the binary:

which canonical-mcp

Claude Desktop / Cowork

Edit ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):

{
  "mcpServers": {
    "canonical": {
      "command": "/full/path/to/canonical-mcp",
      "env": {
        "CANONICAL_API_KEY": "sk_your_key"
      }
    }
  }
}

Then fully quit and restart Claude Desktop.

Claude Code

claude mcp add canonical -- canonical-mcp
# Set your API key in the environment:
export CANONICAL_API_KEY=sk_your_key

Cursor

Add to .cursor/mcp.json in your project or ~/.cursor/mcp.json globally:

{
  "mcpServers": {
    "canonical": {
      "command": "/full/path/to/canonical-mcp",
      "env": {
        "CANONICAL_API_KEY": "sk_your_key"
      }
    }
  }
}

Note: Always use the absolute path from which canonical-mcp. Relative paths are the most common cause of MCP connection failures.

Framework Integration

The SDK works with any Python-based AI agent framework with minimal glue code.

AutoGen

from autogen import register_function
from canonical_search import CanonicalClient

client = CanonicalClient(api_key="sk_your_key")

def search_companies(query: str, top_k: int = 20) -> str:
    """Search for companies using natural language."""
    return client.search(query, top_k).model_dump_json()

register_function(
    search_companies,
    caller=assistant,
    executor=executor,
    description="Search for companies using natural language",
)

LangChain

from langchain_core.tools import tool
from canonical_search import CanonicalClient

client = CanonicalClient(api_key="sk_your_key")

@tool
def search_companies(query: str, top_k: int = 20) -> str:
    """Search for companies using natural language."""
    return client.search(query, top_k).model_dump_json()

Agno

from agno.tools import tool
from canonical_search import CanonicalClient

client = CanonicalClient(api_key="sk_your_key")

@tool
def search_companies(query: str, top_k: int = 20) -> str:
    """Search for companies using natural language."""
    return client.search(query, top_k).model_dump_json()

CrewAI

from crewai.tools import tool
from canonical_search import CanonicalClient

client = CanonicalClient(api_key="sk_your_key")

@tool("Company Search")
def search_companies(query: str, top_k: int = 20) -> str:
    """Search for companies using natural language."""
    return client.search(query, top_k).model_dump_json()

Response Schema

SearchResponse:
    results: list[Company]  # List of matching companies
    count: int              # Number of results
    query: str              # Original query
    credits_used: int       # Credits consumed
    credits_remaining: int  # Remaining credits (if available)

Company:
    id: int
    name: str
    website: str
    logo_url: str | None
    domain: str
    description: str
    verdict: str | None         # Only when verified=True
    verdict_reason: str | None  # Only when verified=True

Get an API Key

  1. Sign up at trycanonical.ai
  2. Go to Dashboard → API Keys
  3. Create a new key (starts with sk_)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

canonical_search-0.1.1.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

canonical_search-0.1.1-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file canonical_search-0.1.1.tar.gz.

File metadata

  • Download URL: canonical_search-0.1.1.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.13.3 Darwin/23.6.0

File hashes

Hashes for canonical_search-0.1.1.tar.gz
Algorithm Hash digest
SHA256 7b1bec1bd1c90218877e5300670841445bbe620d0a815fb24d8d82fdd4adddad
MD5 d9507d20125633589c84b81ded64c741
BLAKE2b-256 9c8fa87ee9a596e4b64db1df4a137b81f76a87ffd07485c2fe45d85e59afb70f

See more details on using hashes here.

File details

Details for the file canonical_search-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: canonical_search-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.13.3 Darwin/23.6.0

File hashes

Hashes for canonical_search-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8c966ef0b9e4f59d7c164a107f2392abd7caafabd4a5b43b5c545e32cc402fbd
MD5 04c539891530887167e85b95cffa8348
BLAKE2b-256 bb3c9043dc9a78084ed636355bacb87e57a3e4e5b708c4ed83f75c8550ac3d1e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page