Skip to main content
The Python SDK (omni-connector) provides everything you need to build custom connectors that integrate with Omni’s search and AI platform.

Installation

The SDK is not published to PyPI. Connectors live in the Omni monorepo and depend on the SDK as a local path dependency. To start a new Python connector, fork or clone omni and create a directory under connectors/:
Add a pyproject.toml that pulls the SDK from the local checkout — copy from any existing Python connector (e.g. connectors/notion/pyproject.toml):
Then install with uv:
Requirements:
  • Python >= 3.11
  • uv (used throughout the monorepo for Python dependency management)
Transitive dependencies pulled in by the SDK:
  • fastapi - Web framework
  • uvicorn - ASGI server
  • httpx - Async HTTP client
  • pydantic - Data validation
Run /build-connector <service name> from Claude Code inside the omni repo to scaffold the entire connector structure (sync logic, manifest, Dockerfile, frontend wiring, Terraform, integration tests) following the conventions used by built-in connectors. See the SDK overview for details.

Quick Start

When running under Docker, set CONNECTOR_MANAGER_URL, CONNECTOR_HOST_NAME, and PORT. The SDK uses CONNECTOR_HOST_NAME plus PORT to register the connector URL that connector-manager calls for syncs, actions, MCP resources, and prompts.

Core Concepts

Connector Class

The Connector abstract base class defines the interface for all connectors. Required Properties: Optional Properties: Required Methods:
Optional Methods:

SyncContext

The SyncContext object is passed to your sync method and provides utilities for the sync operation. Properties: Methods:

ContentStorage

The ContentStorage class handles storing document content.
The returned content_id is a ULID that references the stored content.
Always prefer extract_text / extract_and_store_content over shelling out to your own PDF/Office parser. The connector-manager routes these calls through the centralized Docling service when the admin has enabled it (with the configured quality preset), and falls back to a lightweight built-in extractor otherwise — so your connector automatically honors the instance-wide document-conversion setting.

Document Model

The Document class represents a searchable document.
Document Fields:

Actions

Connectors can define custom actions that users can trigger from the Omni UI.

Connector Skills

Connectors can ship skills — Markdown documents that guide the Omni agent through connector-specific workflows. Skills are loaded into Omni when the connector is enabled.

MCP OAuth and Catalog Cache

Dynamic Client Registration (DCR)

For connectors whose MCP servers require per-user OAuth, OAuthManifestConfig supports automatic client registration so admins don’t need to create OAuth apps manually:

Credential-Ready Lifecycle

After a user completes OAuth, connector-manager calls oauth_credential_ready so the connector can run post-OAuth setup such as authenticated MCP catalog discovery:

Catalog Cache

The SDK caches MCP tool catalogs to disk (default: /var/lib/omni/mcp-catalogs) to avoid costly discovery on every restart. Set CATALOG_CACHE_TTL_SECONDS to control the cache lifetime; it defaults to 86400 seconds (24 hours).
Set a shorter TTL for MCP servers whose tool sets change frequently, or a larger value for stable tool catalogs. Here’s a complete example of an RSS feed connector:

Error Handling

The SDK provides custom exception classes:
Handling errors in sync:

Development

Project Setup

Running Tests

Type Checking

Linting

Testing

The SDK includes a testing module (omni_connector.testing) with utilities for writing integration tests for your connectors.

TestHarness

The TestHarness class provides a self-contained environment for testing your connector without needing a running Omni deployment.

Assertions

The harness captures all emitted documents, errors, and checkpoint changes for easy assertion:

API Reference

Exports

The SDK exports the following: Core Classes:
  • Connector - Abstract base class
  • SyncContext - Sync operation context
  • ContentStorage - Content storage interface
  • SdkClient - SDK client for connector-manager
Data Models:
  • Document, DocumentMetadata, DocumentPermissions
  • ConnectorEvent, EventType
  • ActionDefinition, ActionParameter
  • ActionRequest, ActionResponse
  • ConnectorManifest, SyncMode
  • SyncRequest, SyncResponse
  • CancelRequest, CancelResponse
  • ConnectorSkillDefinition
  • OAuthManifestConfig, OAuthScopeSet
  • OAuthCredentialReadyRequest
  • McpResourceDefinition, McpPromptDefinition
  • StdioMcpServer, HttpMcpServer
Exceptions:
  • ConnectorError, SdkClientError, SyncCancelledError, ConfigurationError

What’s Next

SDK Overview

Learn about SDK architecture

TypeScript SDK

Build connectors with TypeScript