What is a Connector?
A connector is a standalone microservice that provides a standardized interface to interact with a specific type of data source (databases, APIs, etc.). Each connector implements the Model Context Protocol (MCP) to expose tools that can be invoked by users through the platform.Key Characteristics
Independent Service
Each connector runs as its own service on a dedicated port
MCP Protocol
Implements standard MCP for tool registration and execution
Connection Pooling
Manages connection pools for efficient resource usage
Async Operations
Built on async/await for high concurrency
Available Connectors
PostgreSQL Connector
Production-ready connector for PostgreSQL databases. Features:- AsyncPG-based connection pooling
- Full schema introspection
- Parameterized query execution
- Transaction support
- SSL/TLS encryption
MSSQL Connector
Microsoft SQL Server and Azure SQL Database connector. Features:- ODBC Driver 18 support
- Azure SQL authentication
- Async operations with aioodbc
- Connection encryption
- Schema introspection
Connector Architecture
Tools vs Templates
Tools
Tools are callable operations that perform specific actions:list_tables()- List database tablesexecute_query(query, params)- Run SQL queriestest_connection()- Verify connectivity
Templates
Templates are pre-configured tool patterns:- Common query patterns
- Reusable workflows
- Parameter validation
Connection Lifecycle
1
Connector Startup
Service starts and loads configuration
2
Server Creation
User creates a server instance with specific config (host, database, credentials)
3
Pool Initialization
Connection pool created for the server
4
Tool Execution
Tools use pooled connections for operations
5
Pool Cleanup
Idle connections automatically closed after TTL
6
Server Destruction
Pool closed when server is deleted
Configuration Model
Each connector defines a Pydantic configuration model:- Type validation
- Auto-generated forms in dashboard
- Default values
- Field descriptions
Multi-Server Support
A single connector can manage multiple server instances:Performance Features
Connection Pooling
Async Operations
All database operations use async/await:Security Considerations
Credential Storage
Credential Storage
- Credentials stored encrypted in backend database
- Never logged or exposed in responses
- Passed securely to connector services
Connection Encryption
Connection Encryption
- SSL/TLS support for database connections
- Certificate validation options
- Encrypted data in transit
Query Safety
Query Safety
- Parameterized queries prevent SQL injection
- Input validation via Pydantic
- Query timeout limits
Connector Registry
When a connector starts, it registers with the backend:Development Workflow
1
Choose Template
Start with existing connector (PostgreSQL/MSSQL) as template
2
Create Structure
Copy connector directory, update naming
3
Define Schema
Create configuration model in
schema.py4
Implement Manager
Write connection pooling logic in
db_manager.py5
Add Tools
Define tools in
main.py6
Test Locally
Run connector and test with dashboard
7
Containerize
Build Docker image for deployment
Best Practices
✅ DO
- Use async/await throughout
- Implement connection pooling
- Add comprehensive error handling
- Validate inputs with Pydantic
- Include health check endpoint
- Document tool parameters
- Use parameterized queries
❌ DON'T
- Block async operations with sync calls
- Create connections without pooling
- Hard-code credentials
- Ignore connection limits
- Skip input validation
- Expose sensitive data in logs