Skip to content

[FEAT] Live connector tools via MCP OAuth and native APIs#1294

Merged
MODSetter merged 58 commits intoMODSetter:devfrom
CREDO23:feature/mcp-migration
Apr 23, 2026
Merged

[FEAT] Live connector tools via MCP OAuth and native APIs#1294
MODSetter merged 58 commits intoMODSetter:devfrom
CREDO23:feature/mcp-migration

Conversation

@CREDO23
Copy link
Copy Markdown
Contributor

@CREDO23 CREDO23 commented Apr 22, 2026

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

  • This PR includes API changes
    • New /api/v1/auth/mcp/{service}/connector/* OAuth routes for MCP-backed connectors

Change Type

  • New feature
  • Refactoring

Testing Performed

  • Tested locally
  • Manual/QA verification

Checklist

  • Follows project coding standards and conventions
  • Documentation updated as needed
  • Dependencies updated as needed
  • No lint/build errors or new warnings
  • All relevant tests are passing

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
Order File Path
1 surfsense_backend/app/services/mcp_oauth/registry.py
2 surfsense_backend/app/services/mcp_oauth/discovery.py
3 surfsense_backend/app/routes/mcp_oauth_route.py
4 surfsense_backend/app/agents/new_chat/tools/mcp_tool.py
5 surfsense_backend/app/agents/new_chat/tools/registry.py
6 surfsense_backend/app/agents/new_chat/tools/connected_accounts.py
7 surfsense_backend/app/agents/new_chat/system_prompt.py
8 surfsense_backend/app/agents/new_chat/tools/gmail/search_emails.py
9 surfsense_backend/app/agents/new_chat/tools/gmail/read_email.py
10 surfsense_backend/app/agents/new_chat/tools/google_calendar/search_events.py
11 surfsense_backend/app/agents/new_chat/tools/discord/__init__.py
12 surfsense_backend/app/agents/new_chat/tools/discord/list_channels.py
13 surfsense_backend/app/agents/new_chat/tools/discord/read_messages.py
14 surfsense_backend/app/agents/new_chat/tools/discord/send_message.py
15 surfsense_backend/app/agents/new_chat/tools/teams/__init__.py
16 surfsense_backend/app/agents/new_chat/tools/teams/list_channels.py
17 surfsense_backend/app/agents/new_chat/tools/teams/read_messages.py
18 surfsense_backend/app/agents/new_chat/tools/teams/send_message.py
19 surfsense_backend/app/agents/new_chat/tools/luma/__init__.py
20 surfsense_backend/app/agents/new_chat/tools/luma/list_events.py
21 surfsense_backend/app/agents/new_chat/tools/luma/read_event.py
22 surfsense_backend/app/agents/new_chat/tools/luma/create_event.py
23 surfsense_backend/app/routes/search_source_connectors_routes.py
24 surfsense_backend/app/tasks/celery_tasks/connector_tasks.py
25 surfsense_backend/app/celery_app.py
26 surfsense_backend/app/routes/linear_add_connector_route.py
27 surfsense_backend/app/routes/jira_add_connector_route.py
28 surfsense_backend/app/routes/clickup_add_connector_route.py
29 surfsense_backend/app/routes/slack_add_connector_route.py
30 surfsense_backend/app/routes/airtable_add_connector_route.py
31 surfsense_backend/app/routes/discord_add_connector_route.py
32 surfsense_backend/app/routes/teams_add_connector_route.py
33 surfsense_backend/app/routes/google_gmail_add_connector_route.py
34 surfsense_backend/app/routes/google_calendar_add_connector_route.py
35 surfsense_backend/app/routes/luma_add_connector_route.py
36 surfsense_web/components/assistant-ui/connector-popup/constants/connector-constants.ts
37 surfsense_web/components/assistant-ui/connector-popup/connector-configs/components/mcp-service-config.tsx
38 surfsense_web/components/assistant-ui/connector-popup/connector-configs/views/connector-edit-view.tsx
39 surfsense_web/components/assistant-ui/connector-popup/connector-configs/views/indexing-configuration-view.tsx
40 surfsense_web/components/assistant-ui/connector-popup/components/connector-card.tsx

Need help? Join our Discord

Analyze latest changes

CREDO23 added 30 commits April 20, 2026 20:59
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 added 22 commits April 22, 2026 08:42
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 22, 2026

@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.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 22, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 81918cbc-a620-474d-af8c-0b1e2233177b

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)

❌ Error creating Unit Test PR.

  • Create PR with unit tests
  • Commit unit tests in branch feature/mcp-migration

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@recurseml recurseml Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review by RecurseML

🔍 Review performed on f5376f2..b6c506a

  Severity     Location     Issue     Delete  
High 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

Comment thread surfsense_backend/app/agents/new_chat/tools/mcp_tool.py
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 22, 2026

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
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 22, 2026

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.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 22, 2026

❌ Failed to create PR with unit tests: AGENT_CHAT: Failed to open pull request

1 similar comment
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 22, 2026

❌ Failed to create PR with unit tests: AGENT_CHAT: Failed to open pull request

@MODSetter MODSetter merged commit 7245ab4 into MODSetter:dev Apr 23, 2026
5 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants