[FEAT] Live connector tools via MCP OAuth and native APIs#1294
[FEAT] Live connector tools via MCP OAuth and native APIs#1294MODSetter merged 58 commits intoMODSetter:devfrom
Conversation
Implements Notion MCP integration core: - OAuth 2.0 discovery (RFC 9470 + 8414), dynamic client registration, PKCE token exchange, and refresh with rotation - NotionMCPAdapter connecting to mcp.notion.com/mcp with fallback to direct API on known serialization errors - Response parser translating MCP text responses into dicts matching NotionHistoryConnector output format - has_mcp_notion_connector() helper for connector gating
|
@CREDO23 is attempting to deploy a commit to the Rohan Verma's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)❌ Error creating Unit Test PR.
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Review by RecurseML
🔍 Review performed on f5376f2..b6c506a
| Severity | Location | Issue | Delete |
|---|---|---|---|
| surfsense_backend/app/agents/new_chat/tools/mcp_tool.py:637 | Invalid JSONB cast on JSON column |
✅ Files analyzed, no issues (49)
• surfsense_backend/app/agents/new_chat/chat_deepagent.py
• surfsense_backend/app/agents/new_chat/system_prompt.py
• surfsense_backend/app/agents/new_chat/tools/connected_accounts.py
• surfsense_backend/app/agents/new_chat/tools/discord/__init__.py
• surfsense_backend/app/agents/new_chat/tools/discord/_auth.py
• surfsense_backend/app/agents/new_chat/tools/discord/list_channels.py
• surfsense_backend/app/agents/new_chat/tools/discord/read_messages.py
• surfsense_backend/app/agents/new_chat/tools/discord/send_message.py
• surfsense_backend/app/agents/new_chat/tools/gmail/__init__.py
• surfsense_backend/app/agents/new_chat/tools/gmail/read_email.py
• surfsense_backend/app/agents/new_chat/tools/gmail/search_emails.py
• surfsense_backend/app/agents/new_chat/tools/google_calendar/__init__.py
• surfsense_backend/app/agents/new_chat/tools/google_calendar/search_events.py
• surfsense_backend/app/agents/new_chat/tools/hitl.py
• surfsense_backend/app/agents/new_chat/tools/luma/__init__.py
• surfsense_backend/app/agents/new_chat/tools/luma/_auth.py
• surfsense_backend/app/agents/new_chat/tools/luma/create_event.py
• surfsense_backend/app/agents/new_chat/tools/luma/list_events.py
• surfsense_backend/app/agents/new_chat/tools/luma/read_event.py
• surfsense_backend/app/agents/new_chat/tools/registry.py
• surfsense_backend/app/agents/new_chat/tools/teams/__init__.py
• surfsense_backend/app/agents/new_chat/tools/teams/_auth.py
• surfsense_backend/app/agents/new_chat/tools/teams/list_channels.py
• surfsense_backend/app/agents/new_chat/tools/teams/read_messages.py
• surfsense_backend/app/agents/new_chat/tools/teams/send_message.py
• surfsense_backend/app/agents/new_chat/tools/tool_response.py
• surfsense_backend/app/celery_app.py
• surfsense_backend/app/connectors/exceptions.py
• surfsense_backend/app/routes/__init__.py
• surfsense_backend/app/routes/airtable_add_connector_route.py
• surfsense_backend/app/routes/clickup_add_connector_route.py
• surfsense_backend/app/routes/discord_add_connector_route.py
• surfsense_backend/app/routes/google_calendar_add_connector_route.py
• surfsense_backend/app/routes/google_gmail_add_connector_route.py
• surfsense_backend/app/routes/jira_add_connector_route.py
• surfsense_backend/app/routes/linear_add_connector_route.py
• surfsense_backend/app/routes/luma_add_connector_route.py
• surfsense_backend/app/routes/mcp_oauth_route.py
• surfsense_backend/app/routes/oauth_connector_base.py
• surfsense_backend/app/routes/search_source_connectors_routes.py
• surfsense_backend/app/routes/slack_add_connector_route.py
• surfsense_backend/app/routes/teams_add_connector_route.py
• surfsense_backend/app/services/composio_service.py
• surfsense_backend/app/services/llm_router_service.py
• surfsense_backend/app/services/mcp_oauth/discovery.py
• surfsense_backend/app/services/mcp_oauth/registry.py
• surfsense_backend/app/services/notion/tool_metadata_service.py
• surfsense_backend/app/tasks/celery_tasks/connector_tasks.py
• surfsense_backend/app/tasks/celery_tasks/schedule_checker_task.py
⏭️ Files skipped (15)
| Locations |
|---|
surfsense_backend/app/services/mcp_oauth/__init__.py |
surfsense_backend/app/tasks/connector_indexers/__init__.py |
surfsense_backend/app/utils/async_retry.py |
surfsense_backend/app/utils/connector_naming.py |
surfsense_backend/app/utils/periodic_scheduler.py |
surfsense_web/components/assistant-ui/connector-popup/components/connector-card.tsx |
surfsense_web/components/assistant-ui/connector-popup/connector-configs/components/discord-config.tsx |
surfsense_web/components/assistant-ui/connector-popup/connector-configs/components/mcp-service-config.tsx |
surfsense_web/components/assistant-ui/connector-popup/connector-configs/components/teams-config.tsx |
surfsense_web/components/assistant-ui/connector-popup/connector-configs/views/connector-edit-view.tsx |
surfsense_web/components/assistant-ui/connector-popup/connector-configs/views/indexing-configuration-view.tsx |
surfsense_web/components/assistant-ui/connector-popup/constants/connector-constants.ts |
surfsense_web/components/assistant-ui/connector-popup/hooks/use-connector-dialog.ts |
surfsense_web/components/assistant-ui/connector-popup/tabs/active-connectors-tab.tsx |
surfsense_web/components/assistant-ui/connector-popup/views/connector-accounts-list-view.tsx |
|
Note Unit test generation is a public access feature. Expect some limitations and changes as we gather feedback and continue to improve it. Generating unit tests... This may take up to 20 minutes. |
1 similar comment
|
Note Unit test generation is a public access feature. Expect some limitations and changes as we gather feedback and continue to improve it. Generating unit tests... This may take up to 20 minutes. |
|
❌ Failed to create PR with unit tests: AGENT_CHAT: Failed to open pull request |
1 similar comment
|
❌ Failed to create PR with unit tests: AGENT_CHAT: Failed to open pull request |
Description
Replace periodic-indexing integrations for Linear, Jira, ClickUp, Slack, Airtable, Discord, Teams, Gmail, Google Calendar, and Luma with real-time agent tools. Adds MCP OAuth 2.1 (discovery + DCR + PKCE) for Linear/Jira/ClickUp/Slack/Airtable, native REST tools for Discord/Teams/Luma, and Google API tools for Gmail/Calendar. Includes multi-account disambiguation, token encryption at rest, automatic token refresh, and a unified frontend connector UX where all live connectors skip indexing UI entirely.
API Changes
/api/v1/auth/mcp/{service}/connector/*OAuth routes for MCP-backed connectorsChange Type
Testing Performed
Checklist
High-level PR Summary
This PR replaces periodic background indexing for Linear, Jira, ClickUp, Slack, Airtable, Discord, Teams, Gmail, Google Calendar, and Luma with real-time agent tools. For Linear, Jira, ClickUp, Slack, and Airtable, the changes introduce MCP OAuth 2.1 with discovery, Dynamic Client Registration (DCR), and PKCE flow. For Discord, Teams, and Luma, native REST API tools are added. Gmail and Google Calendar gain direct search and read tools using Google APIs. The implementation includes multi-account disambiguation (tool name prefixing when multiple accounts exist), token encryption at rest with automatic refresh, a unified frontend that skips indexing UI for live connectors, and extensive system prompt updates to guide the LLM through discovery patterns and service routing.
⏱️ Estimated Review Time: 3+ hours
💡 Review Order Suggestion
surfsense_backend/app/services/mcp_oauth/registry.pysurfsense_backend/app/services/mcp_oauth/discovery.pysurfsense_backend/app/routes/mcp_oauth_route.pysurfsense_backend/app/agents/new_chat/tools/mcp_tool.pysurfsense_backend/app/agents/new_chat/tools/registry.pysurfsense_backend/app/agents/new_chat/tools/connected_accounts.pysurfsense_backend/app/agents/new_chat/system_prompt.pysurfsense_backend/app/agents/new_chat/tools/gmail/search_emails.pysurfsense_backend/app/agents/new_chat/tools/gmail/read_email.pysurfsense_backend/app/agents/new_chat/tools/google_calendar/search_events.pysurfsense_backend/app/agents/new_chat/tools/discord/__init__.pysurfsense_backend/app/agents/new_chat/tools/discord/list_channels.pysurfsense_backend/app/agents/new_chat/tools/discord/read_messages.pysurfsense_backend/app/agents/new_chat/tools/discord/send_message.pysurfsense_backend/app/agents/new_chat/tools/teams/__init__.pysurfsense_backend/app/agents/new_chat/tools/teams/list_channels.pysurfsense_backend/app/agents/new_chat/tools/teams/read_messages.pysurfsense_backend/app/agents/new_chat/tools/teams/send_message.pysurfsense_backend/app/agents/new_chat/tools/luma/__init__.pysurfsense_backend/app/agents/new_chat/tools/luma/list_events.pysurfsense_backend/app/agents/new_chat/tools/luma/read_event.pysurfsense_backend/app/agents/new_chat/tools/luma/create_event.pysurfsense_backend/app/routes/search_source_connectors_routes.pysurfsense_backend/app/tasks/celery_tasks/connector_tasks.pysurfsense_backend/app/celery_app.pysurfsense_backend/app/routes/linear_add_connector_route.pysurfsense_backend/app/routes/jira_add_connector_route.pysurfsense_backend/app/routes/clickup_add_connector_route.pysurfsense_backend/app/routes/slack_add_connector_route.pysurfsense_backend/app/routes/airtable_add_connector_route.pysurfsense_backend/app/routes/discord_add_connector_route.pysurfsense_backend/app/routes/teams_add_connector_route.pysurfsense_backend/app/routes/google_gmail_add_connector_route.pysurfsense_backend/app/routes/google_calendar_add_connector_route.pysurfsense_backend/app/routes/luma_add_connector_route.pysurfsense_web/components/assistant-ui/connector-popup/constants/connector-constants.tssurfsense_web/components/assistant-ui/connector-popup/connector-configs/components/mcp-service-config.tsxsurfsense_web/components/assistant-ui/connector-popup/connector-configs/views/connector-edit-view.tsxsurfsense_web/components/assistant-ui/connector-popup/connector-configs/views/indexing-configuration-view.tsxsurfsense_web/components/assistant-ui/connector-popup/components/connector-card.tsx