--- title: Sources | 0ct description: Connect external data to your AI tasks --- # Sources Sources connect 0ct to your external data, enabling AI tasks to access real-time information during execution. Using the Model Context Protocol (MCP), tasks can query your tools just like you would. ## How Sources Work When a task runs with connected sources: 1. 0ct initializes connections to each source 2. Sources are exposed to the AI as callable tools 3. AI can query sources as needed during execution 4. Fresh data is incorporated into the task output ## Supported Integrations ### Project Management - **Linear** - Issues, projects, cycles, roadmaps - **Todoist** - Tasks, projects, labels - **Asana** - Tasks, projects, workspaces ### Development - **GitHub** - Repositories, issues, PRs, commits - **GitLab** - Projects, merge requests, pipelines ### Communication - **Slack** - Channels, messages, users - **Discord** - Servers, channels, messages ### Productivity - **Notion** - Pages, databases, blocks - **Google Drive** - Files, folders, documents ### Custom - **Any API** - Custom MCP server configuration ## Connecting a Source ### Via Dashboard 1. Navigate to **Sources** in the sidebar 2. Click **Add Source** 3. Choose an integration from the registry 4. Click **Connect** to start OAuth flow 5. Authorize access in the popup 6. Source is ready to use! ### Via SDK ``` import Oct from '0ct'; const client = new Oct({ apiKey: process.env.OCT_API_KEY }); // Create a source const source = await client.promptly.sources.create({ name: 'My GitHub', type: 'github', organizationId: 'org_abc123', config: { // Configuration depends on source type owner: 'my-org', repo: 'my-repo' } }); ``` > **Note**: Most sources require OAuth authentication in the dashboard. The SDK is best for managing sources after they’ve been connected. ## MCP Registry 0ct includes auto-discovery of popular MCP servers. When adding a source: 1. Search by name or description 2. Matching integrations appear with setup instructions 3. OAuth-enabled integrations offer one-click connection ### Popular Integrations | Service | Description | Auth Type | | ------- | ------------------ | --------- | | Linear | Project tracking | OAuth | | GitHub | Code hosting | OAuth | | Slack | Team communication | OAuth | | Notion | Workspace docs | OAuth | | Todoist | Personal tasks | OAuth | | Discord | Community chat | OAuth | ## Source Configuration ### OAuth Sources Most sources use OAuth for secure authorization: ``` // OAuth sources are configured in the dashboard // The SDK can list and manage them const sources = await client.promptly.sources.list(); ``` ### API Key Sources Some sources accept API keys directly: ``` const source = await client.promptly.sources.create({ name: 'Custom API', type: 'api', config: { baseUrl: 'https://api.example.com', headers: { 'Authorization': 'Bearer your-api-key' } } }); ``` ### Custom MCP Servers For advanced use cases, connect any MCP-compatible server: ``` const source = await client.promptly.sources.create({ name: 'Custom MCP', type: 'mcp', config: { serverUrl: 'https://mcp.example.com', transport: 'http' } }); ``` ## Using Sources in Tasks ### Attach During Creation ``` const task = await client.promptly.tasks.create({ name: 'GitHub Activity Report', prompt: ` Review recent GitHub activity: - List merged PRs from the past week - Summarize key changes - Identify any open issues needing attention `, modelId: 'openai/gpt-4o', frequency: 'weekly', scheduledDay: 'monday', scheduledTime: '09:00', sources: ['source_github_abc123'] }); ``` ### Update Existing Task ``` await client.promptly.tasks.update('task_xyz', { sources: ['source_github_abc', 'source_linear_def'] }); ``` ## Source Capabilities Each source exposes different tools to the AI: ### GitHub Example Tools - `list_repositories` - Get repositories - `list_issues` - Get issues with filters - `list_pull_requests` - Get PRs - `get_file_contents` - Read file content - `search_code` - Search across repos ### Linear Example Tools - `list_issues` - Get issues - `list_projects` - Get projects - `get_cycle` - Get current cycle - `list_team_members` - Get team ### Slack Example Tools - `list_channels` - Get channels - `get_messages` - Read channel messages - `search_messages` - Search across workspace ## Managing Sources ### List Sources ``` const sources = await client.promptly.sources.list(); for (const source of sources.data) { console.log(`${source.name} (${source.type}): ${source.status}`); } ``` ### Test Connection ``` const result = await client.promptly.sources.test('source_abc123'); if (result.success) { console.log('Connection healthy!'); } else { console.log('Error:', result.error); } ``` ### Update Source ``` await client.promptly.sources.update('source_abc123', { name: 'Renamed Source', config: { // Updated configuration } }); ``` ### Delete Source ``` await client.promptly.sources.delete('source_abc123'); ``` ## Best Practices ### Naming Conventions Use descriptive names that indicate the source and scope: - ✅ `GitHub - Main Repo` - ✅ `Linear - Engineering Team` - ❌ `Source 1` ### Access Scopes Request only the permissions you need: - Read-only access for reporting tasks - Write access only when tasks need to create/update ### Connection Health Monitor source status regularly: ``` const sources = await client.promptly.sources.list(); const unhealthy = sources.data.filter(s => s.status !== 'connected'); if (unhealthy.length > 0) { console.log('Sources need attention:', unhealthy.map(s => s.name)); } ``` ## Troubleshooting ### ”Source disconnected” OAuth tokens may have expired. Re-authorize in the dashboard. ### ”Rate limited” Some APIs have rate limits. Reduce task frequency or source queries. ### ”Permission denied” Check that the OAuth scope includes required permissions. ## Next Steps - [Create Skills](/guides/skills/index.md) - Add reusable instructions - [Configure Destinations](/guides/destinations/index.md) - Set up result delivery - [Explore Tasks](/guides/tasks/index.md) - Advanced task configuration