Overview
Core integrations serve three main purposes:- Activity Sync - Automatically capture relevant activities from external services into your knowledge graph
- Real-time Updates - Receive webhook events for instant synchronization
- MCP Tools - Expose service-specific tools to AI agents through the MCP Hub
Integration Architecture
Every Core integration consists of:- spec.json - Defines integration metadata, authentication, and MCP configuration
- index.ts - Main entry point that handles different event types
- account-create.ts - Handles OAuth flow completion and account setup
- Event handlers - Process webhooks (webhook-based) or scheduled syncs (schedule-based)
Integration Types
Core supports two primary integration patterns:1. Webhook-Based Integrations
Best for: Real-time events, chat platforms, collaboration tools Webhook-based integrations receive HTTP callbacks from the external service whenever events occur. This provides instant synchronization with minimal latency. Example: Slack- Receives webhook events for messages, reactions, mentions
- Processes events in real-time as they happen
- Uses
PROCESSandIDENTIFYevent types
2. Schedule-Based Sync Integrations
Best for: Services without webhooks, APIs with rate limits, batch processing Schedule-based integrations run on a cron schedule to poll the external API and fetch new activities. This is ideal for services that don’t support webhooks or when you want to batch process data. Example: GitHub- Runs every 5-15 minutes (configurable)
- Fetches notifications, PRs, issues, and comments
- Maintains state to track last sync time
- Uses
SYNCevent type
Integration Components
spec.json
The specification file defines your integration’s core configuration:index.ts
The main entry point routes events to appropriate handlers:Event Types
SETUP
Called when a user completes OAuth authorization. Create the integration account and return configuration. Returns:SYNC (Schedule-Based)
Called on cron schedule. Fetch activities since last sync and return them. Returns:PROCESS (Webhook-Based)
Called when webhook event is received. Process the event and return activities. Returns:IDENTIFY (Webhook-Based)
Extract user identifier from webhook event for routing. Returns:MCP Hub Integration
The MCP Hub allows your integration to expose tools that AI agents can use. Configure this in spec.json:HTTP-based MCP
For services with existing MCP servers:Stdio-based MCP
For local command-line MCP servers:${config:access_token} placeholder will be replaced with the user’s OAuth access token at runtime.
Best Practices
Activity Messages
- Be Descriptive - Include who, what, where, and context
- Include URLs - Always provide sourceURL for deep linking
- Use Consistent Format - Follow patterns from existing integrations
- Filter Noise - Only sync relevant activities (e.g., mentions, assignments)
State Management
For schedule-based integrations:- Track Sync Time - Always save lastSyncTime in state
- Default to 24 Hours - On first sync, fetch last 24 hours of data
- Use Pagination - Handle large datasets with proper pagination
- Error Handling - Continue processing even if individual items fail
Error Handling
- Silent Failures - Don’t pollute stdout with errors (return empty arrays)
- Graceful Degradation - Continue processing other items if one fails
- Validate Tokens - Check for access_token presence early
- Return Empty Arrays - On fatal errors, return [] instead of throwing
OAuth Configuration
- Request Minimal Scopes - Only ask for permissions you need
- Store Refresh Tokens - Enable long-term access
- Pass to MCP - Include access_token in mcp config for tool usage
Testing Your Integration
- Local Development - Use the SDK CLI to test event handling
- OAuth Flow - Test complete authorization flow
- Sync/Webhook - Verify activities are created correctly
- MCP Tools - Test tool exposure and authentication
- Error Cases - Test with invalid tokens, network failures, etc.
Project Structure
Next Steps
- See Webhook-Based Integration Example (Slack)
- See Schedule-Based Integration Example (GitHub)
- Learn About MCP Hub
- View SDK Reference
Contributing
We welcome community contributions! To submit your integration:- Fork the Core repository
- Create your integration in
integrations/your-service/ - Follow the patterns from GitHub/Slack examples
- Test thoroughly
- Submit a pull request
