Python SDK and MCP server 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
- Sign up at trycanonical.ai
- Go to Dashboard → API Keys
- Create a new key (starts with
sk_)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file canonical_search-0.1.0.tar.gz.
File metadata
- Download URL: canonical_search-0.1.0.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.3 CPython/3.13.3 Darwin/23.6.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
16cab9b01378dd69348260d323ed9c98e6b4ac94c2a4dec1ffaa6c43d1e2930c
|
|
| MD5 |
8a7a85a627044fe3fbd65a741f0c366c
|
|
| BLAKE2b-256 |
2c12dd0583f1f3afe09b44e6010c9156fb917cd58b9573e2097551b1a6ed7f0e
|
File details
Details for the file canonical_search-0.1.0-py3-none-any.whl.
File metadata
- Download URL: canonical_search-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.5 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6ef528e33d2f65aff24ef534cd0e7e2c986b691692d4bbd980127937815c10f9
|
|
| MD5 |
a01e1e335152deb1dca8e2044bc98c2e
|
|
| BLAKE2b-256 |
5d937adc876cab8365b36cfbd42d7886683fb3afda03ab6eaa499cc3f2ee7055
|