AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.
feat(platform): add supported official MCP integrations (#14514)
Nicholas Tindle8832e81242bd
diff --git a/autogpt_platform/backend/backend/api/features/integrations/codex_test.py b/autogpt_platform/backend/backend/api/features/integrations/codex_test.pyindex 10d2c61428..0057ee1743 100644--- a/autogpt_platform/backend/backend/api/features/integrations/codex_test.py+++ b/autogpt_platform/backend/backend/api/features/integrations/codex_test.py@@ -433,7 +433,9 @@ def test_provider_discovery_includes_codex_when_user_has_access():response = client.get("/providers")assert response.status_code == 200- assert [provider["name"] for provider in response.json()] == ["codex", "github"]+ assert [+ provider["name"] for provider in response.json() if not provider["mcp_server"]+ ] == ["codex", "github"]def test_provider_discovery_omits_codex_when_user_lacks_access():@@ -460,7 +462,9 @@ def test_provider_discovery_omits_codex_when_user_lacks_access():response = client.get("/providers")assert response.status_code == 200- assert [provider["name"] for provider in response.json()] == ["github"]+ assert [+ provider["name"] for provider in response.json() if not provider["mcp_server"]+ ] == ["github"]access.assert_awaited_once_with(TEST_USER_ID)@@ -489,7 +493,9 @@ def test_provider_discovery_remains_public_and_omits_codex_anonymously():response = client.get("/providers")assert response.status_code == 200- assert [provider["name"] for provider in response.json()] == ["github"]+ assert [+ provider["name"] for provider in response.json() if not provider["mcp_server"]+ ] == ["github"]access.assert_not_awaited()diff --git a/autogpt_platform/backend/backend/api/features/integrations/mcp_catalog_routes_test.py b/autogpt_platform/backend/backend/api/features/integrations/mcp_catalog_routes_test.pynew file mode 100644index 0000000000..c7e6080c19--- /dev/null+++ b/autogpt_platform/backend/backend/api/features/integrations/mcp_catalog_routes_test.py@@ -0,0 +1,67 @@+from unittest.mock import patch++import pytest+from autogpt_libs.auth import get_optional_user_id+from fastapi import FastAPI+from fastapi.testclient import TestClient++from backend.api.features.integrations.models import ProviderNamesResponse+from backend.api.features.integrations.router import router, settings+from backend.integrations.mcp_catalog import get_mcp_catalog+from backend.util.settings import BehaveAs++app = FastAPI()+app.include_router(router)+app.dependency_overrides[get_optional_user_id] = lambda: None++[email protected]("behave_as", [BehaveAs.CLOUD, BehaveAs.LOCAL])+def test_provider_endpoint_only_exposes_connectable_catalog(behave_as: BehaveAs):+ with (+ patch.object(settings.config, "behave_as", behave_as),+ patch("backend.blocks.load_all_blocks"),+ patch(+ "backend.api.features.integrations.router.get_all_provider_names",+ return_value=["notion", "google"],+ ),+ patch(+ "backend.api.features.integrations.router.get_provider_description",+ return_value="Native integration",+ ),+ patch(+ "backend.api.features.integrations.router.get_supported_auth_types",+ return_value=["oauth2"],+ ),+ ):+ response = TestClient(app).get("/providers")++ assert response.status_code == 200+ providers = response.json()+ connectable = {entry.name for entry in get_mcp_catalog()}+ assert {provider["name"] for provider in providers[2:]} == connectable+ assert len({provider["name"] for provider in providers}) == len(providers)+ assert "mcp_langfuse" in {provider["name"] for provider in providers}+ assert [provider["name"] for provider in providers[:2]] == ["notion", "google"]+ assert all(provider["mcp_server"] is None for provider in providers[:2])+ notion = next(+ provider for provider in providers if provider["name"] == "mcp_notion"+ )+ assert notion["display_name"] == "Notion"+ assert notion["supported_auth_types"] == []+ assert notion["mcp_server"]["server_url"] == "https://mcp.notion.com/mcp"+ assert notion["mcp_server"]["connection_mode"] == "hosted"+++def test_catalog_entries_do_not_register_credential_providers():+ credential_providers = set(ProviderNamesResponse().providers)+ catalog_names = {entry.name for entry in get_mcp_catalog()}+ assert credential_providers.isdisjoint(catalog_names)+++def test_provider_openapi_exposes_typed_mcp_metadata():+ schemas = app.openapi()["components"]["schemas"]+ metadata = schemas["MCPServerMetadata"]["properties"]+ assert metadata["connection_mode"]["enum"] == ["hosted", "custom"]+ assert metadata["auth_methods"]["minItems"] == 1+ assert "auth_methods" in schemas["MCPServerMetadata"]["required"]+ assert "mcp_server" in schemas["ProviderMetadata"]["properties"]diff --git a/autogpt_platform/backend/backend/api/features/integrations/models.py b/autogpt_platform/backend/backend/api/features/integrations/models.pyindex 84bda37da4..8fed2d8050 100644--- a/autogpt_platform/backend/backend/api/features/integrations/models.py+++ b/autogpt_platform/backend/backend/api/features/integrations/models.py@@ -8,6 +8,7 @@ allowing frontend code generators like Orval to create corresponding TypeScriptfrom pydantic import BaseModel, Fieldfrom backend.data.model import CredentialsType+from backend.integrations.mcp_catalog import MCPServerMetadatafrom backend.integrations.providers import ProviderNamefrom backend.sdk.registry import AutoRegistry@@ -52,6 +53,12 @@ class ProviderMetadata(BaseModel):"""Display metadata for a provider, shown in the settings integrations UI."""name: str = Field(description="Provider slug (e.g. ``github``)")+ display_name: str | None = Field(+ default=None, description="Human-readable provider name"+ )+ mcp_server: MCPServerMetadata | None = Field(+ default=None, description="Official MCP catalog connection and setup metadata"+ )description: str | None = Field(default=None,description=(diff --git a/autogpt_platform/backend/backend/api/features/integrations/router.py b/autogpt_platform/backend/backend/api/features/integrations/router.pyindex fc70877300..9fa746211f 100644--- a/autogpt_platform/backend/backend/api/features/integrations/router.py+++ b/autogpt_platform/backend/backend/api/features/integrations/router.py@@ -68,6 +68,7 @@ from backend.integrations.managed_providers.ayrshare import AyrshareManagedProvifrom backend.integrations.managed_providers.ayrshare import (settings_available as ayrshare_settings_available,)+from backend.integrations.mcp_catalog import get_mcp_catalogfrom backend.integrations.oauth import (CREDENTIALS_BY_PROVIDER,DEVICE_HANDLERS_BY_NAME,@@ -1949,8 +1950,9 @@ async def list_providers(a ``description`` declared via ``ProviderBuilder.with_description(...)`` inthe provider's ``_config.py``.- Note: The complete list of provider names is also available as a constant- in the generated TypeScript client via PROVIDER_NAMES.+ Official MCP catalog entries are appended as display metadata and use the+ generic MCP connection flow. They are not registered credential providers,+ so PROVIDER_NAMES continues to contain only credential-provider names."""# Ensure all block modules (and therefore every provider's _config.py) are# imported before we read from AutoRegistry. Cached on first call.@@ -1973,6 +1975,14 @@ async def list_providers(supported_auth_types=get_supported_auth_types(name),)for name in all_providers+ ] + [+ ProviderMetadata(+ name=entry.name,+ display_name=entry.display_name,+ description=entry.description,+ mcp_server=entry.mcp_server,+ )+ for entry in get_mcp_catalog()]diff --git a/autogpt_platform/backend/backend/api/features/mcp/oauth_registration.py b/autogpt_platform/backend/backend/api/features/mcp/oauth_registration.pynew file mode 100644index 0000000000..514fdfe1a0--- /dev/null+++ b/autogpt_platform/backend/backend/api/features/mcp/oauth_registration.py@@ -0,0 +1,34 @@+from pydantic import BaseModel, Field, SecretStr, model_validator++from backend.blocks.mcp.oauth import MCPTokenEndpointAuthMethod+++class MCPClientRegistration(BaseModel):+ client_id: str = Field(min_length=1)+ client_secret: SecretStr = SecretStr("")+ token_endpoint_auth_method: MCPTokenEndpointAuthMethod++ @model_validator(mode="after")+ def validate_client_authentication(self):+ if self.token_endpoint_auth_method == "none":+ self.client_secret = SecretStr("")+ elif not self.client_secret.get_secret_value():+ raise ValueError(+ "Registered client authentication requires a client secret"+ )+ return self+++def select_client_auth_method(+ metadata: dict[str, object]+) -> MCPTokenEndpointAuthMethod:+ supported = metadata.get(+ "token_endpoint_auth_methods_supported", ["client_secret_basic"]+ )+ if isinstance(supported, list):+ for method in ("none", "client_secret_basic", "client_secret_post"):+ if method in supported:+ return method+ raise ValueError(+ "This MCP server requires an unsupported client authentication method"+ )diff --git a/autogpt_platform/backend/backend/api/features/mcp/routes.py b/autogpt_platform/backend/backend/api/features/mcp/routes.pyindex b95e60a084..ef1732aa2e 100644--- a/autogpt_platform/backend/backend/api/features/mcp/routes.py+++ b/autogpt_platform/backend/backend/api/features/mcp/routes.py@@ -13,12 +13,16 @@ from urllib.parse import urlparseimport fastapifrom autogpt_libs.auth import get_user_idfrom fastapi import Security-from pydantic import BaseModel, Field, SecretStr+from pydantic import BaseModel, Field, SecretStr, field_validatorfrom backend.api.features.integrations.router import (CredentialsMetaResponse,to_meta_response,)+from backend.api.features.mcp.oauth_registration import (+ MCPClientRegistration,+ select_client_auth_method,+)from backend.blocks.mcp.client import (MCPClient,MCPClientError,@@ -31,9 +35,10 @@ from backend.blocks.mcp.helpers import (normalize_mcp_url,server_host,)-from backend.blocks.mcp.oauth import MCPOAuthHandler+from backend.blocks.mcp.oauth import MCPOAuthHandler, MCPTokenEndpointAuthMethodfrom backend.data.model import OAuth2Credentialsfrom backend.integrations.creds_manager import IntegrationCredentialsManager+from backend.integrations.mcp_catalog import get_mcp_catalog_entry_for_urlfrom backend.integrations.providers import ProviderNamefrom backend.util.request import (AUTH_STATUS_CODES,@@ -55,6 +60,13 @@ creds_manager = IntegrationCredentialsManager()_PROBE_TIMEOUT_SECONDS = 10_PROBE_CLOSE_TIMEOUT_SECONDS = 5+# `/oauth/login` answers 400 for eight different reasons, and only one of them+# means "there is no OAuth here, use an API token". The connect panel has to+# tell that one apart to decide whether to offer the manual-token form, and+# matching on the prose broke the moment either message was reworded — so the+# two no-OAuth branches carry this code and the rest stay plain strings.+NO_OAUTH_CODE = "no_oauth"+# ====================== Tool Discovery ====================== #@@ -67,6 +79,11 @@ class DiscoverToolsRequest(BaseModel):"""Request to discover tools on an MCP server."""server_url: str = Field(description="URL of the MCP server")+ use_saved_credentials: bool = Field(+ default=True,+ description="Use a saved credential when no auth token is supplied. "+ "Set false to discover public tools without signing in.",+ )auth_token: SecretStr | None = Field(default=None,min_length=1,@@ -108,7 +125,7 @@ async def discover_tools(Connect to an MCP server and return its available tools.If the user has a stored MCP credential for this server URL, it will be- used automatically — no need to pass an explicit auth credential.+ used automatically unless use_saved_credentials is false."""# Validate URL to prevent SSRF — blocks loopback and private IP ranges.try:@@ -125,7 +142,7 @@ async def discover_tools(authorization = normalize_mcp_authorization(explicit_token)except ValueError as e:raise fastapi.HTTPException(status_code=422, detail=str(e)) from e- else:+ elif request.use_saved_credentials:# Auto-use stored MCP credential when no explicit token is provided.stored_credential = await auto_lookup_mcp_credential(user_id, normalize_mcp_url(request.server_url)@@ -182,6 +199,26 @@ class MCPOAuthLoginRequest(BaseModel):"""Request to start an OAuth flow for an MCP server."""server_url: str = Field(description="URL of the MCP server that requires OAuth")+ scopes: list[str] | None = Field(+ default=None,+ description="OAuth scopes to request. Omit or use null to use catalogue or discovered defaults; "+ "an empty list requests no scopes.",+ )++ @field_validator("scopes")+ @classmethod+ def validate_scopes(cls, scopes: list[str] | None) -> list[str] | None:+ if scopes is not None:+ for scope in scopes:+ if not scope or any(+ char.isspace() or ord(char) < 32 or ord(char) == 127+ for char in scope+ ):+ raise ValueError(+ "OAuth scopes must be nonempty tokens without whitespace "+ "or control characters"+ )+ return scopesclass MCPOAuthLoginResponse(BaseModel):@@ -216,6 +253,21 @@ async def mcp_oauth_login(# Normalize the URL so that credentials stored here are matched consistently# by auto_lookup_mcp_credential (which also uses normalized URLs).server_url = normalize_mcp_url(request.server_url)+ frontend_base_url = settings.config.frontend_base_url+ catalog_entry = get_mcp_catalog_entry_for_url(server_url)+ catalog_scopes: list[str] | None = None+ if catalog_entry:+ if "oauth" not in catalog_entry.mcp_server.auth_methods:+ raise fastapi.HTTPException(+ status_code=400,+ detail={+ "code": NO_OAUTH_CODE,+ "message": f"{catalog_entry.display_name} uses "+ f"{' / '.join(catalog_entry.mcp_server.auth_methods)} "+ f"authentication. {catalog_entry.mcp_server.setup_instructions}",+ },+ )+ catalog_scopes = catalog_entry.mcp_server.oauth_scopesclient = MCPClient(server_url)# Step 1: Discover protected-resource metadata (RFC 9728)@@ -261,17 +313,42 @@ async def mcp_oauth_login():raise fastapi.HTTPException(status_code=400,- detail="This MCP server does not advertise OAuth support. "- "You may need to provide an auth credential manually.",+ detail={+ "code": NO_OAUTH_CODE,+ "message": "This MCP server does not advertise OAuth support. "+ "You may need to provide an auth credential manually.",+ },)authorize_url = metadata["authorization_endpoint"]token_url = metadata["token_endpoint"]registration_endpoint = metadata.get("registration_endpoint")revoke_url = metadata.get("revocation_endpoint")+ # The revocation call carries the token, and this URL comes from the+ # server's own metadata. Over plain HTTP that hands the token to anyone+ # on the path, so drop it rather than use it; revocation is best-effort.+ if isinstance(revoke_url, str) and not revoke_url.lower().startswith("https://"):+ logger.warning(+ "Ignoring non-HTTPS revocation endpoint advertised by %s",+ server_host(request.server_url),+ )+ revoke_url = None+ scopes = (+ request.scopes+ if request.scopes is not None+ else (+ catalog_scopes+ if catalog_scopes is not None+ else (protected_resource or {}).get("scopes_supported")+ or metadata.get("scopes_supported", [])+ )+ )+ issuer = _validated_issuer(metadata, expected_issuer)+ iss_required = bool(issuer) and (+ metadata.get("authorization_response_iss_parameter_supported") is True+ )# Step 3: Dynamic Client Registration (RFC 7591) if available- frontend_base_url = settings.config.frontend_base_urlif not frontend_base_url:raise fastapi.HTTPException(status_code=500,@@ -281,35 +358,61 @@ async def mcp_oauth_login(client_id = ""client_secret = ""+ token_endpoint_auth_method: MCPTokenEndpointAuthMethod = "none"if registration_endpoint:+ try:+ requested_auth_method = select_client_auth_method(metadata)+ except ValueError as e:+ raise fastapi.HTTPException(status_code=400, detail=str(e))# Validate the registration endpoint from metadata to prevent SSRF.try:await validate_url_host(registration_endpoint)except ValueError:- pass # Skip registration, fall back to default client_id+ raise fastapi.HTTPException(+ status_code=400,+ detail="Could not register an OAuth client because the MCP server's "+ "registration URL is invalid. Use a manual auth credential if supported.",+ )else:reg_result = await _register_mcp_client(- registration_endpoint, redirect_uri, server_url+ registration_endpoint,+ redirect_uri,+ server_url,+ requested_auth_method,+ scopes=scopes,+ supports_refresh_token="refresh_token"+ in (metadata.get("grant_types_supported") or []),)- if reg_result:- client_id = reg_result.get("client_id", "")- client_secret = reg_result.get("client_secret", "")+ if not reg_result:+ raise fastapi.HTTPException(+ status_code=400,+ detail="Could not register an OAuth client with this MCP server. "+ "Use a manual auth credential if supported.",+ )+ try:+ registration = MCPClientRegistration.model_validate(+ {+ **reg_result,+ "token_endpoint_auth_method": reg_result.get(+ "token_endpoint_auth_method", requested_auth_method+ ),+ }+ )+ except ValueError:+ raise fastapi.HTTPException(+ status_code=400,+ detail="The MCP server returned an invalid registered client, "+ "unsupported authentication method, or missing client secret. "+ "Use a manual auth credential if supported.",+ )+ client_id = registration.client_id+ client_secret = registration.client_secret.get_secret_value()+ token_endpoint_auth_method = registration.token_endpoint_auth_methodif not client_id:client_id = "autogpt-platform"# Step 4: Store state token with OAuth metadata for the callback- scopes = (protected_resource or {}).get("scopes_supported") or metadata.get(- "scopes_supported", []- )- # RFC 8414 issuer identifier: validated against the ``iss``- # authorization-response parameter (RFC 9207) on callback, and recorded- # on the credential so it stays bound to the authorization server that- # issued it. Servers that advertise ``iss`` support must send it.- issuer = _validated_issuer(metadata, expected_issuer)- iss_required = bool(issuer) and (- metadata.get("authorization_response_iss_parameter_supported") is True- )state_token, code_challenge = await creds_manager.store.store_state_token(user_id,ProviderName.MCP.value,@@ -322,6 +425,7 @@ async def mcp_oauth_login("server_url": server_url,"client_id": client_id,"client_secret": client_secret,+ "token_endpoint_auth_method": token_endpoint_auth_method,"issuer": issuer,"iss_required": iss_required,},@@ -335,6 +439,7 @@ async def mcp_oauth_login(authorize_url=authorize_url,token_url=token_url,resource_url=resource_url,+ token_endpoint_auth_method=token_endpoint_auth_method,)login_url = handler.get_login_url(scopes, state_token, code_challenge=code_challenge@@ -421,6 +526,7 @@ async def mcp_oauth_callback(token_url=meta["token_url"],revoke_url=meta.get("revoke_url"),resource_url=meta.get("resource_url"),+ token_endpoint_auth_method=meta.get("token_endpoint_auth_method"),)try:@@ -436,10 +542,29 @@ async def mcp_oauth_callback(# Enrich credential metadata for future lookup and token refreshif credentials.metadata is None:credentials.metadata = {}- credentials.metadata["mcp_server_url"] = meta["server_url"]+ # Two catalog entries sign in at a different URL from the one their+ # tools are called on (Context7 and Parallel). Binding the credential to+ # the sign-in URL made lookup miss: the user completed OAuth, the dialog+ # said connected, and every later call fell back to public limits with+ # nothing reporting a problem. Record the URL the tools actually use.+ catalog_entry = get_mcp_catalog_entry_for_url(meta["server_url"])+ tools_url = (+ catalog_entry.mcp_server.server_url+ if catalog_entry and catalog_entry.mcp_server.server_url+ else meta["server_url"]+ )+ credentials.metadata["mcp_server_url"] = tools_urlcredentials.metadata["mcp_client_id"] = meta["client_id"]- credentials.metadata["mcp_client_secret"] = meta.get("client_secret", "")+ credentials.metadata["mcp_client_secret"] = (+ ""+ if meta.get("token_endpoint_auth_method") == "none"+ else meta.get("client_secret", "")+ )+ credentials.metadata["mcp_token_endpoint_auth_method"] = meta.get(+ "token_endpoint_auth_method"+ ) or ("client_secret_post" if meta.get("client_secret") else "none")credentials.metadata["mcp_token_url"] = meta["token_url"]+ credentials.metadata["mcp_revoke_url"] = meta.get("revoke_url")credentials.metadata["mcp_resource_url"] = meta.get("resource_url", "")credentials.metadata["mcp_issuer"] = expected_issuer@@ -452,10 +577,13 @@ async def mcp_oauth_callback(user_id, ProviderName.MCP.value)for old in old_creds:- if (- isinstance(old, OAuth2Credentials)- and (old.metadata or {}).get("mcp_server_url") == meta["server_url"]- ):+ # Both URLs count. The new credential is filed under the tools+ # URL, but ones stored before that change are under the sign-in+ # URL, and for the two entries where those differ matching only+ # one of them leaves a dead token behind on every reconnection.+ if isinstance(old, OAuth2Credentials) and (old.metadata or {}).get(+ "mcp_server_url"+ ) in {tools_url, meta["server_url"]}:await creds_manager.store.delete_creds_by_id(user_id, old.id)logger.info("Removed old MCP credential %s for %s",@@ -736,21 +864,29 @@ async def _register_mcp_client(registration_endpoint: str,redirect_uri: str,server_url: str,+ token_endpoint_auth_method: MCPTokenEndpointAuthMethod = "client_secret_post",+ *,+ scopes: list[str] | None = None,+ supports_refresh_token: bool = False,) -> dict[str, Any] | None:"""Attempt Dynamic Client Registration (RFC 7591) with an MCP auth server."""try:+ grant_types = ["authorization_code"]+ if supports_refresh_token:+ grant_types.append("refresh_token")+ payload: dict[str, str | list[str]] = {+ "client_name": "AutoGPT Platform",+ "redirect_uris": [redirect_uri],+ "grant_types": grant_types,+ "response_types": ["code"],+ "token_endpoint_auth_method": token_endpoint_auth_method,+ "application_type": "web",+ }+ if scopes:+ payload["scope"] = " ".join(scopes)response = await Requests(raise_for_status=True).post(registration_endpoint,- json={- "client_name": "AutoGPT Platform",- "redirect_uris": [redirect_uri],- "grant_types": ["authorization_code"],- "response_types": ["code"],- "token_endpoint_auth_method": "client_secret_post",- # Required by MCP 2026-07-28 so OIDC-backed authorization- # servers apply web-app redirect URI rules.- "application_type": "web",- },+ json=payload,)data = response.json()if isinstance(data, dict) and "client_id" in data:diff --git a/autogpt_platform/backend/backend/api/features/mcp/test_oauth_auth_methods.py b/autogpt_platform/backend/backend/api/features/mcp/test_oauth_auth_methods.pynew file mode 100644index 0000000000..683df51197--- /dev/null+++ b/autogpt_platform/backend/backend/api/features/mcp/test_oauth_auth_methods.py@@ -0,0 +1,484 @@+import base64+from unittest.mock import AsyncMock, MagicMock, patch+from urllib.parse import parse_qs, urlparse++import fastapi+import httpx+import pytest+import pytest_asyncio+from autogpt_libs.auth import get_user_id++from backend.api.features.mcp.routes import NO_OAUTH_CODE, router+from backend.data.model import OAuth2Credentials+from backend.integrations.creds_manager import create_mcp_oauth_handler+from backend.util.request import HTTPClientError++app = fastapi.FastAPI()+app.include_router(router)+app.dependency_overrides[get_user_id] = lambda: "test-user-id"+++@pytest_asyncio.fixture(scope="module")+async def client():+ async with httpx.AsyncClient(+ transport=httpx.ASGITransport(app=app), base_url="http://test"+ ) as client:+ yield client+++def oauth_mocks():+ with (+ patch("backend.api.features.mcp.routes.MCPClient") as mcp_client,+ patch("backend.api.features.mcp.routes.creds_manager") as manager,+ patch("backend.api.features.mcp.routes.settings") as settings,+ patch("backend.api.features.mcp.routes.Requests") as requests,+ patch(+ "backend.api.features.mcp.routes.validate_url_host",+ new_callable=AsyncMock,+ ),+ ):+ metadata = {+ "issuer": "https://auth.example.com",+ "authorization_endpoint": "https://auth.example.com/authorize",+ "token_endpoint": "https://auth.example.com/token",+ "revocation_endpoint": "https://auth.example.com/revoke",+ "registration_endpoint": "https://auth.example.com/register",+ "token_endpoint_auth_methods_supported": ["none"],+ }+ mcp_client.return_value.discover_auth = AsyncMock(return_value=None)+ mcp_client.return_value.discover_auth_server_metadata = AsyncMock(+ return_value=(metadata, "https://auth.example.com")+ )+ registration = {+ "client_id": "client:id",+ "client_secret": "<test secret>",+ "token_endpoint_auth_method": "none",+ }+ response = MagicMock()+ response.json.return_value = registration+ post = requests.return_value.post = AsyncMock(return_value=response)+ manager.store.store_state_token = AsyncMock(+ return_value=("state", "pkce-challenge")+ )+ manager.store.get_creds_by_provider = AsyncMock(return_value=[])+ manager.create = AsyncMock()+ settings.config.frontend_base_url = "https://app.example.com"+ yield metadata, registration, post, manager+++ "advertised,requested,registered",+ [+ (["none"], "none", "none"),+ (["none"], "none", None),+ (["client_secret_basic"], "client_secret_basic", "client_secret_basic"),+ (["client_secret_post"], "client_secret_post", "client_secret_post"),+ (["client_secret_post", "none"], "none", "none"),+ (["client_secret_basic", "none"], "none", "none"),+ (["client_secret_basic", "client_secret_post", "none"], "none", "none"),+ (None, "client_secret_basic", "client_secret_basic"),+ ],+)[email protected](loop_scope="session")+async def test_registered_method_survives_token_lifecycle(+ client, oauth_mocks, advertised, requested, registered+):+ metadata, registration, post, manager = oauth_mocks+ if advertised is None:+ metadata.pop("token_endpoint_auth_methods_supported")+ else:+ metadata["token_endpoint_auth_methods_supported"] = advertised+ if registered is None:+ registration.pop("token_endpoint_auth_method")+ registered = requested+ else:+ registration["token_endpoint_auth_method"] = registered++ response = await client.post(+ "/oauth/login", json={"server_url": "https://mcp.example.com/mcp"}+ )++ assert response.status_code == 200+ assert post.call_args.kwargs["json"]["token_endpoint_auth_method"] == requested+ state_metadata = manager.store.store_state_token.call_args.kwargs["state_metadata"]+ assert state_metadata["token_endpoint_auth_method"] == registered+ assert state_metadata["client_secret"] == (+ "" if registered == "none" else "<test secret>"+ )+ assert "client_secret" not in response.text+ state = MagicMock()+ state.state_metadata = state_metadata+ state.scopes = ["read"]+ state.code_verifier = "pkce-verifier"+ manager.store.verify_state_token = AsyncMock(return_value=state)++ with patch("backend.blocks.mcp.oauth.Requests") as token_requests:+ token_response = MagicMock()+ token_response.json.return_value = {+ "access_token": "<test-access-token>",+ "refresh_token": "<test-refresh-token>",+ }+ token_post = token_requests.return_value.post = AsyncMock(+ return_value=token_response+ )+ callback = await client.post(+ "/oauth/callback", json={"code": "code", "state_token": "state"}+ )+ assert callback.status_code == 200+ manager.store.verify_state_token.assert_awaited_once_with(+ "test-user-id", "state", "mcp"+ )+ exchange_args = token_post.call_args.kwargs+ assert exchange_args["data"]["code_verifier"] == "pkce-verifier"+ credentials = manager.create.call_args.args[1]+ assert credentials.metadata["mcp_token_endpoint_auth_method"] == registered+ assert credentials.metadata["mcp_client_secret"] == (+ "" if registered == "none" else "<test secret>"+ )+ assert "mcp_client_secret" not in callback.text+ await create_mcp_oauth_handler(credentials)._refresh_tokens(credentials)+ refresh_args = token_post.call_args.kwargs+ assert refresh_args["data"]["grant_type"] == "refresh_token"+ handler = create_mcp_oauth_handler(credentials)+ assert await handler.revoke_tokens(credentials)+ assert token_post.call_args.args[0] == "https://auth.example.com/revoke"+ revoke_args = token_post.call_args.kwargs+ assert revoke_args["data"]["token"] == "<test-access-token>"++ for args in (exchange_args, refresh_args, revoke_args):+ if registered == "client_secret_basic":+ assert (+ base64.b64decode(+ args["headers"]["Authorization"].removeprefix("Basic ")+ ).decode()+ == "client%3Aid:%3Ctest+secret%3E"+ )+ # The id rides along for servers that do not read it from the+ # header (Miro answers "Missing client_id" otherwise); the+ # secret is what must stay out of the body.+ assert args["data"]["client_id"] == "client:id"+ assert "client_secret" not in args["data"]+ assert "client_secret" not in args["data"]+ else:+ assert "Authorization" not in args["headers"]+ assert args["data"]["client_id"] == "client:id"+ if registered == "none":+ assert "client_secret" not in args["data"]+ else:+ assert args["data"]["client_secret"] == "<test secret>"++[email protected]("unsupported_at", ["metadata", "registration"])[email protected](loop_scope="session")+async def test_unsupported_method_stops_login(client, oauth_mocks, unsupported_at):+ metadata, registration, post, manager = oauth_mocks+ if unsupported_at == "metadata":+ metadata["token_endpoint_auth_methods_supported"] = ["private_key_jwt"]+ else:+ registration["token_endpoint_auth_method"] = "private_key_jwt"++ response = await client.post(+ "/oauth/login", json={"server_url": "https://mcp.example.com/mcp"}+ )++ assert response.status_code == 400+ assert "authentication method" in response.json()["detail"]+ manager.store.store_state_token.assert_not_awaited()+ if unsupported_at == "metadata":+ post.assert_not_awaited()++[email protected](loop_scope="session")+async def test_missing_registered_secret_stops_login(client, oauth_mocks):+ metadata, registration, _, manager = oauth_mocks+ metadata["token_endpoint_auth_methods_supported"] = ["client_secret_post"]+ registration["token_endpoint_auth_method"] = "client_secret_post"+ registration.pop("client_secret")++ response = await client.post(+ "/oauth/login", json={"server_url": "https://mcp.example.com/mcp"}+ )++ assert response.status_code == 400+ assert "client secret" in response.json()["detail"]+ manager.store.store_state_token.assert_not_awaited()+++ "failure", ["http_error", "missing_id", "empty_id", "invalid_url"]+)[email protected](loop_scope="session")+async def test_failed_registration_does_not_open_an_unregistered_login(+ client, oauth_mocks, failure+):+ _, registration, post, manager = oauth_mocks+ if failure == "http_error":+ post.side_effect = HTTPClientError("Registration denied", 403)+ elif failure == "missing_id":+ registration.pop("client_id")+ elif failure == "empty_id":+ registration["client_id"] = ""++ with patch(+ "backend.api.features.mcp.routes.validate_url_host",+ new_callable=AsyncMock,+ ) as validate:+ if failure == "invalid_url":+ validate.side_effect = [None, ValueError("Private host")]+ response = await client.post(+ "/oauth/login", json={"server_url": "https://mcp.example.com/mcp"}+ )++ assert response.status_code == 400+ assert "register" in response.json()["detail"].lower()+ manager.store.store_state_token.assert_not_awaited()+ if failure == "invalid_url":+ post.assert_not_awaited()++[email protected]("scope_source", ["resource", "authorization_server"])[email protected](loop_scope="session")+async def test_discovered_required_scopes_are_included(+ client, oauth_mocks, scope_source+):+ metadata, _, post, manager = oauth_mocks+ required_scopes = ["openid", "offline_access"]+ metadata["scopes_supported"] = (+ ["other_scope"] if scope_source == "resource" else required_scopes+ )+ resource = {+ "resource": "https://mcp.example.com/mcp",+ "authorization_servers": ["https://auth.example.com"],+ }+ if scope_source == "resource":+ resource["scopes_supported"] = required_scopes+ with patch("backend.api.features.mcp.routes.MCPClient") as mcp_client:+ mcp_client.return_value.discover_auth = AsyncMock(return_value=resource)+ mcp_client.return_value.discover_auth_server_metadata = AsyncMock(+ return_value=(metadata, "https://auth.example.com")+ )+ response = await client.post(+ "/oauth/login", json={"server_url": "https://mcp.example.com/mcp"}+ )++ assert response.status_code == 200+ assert parse_qs(urlparse(response.json()["login_url"]).query)["scope"] == [+ "openid offline_access"+ ]+ assert manager.store.store_state_token.call_args.args[2] == required_scopes+ assert post.call_args.kwargs["json"]["scope"] == "openid offline_access"+++ "advertised,expected",+ [+ (+ ["authorization_code", "refresh_token"],+ ["authorization_code", "refresh_token"],+ ),+ (+ ["refresh_token", "authorization_code"],+ ["authorization_code", "refresh_token"],+ ),+ (["authorization_code"], ["authorization_code"]),+ ([], ["authorization_code"]),+ (None, ["authorization_code"]),+ ],+)[email protected](loop_scope="session")+async def test_registration_requests_only_advertised_refresh_grant(+ client, oauth_mocks, advertised, expected+):+ metadata, _, post, _ = oauth_mocks+ if advertised is not None:+ metadata["grant_types_supported"] = advertised++ response = await client.post(+ "/oauth/login", json={"server_url": "https://mcp.example.com/mcp"}+ )++ assert response.status_code == 200+ payload = post.call_args.kwargs["json"]+ assert payload["grant_types"] == expected+ assert "scope" not in payload+++ "requested,expected",+ [+ (["read"], ["read"]),+ ([], []),+ (None, ["read", "write"]),+ (+ ["mcp:read", "https://api.example.com/scope"],+ ["mcp:read", "https://api.example.com/scope"],+ ),+ ],+)[email protected](loop_scope="session")+async def test_explicit_scopes_propagate_to_registration_state_and_login(+ client, oauth_mocks, requested, expected+):+ metadata, _, post, manager = oauth_mocks+ metadata["scopes_supported"] = ["read", "write"]++ response = await client.post(+ "/oauth/login",+ json={"server_url": "https://mcp.example.com/mcp", "scopes": requested},+ )++ assert response.status_code == 200+ assert manager.store.store_state_token.call_args.args[2] == expected+ payload = post.call_args.kwargs["json"]+ query = parse_qs(urlparse(response.json()["login_url"]).query)+ if expected:+ assert payload["scope"] == " ".join(expected)+ assert query["scope"] == [" ".join(expected)]+ else:+ assert "scope" not in payload+ assert "scope" not in query+++ "scope", ["", "read write", " read", "read\twrite", "read\nwrite", "read\x00write"]+)[email protected](loop_scope="session")+async def test_invalid_explicit_scope_does_not_register(client, oauth_mocks, scope):+ _, _, post, manager = oauth_mocks++ response = await client.post(+ "/oauth/login",+ json={"server_url": "https://mcp.example.com/mcp", "scopes": [scope]},+ )++ assert response.status_code == 422+ post.assert_not_awaited()+ manager.store.store_state_token.assert_not_awaited()++[email protected](loop_scope="session")+async def test_issuer_mismatch_rejected_before_registration(client, oauth_mocks):+ metadata, _, post, manager = oauth_mocks+ metadata["issuer"] = "https://another.example.com"++ response = await client.post(+ "/oauth/login", json={"server_url": "https://mcp.example.com/mcp"}+ )++ assert response.status_code == 400+ assert "issuer" in response.json()["detail"].lower()+ post.assert_not_awaited()+ manager.store.store_state_token.assert_not_awaited()+++ "server_url,scope_override,expected",+ [+ ("https://mcp.customer.io/mcp", None, ["read"]),+ ("https://MCP.CUSTOMER.IO:443/mcp/", None, ["read"]),+ ("https://mcp-eu.customer.io/mcp", None, ["read"]),+ ("https://mcp.customer.io/mcp", ["read", "write"], ["read", "write"]),+ ("https://mcp.customer.io/mcp", [], []),+ ("https://mcp.craft.do/my/mcp", None, []),+ ("https://unknown.example.com/mcp", None, ["discovered"]),+ ],+)[email protected](loop_scope="session")+async def test_catalog_defaults_apply_to_generic_oauth_login(+ client, oauth_mocks, server_url, scope_override, expected+):+ metadata, _, post, manager = oauth_mocks+ metadata["scopes_supported"] = ["discovered"]++ response = await client.post(+ "/oauth/login", json={"server_url": server_url, "scopes": scope_override}+ )++ assert response.status_code == 200+ assert manager.store.store_state_token.call_args.args[2] == expected+ assert post.call_args.kwargs["json"].get("scope") == (+ " ".join(expected) if expected else None+ )+ assert parse_qs(urlparse(response.json()["login_url"]).query).get("scope") == (+ [" ".join(expected)] if expected else None+ )+++ "provider_name",+ ["mcp_antimetal", "mcp_brevo", "mcp_intercom"],+)[email protected](loop_scope="session")+async def test_token_connections_do_not_start_oauth(client, oauth_mocks, provider_name):+ from backend.integrations.mcp_catalog import get_mcp_catalog++ entry = next(entry for entry in get_mcp_catalog() if entry.name == provider_name)+ _, _, post, manager = oauth_mocks+ with patch("backend.api.features.mcp.routes.MCPClient") as mcp_client:+ response = await client.post(+ "/oauth/login", json={"server_url": entry.mcp_server.server_url}+ )++ assert response.status_code == 400+ detail = response.json()["detail"]+ # The code is what sends the connect panel to its manual-token form; these+ # services have no OAuth to offer under any wording of the message.+ assert detail["code"] == NO_OAUTH_CODE+ assert entry.display_name in detail["message"]+ assert "authentication" in detail["message"]+ mcp_client.assert_not_called()+ post.assert_not_awaited()+ manager.store.store_state_token.assert_not_awaited()++[email protected](loop_scope="session")+async def test_reconnect_replaces_credentials_under_either_url(client, oauth_mocks):+ """Context7 and Parallel sign in at one URL and serve tools at another.++ The new credential is filed under the tools URL, so the cleanup has to+ look for the old one there too — matching on the sign-in URL found+ nothing and left a dead token behind on every reconnection.+ """+ _, _, _, manager = oauth_mocks+ sign_in_url = "https://mcp.context7.com/mcp/oauth"+ tools_url = "https://mcp.context7.com/mcp"++ stale = MagicMock(spec=OAuth2Credentials)+ stale.id = "stale-credential-id"+ stale.metadata = {"mcp_server_url": tools_url}+ # Credentials stored before the URL was normalised sit under the sign-in+ # URL instead, and have to be swept up by the same pass.+ legacy = MagicMock(spec=OAuth2Credentials)+ legacy.id = "legacy-credential-id"+ legacy.metadata = {"mcp_server_url": sign_in_url}+ manager.store.get_creds_by_provider = AsyncMock(return_value=[stale, legacy])+ manager.store.delete_creds_by_id = AsyncMock()++ state = MagicMock()+ state.state_metadata = {+ "server_url": sign_in_url,+ "client_id": "client:id",+ "client_secret": "",+ "authorize_url": "https://auth.example.com/authorize",+ "token_url": "https://auth.example.com/token",+ "token_endpoint_auth_method": "none",+ }+ state.scopes = ["read"]+ state.code_verifier = "pkce-verifier"+ manager.store.verify_state_token = AsyncMock(return_value=state)++ with patch("backend.blocks.mcp.oauth.Requests") as token_requests:+ token_response = MagicMock()+ token_response.json.return_value = {"access_token": "<test-access-token>"}+ token_requests.return_value.post = AsyncMock(return_value=token_response)+ callback = await client.post(+ "/oauth/callback", json={"code": "code", "state_token": "state"}+ )++ assert callback.status_code == 200+ assert manager.create.call_args.args[1].metadata["mcp_server_url"] == tools_url+ deleted = {+ call.args[1] for call in manager.store.delete_creds_by_id.await_args_list+ }+ assert deleted == {"stale-credential-id", "legacy-credential-id"}diff --git a/autogpt_platform/backend/backend/api/features/mcp/test_oauth_legacy_credentials.py b/autogpt_platform/backend/backend/api/features/mcp/test_oauth_legacy_credentials.pynew file mode 100644index 0000000000..5405b6065d--- /dev/null+++ b/autogpt_platform/backend/backend/api/features/mcp/test_oauth_legacy_credentials.py@@ -0,0 +1,120 @@+from unittest.mock import AsyncMock, MagicMock, patch++import pytest+from pydantic import SecretStr++from backend.blocks.mcp.oauth import MCPOAuthHandler+from backend.data.model import OAuth2Credentials+from backend.integrations.creds_manager import create_mcp_oauth_handler+from backend.util.request import HTTPClientError++[email protected]("client_secret", ["", "<legacy-test-secret>"])[email protected](loop_scope="session")+async def test_existing_credentials_without_auth_method_still_refresh(client_secret):+ credentials = OAuth2Credentials(+ provider="mcp",+ access_token=SecretStr("<test-access-token>"),+ refresh_token=SecretStr("<test-refresh-token>"),+ scopes=["read"],+ metadata={+ "mcp_token_url": "https://auth.example.com/token",+ "mcp_client_id": "legacy-client",+ "mcp_client_secret": client_secret,+ },+ )+ with patch("backend.blocks.mcp.oauth.Requests") as requests:+ response = MagicMock()+ response.json.return_value = {"access_token": "<new-test-token>"}+ post = requests.return_value.post = AsyncMock(return_value=response)+ refreshed = await create_mcp_oauth_handler(credentials)._refresh_tokens(+ credentials+ )++ assert "Authorization" not in post.call_args.kwargs["headers"]+ data = post.call_args.kwargs["data"]+ assert data["client_id"] == "legacy-client"+ if client_secret:+ assert data["client_secret"] == client_secret+ else:+ assert "client_secret" not in data+ assert refreshed.id == credentials.id+ assert refreshed.refresh_token == credentials.refresh_token+ assert refreshed.metadata == credentials.metadata+++ "method", ["client_secret_basic", "client_secret_post", "none"]+)[email protected](loop_scope="session")+async def test_revocation_uses_registered_authentication(method):+ handler = MCPOAuthHandler(+ client_id="client",+ client_secret="<test-secret>",+ redirect_uri="",+ authorize_url="",+ token_url="https://auth.example.com/token",+ revoke_url="https://auth.example.com/revoke",+ token_endpoint_auth_method=method,+ )+ credentials = OAuth2Credentials(+ provider="mcp", access_token=SecretStr("<test-token>"), scopes=[]+ )+ with patch("backend.blocks.mcp.oauth.Requests") as requests:+ post = requests.return_value.post = AsyncMock()+ assert await handler.revoke_tokens(credentials)++ args = post.call_args.kwargs+ assert args["data"]["token"] == "<test-token>"+ if method == "client_secret_basic":+ assert args["headers"]["Authorization"].startswith("Basic ")+ assert args["data"]["client_id"] == "client"+ assert "client_secret" not in args["data"]+ assert "client_secret" not in args["data"]+ elif method == "client_secret_post":+ assert "Authorization" not in args["headers"]+ assert args["data"]["client_id"] == "client"+ assert args["data"]["client_secret"] == "<test-secret>"+ else:+ assert "Authorization" not in args["headers"]+ assert args["data"]["client_id"] == "client"+ assert "client_secret" not in args["data"]+++def test_unsupported_stored_authentication_method_is_rejected():+ credentials = OAuth2Credentials(+ provider="mcp",+ access_token=SecretStr("<test-token>"),+ scopes=[],+ metadata={+ "mcp_token_url": "https://auth.example.com/token",+ "mcp_client_id": "client",+ "mcp_token_endpoint_auth_method": "private_key_jwt",+ },+ )+ with pytest.raises(+ ValueError, match="Unsupported MCP client authentication method"+ ):+ create_mcp_oauth_handler(credentials)++[email protected](loop_scope="session")+async def test_rejected_revocation_does_not_report_success():+ handler = MCPOAuthHandler(+ client_id="client",+ client_secret="",+ redirect_uri="",+ authorize_url="",+ token_url="https://auth.example.com/token",+ revoke_url="https://auth.example.com/revoke",+ token_endpoint_auth_method="none",+ )+ credentials = OAuth2Credentials(+ provider="mcp", access_token=SecretStr("<test-token>"), scopes=[]+ )+ with patch("backend.blocks.mcp.oauth.Requests") as requests:+ requests.return_value.post = AsyncMock(+ side_effect=HTTPClientError("Revocation rejected", 401)+ )+ assert await handler.revoke_tokens(credentials) is False+ requests.assert_called_once_with(raise_for_status=True)diff --git a/autogpt_platform/backend/backend/api/features/mcp/test_routes.py b/autogpt_platform/backend/backend/api/features/mcp/test_routes.pyindex 814f80ab80..e64dae8b42 100644--- a/autogpt_platform/backend/backend/api/features/mcp/test_routes.py+++ b/autogpt_platform/backend/backend/api/features/mcp/test_routes.py@@ -14,7 +14,7 @@ import pytest_asynciofrom autogpt_libs.auth import get_user_idfrom pydantic import SecretStr-from backend.api.features.mcp.routes import router+from backend.api.features.mcp.routes import NO_OAUTH_CODE, routerfrom backend.blocks.mcp.client import MCPClientError, MCPToolfrom backend.data.model import OAuth2Credentialsfrom backend.util.request import HTTPClientError, HTTPServerError@@ -123,9 +123,11 @@ class TestDiscoverTools:authorization="Bearer my-secret-token",)+ @pytest.mark.parametrize("use_saved_credentials", [None, True, False])@pytest.mark.asyncio(loop_scope="session")- async def test_discover_tools_auto_uses_stored_credential(self, client):- """When no explicit token is given, stored MCP credentials are used."""+ async def test_discover_tools_respects_saved_credential_preference(+ self, client, use_saved_credentials+ ):stored_cred = OAuth2Credentials(provider="mcp",title="MCP: example.com",@@ -143,7 +145,7 @@ class TestDiscoverTools:"backend.api.features.mcp.routes.auto_lookup_mcp_credential",new_callable=AsyncMock,return_value=stored_cred,- ),+ ) as lookup,):instance = MockClient.return_valueinstance.close = AsyncMock()@@ -152,16 +154,24 @@ class TestDiscoverTools:)instance.list_tools = AsyncMock(return_value=[])- response = await client.post(- "/discover-tools",- json={"server_url": "https://mcp.example.com/mcp"},- )+ payload = {"server_url": "https://mcp.example.com/mcp"}+ if use_saved_credentials is not None:+ payload["use_saved_credentials"] = use_saved_credentials+ response = await client.post("/discover-tools", json=payload)assert response.status_code == 200MockClient.assert_called_once_with("https://mcp.example.com/mcp",- authorization="Bearer stored-token-123",+ authorization=(+ None if use_saved_credentials is False else "Bearer stored-token-123"+ ),)+ if use_saved_credentials is False:+ lookup.assert_not_awaited()+ else:+ lookup.assert_awaited_once_with(+ "test-user-id", "https://mcp.example.com/mcp"+ )@pytest.mark.asyncio(loop_scope="session")async def test_discover_tools_mcp_error(self, client):@@ -328,7 +338,11 @@ class TestOAuthLogin:)assert response.status_code == 400- assert "does not advertise OAuth" in response.json()["detail"]+ detail = response.json()["detail"]+ # The connect panel offers the manual-token form off this code, so it+ # has to survive any rewording of the message beside it.+ assert detail["code"] == NO_OAUTH_CODE+ assert "does not advertise OAuth" in detail["message"]@pytest.mark.asyncio(loop_scope="session")async def test_oauth_login_fallback_to_public_client(self, client):diff --git a/autogpt_platform/backend/backend/blocks/mcp/client.py b/autogpt_platform/backend/backend/blocks/mcp/client.pyindex 6f7a35bedf..5b6f54c565 100644--- a/autogpt_platform/backend/backend/blocks/mcp/client.py+++ b/autogpt_platform/backend/backend/blocks/mcp/client.py@@ -761,6 +761,12 @@ class MCPClient:f"{base}{path}",))+ candidates.append(+ (+ f"{base}{path}/.well-known/openid-configuration",+ f"{base}{path}",+ )+ )candidates.append((f"{base}/.well-known/oauth-authorization-server", base))candidates.append((f"{base}/.well-known/openid-configuration", base))diff --git a/autogpt_platform/backend/backend/blocks/mcp/oauth.py b/autogpt_platform/backend/backend/blocks/mcp/oauth.pyindex e0d2eecfdb..8625453d8f 100644--- a/autogpt_platform/backend/backend/blocks/mcp/oauth.py+++ b/autogpt_platform/backend/backend/blocks/mcp/oauth.py@@ -9,7 +9,8 @@ This handler accepts those endpoints at construction time.import loggingimport timeimport urllib.parse-from typing import ClassVar, Optional+from base64 import b64encode+from typing import ClassVar, Literal, Optionalfrom pydantic import SecretStr@@ -20,6 +21,10 @@ from backend.util.request import Requestslogger = logging.getLogger(__name__)+MCPTokenEndpointAuthMethod = Literal[+ "none", "client_secret_post", "client_secret_basic"+]+class MCPOAuthHandler(BaseOAuthHandler):"""@@ -43,9 +48,24 @@ class MCPOAuthHandler(BaseOAuthHandler):token_url: str,revoke_url: str | None = None,resource_url: str | None = None,+ token_endpoint_auth_method: MCPTokenEndpointAuthMethod | None = None,):+ if token_endpoint_auth_method not in (+ None,+ "none",+ "client_secret_post",+ "client_secret_basic",+ ):+ raise ValueError("Unsupported MCP client authentication method")self.client_id = client_id- self.client_secret = client_secret+ self.token_endpoint_auth_method: MCPTokenEndpointAuthMethod = (+ token_endpoint_auth_method+ if token_endpoint_auth_method is not None+ else "client_secret_post" if client_secret else "none"+ )+ self.client_secret = (+ "" if self.token_endpoint_auth_method == "none" else client_secret+ )self.redirect_uri = redirect_uriself.authorize_url = authorize_urlself.token_url = token_url@@ -84,14 +104,13 @@ class MCPOAuthHandler(BaseOAuthHandler):scopes: list[str],code_verifier: Optional[str],) -> OAuth2Credentials:+ client_auth, headers = self._token_client_auth()data: dict[str, str] = {+ **client_auth,"grant_type": "authorization_code","code": code,"redirect_uri": self.redirect_uri,- "client_id": self.client_id,}- if self.client_secret:- data["client_secret"] = self.client_secretif code_verifier:data["code_verifier"] = code_verifierif self.resource_url:@@ -100,7 +119,7 @@ class MCPOAuthHandler(BaseOAuthHandler):response = await Requests(raise_for_status=True).post(self.token_url,data=data,- headers={"Content-Type": "application/x-www-form-urlencoded"},+ headers=headers,)tokens = response.json()@@ -130,6 +149,7 @@ class MCPOAuthHandler(BaseOAuthHandler):metadata={"mcp_token_url": self.token_url,"mcp_resource_url": self.resource_url,+ "mcp_token_endpoint_auth_method": self.token_endpoint_auth_method,},)@@ -139,20 +159,19 @@ class MCPOAuthHandler(BaseOAuthHandler):if not credentials.refresh_token:raise ValueError("No refresh token available for MCP OAuth credentials")+ client_auth, headers = self._token_client_auth()data: dict[str, str] = {+ **client_auth,"grant_type": "refresh_token","refresh_token": credentials.refresh_token.get_secret_value(),- "client_id": self.client_id,}- if self.client_secret:- data["client_secret"] = self.client_secretif self.resource_url:data["resource"] = self.resource_urlresponse = await Requests(raise_for_status=True).post(self.token_url,data=data,- headers={"Content-Type": "application/x-www-form-urlencoded"},+ headers=headers,)tokens = response.json()@@ -188,17 +207,38 @@ class MCPOAuthHandler(BaseOAuthHandler):return Falsetry:+ client_auth, headers = self._token_client_auth()data = {+ **client_auth,"token": credentials.access_token.get_secret_value(),"token_type_hint": "access_token",- "client_id": self.client_id,}- await Requests().post(+ await Requests(raise_for_status=True).post(self.revoke_url,data=data,- headers={"Content-Type": "application/x-www-form-urlencoded"},+ headers=headers,)return Trueexcept Exception:logger.warning("Failed to revoke MCP OAuth tokens", exc_info=True)return False++ def _token_client_auth(self) -> tuple[dict[str, str], dict[str, str]]:+ headers = {"Content-Type": "application/x-www-form-urlencoded"}+ if self.token_endpoint_auth_method == "client_secret_basic":+ client_id = urllib.parse.quote_plus(self.client_id, safe="")+ client_secret = urllib.parse.quote_plus(self.client_secret, safe="")+ encoded = b64encode(f"{client_id}:{client_secret}".encode()).decode()+ headers["Authorization"] = f"Basic {encoded}"+ # The secret stays in the header, but the id also goes in the body:+ # RFC 6749 §2.3.1 allows it for identification, and servers that do+ # not read the Basic header for the id reject the exchange outright+ # (Miro answers "Missing client_id" and the sign-in dies after the+ # user has already consented).+ return {"client_id": self.client_id}, headers+ data = {"client_id": self.client_id}+ if self.token_endpoint_auth_method == "client_secret_post":+ data["client_secret"] = self.client_secret+ elif self.token_endpoint_auth_method != "none":+ raise ValueError("Unsupported MCP client authentication method")+ return data, headersdiff --git a/autogpt_platform/backend/backend/blocks/mcp/test_oauth.py b/autogpt_platform/backend/backend/blocks/mcp/test_oauth.pyindex 1d704c8e2f..2266c27681 100644--- a/autogpt_platform/backend/backend/blocks/mcp/test_oauth.py+++ b/autogpt_platform/backend/backend/blocks/mcp/test_oauth.py@@ -24,16 +24,18 @@ def _mock_response(json_data: dict, status: int = 200) -> MagicMock:class TestMCPOAuthHandler:"""Tests for the MCPOAuthHandler."""- def _make_handler(self, **overrides) -> MCPOAuthHandler:- defaults = {- "client_id": "test-client-id",- "client_secret": "test-client-secret",- "redirect_uri": "https://app.example.com/callback",- "authorize_url": "https://auth.example.com/authorize",- "token_url": "https://auth.example.com/token",- }- defaults.update(overrides)- return MCPOAuthHandler(**defaults)+ def _make_handler(+ self, *, revoke_url: str | None = None, resource_url: str | None = None+ ) -> MCPOAuthHandler:+ return MCPOAuthHandler(+ client_id="test-client-id",+ client_secret="<test-client-secret>",+ redirect_uri="https://app.example.com/callback",+ authorize_url="https://auth.example.com/authorize",+ token_url="https://auth.example.com/token",+ revoke_url=revoke_url,+ resource_url=resource_url,+ )def test_get_login_url_basic(self):handler = self._make_handler()@@ -246,3 +248,27 @@ class TestMCPClientDiscovery:# RFC 8414 §3.3: a document served at the well-known root must declare# the bare origin as its issuer.assert expected_issuer == "https://auth.example.com"++ @pytest.mark.asyncio(loop_scope="session")+ async def test_discovers_oidc_metadata_under_issuer_path(self):+ client = MCPClient("https://mcp.example.com/mcp")+ issuer = "https://auth.example.com/v1/oauth2/console"+ metadata = {+ "issuer": issuer,+ "authorization_endpoint": f"{issuer}/authorize",+ "token_endpoint": f"{issuer}/token",+ }++ async def get_metadata(url):+ return _mock_response(+ metadata if url == f"{issuer}/.well-known/openid-configuration" else {},+ status=(+ 200 if url == f"{issuer}/.well-known/openid-configuration" else 404+ ),+ )++ with patch("backend.blocks.mcp.client.Requests") as requests:+ requests.return_value.get = AsyncMock(side_effect=get_metadata)+ result = await client.discover_auth_server_metadata(issuer)++ assert result == (metadata, issuer)diff --git a/autogpt_platform/backend/backend/copilot/sdk/mcp_tool_guide.md b/autogpt_platform/backend/backend/copilot/sdk/mcp_tool_guide.mdindex 6041b20657..dfc7a55314 100644--- a/autogpt_platform/backend/backend/copilot/sdk/mcp_tool_guide.md+++ b/autogpt_platform/backend/backend/copilot/sdk/mcp_tool_guide.md@@ -22,18 +22,30 @@ Use these URLs directly without asking the user:| Service | URL ||---|---|-| Notion | `https://mcp.notion.com/mcp` || Linear | `https://mcp.linear.app/mcp` || Stripe | `https://mcp.stripe.com` |-| Intercom | `https://mcp.intercom.com/mcp` || Cloudflare | `https://mcp.cloudflare.com/mcp` |-| Atlassian / Jira | `https://mcp.atlassian.com/mcp` |++<!-- official-mcp-catalog -->For other services, **web-search for the service's official MCP server URL**(e.g. "`<service>` MCP server URL") — many vendors host an MCP server evenwhen it's not in the list above. Treat search results as unvetted: confirmthe hostname is vendor-owned before using it (see below).+The platform supports remote HTTP connections in both cloud and local deployments.+Follow the setup requirements in the table before starting sign-in;+some services require an administrator to enable access or a dedicated token.+Use the listed authentication methods and default permissions. Where the table+gives a separate OAuth URL, use that URL for signed-in account tools. Do not send+API keys to an OAuth-only connection or infer that every advertised scope is+required.+For region choices, confirm where the user's account stores its data. For+tenant-specific connections, obtain the endpoint using the vendor's setup+instructions. Never substitute a documentation URL for the connection endpoint+or invent a tenant hostname. Direct the user to the matching integration preset+for regional selection, manual credentials, or optional write permissions.+### Important: Check blocks first, then MCP is MANDATORYAlways follow the **Tool Discovery Priority** described in the tool notes:diff --git a/autogpt_platform/backend/backend/copilot/tools/get_mcp_guide.py b/autogpt_platform/backend/backend/copilot/tools/get_mcp_guide.pyindex 7afd3e808c..9166789ebf 100644--- a/autogpt_platform/backend/backend/copilot/tools/get_mcp_guide.py+++ b/autogpt_platform/backend/backend/copilot/tools/get_mcp_guide.py@@ -5,6 +5,7 @@ from pathlib import Pathfrom typing import Anyfrom backend.copilot.model import ChatSession+from backend.integrations.mcp_guide import render_mcp_guidefrom .base import BaseToolfrom .models import ErrorResponse, ResponseType, ToolResponseBase@@ -18,7 +19,7 @@ def _load_guide() -> str:global _GUIDE_CACHEif _GUIDE_CACHE is None:guide_path = Path(__file__).parent.parent / "sdk" / "mcp_tool_guide.md"- _GUIDE_CACHE = guide_path.read_text(encoding="utf-8")+ _GUIDE_CACHE = render_mcp_guide(guide_path.read_text(encoding="utf-8"))return _GUIDE_CACHEdiff --git a/autogpt_platform/backend/backend/copilot/tools/mcp_catalog_guide_test.py b/autogpt_platform/backend/backend/copilot/tools/mcp_catalog_guide_test.pynew file mode 100644index 0000000000..3f6314ee33--- /dev/null+++ b/autogpt_platform/backend/backend/copilot/tools/mcp_catalog_guide_test.py@@ -0,0 +1,16 @@+from unittest.mock import patch++from backend.copilot.tools.get_mcp_guide import _load_guide+from backend.copilot.tools.skills import get_default_skill_with_body+from backend.integrations.mcp_guide import MCP_CATALOG_MARKER+++def test_both_guide_loaders_render_the_catalogue():+ with patch("backend.copilot.tools.get_mcp_guide._GUIDE_CACHE", None):+ legacy = _load_guide()+ skill = get_default_skill_with_body("mcp_tool_guide")++ assert skill is not None+ assert legacy == skill.body+ assert MCP_CATALOG_MARKER not in legacy+ assert "Additional official connections" in legacydiff --git a/autogpt_platform/backend/backend/copilot/tools/skills.py b/autogpt_platform/backend/backend/copilot/tools/skills.pyindex c085f9ad41..a7a5c9273f 100644--- a/autogpt_platform/backend/backend/copilot/tools/skills.py+++ b/autogpt_platform/backend/backend/copilot/tools/skills.py@@ -48,6 +48,7 @@ from backend.data.workspace_scope import (expert_skills_folder,)from backend.executor.cluster_lock import AsyncClusterLock+from backend.integrations.mcp_guide import render_mcp_guidefrom backend.util.exceptions import ConflictErrorfrom backend.util.feature_flag import Flag, is_feature_enabledfrom backend.util.workspace import WorkspaceManager@@ -373,7 +374,7 @@ def _load_default_body(skill: _DefaultSkill) -> str:"""Read a default skill's body from disk (cached at module levelvia :func:`functools.lru_cache` would re-read on test reloads, sowe hit the disk each call — these files are small)."""- return skill.body_path.read_text(encoding="utf-8")+ return render_mcp_guide(skill.body_path.read_text(encoding="utf-8"))def get_default_skill_with_body(name: str) -> ParsedSkill | None:diff --git a/autogpt_platform/backend/backend/integrations/creds_manager.py b/autogpt_platform/backend/backend/integrations/creds_manager.pyindex 351c77e6d5..e94769418a 100644--- a/autogpt_platform/backend/backend/integrations/creds_manager.py+++ b/autogpt_platform/backend/backend/integrations/creds_manager.py@@ -586,5 +586,7 @@ def create_mcp_oauth_handler(redirect_uri="", # Not needed for token refreshauthorize_url="", # Not needed for token refreshtoken_url=token_url,+ revoke_url=meta.get("mcp_revoke_url"),resource_url=meta.get("mcp_resource_url"),+ token_endpoint_auth_method=meta.get("mcp_token_endpoint_auth_method"),)diff --git a/autogpt_platform/backend/backend/integrations/mcp_catalog.json b/autogpt_platform/backend/backend/integrations/mcp_catalog.jsonnew file mode 100644index 0000000000..8cb7e8e1c1--- /dev/null+++ b/autogpt_platform/backend/backend/integrations/mcp_catalog.json@@ -0,0 +1,1069 @@+[+ {+ "name": "mcp_1inch",+ "display_name": "1inch",+ "description": "Search public API documentation and use authorized 1inch API workflows.",+ "mcp_server": {+ "server_url": "https://api.1inch.com/mcp/protocol",+ "documentation_url": "https://github.com/1inch/1inch-ai",+ "setup_instructions": "Use a 1inch Business API key for account operations, or sign in. Public documentation tools need no account. Organization permissions apply; wallet signing remains separate.",+ "connection_mode": "hosted",+ "auth_methods": [+ "bearer",+ "oauth",+ "none"+ ],+ "icon_id": "1inch"+ }+ },+ {+ "name": "mcp_aave",+ "display_name": "Aave",+ "description": "Inspect lending markets and wallet positions, and prepare unsigned transactions.",+ "mcp_server": {+ "server_url": "https://mcp.aave.com",+ "documentation_url": "https://www.aave.com/blog/introducing-aave-mcp-server",+ "setup_instructions": "Public market tools require no sign-in. Sign any transaction separately in your wallet.",+ "connection_mode": "hosted",+ "auth_methods": [+ "none"+ ],+ "icon_id": "aave"+ }+ },+ {+ "name": "mcp_agentmail",+ "display_name": "AgentMail",+ "description": "Work with agent inboxes, messages, drafts, threads, and attachments.",+ "mcp_server": {+ "server_url": "https://mcp.agentmail.to/mcp",+ "documentation_url": "https://docs.agentmail.to/integrations/mcp",+ "setup_instructions": "Sign in to AgentMail and choose the organization to connect.",+ "connection_mode": "hosted",+ "icon_id": "agent_mail",+ "auth_methods": [+ "oauth"+ ]+ }+ },+ {+ "name": "mcp_airtable",+ "display_name": "Airtable",+ "description": "Search bases and manage records and schemas within your Airtable permissions.",+ "mcp_server": {+ "server_url": "https://mcp.airtable.com/mcp",+ "documentation_url": "https://support.airtable.com/articles/9897799762-using-the-airtable-mcp-server",+ "setup_instructions": "Sign in and select bases to authorize. Records, comments and schema reads are selected initially. Allow changes adds record, comment and schema writes. A personal access token can further limit automation to selected bases or workspaces.",+ "connection_mode": "hosted",+ "icon_id": "airtable",+ "auth_methods": [+ "oauth",+ "bearer"+ ],+ "oauth_scopes": [+ "data.records:read",+ "schema.bases:read",+ "data.recordComments:read",+ "workspacesAndBases:read"+ ],+ "oauth_write_scopes": [+ "data.records:write",+ "schema.bases:write",+ "data.recordComments:write"+ ]+ }+ },+ {+ "name": "mcp_algolia_productivity",+ "display_name": "Algolia Productivity",+ "description": "Read search indexes, results, facets, recommendations, and analytics.",+ "mcp_server": {+ "server_url": "https://mcp.algolia.com/mcp",+ "documentation_url": "https://www.algolia.com/doc/guides/model-context-protocol/productivity-mcp",+ "setup_instructions": "Enable MCP in your Algolia dashboard, then sign in. This connection provides read-only tools.",+ "connection_mode": "hosted",+ "auth_methods": [+ "oauth"+ ],+ "icon_id": "algolia"+ }+ },+ {+ "name": "mcp_amplemarket",+ "display_name": "Amplemarket",+ "description": "Research prospects and companies, and manage sales lists and sequences.",+ "mcp_server": {+ "server_url": "https://mcp.amplemarket.com/mcp",+ "documentation_url": "https://knowledge.amplemarket.com/articles/8022685319-connecting-to-the-amplemarket-mcp-server",+ "setup_instructions": "Sign in with an active Amplemarket account. Existing permissions apply to sales updates and outreach; enrichment can consume account credits.",+ "connection_mode": "hosted",+ "auth_methods": [+ "oauth"+ ],+ "icon_id": "amplemarket"+ }+ },+ {+ "name": "mcp_amplitude",+ "display_name": "Amplitude",+ "description": "Explore product analytics, charts, dashboards, cohorts, and experiments.",+ "mcp_server": {+ "documentation_url": "https://amplitude.com/docs/amplitude-ai/amplitude-mcp",+ "setup_instructions": "Choose the region where your Amplitude account stores data, then sign in. For read-only project access, ask your admin for a role with Use MCP (read) and without Use MCP (write). Amplitude enforces these roles on each tool call.",+ "connection_mode": "custom",+ "auth_methods": [+ "oauth"+ ],+ "server_url_options": [+ {+ "label": "US",+ "url": "https://mcp.amplitude.com/mcp"+ },+ {+ "label": "EU",+ "url": "https://mcp.eu.amplitude.com/mcp"+ }+ ],+ "icon_id": "amplitude"+ }+ },+ {+ "name": "mcp_ando",+ "display_name": "Ando",+ "description": "Read and participate in conversations, messages, files, and inbox workflows.",+ "mcp_server": {+ "server_url": "https://mcp.ando.so/mcp",+ "documentation_url": "https://docs.ando.so/docs/ando-mcp",+ "setup_instructions": "Sign in as an Ando member, or use an API key from Settings > API access.",+ "connection_mode": "hosted",+ "auth_methods": [+ "oauth",+ "bearer"+ ],+ "icon_id": "ando"+ }+ },+ {+ "name": "mcp_antimetal",+ "display_name": "Antimetal",+ "description": "Investigate operational issues using runtime context and root-cause analysis.",+ "mcp_server": {+ "server_url": "https://mcp.antimetal.com",+ "documentation_url": "https://docs.antimetal.com/connect",+ "setup_instructions": "Use an Antimetal API key.",+ "connection_mode": "hosted",+ "auth_methods": [+ "bearer"+ ],+ "icon_id": "antimetal"+ }+ },+ {+ "name": "mcp_apify",+ "display_name": "Apify",+ "description": "Discover and run scraping and extraction Actors, and read their results.",+ "mcp_server": {+ "server_url": "https://mcp.apify.com",+ "documentation_url": "https://docs.apify.com/integrations/mcp",+ "setup_instructions": "Sign in to Apify or use an Apify API token. Running Actors may incur usage charges.",+ "connection_mode": "hosted",+ "auth_methods": [+ "oauth",+ "bearer"+ ],+ "icon_id": "apify"+ }+ },+ {+ "name": "mcp_apollo_io",+ "display_name": "Apollo.io",+ "description": "Find people and read existing Apollo contacts, with optional contact creation and updates.",+ "mcp_server": {+ "server_url": "https://mcp.apollo.io/mcp",+ "documentation_url": "https://docs.apollo.io/docs/apollo-mcp",+ "setup_instructions": "Sign in for people search and existing-contact reads. Allow changes adds contact creation and updates. Account access rules still apply.",+ "connection_mode": "hosted",+ "icon_id": "apollo",+ "auth_methods": [+ "oauth"+ ],+ "oauth_scopes": [+ "read_user_profile",+ "app_scopes",+ "mixed_people_api_search",+ "contacts_search",+ "contact_read"+ ],+ "oauth_write_scopes": [+ "contact_write",+ "contact_update"+ ]+ }+ },+ {+ "name": "mcp_appwrite",+ "display_name": "Appwrite",+ "description": "Manage Appwrite project databases, users, storage, teams, and functions.",+ "mcp_server": {+ "server_url": "https://mcp.appwrite.io/",+ "documentation_url": "https://appwrite.io/docs/tooling/ai/mcp-servers",+ "setup_instructions": "Sign in to Appwrite Cloud and review the projects, organizations and actions you authorize.",+ "connection_mode": "hosted",+ "auth_methods": [+ "oauth"+ ],+ "icon_id": "appwrite"+ }+ },+ {+ "name": "mcp_arize",+ "display_name": "Arize Documentation",+ "description": "Search public Arize documentation for tracing and instrumentation guidance.",+ "mcp_server": {+ "server_url": "https://arize.com/docs/mcp",+ "documentation_url": "https://arize.com/docs/ax/arize-ai-for-agents",+ "setup_instructions": "Read public Arize AX documentation.",+ "connection_mode": "hosted",+ "auth_methods": [+ "none"+ ],+ "icon_id": "arize"+ }+ },+ {+ "name": "mcp_atlan",+ "display_name": "Atlan",+ "description": "Search governed metadata, lineage, glossary terms, and supported catalog actions.",+ "mcp_server": {+ "server_url": "https://mcp.atlan.com/mcp",+ "documentation_url": "https://docs.atlan.com/product/capabilities/atlan-ai/how-tos/remote-mcp-overview",+ "setup_instructions": "Sign in to Atlan, or use an API token created by an administrator for automation. Tenant policies, personas and token permissions govern available tools.",+ "connection_mode": "hosted",+ "auth_methods": [+ "oauth",+ "bearer"+ ],+ "icon_id": "atlan"+ }+ },+ {+ "name": "mcp_atlassian",+ "display_name": "Atlassian",+ "description": "Search and work across Jira, Confluence, and Atlassian Teamwork Graph through Rovo MCP.",+ "mcp_server": {+ "server_url": "https://mcp.atlassian.com/v2/mcp",+ "documentation_url": "https://developer.atlassian.com/cloud/rovo-mcp/guides/getting-started/",+ "setup_instructions": "Your admin must allow this AutoGPT origin for Rovo MCP. If API-token authentication is enabled, use Basic with email:personal API token, or Bearer with a service-account token. Some Code Search and Teams tools require sign-in. Product permissions and credit limits apply.",+ "connection_mode": "hosted",+ "auth_methods": [+ "oauth",+ "basic",+ "bearer"+ ],+ "icon_id": "atlassian"+ }+ },+ {+ "name": "mcp_atlassian_forge",+ "display_name": "Atlassian Forge",+ "description": "Search public Forge documentation, modules, and manifest guidance.",+ "mcp_server": {+ "server_url": "https://mcp.atlassian.com/v1/forge/mcp",+ "documentation_url": "https://developer.atlassian.com/platform/forge/ai-development-toolkit/forge-mcp/",+ "setup_instructions": "Search public Forge development documentation.",+ "connection_mode": "hosted",+ "auth_methods": [+ "none"+ ],+ "icon_id": "atlassian"+ }+ },+ {+ "name": "mcp_aws_databases",+ "display_name": "AWS Knowledge",+ "description": "Search AWS documentation and guidance for AWS Agents, AWS Databases, AWS Deployments, and AWS Amplify.",+ "mcp_server": {+ "server_url": "https://knowledge-mcp.global.api.aws",+ "documentation_url": "https://awslabs.github.io/mcp/servers/aws-knowledge-mcp-server",+ "setup_instructions": "Read public AWS documentation and guidance without an AWS account.",+ "connection_mode": "hosted",+ "icon_id": "aws",+ "auth_methods": [+ "none"+ ]+ }+ },+ {+ "name": "mcp_azure_cosmos_db",+ "display_name": "Azure Cosmos DB",+ "description": "Query and search data using your deployed Azure Cosmos DB MCP Toolkit.",+ "mcp_server": {+ "documentation_url": "https://learn.microsoft.com/en-us/azure/cosmos-db/gen-ai/model-context-protocol-toolkit",+ "setup_instructions": "Deploy the official Toolkit, then enter its HTTPS endpoint and an Entra access token for that deployment with the Mcp.Tool.Executor role. Configure managed identity and database permissions; token renewal remains external.",+ "connection_mode": "custom",+ "icon_id": "azure_cosmos_db",+ "auth_methods": [+ "bearer"+ ]+ }+ },+ {+ "name": "mcp_bird",+ "display_name": "Bird",+ "description": "Use supported customer-communication tools through Bird's official server.",+ "mcp_server": {+ "server_url": "https://mcp.bird.com",+ "documentation_url": "https://bird.com/docs/ai/mcp-server",+ "setup_instructions": "Sign in to Bird and review the workspace permissions requested. Sending messages requires the relevant channel setup. This connection can update account resources; select only the permissions needed for your work.",+ "connection_mode": "hosted",+ "auth_methods": [+ "oauth"+ ],+ "icon_id": "bird"+ }+ },+ {+ "name": "mcp_brevo",+ "display_name": "Brevo",+ "description": "Work with contacts, campaigns, and supported messaging workflows.",+ "mcp_server": {+ "server_url": "https://mcp.brevo.com/v1/brevo/mcp",+ "documentation_url": "https://developers.brevo.com/docs/mcp-protocol",+ "setup_instructions": "In Brevo, open Account > SMTP & API > API Keys and create a key with the MCP option enabled. Paste that dedicated MCP token as the access token.",+ "connection_mode": "hosted",+ "auth_methods": [+ "bearer"+ ],+ "icon_id": "brevo"+ }+ },+ {+ "name": "mcp_brex",+ "display_name": "Brex",+ "description": "Inspect expenses, receipts, bills, cards, and supported financial workflows.",+ "mcp_server": {+ "server_url": "https://api.brex.com/mcp",+ "documentation_url": "https://developer.brex.com/docs/mcp",+ "setup_instructions": "An account or card admin must accept the Developer API agreement and enable Settings > Beta features > Brex in AI assistants. Then sign in, or use a restricted Brex API token. Existing account roles and token permissions apply.",+ "connection_mode": "hosted",+ "auth_methods": [+ "oauth",+ "bearer"+ ],+ "icon_id": "brex"+ }+ },+ {+ "name": "mcp_calendly",+ "display_name": "Calendly",+ "description": "Check scheduling availability and manage supported bookings.",+ "mcp_server": {+ "server_url": "https://mcp.calendly.com",+ "documentation_url": "https://developer.calendly.com/docs/mcp/calendly-mcp-server",+ "setup_instructions": "Sign in to Calendly. The vendor registers scheduling read and write permissions; review account access during consent.",+ "connection_mode": "hosted",+ "auth_methods": [+ "oauth"+ ],+ "oauth_scopes": [+ "mcp:scheduling:read",+ "mcp:scheduling:write"+ ],+ "icon_id": "calendly"+ }+ },+ {+ "name": "mcp_chargebee",+ "display_name": "Chargebee",+ "description": "Look up and export billing data through your Chargebee site MCP server.",+ "mcp_server": {+ "documentation_url": "https://www.chargebee.com/docs/billing/2.0/ai-in-chargebee/data-lookup-agent",+ "setup_instructions": "Enable Agentic AI > MCP Servers > Data Lookup in your Chargebee site. Copy that server's endpoint and generate its MCP API key. Choose the intended test or live site and region.",+ "connection_mode": "custom",+ "auth_methods": [+ "bearer"+ ],+ "icon_id": "chargebee"+ }+ },+ {+ "name": "mcp_clay",+ "display_name": "Clay",+ "description": "Research and enrich companies and people through Clay workflows.",+ "mcp_server": {+ "server_url": "https://api.clay.com/v3/mcp",+ "documentation_url": "https://university.clay.com/docs/connect-to-clay-mcp",+ "setup_instructions": "Your workspace admin must allow Unknown clients under MCP users > Allowed MCP clients for AutoGPT dynamic registration. Sign in as a workspace member; this policy also applies when tokens refresh.",+ "connection_mode": "hosted",+ "auth_methods": [+ "oauth"+ ],+ "oauth_scopes": [+ "mcp"+ ],+ "icon_id": "clay"+ }+ },+ {+ "name": "mcp_coda",+ "display_name": "Coda",+ "description": "Search and work with Coda documents, tables, and rows.",+ "mcp_server": {+ "server_url": "https://coda.io/apis/mcp",+ "documentation_url": "https://help.coda.io/hc/en-us/articles/44722661982989-Connect-to-the-Coda-MCP",+ "setup_instructions": "Sign in to select documents with read and write access. For narrower access, create an API token with the MCP restriction and the intended read/write permissions. Available tools depend on your Coda role and plan.",+ "connection_mode": "hosted",+ "auth_methods": [+ "oauth",+ "bearer"+ ],+ "oauth_scopes": [+ "mcp:all"+ ],+ "icon_id": "coda"+ }+ },+ {+ "name": "mcp_composio",+ "display_name": "Composio",+ "description": "Connect approved external apps through Composio Connect and discover their tools.",+ "mcp_server": {+ "server_url": "https://connect.composio.dev/mcp",+ "documentation_url": "https://docs.composio.dev/docs/composio-connect",+ "setup_instructions": "Sign in to Composio Connect, then authorize each upstream app you want to use. App permissions, subscriptions and usage limits remain separate.",+ "connection_mode": "hosted",+ "auth_methods": [+ "oauth"+ ],+ "icon_id": "composio"+ }+ },+ {+ "name": "mcp_context_dev",+ "display_name": "Context.dev",+ "description": "Search, crawl, scrape, and extract web content.",+ "mcp_server": {+ "server_url": "https://mcp.context.dev/mcp",+ "documentation_url": "https://docs.context.dev/install-mcp",+ "setup_instructions": "Sign in to research and retrieve web content. Read access is selected initially; allow changes only when you want to create or update monitors. Account credits apply.",+ "connection_mode": "hosted",+ "auth_methods": [+ "oauth"+ ],+ "oauth_scopes": [+ "api.read"+ ],+ "oauth_write_scopes": [+ "api.write"+ ],+ "icon_id": "context_dev"+ }+ },+ {+ "name": "mcp_context7",+ "display_name": "Context7",+ "description": "Retrieve current, version-specific documentation for software libraries.",+ "mcp_server": {+ "server_url": "https://mcp.context7.com/mcp",+ "documentation_url": "https://context7.com/docs/howto/oauth",+ "setup_instructions": "Sign in for your account's documentation quota and private libraries, or use a Context7 API key. Public library documentation can also be used without sign-in at shared limits.",+ "connection_mode": "hosted",+ "auth_methods": [+ "oauth",+ "bearer",+ "none"+ ],+ "oauth_server_url": "https://mcp.context7.com/mcp/oauth",+ "icon_id": "context7"+ }+ },+ {+ "name": "mcp_craft",+ "display_name": "Craft",+ "description": "Read and edit Craft documents and connected workspace content.",+ "mcp_server": {+ "server_url": "https://mcp.craft.do/my/mcp",+ "documentation_url": "https://www.craft.do/imagine/guide/mcp",+ "setup_instructions": "Sign in to Craft and select the space to authorize. Each connection accesses one space; scoped document connections use separately generated links.",+ "connection_mode": "hosted",+ "auth_methods": [+ "oauth"+ ],+ "oauth_scopes": [],+ "icon_id": "craft"+ }+ },+ {+ "name": "mcp_crustdata",+ "display_name": "Crustdata",+ "description": "Search and enrich people and companies, including jobs and social activity.",+ "mcp_server": {+ "server_url": "https://install.crustdata.com/mcp",+ "documentation_url": "https://docs.crustdata.com/for-agents/mcp",+ "setup_instructions": "Sign in with your Crustdata account. A Crustdata API key as a Bearer token is also supported for programmatic access. Account credits apply.",+ "connection_mode": "hosted",+ "auth_methods": [+ "oauth",+ "bearer"+ ],+ "oauth_scopes": [],+ "icon_id": "crustdata"+ }+ },+ {+ "name": "mcp_customer_io",+ "display_name": "Customer.io (US)",+ "description": "Work with Customer.io workspace data and supported messaging workflows.",+ "mcp_server": {+ "server_url": "https://mcp.customer.io/mcp",+ "documentation_url": "https://docs.customer.io/ai/mcp/get-started/",+ "setup_instructions": "An account admin must enable Customer.io MCP under Settings > AI. Sign in and select your US workspaces. Read access is selected initially; Allow changes adds draft-write access. Sensitive data, live publishing and configuration need separate grants and are not requested here.",+ "connection_mode": "hosted",+ "auth_methods": [+ "oauth"+ ],+ "oauth_scopes": [+ "read"+ ],+ "oauth_write_scopes": [+ "write"+ ],+ "icon_id": "customer_io"+ }+ },+ {+ "name": "mcp_customer_io_eu",+ "display_name": "Customer.io (EU)",+ "description": "Work with Customer.io workspace data and supported messaging workflows.",+ "mcp_server": {+ "server_url": "https://mcp-eu.customer.io/mcp",+ "documentation_url": "https://docs.customer.io/ai/mcp/get-started/",+ "setup_instructions": "An account admin must enable Customer.io MCP under Settings > AI. Sign in and select your EU workspaces. Read access is selected initially; Allow changes adds draft-write access. Sensitive data, live publishing and configuration need separate grants and are not requested here.",+ "connection_mode": "hosted",+ "auth_methods": [+ "oauth"+ ],+ "oauth_scopes": [+ "read"+ ],+ "oauth_write_scopes": [+ "write"+ ],+ "icon_id": "customer_io"+ }+ },+ {+ "name": "mcp_datarobot",+ "display_name": "DataRobot",+ "description": "Access DataRobot's managed Global MCP tools.",+ "mcp_server": {+ "documentation_url": "https://docs.datarobot.com/en/docs/agentic-ai/agentic-mcp/agentic-mcp-overview.html",+ "setup_instructions": "Enter your DataRobot deployment URL ending in /api/v2/genai/globalmcp/mcp and a Bearer API token with the required scope.",+ "connection_mode": "custom",+ "auth_methods": [+ "bearer"+ ],+ "icon_id": "datarobot"+ }+ },+ {+ "name": "mcp_github",+ "display_name": "GitHub",+ "description": "Search repositories and read code, issues, and pull requests with GitHub's read-only MCP tools.",+ "mcp_server": {+ "server_url": "https://api.githubcopilot.com/mcp/readonly",+ "documentation_url": "https://github.com/github/github-mcp-server/blob/main/docs/remote-server.md",+ "setup_instructions": "Use a fine-grained personal access token limited to the repositories and read permissions you need. Organization approval or SSO authorization may be required. This connection exposes read-only tools.",+ "connection_mode": "hosted",+ "auth_methods": [+ "bearer"+ ],+ "icon_id": "github"+ }+ },+ {+ "name": "mcp_gojiberry_ai",+ "display_name": "Gojiberry AI",+ "description": "Connect AI workflows to Gojiberry sales and lead-research tools.",+ "mcp_server": {+ "server_url": "https://mcp.gojiberry.ai",+ "documentation_url": "https://help.gojiberry.ai/en/articles/14540015-using-the-gojiberry-mcp-server",+ "setup_instructions": "Paste your Gojiberry API key as the access token.",+ "connection_mode": "hosted",+ "auth_methods": [+ "bearer"+ ],+ "icon_id": "gojiberry"+ }+ },+ {+ "name": "mcp_gong",+ "display_name": "Gong",+ "description": "Ask read-only account and deal questions and generate summarized briefs from Gong.",+ "mcp_server": {+ "server_url": "https://mcp.gong.io/mcp",+ "documentation_url": "https://help.gong.io/docs/create-an-integration-to-connect-to-the-mcp-server",+ "setup_instructions": "A Gong Tech admin must create an integration with Automatic registration and this AutoGPT deployment's exact callback URL. Choose Personal access to retain your permissions; Shared access can expose organization-wide data. A paid seat and credits are required.",+ "connection_mode": "hosted",+ "auth_methods": [+ "oauth"+ ],+ "icon_id": "gong"+ }+ },+ {+ "name": "mcp_granola",+ "display_name": "Granola",+ "description": "Search meeting notes, transcripts, folders, and related context.",+ "mcp_server": {+ "server_url": "https://mcp.granola.ai/mcp",+ "documentation_url": "https://docs.granola.ai/help-center/sharing/integrations/mcp",+ "setup_instructions": "Sign in to Granola to read meeting notes from your active workspace. Paid plans provide additional folders, transcripts and search. Enterprise admins can restrict or disable MCP access.",+ "connection_mode": "hosted",+ "auth_methods": [+ "oauth"+ ],+ "icon_id": "granola"+ }+ },+ {+ "name": "mcp_harmonic",+ "display_name": "Harmonic",+ "description": "Research companies, people, and investors, and manage research lists.",+ "mcp_server": {+ "server_url": "https://mcp.api.harmonic.ai",+ "documentation_url": "https://support.harmonic.ai/en/articles/12785899-harmonic-mcp-server-getting-started-guide",+ "setup_instructions": "Sign in to Harmonic to research companies and people. Account usage limits apply; higher API-credit usage and optional Scout tools require admin or account-team enablement.",+ "connection_mode": "hosted",+ "auth_methods": [+ "oauth"+ ],+ "icon_id": "harmonic"+ }+ },+ {+ "name": "mcp_infobip",+ "display_name": "Infobip",+ "description": "Connect to product-specific messaging, customer-profile, or account tools.",+ "mcp_server": {+ "documentation_url": "https://www.infobip.com/docs/mcp/using-mcp",+ "setup_instructions": "Choose a documented Infobip product endpoint, such as SMS or email, and sign in through OAuth.",+ "connection_mode": "custom",+ "auth_methods": [+ "oauth"+ ],+ "icon_id": "infobip"+ }+ },+ {+ "name": "mcp_intercom",+ "display_name": "Intercom (US)",+ "description": "Search support conversations and contacts, and work with Help Center articles.",+ "mcp_server": {+ "server_url": "https://mcp.intercom.com/mcp",+ "documentation_url": "https://developers.intercom.com/docs/guides/mcp",+ "setup_instructions": "Use an Intercom API token for your US workspace.",+ "connection_mode": "hosted",+ "auth_methods": [+ "bearer"+ ],+ "icon_id": "intercom"+ }+ },+ {+ "name": "mcp_intercom_eu",+ "display_name": "Intercom (EU)",+ "description": "Search support conversations and contacts, and work with Help Center articles.",+ "mcp_server": {+ "server_url": "https://mcp.eu.intercom.com/mcp",+ "documentation_url": "https://developers.intercom.com/docs/guides/mcp",+ "setup_instructions": "Use an Intercom API token for your EU workspace.",+ "connection_mode": "hosted",+ "auth_methods": [+ "bearer"+ ],+ "icon_id": "intercom"+ }+ },+ {+ "name": "mcp_langfuse",+ "display_name": "Langfuse",+ "description": "Work with project traces, prompts, datasets, evaluations, and dashboards.",+ "mcp_server": {+ "documentation_url": "https://langfuse.com/docs/api-and-data-platform/features/mcp-server",+ "setup_instructions": "Choose your project's region or self-hosted endpoint ending in /api/public/mcp. Use the project public and secret key pair as Basic base64(publicKey:secretKey). Permissions follow the project key.",+ "connection_mode": "custom",+ "auth_methods": [+ "basic"+ ],+ "server_url_options": [+ {+ "label": "EU",+ "url": "https://cloud.langfuse.com/api/public/mcp"+ },+ {+ "label": "US",+ "url": "https://us.cloud.langfuse.com/api/public/mcp"+ },+ {+ "label": "Japan",+ "url": "https://jp.cloud.langfuse.com/api/public/mcp"+ },+ {+ "label": "HIPAA US",+ "url": "https://hipaa.cloud.langfuse.com/api/public/mcp"+ }+ ],+ "icon_id": "langfuse"+ }+ },+ {+ "name": "mcp_linear",+ "display_name": "Linear",+ "description": "Search issues, projects, and documents, with optional updates to your team's work.",+ "mcp_server": {+ "server_url": "https://mcp.linear.app/mcp",+ "documentation_url": "https://linear.app/docs/mcp",+ "setup_instructions": "Sign in to the Linear workspace to connect. Read access is selected initially; Allow changes adds write access. You can also use a Linear API key limited to the teams and permissions you need.",+ "connection_mode": "hosted",+ "auth_methods": [+ "oauth",+ "bearer"+ ],+ "oauth_scopes": [+ "read"+ ],+ "oauth_write_scopes": [+ "write"+ ],+ "icon_id": "linear"+ }+ },+ {+ "name": "mcp_miro",+ "display_name": "Miro",+ "description": "Read board content and turn plans into diagrams, documents, and board items.",+ "mcp_server": {+ "server_url": "https://mcp.miro.com/",+ "documentation_url": "https://developers.miro.com/docs/connecting-to-miro-mcp",+ "setup_instructions": "Sign in and select the team containing your boards. Miro requests board read and write access; your existing board permissions apply. Enterprise organizations may require an administrator to enable MCP.",+ "connection_mode": "hosted",+ "auth_methods": [+ "oauth"+ ],+ "icon_id": "miro",+ "oauth_scopes": [+ "boards:read",+ "boards:write"+ ]+ }+ },+ {+ "name": "mcp_mobbin",+ "display_name": "Mobbin",+ "description": "Find real-world UI references and screen images.",+ "mcp_server": {+ "server_url": "https://api.mobbin.com/mcp",+ "documentation_url": "https://docs.mobbin.com/mcp/introduction",+ "setup_instructions": "Sign in with a Mobbin Pro, Team, or Enterprise account.",+ "connection_mode": "hosted",+ "auth_methods": [+ "oauth"+ ],+ "oauth_scopes": [+ "openid"+ ],+ "icon_id": "mobbin"+ }+ },+ {+ "name": "mcp_monday",+ "display_name": "monday.com",+ "description": "Search and manage boards, items, updates, and workdocs in your monday.com account.",+ "mcp_server": {+ "server_url": "https://mcp.monday.com/mcp",+ "documentation_url": "https://developer.monday.com/api-reference/docs/build-on-monday-with-ai",+ "setup_instructions": "Sign in as a member or administrator and review monday.com's requested account permissions. Available reads and changes follow your user permissions. A personal API token is also supported.",+ "connection_mode": "hosted",+ "auth_methods": [+ "oauth",+ "bearer"+ ],+ "icon_id": "monday"+ }+ },+ {+ "name": "mcp_notion",+ "display_name": "Notion",+ "description": "Search and edit workspace pages and databases.",+ "mcp_server": {+ "server_url": "https://mcp.notion.com/mcp",+ "documentation_url": "https://developers.notion.com/guides/mcp/get-started-with-mcp",+ "setup_instructions": "Sign in to Notion and authorize workspace access. Enterprise workspaces may require an owner or admin to approve AutoGPT under the allowed AI apps policy.",+ "connection_mode": "hosted",+ "icon_id": "notion",+ "auth_methods": [+ "oauth"+ ],+ "oauth_scopes": [+ "default"+ ]+ }+ },+ {+ "name": "mcp_opsera",+ "display_name": "Opsera",+ "description": "Use DevSecOps investigation, architecture, compliance, and security tools.",+ "mcp_server": {+ "server_url": "https://agent.opsera.ai/mcp",+ "documentation_url": "https://docs.agents.opsera.ai/terminal-setup/claude-desktop",+ "setup_instructions": "Sign in with your Opsera account in the browser. Connected tools and organization policies determine available actions.",+ "connection_mode": "hosted",+ "auth_methods": [+ "oauth"+ ],+ "icon_id": "opsera"+ }+ },+ {+ "name": "mcp_parallel",+ "display_name": "Parallel Search",+ "description": "Search and extract public web content with Parallel Search.",+ "mcp_server": {+ "server_url": "https://search.parallel.ai/mcp",+ "documentation_url": "https://docs.parallel.ai/integrations/mcp/quickstart",+ "setup_instructions": "Public Search works without an account at shared limits. Sign in or use an API key for production limits; organizations needing zero data retention should use authenticated Search.",+ "connection_mode": "hosted",+ "auth_methods": [+ "none",+ "oauth",+ "bearer"+ ],+ "oauth_server_url": "https://search.parallel.ai/mcp-oauth",+ "oauth_scopes": [+ "key:read"+ ],+ "icon_id": "parallel"+ }+ },+ {+ "name": "mcp_plain",+ "display_name": "Plain",+ "description": "Manage support threads, replies, customers, labels, and Help Center content.",+ "mcp_server": {+ "server_url": "https://mcp.plain.com/mcp",+ "documentation_url": "https://www.plain.com/docs/agents/mcp-server",+ "setup_instructions": "Sign in with your Plain account. OAuth must authorize openid and offline_access; your existing workspace permissions apply.",+ "connection_mode": "hosted",+ "auth_methods": [+ "oauth"+ ],+ "oauth_scopes": [+ "openid",+ "offline_access"+ ],+ "icon_id": "plain"+ }+ },+ {+ "name": "mcp_runlayer",+ "display_name": "Runlayer",+ "description": "Discover and access tools through your organization's managed MCP catalog.",+ "mcp_server": {+ "documentation_url": "https://docs.runlayer.com/connecting-clients",+ "setup_instructions": "Copy the HTTPS proxy URL from your Runlayer Plugin or connector page, then sign in through your organization OAuth/SSO. Your organization must permit the client and upstream tools.",+ "connection_mode": "custom",+ "auth_methods": [+ "oauth"+ ],+ "icon_id": "runlayer"+ }+ },+ {+ "name": "mcp_sentry",+ "display_name": "Sentry",+ "description": "Investigate errors and performance, triage issues, and inspect project context.",+ "mcp_server": {+ "server_url": "https://mcp.sentry.dev/mcp",+ "documentation_url": "https://mcp.sentry.dev/",+ "setup_instructions": "Sign in to Sentry and select the MCP skills to authorize. Choose inspection and documentation for investigation; enable triage or project management only when needed. Your Sentry organization permissions apply.",+ "connection_mode": "hosted",+ "auth_methods": [+ "oauth"+ ],+ "icon_id": "sentry"+ }+ },+ {+ "name": "mcp_sourcegraph",+ "display_name": "Sourcegraph",+ "description": "Search repositories, read code, and retrieve cross-repository context.",+ "mcp_server": {+ "documentation_url": "https://7.3.sourcegraph.com/api/mcp",+ "setup_instructions": "Enter your Sourcegraph instance's core endpoint ending in /.api/mcp. Your admin must enable MCP and dynamic client registration, and your role needs MCP access. Sign in to use your repository permissions.",+ "connection_mode": "custom",+ "auth_methods": [+ "oauth"+ ],+ "oauth_scopes": [+ "mcp"+ ],+ "icon_id": "sourcegraph"+ }+ },+ {+ "name": "mcp_stripe",+ "display_name": "Stripe",+ "description": "Inspect Stripe customers, invoices, subscriptions, and payments, and use permitted account operations.",+ "mcp_server": {+ "server_url": "https://mcp.stripe.com",+ "documentation_url": "https://docs.stripe.com/mcp",+ "setup_instructions": "Sign in and choose the Stripe account and sandbox or live environment. Review the requested access before authorizing. For narrowly scoped access, use a restricted API key with only the required read permissions.",+ "connection_mode": "hosted",+ "auth_methods": [+ "oauth",+ "bearer"+ ],+ "icon_id": "stripe"+ }+ },+ {+ "name": "mcp_subtext",+ "display_name": "Subtext",+ "description": "Inspect session replay, UI snapshots, and privacy rules.",+ "mcp_server": {+ "server_url": "https://api.fullstory.com/mcp/subtext",+ "documentation_url": "https://subtext.fullstory.com/docs/install/manual",+ "setup_instructions": "Sign in to Subtext or use a project API key from Settings > API Keys. Configure the capture snippet to make recordings available. Session and privacy-setting reads are selected initially; allow changes only to modify privacy rules.",+ "connection_mode": "hosted",+ "auth_methods": [+ "oauth",+ "bearer"+ ],+ "oauth_scopes": [+ "sessions:read",+ "settings.privacy:read"+ ],+ "oauth_write_scopes": [+ "settings.privacy.element_block:write",+ "settings.privacy.url:write"+ ],+ "icon_id": "subtext"+ }+ },+ {+ "name": "mcp_superme",+ "display_name": "SuperMe",+ "description": "Find expert profiles and converse with SuperMe agents.",+ "mcp_server": {+ "server_url": "https://mcp.superme.ai",+ "documentation_url": "https://github.com/superme-ai/superme-plugins",+ "setup_instructions": "Sign in with your SuperMe account through OAuth.",+ "connection_mode": "hosted",+ "auth_methods": [+ "oauth"+ ],+ "icon_id": "superme"+ }+ },+ {+ "name": "mcp_tabnine",+ "display_name": "Tabnine",+ "description": "Search enterprise repositories with the Tabnine Context Engine MCP service.",+ "mcp_server": {+ "documentation_url": "https://github.com/tabnine/skills",+ "setup_instructions": "Enter your Tabnine instance endpoint ending in /indexer/mcp. Create a personal access token in the instance's Settings > Access tokens and choose its expiry. Team permissions apply.",+ "connection_mode": "custom",+ "auth_methods": [+ "bearer"+ ],+ "icon_id": "tabnine"+ }+ },+ {+ "name": "mcp_tavily",+ "display_name": "Tavily",+ "description": "Search the web and extract page content for research and grounded answers.",+ "mcp_server": {+ "server_url": "https://mcp.tavily.com/mcp/",+ "documentation_url": "https://docs.tavily.com/documentation/mcp",+ "setup_instructions": "Sign in to Tavily and authorize the connection. Searches and extraction use credits from the API key selected by Tavily for this MCP connection.",+ "connection_mode": "hosted",+ "auth_methods": [+ "oauth"+ ],+ "icon_id": "tavily"+ }+ },+ {+ "name": "mcp_todoist",+ "display_name": "Todoist",+ "description": "Review and organize tasks and projects, including creating and updating tasks.",+ "mcp_server": {+ "server_url": "https://ai.todoist.net/mcp",+ "documentation_url": "https://developer.todoist.com/api/v1/",+ "setup_instructions": "Sign in to Todoist. Its MCP connection requests read and write access to your tasks and projects; shared workspace permissions still apply.",+ "connection_mode": "hosted",+ "auth_methods": [+ "oauth"+ ],+ "oauth_scopes": [+ "data:read_write"+ ],+ "icon_id": "todoist"+ }+ },+ {+ "name": "mcp_treg",+ "display_name": "Treg",+ "description": "Discover and call tools through the Treg catalog and team gateway.",+ "mcp_server": {+ "server_url": "https://treg.to/mcp/",+ "documentation_url": "https://treg.to/llms.txt",+ "setup_instructions": "Sign in and choose your Treg team, or use a team-scoped dashboard API key. Discovery and account reads are selected initially; allow changes to grant tool execution, which may consume team credits.",+ "connection_mode": "hosted",+ "auth_methods": [+ "oauth",+ "bearer"+ ],+ "oauth_scopes": [+ "treg:catalog",+ "treg:read"+ ],+ "oauth_write_scopes": [+ "treg:call"+ ],+ "icon_id": "treg"+ }+ },+ {+ "name": "mcp_webflow",+ "display_name": "Webflow",+ "description": "Work with site content, CMS collections, pages, and assets through Webflow's API tools.",+ "mcp_server": {+ "server_url": "https://mcp.webflow.com/mcp",+ "documentation_url": "https://developers.webflow.com/mcp/reference/how-it-works",+ "setup_instructions": "Sign in and authorize the Webflow sites or workspace to connect. Your role controls available changes. Content and API tools work remotely; visual snapshots and canvas interactions require the Designer with its MCP Bridge app open.",+ "connection_mode": "hosted",+ "auth_methods": [+ "oauth"+ ],+ "icon_id": "webflow"+ }+ },+ {+ "name": "mcp_wonder",+ "display_name": "Wonder",+ "description": "Read and edit canvas designs, components, and design documentation.",+ "mcp_server": {+ "server_url": "https://mcp.wonder.so/mcp",+ "documentation_url": "https://wonder.design/docs/mcp",+ "setup_instructions": "Sign in to Wonder and keep the intended file open in its web or desktop canvas. Tools read and edit that open file.",+ "connection_mode": "hosted",+ "auth_methods": [+ "oauth"+ ],+ "icon_id": "wonder"+ }+ }+]diff --git a/autogpt_platform/backend/backend/integrations/mcp_catalog.py b/autogpt_platform/backend/backend/integrations/mcp_catalog.pynew file mode 100644index 0000000000..260e855f3f--- /dev/null+++ b/autogpt_platform/backend/backend/integrations/mcp_catalog.py@@ -0,0 +1,160 @@+import ipaddress+from functools import cache+from pathlib import Path+from typing import Literal+from urllib.parse import urlsplit++from pydantic import (+ BaseModel,+ ConfigDict,+ Field,+ TypeAdapter,+ field_validator,+ model_validator,+)+++class MCPServerURLPreset(BaseModel):+ model_config = ConfigDict(extra="forbid", frozen=True)++ label: str = Field(min_length=1)+ url: str+++class MCPServerMetadata(BaseModel):+ model_config = ConfigDict(extra="forbid", frozen=True)++ server_url: str | None = None+ documentation_url: str+ setup_instructions: str+ connection_mode: Literal["hosted", "custom"]+ auth_methods: list[Literal["oauth", "bearer", "basic", "none"]] = Field(+ min_length=1+ )+ server_url_options: list[MCPServerURLPreset] = Field(default_factory=list)+ oauth_server_url: str | None = None+ oauth_scopes: list[str] | None = None+ oauth_write_scopes: list[str] = Field(default_factory=list)+ icon_id: str | None = Field(default=None, pattern=r"^[a-z0-9_-]+$")++ @field_validator("server_url", "documentation_url", "oauth_server_url")+ @classmethod+ def validate_public_url(cls, value: str | None) -> str | None:+ if value is None:+ return None+ parsed = urlsplit(value)+ hostname = parsed.hostname or ""+ if (+ parsed.scheme != "https"+ or any(character.isspace() for character in value)+ or not hostname+ or "." not in hostname+ or hostname.endswith((".localhost", ".local", ".internal"))+ or parsed.username+ or parsed.password+ or parsed.query+ or parsed.fragment+ or parsed.port not in (None, 443)+ ):+ raise ValueError(+ "Catalog URLs must be public HTTPS URLs without credentials"+ )+ try:+ ipaddress.ip_address(hostname)+ except ValueError:+ return value+ raise ValueError("Catalog URLs must use a public hostname")++ @model_validator(mode="after")+ def validate_connection(self) -> "MCPServerMetadata":+ if self.connection_mode == "hosted":+ if not self.server_url:+ raise ValueError("Hosted entries require a URL")+ elif self.server_url is not None:+ raise ValueError("Custom entries cannot prefill a URL")+ if len(set(self.auth_methods)) != len(self.auth_methods):+ raise ValueError("Authentication methods must be unique")+ if self.oauth_write_scopes and self.oauth_scopes is None:+ raise ValueError("Optional write scopes require explicit default scopes")+ if set(self.oauth_scopes or []) & set(self.oauth_write_scopes):+ raise ValueError("Default and optional write scopes must be disjoint")+ if (+ self.oauth_server_url+ or self.oauth_scopes is not None+ or self.oauth_write_scopes+ ) and "oauth" not in self.auth_methods:+ raise ValueError("OAuth settings require OAuth authentication")+ for option in self.server_url_options:+ self.validate_public_url(option.url)+ return self++ @field_validator("oauth_scopes", "oauth_write_scopes")+ @classmethod+ def validate_scope_tokens(cls, scopes: list[str] | None) -> list[str] | None:+ if scopes is None:+ return None+ if len(set(scopes)) != len(scopes):+ raise ValueError("OAuth scopes must be unique")+ for scope in scopes:+ if not scope or any(+ character.isspace() or ord(character) < 32 or ord(character) == 127+ for character in scope+ ):+ raise ValueError("OAuth scopes must be nonempty tokens")+ return scopes+++class MCPCatalogEntry(BaseModel):+ model_config = ConfigDict(extra="forbid", frozen=True)++ name: str = Field(pattern=r"^mcp_[a-z0-9]+(?:_[a-z0-9]+)*$")+ display_name: str = Field(min_length=1)+ description: str = Field(min_length=1)+ mcp_server: MCPServerMetadata+++@cache+def get_mcp_catalog() -> tuple[MCPCatalogEntry, ...]:+ content = Path(__file__).with_suffix(".json").read_text(encoding="utf-8")+ return parse_mcp_catalog(content)+++def _catalog_url_key(url: str) -> tuple[str, str] | None:+ try:+ parsed = urlsplit(url.strip())+ if (+ parsed.scheme != "https"+ or not parsed.hostname+ or parsed.port not in (None, 443)+ or parsed.username+ or parsed.password+ or parsed.query+ or parsed.fragment+ ):+ return None+ return parsed.hostname, parsed.path.rstrip("/")+ except ValueError:+ return None+++def get_mcp_catalog_entry_for_url(server_url: str) -> MCPCatalogEntry | None:+ key = _catalog_url_key(server_url)+ if key is None:+ return None+ for entry in get_mcp_catalog():+ server = entry.mcp_server+ urls = [+ server.server_url,+ server.oauth_server_url,+ *(option.url for option in server.server_url_options),+ ]+ if any(url and _catalog_url_key(url) == key for url in urls):+ return entry+ return None+++def parse_mcp_catalog(content: str) -> tuple[MCPCatalogEntry, ...]:+ entries = TypeAdapter(list[MCPCatalogEntry]).validate_json(content)+ if len({entry.name for entry in entries}) != len(entries):+ raise ValueError("MCP catalog provider names must be unique")+ return tuple(entries)diff --git a/autogpt_platform/backend/backend/integrations/mcp_catalog_test.py b/autogpt_platform/backend/backend/integrations/mcp_catalog_test.pynew file mode 100644index 0000000000..c038dc434f--- /dev/null+++ b/autogpt_platform/backend/backend/integrations/mcp_catalog_test.py@@ -0,0 +1,179 @@+import json+from unittest.mock import patch++import pytest+from pydantic import ValidationError++from backend.integrations.mcp_catalog import (+ MCPCatalogEntry,+ MCPServerMetadata,+ get_mcp_catalog,+ parse_mcp_catalog,+)+++def test_catalog_loads_validated_entries():+ assert get_mcp_catalog()+++ "url",+ [+ "http://vendor.com/mcp",+ "https://localhost/mcp",+ "https://127.0.0.1/mcp",+ "https://192.168.1.1/mcp",+ "https://service.internal/mcp",+ "https://user:[email protected]/mcp",+ "https://vendor.com/mcp?api_key=secret",+ "https://vendor.com/mcp#secret",+ "https://vendor.com:8443/mcp",+ "https://vendor.com/ mc p",+ ],+)[email protected]("field", ["server_url", "documentation_url"])+def test_catalog_rejects_unsafe_urls(url: str, field: str):+ data = get_mcp_catalog()[0].mcp_server.model_dump()+ data[field] = url+ with pytest.raises(ValidationError):+ MCPServerMetadata.model_validate(data)+++ "changes",+ [+ {"server_url": None},+ {"connection_mode": "custom"},+ ],+)+def test_catalog_rejects_misleading_connection_modes(changes: dict[str, str | None]):+ data = get_mcp_catalog()[0].mcp_server.model_dump()+ data.update(changes)+ with pytest.raises(ValidationError):+ MCPServerMetadata.model_validate(data)+++def test_custom_presets_require_authentication_methods():+ data = get_mcp_catalog()[0].mcp_server.model_dump()+ data.update(server_url=None, connection_mode="custom")+ data.pop("auth_methods")+ with pytest.raises(ValidationError, match="auth_methods"):+ MCPServerMetadata.model_validate(data)+++def test_catalog_rejects_duplicate_names():+ entry = get_mcp_catalog()[0].model_dump()+ with pytest.raises(ValueError, match="unique"):+ parse_mcp_catalog(json.dumps([entry, entry]))+++def oauth_server_data():+ return {+ "server_url": "https://mcp.vendor.com/mcp",+ "documentation_url": "https://docs.vendor.com/mcp",+ "setup_instructions": "Sign in to the vendor.",+ "connection_mode": "hosted",+ "auth_methods": ["oauth"],+ }+++ "changes",+ [+ {"auth_methods": []},+ {"auth_methods": ["oauth", "oauth"]},+ {"server_url": None, "connection_mode": "custom", "auth_methods": []},+ {"auth_methods": ["bearer"], "oauth_scopes": []},+ ],+)+def test_catalog_rejects_inconsistent_authentication(changes):+ with pytest.raises(ValidationError):+ MCPServerMetadata.model_validate({**oauth_server_data(), **changes})++[email protected]("field", ["oauth_scopes", "oauth_write_scopes"])+ "scopes",+ [[""], ["read write"], ["read\twrite"], ["read\x00write"], ["read", "read"]],+)+def test_catalog_rejects_invalid_scope_tokens(field, scopes):+ data = {**oauth_server_data(), "oauth_scopes": []}+ data[field] = scopes+ with pytest.raises(ValidationError):+ MCPServerMetadata.model_validate(data)+++def test_catalog_rejects_overlapping_scope_profiles():+ with pytest.raises(ValidationError):+ MCPServerMetadata.model_validate(+ {+ **oauth_server_data(),+ "oauth_scopes": ["read"],+ "oauth_write_scopes": ["read", "write"],+ }+ )+++def test_catalog_preserves_empty_and_vendor_specific_scope_profiles():+ server = MCPServerMetadata.model_validate(+ {+ **oauth_server_data(),+ "oauth_scopes": [],+ "oauth_write_scopes": [+ "project:documents.write",+ "https://api.vendor.com/scope",+ ],+ }+ )+ assert server.oauth_scopes == []+ assert server.oauth_write_scopes == [+ "project:documents.write",+ "https://api.vendor.com/scope",+ ]+++def catalog_entry(name, server):+ return MCPCatalogEntry.model_validate(+ {+ "name": name,+ "display_name": name,+ "description": "Vendor tools.",+ "mcp_server": server,+ }+ )+++ "url,matched",+ [+ ("https://mcp.vendor.com/mcp", True),+ ("https://MCP.VENDOR.COM:443/mcp/", True),+ ("https://mcp.vendor.com/oauth", True),+ ("https://eu.vendor.com/mcp", True),+ ("https://mcp.vendor.com/other", False),+ ("https://mcp.vendor.com.evil.com/mcp", False),+ ("https://[email protected]/mcp", False),+ ("https://[email protected]/mcp", False),+ ("https://mcp.vendor.com/mcp?tenant=other", False),+ ("https://mcp.vendor.com/mcp#other", False),+ ("http://mcp.vendor.com/mcp", False),+ ("https://mcp.vendor.com:8443/mcp", False),+ ],+)+def test_catalog_matches_only_complete_known_urls(url, matched):+ from backend.integrations.mcp_catalog import get_mcp_catalog_entry_for_url++ entry = catalog_entry(+ "mcp_vendor",+ {+ **oauth_server_data(),+ "oauth_server_url": "https://mcp.vendor.com/oauth",+ "server_url_options": [{"label": "EU", "url": "https://eu.vendor.com/mcp"}],+ },+ )+ with patch(+ "backend.integrations.mcp_catalog.get_mcp_catalog", return_value=(entry,)+ ):+ result = get_mcp_catalog_entry_for_url(url)++ assert result == (entry if matched else None)diff --git a/autogpt_platform/backend/backend/integrations/mcp_guide.py b/autogpt_platform/backend/backend/integrations/mcp_guide.pynew file mode 100644index 0000000000..93d94db687--- /dev/null+++ b/autogpt_platform/backend/backend/integrations/mcp_guide.py@@ -0,0 +1,59 @@+from backend.integrations.mcp_catalog import MCPCatalogEntry, get_mcp_catalog++MCP_CATALOG_MARKER = "<!-- official-mcp-catalog -->"+++def render_mcp_guide(content: str) -> str:+ if MCP_CATALOG_MARKER not in content:+ return content+ table = "\n".join(+ [+ "Additional official connections from the integration catalog:",+ "",+ "Respect each entry's purpose. Public documentation servers do not "+ "provide private account access. For regional or tenant-specific servers, "+ "confirm the user's region or obtain their endpoint before connecting.",+ "",+ "| Service | URL | Authentication | Purpose | Setup requirements |",+ "|---|---|---|---|---|",+ *(_render_entry(entry) for entry in get_mcp_catalog()),+ ]+ )+ return content.replace(MCP_CATALOG_MARKER, table)+++def _render_entry(entry: MCPCatalogEntry) -> str:+ cells = [+ entry.display_name,+ _server_location(entry),+ _authentication(entry),+ entry.description,+ entry.mcp_server.setup_instructions,+ ]+ return "| " + " | ".join(cell.replace("|", r"\|") for cell in cells) + " |"+++def _server_location(entry: MCPCatalogEntry) -> str:+ server = entry.mcp_server+ if server.server_url_options:+ options = "; ".join(+ f"{option.label}: `{option.url}`" for option in server.server_url_options+ )+ return f"Choose the account region: {options}"+ if server.server_url:+ return f"`{server.server_url}`"+ return f"User-provided endpoint; [setup instructions]({server.documentation_url})"+++def _authentication(entry: MCPCatalogEntry) -> str:+ server = entry.mcp_server+ methods = " / ".join(server.auth_methods)+ if server.oauth_server_url:+ methods += f"; OAuth uses `{server.oauth_server_url}`"+ if server.oauth_scopes is not None:+ methods += "; default OAuth scopes: " + (+ ", ".join(server.oauth_scopes) or "none"+ )+ if server.oauth_write_scopes:+ methods += "; optional grants require explicit selection in Integrations"+ return methodsdiff --git a/autogpt_platform/backend/backend/integrations/mcp_guide_test.py b/autogpt_platform/backend/backend/integrations/mcp_guide_test.pynew file mode 100644index 0000000000..6a3dcb2d3b--- /dev/null+++ b/autogpt_platform/backend/backend/integrations/mcp_guide_test.py@@ -0,0 +1,48 @@+from unittest.mock import patch++from backend.integrations.mcp_catalog import (+ MCPCatalogEntry,+ MCPServerMetadata,+ get_mcp_catalog,+)+from backend.integrations.mcp_guide import MCP_CATALOG_MARKER, render_mcp_guide+++def test_guide_distinguishes_oauth_url_and_optional_permissions():+ entry = MCPCatalogEntry(+ name="mcp_vendor",+ display_name="Vendor",+ description="Search public and private content.",+ mcp_server=MCPServerMetadata(+ server_url="https://mcp.vendor.com/mcp",+ oauth_server_url="https://mcp.vendor.com/mcp/oauth",+ documentation_url="https://docs.vendor.com/mcp",+ setup_instructions="Select your workspace.",+ connection_mode="hosted",+ auth_methods=["none", "oauth", "bearer"],+ oauth_scopes=["read"],+ oauth_write_scopes=["write"],+ ),+ )+ with patch("backend.integrations.mcp_guide.get_mcp_catalog", return_value=(entry,)):+ guide = render_mcp_guide(MCP_CATALOG_MARKER)++ assert "none / oauth / bearer" in guide+ assert "OAuth uses `https://mcp.vendor.com/mcp/oauth`" in guide+ assert "default OAuth scopes: read" in guide+ assert "optional grants require explicit selection" in guide+++def test_guide_includes_connections_and_endpoint_choices():+ guide = render_mcp_guide(MCP_CATALOG_MARKER)++ for entry in get_mcp_catalog():+ assert entry.display_name in guide+ assert entry.mcp_server.setup_instructions in guide+ server = entry.mcp_server+ if server.server_url:+ assert f"`{server.server_url}`" in guide+ elif not server.server_url_options:+ assert f"[setup instructions]({server.documentation_url})" in guide+ for option in server.server_url_options:+ assert f"{option.label}: `{option.url}`" in guidediff --git a/autogpt_platform/backend/backend/util/request.py b/autogpt_platform/backend/backend/util/request.pyindex cdb25ea5d6..5f7599745a 100644--- a/autogpt_platform/backend/backend/util/request.py+++ b/autogpt_platform/backend/backend/util/request.py@@ -290,7 +290,7 @@ async def resolve_and_check_blocked(hostname: str) -> list[str]:def parse_url(url: str) -> URL:"""Canonicalizes and parses a URL string."""- url = url.strip("/ ").replace("\\", "/")+ url = url.lstrip("/ ").rstrip(" ").replace("\\", "/")# Ensure scheme is present for proper parsing.# Avoid regex to sidestep CodeQL py/polynomial-redos on user-controlleddiff --git a/autogpt_platform/backend/backend/util/request_test.py b/autogpt_platform/backend/backend/util/request_test.pyindex f6b82cff92..d85de7784f 100644--- a/autogpt_platform/backend/backend/util/request_test.py+++ b/autogpt_platform/backend/backend/util/request_test.py@@ -583,3 +583,42 @@ async def test_credentials_survive_a_same_origin_redirect():assert seen["authorization"] == "Basic dXNlcjpwYXNz"assert seen["cookie"] == "session=secret_session_value"+++async def test_post_follows_redirect_to_trailing_slash_without_looping():+ from backend.util.request import Requests++ seen: list[str] = []++ async def redirect(request: web.Request) -> web.Response:+ seen.append(request.path)+ raise web.HTTPTemporaryRedirect("/mcp/")++ async def endpoint(request: web.Request) -> web.Response:+ seen.append(request.path)+ assert await request.json() == {"method": "initialize"}+ return web.json_response({"error": "unauthorized"}, status=401)++ app = web.Application()+ app.router.add_post("/mcp", redirect)+ app.router.add_post("/mcp/", endpoint)+ runner = web.AppRunner(app)+ await runner.setup()+ await web.TCPSite(runner, "127.0.0.1", 0).start()+ port = runner.addresses[0][1]++ try:+ response = await Requests(+ trusted_origins=["127.0.0.1"], raise_for_status=False+ ).post(+ f"http://127.0.0.1:{port}/mcp",+ json={"method": "initialize"},+ max_redirects=2,+ )+ finally:+ await runner.cleanup()++ assert response.status == 401+ assert response.json() == {"error": "unauthorized"}+ assert seen == ["/mcp", "/mcp/"]diff --git a/autogpt_platform/frontend/public/integrations/1inch.png b/autogpt_platform/frontend/public/integrations/1inch.pngnew file mode 100644index 0000000000..6547531b85Binary files /dev/null and b/autogpt_platform/frontend/public/integrations/1inch.png differdiff --git a/autogpt_platform/frontend/public/integrations/aave.png b/autogpt_platform/frontend/public/integrations/aave.pngnew file mode 100644index 0000000000..afecd20054Binary files /dev/null and b/autogpt_platform/frontend/public/integrations/aave.png differdiff --git a/autogpt_platform/frontend/public/integrations/airwallex.png b/autogpt_platform/frontend/public/integrations/airwallex.pngnew file mode 100644index 0000000000..24ec91a2c0Binary files /dev/null and b/autogpt_platform/frontend/public/integrations/airwallex.png differdiff --git a/autogpt_platform/frontend/public/integrations/algolia.png b/autogpt_platform/frontend/public/integrations/algolia.pngnew file mode 100644index 0000000000..ad3f519938Binary files /dev/null and b/autogpt_platform/frontend/public/integrations/algolia.png differdiff --git a/autogpt_platform/frontend/public/integrations/amplemarket.png b/autogpt_platform/frontend/public/integrations/amplemarket.pngnew file mode 100644index 0000000000..1f7510971dBinary files /dev/null and b/autogpt_platform/frontend/public/integrations/amplemarket.png differdiff --git a/autogpt_platform/frontend/public/integrations/amplitude.png b/autogpt_platform/frontend/public/integrations/amplitude.pngnew file mode 100644index 0000000000..dfe42f7b79Binary files /dev/null and b/autogpt_platform/frontend/public/integrations/amplitude.png differdiff --git a/autogpt_platform/frontend/public/integrations/ando.png b/autogpt_platform/frontend/public/integrations/ando.pngnew file mode 100644index 0000000000..2f0e454ca7Binary files /dev/null and b/autogpt_platform/frontend/public/integrations/ando.png differdiff --git a/autogpt_platform/frontend/public/integrations/antimetal.png b/autogpt_platform/frontend/public/integrations/antimetal.pngnew file mode 100644index 0000000000..676d9d1b2eBinary files /dev/null and b/autogpt_platform/frontend/public/integrations/antimetal.png differdiff --git a/autogpt_platform/frontend/public/integrations/apify.png b/autogpt_platform/frontend/public/integrations/apify.pngnew file mode 100644index 0000000000..fd597abf8eBinary files /dev/null and b/autogpt_platform/frontend/public/integrations/apify.png differdiff --git a/autogpt_platform/frontend/public/integrations/appwrite.png b/autogpt_platform/frontend/public/integrations/appwrite.pngnew file mode 100644index 0000000000..e9a30b47baBinary files /dev/null and b/autogpt_platform/frontend/public/integrations/appwrite.png differdiff --git a/autogpt_platform/frontend/public/integrations/arize.png b/autogpt_platform/frontend/public/integrations/arize.pngnew file mode 100644index 0000000000..9765161d4aBinary files /dev/null and b/autogpt_platform/frontend/public/integrations/arize.png differdiff --git a/autogpt_platform/frontend/public/integrations/astronomer.png b/autogpt_platform/frontend/public/integrations/astronomer.pngnew file mode 100644index 0000000000..294fac6394Binary files /dev/null and b/autogpt_platform/frontend/public/integrations/astronomer.png differdiff --git a/autogpt_platform/frontend/public/integrations/atlan.png b/autogpt_platform/frontend/public/integrations/atlan.pngnew file mode 100644index 0000000000..da95378bd8Binary files /dev/null and b/autogpt_platform/frontend/public/integrations/atlan.png differdiff --git a/autogpt_platform/frontend/public/integrations/atlassian.png b/autogpt_platform/frontend/public/integrations/atlassian.pngnew file mode 100644index 0000000000..caf46ed749Binary files /dev/null and b/autogpt_platform/frontend/public/integrations/atlassian.png differdiff --git a/autogpt_platform/frontend/public/integrations/aws.png b/autogpt_platform/frontend/public/integrations/aws.pngnew file mode 100644index 0000000000..cdb8b91f3aBinary files /dev/null and b/autogpt_platform/frontend/public/integrations/aws.png differdiff --git a/autogpt_platform/frontend/public/integrations/azure_cosmos_db.png b/autogpt_platform/frontend/public/integrations/azure_cosmos_db.pngnew file mode 100644index 0000000000..38bc980522Binary files /dev/null and b/autogpt_platform/frontend/public/integrations/azure_cosmos_db.png differdiff --git a/autogpt_platform/frontend/public/integrations/bird.png b/autogpt_platform/frontend/public/integrations/bird.pngnew file mode 100644index 0000000000..dddd4f158cBinary files /dev/null and b/autogpt_platform/frontend/public/integrations/bird.png differdiff --git a/autogpt_platform/frontend/public/integrations/brevo.png b/autogpt_platform/frontend/public/integrations/brevo.pngnew file mode 100644index 0000000000..490184f3c2Binary files /dev/null and b/autogpt_platform/frontend/public/integrations/brevo.png differdiff --git a/autogpt_platform/frontend/public/integrations/brex.png b/autogpt_platform/frontend/public/integrations/brex.pngnew file mode 100644index 0000000000..1b24c77774Binary files /dev/null and b/autogpt_platform/frontend/public/integrations/brex.png differdiff --git a/autogpt_platform/frontend/public/integrations/calendly.png b/autogpt_platform/frontend/public/integrations/calendly.pngnew file mode 100644index 0000000000..da3391a1c2Binary files /dev/null and b/autogpt_platform/frontend/public/integrations/calendly.png differdiff --git a/autogpt_platform/frontend/public/integrations/chargebee.png b/autogpt_platform/frontend/public/integrations/chargebee.pngnew file mode 100644index 0000000000..182006c908Binary files /dev/null and b/autogpt_platform/frontend/public/integrations/chargebee.png differdiff --git a/autogpt_platform/frontend/public/integrations/clay.png b/autogpt_platform/frontend/public/integrations/clay.pngnew file mode 100644index 0000000000..8b02e86a9bBinary files /dev/null and b/autogpt_platform/frontend/public/integrations/clay.png differdiff --git a/autogpt_platform/frontend/public/integrations/coda.png b/autogpt_platform/frontend/public/integrations/coda.pngnew file mode 100644index 0000000000..ec8c7f26deBinary files /dev/null and b/autogpt_platform/frontend/public/integrations/coda.png differdiff --git a/autogpt_platform/frontend/public/integrations/composio.png b/autogpt_platform/frontend/public/integrations/composio.pngnew file mode 100644index 0000000000..6c0552b107Binary files /dev/null and b/autogpt_platform/frontend/public/integrations/composio.png differdiff --git a/autogpt_platform/frontend/public/integrations/context7.png b/autogpt_platform/frontend/public/integrations/context7.pngnew file mode 100644index 0000000000..47492d2afbBinary files /dev/null and b/autogpt_platform/frontend/public/integrations/context7.png differdiff --git a/autogpt_platform/frontend/public/integrations/context_dev.png b/autogpt_platform/frontend/public/integrations/context_dev.pngnew file mode 100644index 0000000000..bdfa712f1cBinary files /dev/null and b/autogpt_platform/frontend/public/integrations/context_dev.png differdiff --git a/autogpt_platform/frontend/public/integrations/craft.png b/autogpt_platform/frontend/public/integrations/craft.pngnew file mode 100644index 0000000000..55bb98121cBinary files /dev/null and b/autogpt_platform/frontend/public/integrations/craft.png differdiff --git a/autogpt_platform/frontend/public/integrations/crustdata.png b/autogpt_platform/frontend/public/integrations/crustdata.pngnew file mode 100644index 0000000000..29ef85d248Binary files /dev/null and b/autogpt_platform/frontend/public/integrations/crustdata.png differdiff --git a/autogpt_platform/frontend/public/integrations/customer_io.png b/autogpt_platform/frontend/public/integrations/customer_io.pngnew file mode 100644index 0000000000..617546050aBinary files /dev/null and b/autogpt_platform/frontend/public/integrations/customer_io.png differdiff --git a/autogpt_platform/frontend/public/integrations/datarobot.png b/autogpt_platform/frontend/public/integrations/datarobot.pngnew file mode 100644index 0000000000..b4682824e5Binary files /dev/null and b/autogpt_platform/frontend/public/integrations/datarobot.png differdiff --git a/autogpt_platform/frontend/public/integrations/gojiberry.png b/autogpt_platform/frontend/public/integrations/gojiberry.pngnew file mode 100644index 0000000000..e27b832692Binary files /dev/null and b/autogpt_platform/frontend/public/integrations/gojiberry.png differdiff --git a/autogpt_platform/frontend/public/integrations/gong.png b/autogpt_platform/frontend/public/integrations/gong.pngnew file mode 100644index 0000000000..a3ff2d12eeBinary files /dev/null and b/autogpt_platform/frontend/public/integrations/gong.png differdiff --git a/autogpt_platform/frontend/public/integrations/granola.png b/autogpt_platform/frontend/public/integrations/granola.pngnew file mode 100644index 0000000000..2c9a7a69e0Binary files /dev/null and b/autogpt_platform/frontend/public/integrations/granola.png differdiff --git a/autogpt_platform/frontend/public/integrations/harmonic.png b/autogpt_platform/frontend/public/integrations/harmonic.pngnew file mode 100644index 0000000000..eea5c3fe15Binary files /dev/null and b/autogpt_platform/frontend/public/integrations/harmonic.png differdiff --git a/autogpt_platform/frontend/public/integrations/infobip.png b/autogpt_platform/frontend/public/integrations/infobip.pngnew file mode 100644index 0000000000..70083ecef0Binary files /dev/null and b/autogpt_platform/frontend/public/integrations/infobip.png differdiff --git a/autogpt_platform/frontend/public/integrations/intercom.png b/autogpt_platform/frontend/public/integrations/intercom.pngnew file mode 100644index 0000000000..8d5f91b521Binary files /dev/null and b/autogpt_platform/frontend/public/integrations/intercom.png differdiff --git a/autogpt_platform/frontend/public/integrations/langfuse.png b/autogpt_platform/frontend/public/integrations/langfuse.pngnew file mode 100644index 0000000000..92d82278a3Binary files /dev/null and b/autogpt_platform/frontend/public/integrations/langfuse.png differdiff --git a/autogpt_platform/frontend/public/integrations/miro.png b/autogpt_platform/frontend/public/integrations/miro.pngnew file mode 100644index 0000000000..d41cb647d8Binary files /dev/null and b/autogpt_platform/frontend/public/integrations/miro.png differdiff --git a/autogpt_platform/frontend/public/integrations/mobbin.png b/autogpt_platform/frontend/public/integrations/mobbin.pngnew file mode 100644index 0000000000..cde0ece905Binary files /dev/null and b/autogpt_platform/frontend/public/integrations/mobbin.png differdiff --git a/autogpt_platform/frontend/public/integrations/monday.png b/autogpt_platform/frontend/public/integrations/monday.pngnew file mode 100644index 0000000000..1243c14d3eBinary files /dev/null and b/autogpt_platform/frontend/public/integrations/monday.png differdiff --git a/autogpt_platform/frontend/public/integrations/opsera.png b/autogpt_platform/frontend/public/integrations/opsera.pngnew file mode 100644index 0000000000..0d1181aefcBinary files /dev/null and b/autogpt_platform/frontend/public/integrations/opsera.png differdiff --git a/autogpt_platform/frontend/public/integrations/parallel.png b/autogpt_platform/frontend/public/integrations/parallel.pngnew file mode 100644index 0000000000..8f45b7260bBinary files /dev/null and b/autogpt_platform/frontend/public/integrations/parallel.png differdiff --git a/autogpt_platform/frontend/public/integrations/plaid.png b/autogpt_platform/frontend/public/integrations/plaid.pngnew file mode 100644index 0000000000..62f83e23a1Binary files /dev/null and b/autogpt_platform/frontend/public/integrations/plaid.png differdiff --git a/autogpt_platform/frontend/public/integrations/plain.png b/autogpt_platform/frontend/public/integrations/plain.pngnew file mode 100644index 0000000000..c7f82f24c1Binary files /dev/null and b/autogpt_platform/frontend/public/integrations/plain.png differdiff --git a/autogpt_platform/frontend/public/integrations/runlayer.png b/autogpt_platform/frontend/public/integrations/runlayer.pngnew file mode 100644index 0000000000..2198b50a25Binary files /dev/null and b/autogpt_platform/frontend/public/integrations/runlayer.png differdiff --git a/autogpt_platform/frontend/public/integrations/sentry.png b/autogpt_platform/frontend/public/integrations/sentry.pngnew file mode 100644index 0000000000..bc72e58d3cBinary files /dev/null and b/autogpt_platform/frontend/public/integrations/sentry.png differdiff --git a/autogpt_platform/frontend/public/integrations/sourcegraph.png b/autogpt_platform/frontend/public/integrations/sourcegraph.pngnew file mode 100644index 0000000000..128122a9d2Binary files /dev/null and b/autogpt_platform/frontend/public/integrations/sourcegraph.png differdiff --git a/autogpt_platform/frontend/public/integrations/stripe.png b/autogpt_platform/frontend/public/integrations/stripe.pngnew file mode 100644index 0000000000..9c1027d99cBinary files /dev/null and b/autogpt_platform/frontend/public/integrations/stripe.png differdiff --git a/autogpt_platform/frontend/public/integrations/subtext.png b/autogpt_platform/frontend/public/integrations/subtext.pngnew file mode 100644index 0000000000..d17d4002eaBinary files /dev/null and b/autogpt_platform/frontend/public/integrations/subtext.png differdiff --git a/autogpt_platform/frontend/public/integrations/superme.png b/autogpt_platform/frontend/public/integrations/superme.pngnew file mode 100644index 0000000000..bc66af08cbBinary files /dev/null and b/autogpt_platform/frontend/public/integrations/superme.png differdiff --git a/autogpt_platform/frontend/public/integrations/tabnine.png b/autogpt_platform/frontend/public/integrations/tabnine.pngnew file mode 100644index 0000000000..9aa21151e5Binary files /dev/null and b/autogpt_platform/frontend/public/integrations/tabnine.png differdiff --git a/autogpt_platform/frontend/public/integrations/tavily.png b/autogpt_platform/frontend/public/integrations/tavily.pngnew file mode 100644index 0000000000..f8ead905d0Binary files /dev/null and b/autogpt_platform/frontend/public/integrations/tavily.png differdiff --git a/autogpt_platform/frontend/public/integrations/treg.png b/autogpt_platform/frontend/public/integrations/treg.pngnew file mode 100644index 0000000000..c8fdd63a66Binary files /dev/null and b/autogpt_platform/frontend/public/integrations/treg.png differdiff --git a/autogpt_platform/frontend/public/integrations/webflow.png b/autogpt_platform/frontend/public/integrations/webflow.pngnew file mode 100644index 0000000000..815186d259Binary files /dev/null and b/autogpt_platform/frontend/public/integrations/webflow.png differdiff --git a/autogpt_platform/frontend/public/integrations/wonder.png b/autogpt_platform/frontend/public/integrations/wonder.pngnew file mode 100644index 0000000000..482409d4a6Binary files /dev/null and b/autogpt_platform/frontend/public/integrations/wonder.png differdiff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/OnboardingWelcomeDialog/__tests__/connect-flow.test.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/OnboardingWelcomeDialog/__tests__/connect-flow.test.tsxindex 5c9c3d93f8..2b807da96e 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/OnboardingWelcomeDialog/__tests__/connect-flow.test.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/OnboardingWelcomeDialog/__tests__/connect-flow.test.tsx@@ -110,6 +110,37 @@ beforeEach(() => {});describe("ConnectToolsPanel — picking a provider", () => {+ it("excludes MCP presets from the native-method picker", async () => {+ stubPanel();+ server.use(+ http.get(PROVIDERS_URL, () =>+ HttpResponse.json([+ ...REGISTRY,+ {+ name: "mcp_notion",+ display_name: "Notion",+ supported_auth_types: [],+ mcp_server: {+ server_url: "https://mcp.notion.com/mcp",+ documentation_url: "https://developers.notion.com/guides/mcp",+ setup_instructions: "Sign in to Notion.",+ connection_mode: "hosted",+ auth_methods: ["oauth"],+ },+ },+ ]),+ ),+ );+ renderPanel();+ await screen.findByRole("button", { name: /GitHub/ });++ await userEvent.type(screen.getByLabelText("Search services"), "Notion");++ expect(await screen.findByText('No services match "Notion"')).toBeDefined();+ expect(screen.queryByRole("button", { name: /Notion/ })).toBeNull();+ expect(screen.queryByRole("button", { name: "Continue" })).toBeNull();+ });+it("opens the connect step with only the methods the provider supports", async () => {stubPanel();renderPanel();@@ -206,7 +237,7 @@ describe("ConnectToolsPanel — inline API key flow", () => {);await user.type(screen.getByLabelText("Name"), "Work key");- await user.type(apiKeyField, "sk-live-123");+ await user.type(apiKeyField, "<test-api-key>");await waitFor(() =>expect(screen.getByRole("button", { name: "Continue" })).toHaveProperty(@@ -245,7 +276,7 @@ describe("ConnectToolsPanel — inline API key flow", () => {await user.type(await screen.findByLabelText("Name"), "Work key");await user.type(screen.getByLabelText("API key", { selector: "input" }),- "sk-live-123",+ "<test-api-key>",);await user.click(screen.getByRole("button", { name: "Continue" }));@@ -256,7 +287,7 @@ describe("ConnectToolsPanel — inline API key flow", () => {provider: "github",type: "api_key",title: "Work key",- api_key: "sk-live-123",+ api_key: "<test-api-key>",});expect(toastSpy).toHaveBeenCalledWith({title: "API key saved",diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/OnboardingWelcomeDialog/useConnectToolsPanel.ts b/autogpt_platform/frontend/src/app/(platform)/copilot/components/OnboardingWelcomeDialog/useConnectToolsPanel.tsindex 8c391c3a1b..6f8c2b5a34 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/OnboardingWelcomeDialog/useConnectToolsPanel.ts+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/OnboardingWelcomeDialog/useConnectToolsPanel.ts@@ -68,7 +68,9 @@ export function useConnectToolsPanel() {},});- const allProviders = toConnectableProviders(providersQuery.data ?? []);+ const allProviders = toConnectableProviders(+ (providersQuery.data ?? []).filter((provider) => !provider.mcp_server),+ );const providers = filterConnectableProviders(allProviders, debouncedQuery);const selectedProvider: ConnectableProvider | null = selectedId? (allProviders.find((provider) => provider.id === selectedId) ?? null)diff --git a/autogpt_platform/frontend/src/app/(platform)/settings/integrations/__tests__/main.test.tsx b/autogpt_platform/frontend/src/app/(platform)/settings/integrations/__tests__/main.test.tsxindex 177d234ecd..32ce113482 100644--- a/autogpt_platform/frontend/src/app/(platform)/settings/integrations/__tests__/main.test.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/settings/integrations/__tests__/main.test.tsx@@ -55,7 +55,7 @@ describe("SettingsIntegrationsPage — list", () => {render(<SettingsIntegrationsPage />);expect(- await screen.findByRole("heading", { name: /integrations/i }),+ await screen.findByRole("heading", { name: /^integrations$/i }),).toBeDefined();const connectButtons = screen.getAllByRole("button", {name: /connect.*service/i,diff --git a/autogpt_platform/frontend/src/app/(platform)/settings/integrations/__tests__/mcp-auth-fixtures.ts b/autogpt_platform/frontend/src/app/(platform)/settings/integrations/__tests__/mcp-auth-fixtures.tsnew file mode 100644index 0000000000..9b96382b10--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/settings/integrations/__tests__/mcp-auth-fixtures.ts@@ -0,0 +1,92 @@+import { vi } from "vitest";+import { http, HttpResponse } from "msw";+import type { ProviderMetadata } from "@/app/api/__generated__/models/providerMetadata";+import {+ getGetV1ListCredentialsMockHandler,+ getGetV1ListProvidersMockHandler,+} from "@/app/api/__generated__/endpoints/integrations/integrations.msw";+import { server } from "@/mocks/mock-server";++type MCPServer = NonNullable<ProviderMetadata["mcp_server"]>;++function preset(+ name: string,+ slug: string,+ metadata: Partial<MCPServer> & Pick<MCPServer, "auth_methods">,+): ProviderMetadata {+ return {+ name: `mcp_${slug}`,+ display_name: name,+ description: `${name} account and data tools`,+ supported_auth_types: ["oauth2"],+ mcp_server: {+ server_url: `https://mcp.${slug}.example.com/mcp`,+ documentation_url: `https://docs.example.com/${slug}`,+ setup_instructions: `Choose the permitted access for ${name}.`,+ connection_mode: "hosted",+ ...metadata,+ },+ };+}++export const authProviders: ProviderMetadata[] = [+ preset("AgentMail", "agentmail", {+ auth_methods: ["oauth"],+ icon_id: "agent_mail",+ }),+ preset("Intercom", "intercom", {+ auth_methods: ["bearer"],+ }),+ preset("Langfuse", "langfuse", {+ server_url: null,+ connection_mode: "custom",+ auth_methods: ["basic"],+ server_url_options: [+ { label: "EU", url: "https://cloud.langfuse.com/api/public/mcp" },+ { label: "US", url: "https://us.cloud.langfuse.com/api/public/mcp" },+ ],+ }),+ preset("Parallel", "parallel", {+ server_url: "https://search.parallel.ai/mcp",+ oauth_server_url: "https://search.parallel.ai/mcp-oauth",+ auth_methods: ["none", "oauth", "bearer"],+ }),+ preset("Customer.io", "customer_io", {+ auth_methods: ["oauth"],+ oauth_scopes: ["read"],+ oauth_write_scopes: ["write"],+ setup_instructions: "Read account data. Allow changes to create drafts.",+ }),+];++export const oauthRequest = vi.fn();+export const discoveryRequest = vi.fn();+export const tokenRequest = vi.fn();++export function setupAuthFixtures() {+ vi.clearAllMocks();+ server.use(+ getGetV1ListCredentialsMockHandler([]),+ getGetV1ListProvidersMockHandler(authProviders),+ http.post("*/api/mcp/oauth/login", async ({ request }) => {+ oauthRequest(await request.json());+ return HttpResponse.json(+ { detail: "Sign-in is unavailable in this test" },+ { status: 400 },+ );+ }),+ http.post("*/api/mcp/discover-tools", async ({ request }) => {+ discoveryRequest(await request.json());+ return HttpResponse.json({ tools: [] });+ }),+ http.post("*/api/mcp/token", async ({ request }) => {+ tokenRequest(await request.json());+ return HttpResponse.json({+ id: "test-credential",+ provider: "mcp",+ type: "oauth2",+ title: "Saved account",+ });+ }),+ );+}diff --git a/autogpt_platform/frontend/src/app/(platform)/settings/integrations/__tests__/mcp-auth-methods.test.tsx b/autogpt_platform/frontend/src/app/(platform)/settings/integrations/__tests__/mcp-auth-methods.test.tsxnew file mode 100644index 0000000000..1f80cb59f2--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/settings/integrations/__tests__/mcp-auth-methods.test.tsx@@ -0,0 +1,124 @@+import { beforeEach, describe, expect, test } from "vitest";+import {+ fireEvent,+ render,+ screen,+ waitFor,+ within,+} from "@/tests/integrations/test-utils";+import SettingsIntegrationsPage from "../page";+import {+ discoveryRequest,+ oauthRequest,+ setupAuthFixtures,+ tokenRequest,+} from "./mcp-auth-fixtures";++beforeEach(setupAuthFixtures);++async function openPreset(name: string) {+ render(<SettingsIntegrationsPage />);+ fireEvent.click(+ await screen.findByRole("button", { name: new RegExp(name + ".*account") }),+ );+ const dialog = await screen.findByRole("dialog");+ await within(dialog).findByLabelText("Server URL");+ return dialog;+}++describe("MCP preset authentication methods", () => {+ test("AgentMail never offers a manual credential, including after OAuth failure", async () => {+ const dialog = await openPreset("AgentMail");+ expect(within(dialog).queryByText(/use an api token instead/i)).toBeNull();+ expect(within(dialog).queryByLabelText("Authentication type")).toBeNull();+ fireEvent.click(within(dialog).getByRole("button", { name: /^connect$/i }));+ expect(await within(dialog).findByRole("alert")).toBeDefined();+ expect(within(dialog).queryByPlaceholderText("Paste API token")).toBeNull();+ expect(+ within(dialog).queryByRole("button", { name: /save token/i }),+ ).toBeNull();+ expect(oauthRequest).toHaveBeenCalledTimes(1);+ });++ test("Langfuse defaults to Basic and rejects a pasted Bearer scheme before probing", async () => {+ const dialog = await openPreset("Langfuse");+ const url = within(dialog).getByLabelText<HTMLInputElement>("Server URL");+ expect(url.readOnly).toBe(false);+ expect(url.value).toBe("");+ const region = within(dialog).getByRole("combobox", {+ name: "Server region",+ });+ fireEvent.keyDown(region, { key: "ArrowDown" });+ fireEvent.click(await screen.findByRole("option", { name: "EU" }));+ expect(url.value).toBe("https://cloud.langfuse.com/api/public/mcp");+ expect(url.readOnly).toBe(true);+ fireEvent.change(within(dialog).getByPlaceholderText(/paste base64/i), {+ target: { value: "secret-for-old-region" },+ });+ fireEvent.keyDown(region, { key: "ArrowDown" });+ fireEvent.click(await screen.findByRole("option", { name: "Custom URL" }));+ expect(url.value).toBe("");+ expect(url.readOnly).toBe(false);+ expect(+ within(dialog).getByPlaceholderText<HTMLInputElement>(/paste base64/i)+ .value,+ ).toBe("");+ fireEvent.change(url, {+ target: { value: "https://cloud.langfuse.com/api/public/mcp" },+ });+ expect(within(dialog).queryByLabelText("Authentication type")).toBeNull();+ expect(+ within(dialog).queryByRole("button", { name: /try oauth/i }),+ ).toBeNull();+ const token = within(dialog).getByPlaceholderText(/paste base64/i);+ fireEvent.change(token, {+ target: { value: "Bearer cHVibGljOnNlY3JldA==" },+ });+ fireEvent.click(+ within(dialog).getByRole("button", { name: /save token/i }),+ );+ expect(await within(dialog).findByRole("alert")).toBeDefined();+ expect(discoveryRequest).not.toHaveBeenCalled();+ expect(tokenRequest).not.toHaveBeenCalled();+ fireEvent.change(token, { target: { value: "cHVibGljOnNlY3JldA==" } });+ fireEvent.click(+ within(dialog).getByRole("button", { name: /save token/i }),+ );+ await waitFor(() =>+ expect(tokenRequest).toHaveBeenCalledWith({+ server_url: "https://cloud.langfuse.com/api/public/mcp",+ token: "Basic cHVibGljOnNlY3JldA==",+ }),+ );+ expect(discoveryRequest.mock.invocationCallOrder[0]).toBeLessThan(+ tokenRequest.mock.invocationCallOrder[0],+ );+ expect(oauthRequest).not.toHaveBeenCalled();+ });++ test("Intercom offers only Bearer and rejects an explicit Basic credential", async () => {+ const dialog = await openPreset("Intercom");+ expect(+ within(dialog).queryByRole("button", { name: /try oauth/i }),+ ).toBeNull();+ expect(within(dialog).queryByLabelText("Authentication type")).toBeNull();+ const token = within(dialog).getByPlaceholderText("Paste API token");+ fireEvent.change(token, { target: { value: "Basic dXNlcjpwYXNz" } });+ fireEvent.click(+ within(dialog).getByRole("button", { name: /save token/i }),+ );+ expect(await within(dialog).findByRole("alert")).toBeDefined();+ expect(discoveryRequest).not.toHaveBeenCalled();+ fireEvent.change(token, { target: { value: "intercom-access-token" } });+ fireEvent.click(+ within(dialog).getByRole("button", { name: /save token/i }),+ );+ await waitFor(() =>+ expect(tokenRequest).toHaveBeenCalledWith({+ server_url: "https://mcp.intercom.example.com/mcp",+ token: "Bearer intercom-access-token",+ }),+ );+ expect(oauthRequest).not.toHaveBeenCalled();+ });+});diff --git a/autogpt_platform/frontend/src/app/(platform)/settings/integrations/__tests__/mcp-auth-options.test.tsx b/autogpt_platform/frontend/src/app/(platform)/settings/integrations/__tests__/mcp-auth-options.test.tsxnew file mode 100644index 0000000000..acd6f1b788--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/settings/integrations/__tests__/mcp-auth-options.test.tsx@@ -0,0 +1,184 @@+import { beforeEach, describe, expect, test, vi } from "vitest";+import { http, HttpResponse } from "msw";+import { server } from "@/mocks/mock-server";+import { openOAuthPopup } from "@/lib/oauth-popup";+import {+ fireEvent,+ render,+ screen,+ waitFor,+ within,+} from "@/tests/integrations/test-utils";+import SettingsIntegrationsPage from "../page";+import {+ discoveryRequest,+ oauthRequest,+ setupAuthFixtures,+ tokenRequest,+} from "./mcp-auth-fixtures";++beforeEach(setupAuthFixtures);++vi.mock("@/lib/oauth-popup", async (importOriginal) => ({+ ...(await importOriginal<typeof import("@/lib/oauth-popup")>()),+ openOAuthPopup: vi.fn(),+}));++async function openPreset(name: string) {+ render(<SettingsIntegrationsPage />);+ fireEvent.click(+ await screen.findByRole("button", { name: new RegExp(name + ".*account") }),+ );+ const dialog = await screen.findByRole("dialog");+ await within(dialog).findByLabelText("Server URL");+ return dialog;+}++describe("MCP preset access options", () => {+ test("switching preset methods cancels sign-in and discards entered credentials", async () => {+ server.use(+ http.post("*/api/mcp/oauth/login", () =>+ HttpResponse.json({+ login_url: "https://vendor.example.com/authorize",+ state_token: "state",+ }),+ ),+ );+ const controller = new AbortController();+ const abort = vi.fn(() => controller.abort());+ vi.mocked(openOAuthPopup).mockImplementation(() => ({+ promise: new Promise((_resolve, reject) =>+ controller.signal.addEventListener("abort", () =>+ reject(new Error("OAuth flow was canceled")),+ ),+ ),+ cleanup: { abort, signal: controller.signal },+ popupBlocked: false,+ fallbackBlocked: false,+ }));+ const dialog = await openPreset("Parallel");+ fireEvent.mouseDown(+ within(dialog).getByRole("tab", { name: /^sign in$/i }),+ { button: 0, ctrlKey: false },+ );+ fireEvent.click(within(dialog).getByRole("button", { name: /^connect$/i }));+ await waitFor(() => expect(openOAuthPopup).toHaveBeenCalled());+ fireEvent.mouseDown(+ within(dialog).getByRole("tab", { name: /^api token$/i }),+ { button: 0, ctrlKey: false },+ );+ expect(abort).toHaveBeenCalledTimes(1);+ fireEvent.change(within(dialog).getByPlaceholderText("Paste API token"), {+ target: { value: "unsaved-secret" },+ });+ fireEvent.mouseDown(+ within(dialog).getByRole("tab", { name: /^no sign-in$/i }),+ { button: 0, ctrlKey: false },+ );+ fireEvent.mouseDown(+ within(dialog).getByRole("tab", { name: /^api token$/i }),+ { button: 0, ctrlKey: false },+ );+ expect(+ within(dialog).getByPlaceholderText<HTMLInputElement>("Paste API token")+ .value,+ ).toBe("");+ expect(discoveryRequest).not.toHaveBeenCalled();+ expect(tokenRequest).not.toHaveBeenCalled();+ });++ test("Parallel defaults public, offers OAuth on its distinct URL, and saves tokens on the base URL", async () => {+ server.use(+ http.post("*/api/mcp/oauth/login", async ({ request }) => {+ oauthRequest(await request.json());+ return HttpResponse.json({+ login_url: "https://vendor.example.com/authorize",+ state_token: "state",+ });+ }),+ );+ vi.mocked(openOAuthPopup).mockImplementation(() => ({+ promise: Promise.reject(new Error("Vendor rejected this sign-in")),+ cleanup: { abort: vi.fn(), signal: new AbortController().signal },+ popupBlocked: false,+ fallbackBlocked: false,+ }));+ const dialog = await openPreset("Parallel");+ fireEvent.click(+ within(dialog).getByRole("button", { name: /check connection/i }),+ );+ await waitFor(() =>+ expect(discoveryRequest).toHaveBeenCalledWith({+ server_url: "https://search.parallel.ai/mcp",+ use_saved_credentials: false,+ }),+ );+ expect(tokenRequest).not.toHaveBeenCalled();+ expect(oauthRequest).not.toHaveBeenCalled();+ fireEvent.mouseDown(+ within(dialog).getByRole("tab", { name: /^sign in$/i }),+ { button: 0, ctrlKey: false },+ );+ expect(+ within(dialog).getByLabelText<HTMLInputElement>("Server URL").value,+ ).toBe("https://search.parallel.ai/mcp-oauth");+ fireEvent.click(within(dialog).getByRole("button", { name: /^connect$/i }));+ await waitFor(() =>+ expect(oauthRequest).toHaveBeenCalledWith({+ server_url: "https://search.parallel.ai/mcp-oauth",+ }),+ );+ expect((await within(dialog).findByRole("alert")).textContent).toBe(+ "Vendor rejected this sign-in",+ );+ fireEvent.mouseDown(+ within(dialog).getByRole("tab", { name: /^api token$/i }),+ { button: 0, ctrlKey: false },+ );+ expect(+ within(dialog).getByLabelText<HTMLInputElement>("Server URL").value,+ ).toBe("https://search.parallel.ai/mcp");+ fireEvent.change(within(dialog).getByPlaceholderText("Paste API token"), {+ target: { value: "parallel-access-token" },+ });+ fireEvent.click(+ within(dialog).getByRole("button", { name: /save token/i }),+ );+ await waitFor(() =>+ expect(tokenRequest).toHaveBeenCalledWith({+ server_url: "https://search.parallel.ai/mcp",+ token: "Bearer parallel-access-token",+ }),+ );+ expect(discoveryRequest).toHaveBeenCalledWith({+ server_url: "https://search.parallel.ai/mcp",+ auth_token: "Bearer parallel-access-token",+ });+ });++ test("Customer.io defaults to read access and adds only documented draft writes when selected", async () => {+ const dialog = await openPreset("Customer.io");+ const changes = within(dialog).getByRole("checkbox", {+ name: /allow changes/i,+ });+ expect(changes.getAttribute("aria-checked")).toBe("false");+ expect(within(dialog).getByText(/create drafts/i)).toBeDefined();+ fireEvent.click(within(dialog).getByRole("button", { name: /^connect$/i }));+ await waitFor(() =>+ expect(oauthRequest).toHaveBeenLastCalledWith({+ server_url: "https://mcp.customer_io.example.com/mcp",+ scopes: ["read"],+ }),+ );+ await within(dialog).findByRole("alert");+ fireEvent.click(changes);+ fireEvent.click(within(dialog).getByRole("button", { name: /^connect$/i }));+ await waitFor(() =>+ expect(oauthRequest).toHaveBeenLastCalledWith({+ server_url: "https://mcp.customer_io.example.com/mcp",+ scopes: ["read", "write"],+ }),+ );+ expect(tokenRequest).not.toHaveBeenCalled();+ });+});diff --git a/autogpt_platform/frontend/src/app/(platform)/settings/integrations/__tests__/mcp-cancellation.test.tsx b/autogpt_platform/frontend/src/app/(platform)/settings/integrations/__tests__/mcp-cancellation.test.tsxnew file mode 100644index 0000000000..99fdc5bece--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/settings/integrations/__tests__/mcp-cancellation.test.tsx@@ -0,0 +1,126 @@+import { beforeEach, describe, expect, test, vi } from "vitest";+import { http, HttpResponse } from "msw";+import {+ act,+ fireEvent,+ render,+ screen,+ waitFor,+ within,+} from "@/tests/integrations/test-utils";+import { server } from "@/mocks/mock-server";+import { openOAuthPopup } from "@/lib/oauth-popup";+import SettingsIntegrationsPage from "../page";+import { setupAuthFixtures, tokenRequest } from "./mcp-auth-fixtures";++vi.mock("@/lib/oauth-popup", async (importOriginal) => ({+ ...(await importOriginal<typeof import("@/lib/oauth-popup")>()),+ openOAuthPopup: vi.fn(),+}));++beforeEach(setupAuthFixtures);++function delayedResponse() {+ let release = () => {};+ const pending = new Promise<void>((resolve) => {+ release = resolve;+ });+ return { pending, release };+}++async function openParallel() {+ render(<SettingsIntegrationsPage />);+ fireEvent.click(+ await screen.findByRole("button", { name: /parallel.*account/i }),+ );+ const dialog = await screen.findByRole("dialog");+ await within(dialog).findByLabelText("Server URL");+ return dialog;+}++function selectMethod(dialog: HTMLElement, name: RegExp) {+ fireEvent.mouseDown(within(dialog).getByRole("tab", { name }), {+ button: 0,+ ctrlKey: false,+ });+}++async function releaseResponse(gate: ReturnType<typeof delayedResponse>) {+ await act(async () => {+ gate.release();+ await new Promise((resolve) => setTimeout(resolve, 50));+ });+}++describe("MCP preset cancellation during requests", () => {+ test("a delayed login response cannot open a popup after switching methods", async () => {+ const gate = delayedResponse();+ const started = vi.fn();+ const exchanged = vi.fn();+ const requestSignals: AbortSignal[] = [];+ server.use(+ http.post("*/api/mcp/oauth/login", async ({ request }) => {+ requestSignals.push(request.signal);+ started();+ await gate.pending;+ return HttpResponse.json({+ login_url: "https://vendor.example.com/login",+ state_token: "state",+ });+ }),+ http.post("*/api/mcp/oauth/callback", () => {+ exchanged();+ return HttpResponse.json({});+ }),+ );+ vi.mocked(openOAuthPopup).mockImplementation(() => ({+ promise: new Promise(() => {}),+ cleanup: { abort: vi.fn(), signal: new AbortController().signal },+ popupBlocked: false,+ fallbackBlocked: false,+ }));+ const dialog = await openParallel();+ selectMethod(dialog, /^sign in$/i);+ fireEvent.click(within(dialog).getByRole("button", { name: /^connect$/i }));+ await waitFor(() => expect(started).toHaveBeenCalled());+ selectMethod(dialog, /^api token$/i);+ expect(requestSignals[0].aborted).toBe(true);+ await releaseResponse(gate);+ expect(openOAuthPopup).not.toHaveBeenCalled();+ expect(exchanged).not.toHaveBeenCalled();+ expect(tokenRequest).not.toHaveBeenCalled();+ expect(+ within(dialog).getByPlaceholderText("Paste API token"),+ ).toBeDefined();+ });++ test("a delayed token probe cannot save a credential after switching methods", async () => {+ const gate = delayedResponse();+ const started = vi.fn();+ const requestSignals: AbortSignal[] = [];+ server.use(+ http.post("*/api/mcp/discover-tools", async ({ request }) => {+ requestSignals.push(request.signal);+ started();+ await gate.pending;+ return HttpResponse.json({ tools: [] });+ }),+ );+ const dialog = await openParallel();+ selectMethod(dialog, /^api token$/i);+ fireEvent.change(within(dialog).getByPlaceholderText("Paste API token"), {+ target: { value: "unsaved-secret" },+ });+ fireEvent.click(+ within(dialog).getByRole("button", { name: /save token/i }),+ );+ await waitFor(() => expect(started).toHaveBeenCalled());+ selectMethod(dialog, /^no sign-in$/i);+ expect(requestSignals[0].aborted).toBe(true);+ await releaseResponse(gate);+ expect(tokenRequest).not.toHaveBeenCalled();+ expect(+ within(dialog).getByRole("button", { name: /check connection/i }),+ ).toBeDefined();+ });+});diff --git a/autogpt_platform/frontend/src/app/(platform)/settings/integrations/__tests__/mcp-catalog.test.tsx b/autogpt_platform/frontend/src/app/(platform)/settings/integrations/__tests__/mcp-catalog.test.tsxnew file mode 100644index 0000000000..cfcbff2626--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/settings/integrations/__tests__/mcp-catalog.test.tsx@@ -0,0 +1,175 @@+import { beforeEach, describe, expect, test } from "vitest";+import { http, HttpResponse } from "msw";+import {+ fireEvent,+ render,+ screen,+ waitFor,+ within,+} from "@/tests/integrations/test-utils";+import { server } from "@/mocks/mock-server";+import { getGetV1ListProvidersMockHandler } from "@/app/api/__generated__/endpoints/integrations/integrations.msw";+import SettingsIntegrationsPage from "../page";+import {+ authProviders,+ discoveryRequest,+ oauthRequest,+ setupAuthFixtures,+ tokenRequest,+} from "./mcp-auth-fixtures";++beforeEach(() => {+ setupAuthFixtures();+ server.use(+ getGetV1ListProvidersMockHandler([+ ...authProviders,+ {+ name: "github",+ description: "Issues and PRs",+ supported_auth_types: ["api_key"],+ },+ {+ name: "mcp",+ description: "Connect any MCP server",+ supported_auth_types: ["oauth2"],+ },+ ]),+ );+});++async function openPicker() {+ const buttons = await screen.findAllByRole("button", {+ name: /connect.*service/i,+ });+ fireEvent.click(buttons[0]);+ return screen.findByRole("dialog");+}++describe("SettingsIntegrationsPage — MCP catalogue", () => {+ test("lists native providers and branded MCP entries together", async () => {+ render(<SettingsIntegrationsPage />);+ expect(+ await screen.findByRole("button", { name: /github.*issues and prs/i }),+ ).toBeDefined();+ const preset = await screen.findByRole("button", {+ name: /agentmail.*account/i,+ });+ expect(within(preset).getByText("MCP", { exact: true })).toBeDefined();+ expect(preset.querySelector("img")?.getAttribute("src")).toBe(+ "/integrations/agent_mail.png",+ );+ expect(screen.queryByText("Mcp Agentmail")).toBeNull();+ });++ test("search filters native and MCP providers by display name", async () => {+ render(<SettingsIntegrationsPage />);+ await screen.findByRole("button", { name: /agentmail.*account/i });+ fireEvent.change(screen.getByLabelText(/search integrations/i), {+ target: { value: "agentmail" },+ });+ await waitFor(() => {+ expect(+ screen.queryByRole("button", { name: /github.*issues and prs/i }),+ ).toBeNull();+ });+ expect(+ screen.getByRole("button", { name: /agentmail.*account/i }),+ ).toBeDefined();+ expect(+ screen.queryByRole("button", { name: /intercom.*account/i }),+ ).toBeNull();+ });++ test("a page preset locks its URL and uses generic MCP OAuth", async () => {+ render(<SettingsIntegrationsPage />);+ fireEvent.click(+ await screen.findByRole("button", { name: /agentmail.*account/i }),+ );+ const dialog = await screen.findByRole("dialog");+ const input =+ await within(dialog).findByLabelText<HTMLInputElement>("Server URL");+ expect(input.value).toBe("https://mcp.agentmail.example.com/mcp");+ expect(input.readOnly).toBe(true);+ expect(+ within(dialog).getByAltText("AgentMail logo").getAttribute("src"),+ ).toBe("/integrations/agent_mail.png");+ fireEvent.click(within(dialog).getByRole("button", { name: /^connect$/i }));+ await waitFor(() => {+ expect(oauthRequest).toHaveBeenCalledWith({+ server_url: "https://mcp.agentmail.example.com/mcp",+ });+ });+ });++ test("the service picker opens the same named MCP presets", async () => {+ render(<SettingsIntegrationsPage />);+ const dialog = await openPicker();+ fireEvent.click(+ await within(dialog).findByRole("button", {+ name: /agentmail.*account/i,+ }),+ );+ expect(+ (await within(dialog).findByLabelText<HTMLInputElement>("Server URL"))+ .value,+ ).toBe("https://mcp.agentmail.example.com/mcp");+ });++ test("generic MCP setup retains a blank editable URL", async () => {+ render(<SettingsIntegrationsPage />);+ const dialog = await openPicker();+ fireEvent.click(await within(dialog).findByText("Connect any MCP server"));+ const input =+ await within(dialog).findByLabelText<HTMLInputElement>("Server URL");+ expect(input.value).toBe("");+ expect(input.readOnly).toBe(false);+ expect(+ within(dialog).getByRole<HTMLButtonElement>("button", {+ name: /^connect$/i,+ }).disabled,+ ).toBe(true);+ });++ test.each([0, 2])(+ "public discovery reports %i tools without saving or reusing credentials",+ async (toolCount) => {+ server.use(+ http.post("*/api/mcp/discover-tools", async ({ request }) => {+ discoveryRequest(await request.json());+ return HttpResponse.json({+ tools: Array.from({ length: toolCount }, (_, i) => ({+ name: "tool_" + i,+ description: "Tool",+ input_schema: {},+ })),+ });+ }),+ );+ render(<SettingsIntegrationsPage />);+ fireEvent.click(+ await screen.findByRole("button", { name: /parallel.*account/i }),+ );+ const dialog = await screen.findByRole("dialog");+ fireEvent.click(+ await within(dialog).findByRole("button", {+ name: /check connection/i,+ }),+ );+ expect((await within(dialog).findByRole("status")).textContent).toBe(+ toolCount+ ? "2 tools available."+ : "Connected, but this server returned no tools.",+ );+ expect(+ within(dialog).getByText(/no connection was saved/i),+ ).toBeDefined();+ expect(within(dialog).getByText(/use this server url/i)).toBeDefined();+ expect(discoveryRequest).toHaveBeenCalledWith({+ server_url: "https://search.parallel.ai/mcp",+ use_saved_credentials: false,+ });+ expect(tokenRequest).not.toHaveBeenCalled();+ expect(oauthRequest).not.toHaveBeenCalled();+ },+ );+});diff --git a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/__tests__/integrations.test.tsx b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/__tests__/integrations.test.tsxindex 79df813953..1e35d994dc 100644--- a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/__tests__/integrations.test.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/__tests__/integrations.test.tsx@@ -474,6 +474,47 @@ describe("managing an expert's integrations", () => {expect(within(list).queryByRole("button", { name: /Slack/ })).toBeNull();});+ it("excludes MCP presets from the native-method picker", async () => {+ server.use(+ getListExpertCredentialsMockHandler([]),+ http.get("*/api/integrations/providers", () =>+ HttpResponse.json([+ {+ name: "notion",+ description: "Docs and databases",+ supported_auth_types: ["api_key"],+ },+ {+ name: "mcp_airtable",+ display_name: "Airtable",+ supported_auth_types: [],+ mcp_server: {+ server_url: "https://mcp.airtable.com/mcp",+ documentation_url: "https://support.airtable.com",+ setup_instructions: "Sign in to Airtable.",+ connection_mode: "hosted",+ auth_methods: ["oauth"],+ },+ },+ ]),+ ),+ );++ render(<ExpertDetailPage />);+ await openIntegrationsTab();+ await userEvent.click(+ await screen.findByRole("button", { name: /Add integration/ }),+ );+ const dialog = await screen.findByRole("dialog");+ const list = await within(dialog).findByRole("list", { name: "Services" });++ expect(within(list).queryByRole("button", { name: /Airtable/ })).toBeNull();+ await userEvent.click(within(list).getByRole("button", { name: /Notion/ }));+ expect(+ await within(dialog).findByRole("button", { name: /API Key/ }),+ ).toBeDefined();+ });+it("grants only the credential the dialog created", async () => {const workLinkedin = {id: "cred-linkedin",diff --git a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertIntegrationsSection/useExpertConnectServiceDialog.ts b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertIntegrationsSection/useExpertConnectServiceDialog.tsindex 4d1dd3a28b..492330e261 100644--- a/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertIntegrationsSection/useExpertConnectServiceDialog.ts+++ b/autogpt_platform/frontend/src/app/(platform)/team/[expertId]/components/ExpertIntegrationsSection/useExpertConnectServiceDialog.ts@@ -73,7 +73,9 @@ export function useExpertConnectServiceDialog({}}, [open, initialProviderId]);- const allProviders = toConnectableProviders(providersQuery.data ?? []);+ const allProviders = toConnectableProviders(+ (providersQuery.data ?? []).filter((provider) => !provider.mcp_server),+ );const credentials = credentialsQuery.data ?? [];const connectedProviders = new Set(credentials.map((credential) => credential.provider),diff --git a/autogpt_platform/frontend/src/app/(platform)/team/__tests__/main.test.tsx b/autogpt_platform/frontend/src/app/(platform)/team/__tests__/main.test.tsxindex 424143d4e8..1fd380a252 100644--- a/autogpt_platform/frontend/src/app/(platform)/team/__tests__/main.test.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/team/__tests__/main.test.tsx@@ -1215,6 +1215,34 @@ describe("TeamPage - setup needed card", () => {expect(within(card).queryByRole("button", { name: "Connect" })).toBeNull();});+ test("excludes MCP presets from native setup actions while keeping the unmet item", async () => {+ server.use(+ getListExpertSetupItemsMockHandler([+ makeSetupItem({ providers: ["mcp_notion"] }),+ ]),+ getGetV1ListProvidersMockHandler([+ {+ name: "mcp_notion",+ display_name: "Notion",+ supported_auth_types: [],+ mcp_server: {+ server_url: "https://mcp.notion.com/mcp",+ documentation_url: "https://developers.notion.com/guides/mcp",+ setup_instructions: "Sign in to Notion.",+ connection_mode: "hosted",+ auth_methods: ["oauth"],+ },+ },+ ]),+ );+ render(<TeamPage />);++ const card = await screen.findByTestId("setup-needed");+ expect(within(card).getByText("Setup needed (1)")).toBeDefined();+ expect(await within(card).findByText("Needs a platform key")).toBeDefined();+ expect(within(card).queryByRole("button", { name: "Connect" })).toBeNull();+ });+test("Allow grants the existing credential to that expert", async () => {let granted: {expertId: string;diff --git a/autogpt_platform/frontend/src/app/(platform)/team/components/SetupNeeded/useSetupNeeded.ts b/autogpt_platform/frontend/src/app/(platform)/team/components/SetupNeeded/useSetupNeeded.tsindex 240d9acd9b..15dab7ce20 100644--- a/autogpt_platform/frontend/src/app/(platform)/team/components/SetupNeeded/useSetupNeeded.ts+++ b/autogpt_platform/frontend/src/app/(platform)/team/components/SetupNeeded/useSetupNeeded.ts@@ -32,7 +32,9 @@ export function useSetupNeeded({ enabled }: Args) {},});const connectable = new Set(- toConnectableProviders(providersQuery.data ?? []).map((p) => p.id),+ toConnectableProviders(+ (providersQuery.data ?? []).filter((provider) => !provider.mcp_server),+ ).map((p) => p.id),);const { mutate: grant, isPending: isGranting } = useGrantExpertCredentials({diff --git a/autogpt_platform/frontend/src/app/api/openapi.json b/autogpt_platform/frontend/src/app/api/openapi.jsonindex 03194fa706..33a9e5ca0a 100644--- a/autogpt_platform/frontend/src/app/api/openapi.json+++ b/autogpt_platform/frontend/src/app/api/openapi.json@@ -8590,7 +8590,7 @@"get": {"tags": ["v1", "integrations"],"summary": "List Providers",- "description": "Get metadata for every available provider.\n\nReturns both statically defined providers (from ``ProviderName`` enum) and\ndynamically registered providers (from SDK decorators). Each entry includes\na ``description`` declared via ``ProviderBuilder.with_description(...)`` in\nthe provider's ``_config.py``.\n\nNote: The complete list of provider names is also available as a constant\nin the generated TypeScript client via PROVIDER_NAMES.",+ "description": "Get metadata for every available provider.\n\nReturns both statically defined providers (from ``ProviderName`` enum) and\ndynamically registered providers (from SDK decorators). Each entry includes\na ``description`` declared via ``ProviderBuilder.with_description(...)`` in\nthe provider's ``_config.py``.\n\nOfficial MCP catalog entries are appended as display metadata and use the\ngeneric MCP connection flow. They are not registered credential providers,\nso PROVIDER_NAMES continues to contain only credential-provider names.","operationId": "getV1ListProviders","responses": {"200": {@@ -10511,7 +10511,7 @@"post": {"tags": ["v2", "mcp", "mcp"],"summary": "Discover available tools on an MCP server",- "description": "Connect to an MCP server and return its available tools.\n\nIf the user has a stored MCP credential for this server URL, it will be\nused automatically — no need to pass an explicit auth credential.",+ "description": "Connect to an MCP server and return its available tools.\n\nIf the user has a stored MCP credential for this server URL, it will be\nused automatically unless use_saved_credentials is false.","operationId": "postV2Discover available tools on an mcp server","requestBody": {"content": {@@ -20510,6 +20510,12 @@"title": "Server Url","description": "URL of the MCP server"},+ "use_saved_credentials": {+ "type": "boolean",+ "title": "Use Saved Credentials",+ "description": "Use a saved credential when no auth token is supplied. Set false to discover public tools without signing in.",+ "default": true+ },"auth_token": {"anyOf": [{@@ -24952,6 +24958,14 @@"type": "string","title": "Server Url","description": "URL of the MCP server that requires OAuth"+ },+ "scopes": {+ "anyOf": [+ { "items": { "type": "string" }, "type": "array" },+ { "type": "null" }+ ],+ "title": "Scopes",+ "description": "OAuth scopes to request. Omit or use null to use catalogue or discovered defaults; an empty list requests no scopes."}},"type": "object",@@ -24969,6 +24983,83 @@"title": "MCPOAuthLoginResponse","description": "Response with the OAuth login URL for the user to authenticate."},+ "MCPServerMetadata": {+ "properties": {+ "server_url": {+ "anyOf": [{ "type": "string" }, { "type": "null" }],+ "title": "Server Url"+ },+ "documentation_url": {+ "type": "string",+ "title": "Documentation Url"+ },+ "setup_instructions": {+ "type": "string",+ "title": "Setup Instructions"+ },+ "connection_mode": {+ "type": "string",+ "enum": ["hosted", "custom"],+ "title": "Connection Mode"+ },+ "auth_methods": {+ "items": {+ "type": "string",+ "enum": ["oauth", "bearer", "basic", "none"]+ },+ "type": "array",+ "minItems": 1,+ "title": "Auth Methods"+ },+ "server_url_options": {+ "items": { "$ref": "#/components/schemas/MCPServerURLPreset" },+ "type": "array",+ "title": "Server Url Options"+ },+ "oauth_server_url": {+ "anyOf": [{ "type": "string" }, { "type": "null" }],+ "title": "Oauth Server Url"+ },+ "oauth_scopes": {+ "anyOf": [+ { "items": { "type": "string" }, "type": "array" },+ { "type": "null" }+ ],+ "title": "Oauth Scopes"+ },+ "oauth_write_scopes": {+ "items": { "type": "string" },+ "type": "array",+ "title": "Oauth Write Scopes"+ },+ "icon_id": {+ "anyOf": [+ { "type": "string", "pattern": "^[a-z0-9_-]+$" },+ { "type": "null" }+ ],+ "title": "Icon Id"+ }+ },+ "additionalProperties": false,+ "type": "object",+ "required": [+ "documentation_url",+ "setup_instructions",+ "connection_mode",+ "auth_methods"+ ],+ "title": "MCPServerMetadata"+ },+ "MCPServerURLPreset": {+ "properties": {+ "label": { "type": "string", "minLength": 1, "title": "Label" },+ "url": { "type": "string", "title": "Url" }+ },+ "additionalProperties": false,+ "type": "object",+ "required": ["label", "url"],+ "title": "MCPServerURLPreset"+ },"MCPStoreTokenRequest": {"properties": {"server_url": {@@ -27216,6 +27307,18 @@"title": "Name","description": "Provider slug (e.g. ``github``)"},+ "display_name": {+ "anyOf": [{ "type": "string" }, { "type": "null" }],+ "title": "Display Name",+ "description": "Human-readable provider name"+ },+ "mcp_server": {+ "anyOf": [+ { "$ref": "#/components/schemas/MCPServerMetadata" },+ { "type": "null" }+ ],+ "description": "Official MCP catalog connection and setup metadata"+ },"description": {"anyOf": [{ "type": "string" }, { "type": "null" }],"title": "Description",diff --git a/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/IntegrationsPanel.tsx b/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/IntegrationsPanel.tsxindex f569a1d3d5..c22d28d176 100644--- a/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/IntegrationsPanel.tsx+++ b/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/IntegrationsPanel.tsx@@ -8,6 +8,7 @@ import { AIConnectionsSection } from "./components/AIConnectionsSection/AIConnecimport { ConnectServiceDialog } from "./components/ConnectServiceDialog/ConnectServiceDialog";import { IntegrationsHeader } from "./components/IntegrationsHeader/IntegrationsHeader";import { IntegrationsList } from "./components/IntegrationsList/IntegrationsList";+import { AvailableIntegrations } from "./components/AvailableIntegrations/AvailableIntegrations";interface Props {withHeading?: boolean;@@ -15,11 +16,20 @@ interface Props {export function IntegrationsPanel({ withHeading = true }: Props) {const [isConnectOpen, setIsConnectOpen] = useState(false);+ const [selectedProviderId, setSelectedProviderId] = useState<string | null>(+ null,+ );+ const [query, setQuery] = useState("");++ function openConnect(providerId: string | null = null) {+ setSelectedProviderId(providerId);+ setIsConnectOpen(true);+ }return (<><IntegrationsHeader- onConnect={() => setIsConnectOpen(true)}+ onConnect={() => openConnect()}withTitle={withHeading}/><AIConnectionsSection />@@ -32,11 +42,13 @@ export function IntegrationsPanel({ withHeading = true }: Props) {>Tools your agents use</Text>- <IntegrationsList />+ <IntegrationsList query={query} onQueryChange={setQuery} /></section>+ <AvailableIntegrations query={query} onSelect={openConnect} /><ConnectServiceDialogopen={isConnectOpen}onOpenChange={setIsConnectOpen}+ initialProviderId={selectedProviderId}/></>);diff --git a/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/__tests__/IntegrationsPanel.test.tsx b/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/__tests__/IntegrationsPanel.test.tsxindex 5f99dd3fed..c8e2a5bbb4 100644--- a/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/__tests__/IntegrationsPanel.test.tsx+++ b/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/__tests__/IntegrationsPanel.test.tsx@@ -19,6 +19,7 @@ describe("IntegrationsPanel", () => {expect(headings.map((heading) => heading.textContent)).toEqual(["AI subscriptions","Tools your agents use",+ "Available integrations",]);});diff --git a/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/components/AvailableIntegrations/AvailableIntegrations.tsx b/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/components/AvailableIntegrations/AvailableIntegrations.tsxnew file mode 100644index 0000000000..3a986450e6--- /dev/null+++ b/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/components/AvailableIntegrations/AvailableIntegrations.tsx@@ -0,0 +1,78 @@+"use client";++import { Button } from "@/components/atoms/Button/Button";+import { Skeleton } from "@/components/atoms/Skeleton/Skeleton";+import { Text } from "@/components/atoms/Text/Text";+import { ErrorCard } from "@/components/molecules/ErrorCard/ErrorCard";+import { ProviderRow } from "../ConnectServiceDialog/components/ProviderRow";+import { useAvailableIntegrations } from "./useAvailableIntegrations";++interface Props {+ query: string;+ onSelect: (providerId: string) => void;+}++export function AvailableIntegrations({ query, onSelect }: Props) {+ const catalog = useAvailableIntegrations(query);++ return (+ <section+ aria-labelledby="available-integrations-heading"+ className="flex flex-col gap-4 pb-6 pt-6"+ >+ <div className="flex flex-col gap-1 px-4">+ <Text+ variant="small-medium"+ as="h2"+ id="available-integrations-heading"+ className="uppercase tracking-[0.06em] text-zinc-600"+ >+ Available integrations+ </Text>+ <Text variant="small" className="text-zinc-500">+ Connect your services, including official MCP integrations. Some+ services need additional setup.+ </Text>+ </div>+ {catalog.isLoading ? (+ <div className="grid gap-3 sm:grid-cols-2">+ {[0, 1, 2, 3].map((id) => (+ <Skeleton key={id} className="h-20 rounded-xl" />+ ))}+ </div>+ ) : catalog.isError ? (+ <ErrorCard+ context="available integrations"+ responseError={+ catalog.error instanceof Error+ ? { message: catalog.error.message }+ : undefined+ }+ onRetry={() => catalog.refetch()}+ />+ ) : (+ <>+ <ul className="grid gap-3 sm:grid-cols-2">+ {catalog.providers.map((provider) => (+ <li key={provider.id} className="min-w-0">+ <ProviderRow provider={provider} onSelect={onSelect} />+ </li>+ ))}+ </ul>+ <Text variant="small" className="px-4 text-zinc-500" role="status">+ {catalog.total === 0+ ? query.trim()+ ? "No available services match your search."+ : "No available services."+ : `${catalog.providers.length} of ${catalog.total} services`}+ </Text>+ {catalog.hasMore && (+ <Button variant="secondary" size="small" onClick={catalog.showMore}>+ Show more services+ </Button>+ )}+ </>+ )}+ </section>+ );+}diff --git a/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/components/AvailableIntegrations/useAvailableIntegrations.ts b/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/components/AvailableIntegrations/useAvailableIntegrations.tsnew file mode 100644index 0000000000..04112d37a7--- /dev/null+++ b/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/components/AvailableIntegrations/useAvailableIntegrations.ts@@ -0,0 +1,46 @@+"use client";++import { useEffect, useState } from "react";+import { useGetV1ListProviders } from "@/app/api/__generated__/endpoints/integrations/integrations";+import { useDebouncedValue } from "@/hooks/useDebouncedValue";+import {+ filterConnectableProviders,+ toConnectableProviders,+} from "../ConnectServiceDialog/helpers";++const PAGE_SIZE = 24;++export function useAvailableIntegrations(query: string) {+ const [limit, setLimit] = useState(PAGE_SIZE);+ const debouncedQuery = useDebouncedValue(query, 250);+ const result = useGetV1ListProviders({+ query: {+ select: (response) => (response.status === 200 ? response.data : []),+ },+ });+ const allProviders = toConnectableProviders(result.data ?? []);+ const matching = filterConnectableProviders(allProviders, debouncedQuery);+ // Paging applies whether or not there is a query. It used to be skipped+ // while searching, which is the one path a user reaches by typing, so a+ // broad term rendered every match and its image at once.+ const providers = matching.slice(0, limit);++ function showMore() {+ setLimit((current) => current + PAGE_SIZE);+ }++ useEffect(() => {+ setLimit(PAGE_SIZE);+ }, [debouncedQuery]);++ return {+ providers,+ total: matching.length,+ hasMore: providers.length < matching.length,+ showMore,+ isLoading: result.isLoading,+ isError: result.isError,+ error: result.error,+ refetch: result.refetch,+ };+}diff --git a/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/components/ConnectServiceDialog/ConnectServiceDialog.tsx b/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/components/ConnectServiceDialog/ConnectServiceDialog.tsxindex d077d9da9f..a73d3756ad 100644--- a/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/components/ConnectServiceDialog/ConnectServiceDialog.tsx+++ b/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/components/ConnectServiceDialog/ConnectServiceDialog.tsx@@ -22,11 +22,12 @@ interface Props {title?: React.ReactNode;description?: string;onConnected?: (credential: CredentialsMetaResponse) => void;+ initialProviderId?: string | null;}const DEFAULT_TITLE = "Connect a service";const DEFAULT_DESCRIPTION =- "Pick a service to connect an API key or authorize with OAuth.";+ "Choose a service to connect your account or view its setup instructions.";const TRANSITION = { duration: 0.15, ease: [0, 0, 0.2, 1] as const };const HEIGHT_TRANSITION = {@@ -52,6 +53,7 @@ export function ConnectServiceDialog({title = DEFAULT_TITLE,description = DEFAULT_DESCRIPTION,onConnected,+ initialProviderId,}: Props) {const {query,@@ -67,7 +69,12 @@ export function ConnectServiceDialog({handleSelect,handleBack,handleSuccess,- } = useConnectServiceDialog({ open, onOpenChange, onConnected });+ } = useConnectServiceDialog({+ open,+ onOpenChange,+ onConnected,+ initialProviderId,+ });const reduceMotion = useReducedMotion();const variants = reduceMotion ? reducedVariants : stepVariants;diff --git a/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/components/ConnectServiceDialog/__tests__/helpers.test.ts b/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/components/ConnectServiceDialog/__tests__/helpers.test.tsindex 48fda64d2a..69ee7c4b76 100644--- a/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/components/ConnectServiceDialog/__tests__/helpers.test.ts+++ b/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/components/ConnectServiceDialog/__tests__/helpers.test.ts@@ -18,6 +18,40 @@ function makeMeta(overrides: Partial<ProviderMetadata> = {}): ProviderMetadata {}describe("toConnectableProviders", () => {+ test("keeps official MCP presets separate from native auth providers", () => {+ const mcpServer = {+ server_url: "https://mcp.notion.com/mcp",+ documentation_url: "https://developers.notion.com/docs/mcp",+ setup_instructions: "Sign in to your Notion workspace.",+ connection_mode: "hosted" as const,+ auth_methods: ["oauth" as const],+ icon_id: "notion",+ };+ const preset = {+ name: "mcp_notion",+ display_name: "Notion",+ description: "Search and edit workspace content",+ supported_auth_types: [],+ mcp_server: mcpServer,+ };+ const result = toConnectableProviders([+ makeMeta({ name: "notion" }),+ preset,+ ]);++ expect(result).toHaveLength(2);+ expect(+ result.find((provider) => provider.id === "mcp_notion"),+ ).toMatchObject({+ name: "Notion",+ mcpServer,+ supportedAuthTypes: [],+ });+ expect(+ result.find((provider) => provider.id === "notion")?.supportedAuthTypes,+ ).toEqual(["oauth2", "api_key"]);+ });+test("formats provider name and preserves description and supported types", () => {const result = toConnectableProviders([makeMeta({ name: "github", description: "Issues and PRs" }),diff --git a/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/components/ConnectServiceDialog/components/DetailView/DetailView.tsx b/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/components/ConnectServiceDialog/components/DetailView/DetailView.tsxindex d9ae92188f..875d4a069e 100644--- a/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/components/ConnectServiceDialog/components/DetailView/DetailView.tsx+++ b/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/components/ConnectServiceDialog/components/DetailView/DetailView.tsx@@ -13,6 +13,7 @@ import {import { AuthType, ConnectableProvider, type AuthMethod } from "../../helpers";import { McpConnectPanel } from "./McpConnectPanel";+import { MCPPresetPanel } from "./MCPPresetPanel";import { getAuthMethodLabel, MethodPanel } from "./MethodPanel";import { ProviderAvatar } from "./ProviderAvatar";import { UnsupportedNotice } from "./UnsupportedNotice";@@ -66,20 +67,28 @@ export function DetailView({ provider, onBack, onSuccess }: Props) {><Icon icon={ArrowLeft02Icon} size={18} /></Button>- <ProviderAvatar id={provider.id} name={provider.name} />+ <ProviderAvatar+ id={+ provider.mcpServer?.icon_id ??+ (provider.mcpServer ? "mcp" : provider.id)+ }+ name={provider.name}+ /><div className="flex min-w-0 flex-col gap-1"><Text variant="h4" as="h2" className="text-[#1F1F20]">{provider.name}</Text>{description ? (- <Text variant="small" className="truncate text-[#83838C]">+ <Text variant="small" className="text-[#83838C]">{description}</Text>) : null}</div></div>- {provider.id === MCP_PROVIDER_ID ? (+ {provider.mcpServer ? (+ <MCPPresetPanel server={provider.mcpServer} onSuccess={onSuccess} />+ ) : provider.id === MCP_PROVIDER_ID ? (<McpConnectPanel onSuccess={onSuccess} />) : tabs.length === 0 ? (<UnsupportedNotice providerName={provider.name} />diff --git a/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/components/ConnectServiceDialog/components/DetailView/MCPPresetPanel.tsx b/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/components/ConnectServiceDialog/components/DetailView/MCPPresetPanel.tsxnew file mode 100644index 0000000000..8202e052eb--- /dev/null+++ b/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/components/ConnectServiceDialog/components/DetailView/MCPPresetPanel.tsx@@ -0,0 +1,97 @@+"use client";++import type { CredentialsMetaResponse } from "@/app/api/__generated__/models/credentialsMetaResponse";+import type { ProviderMetadata } from "@/app/api/__generated__/models/providerMetadata";+import { Link } from "@/components/atoms/Link/Link";+import { Text } from "@/components/atoms/Text/Text";+import {+ TabsLine,+ TabsLineList,+ TabsLineTrigger,+ TabsLineContent,+} from "@/components/molecules/TabsLine/TabsLine";+import { McpConnectPanel } from "./McpConnectPanel";+import { PublicMCPPanel } from "./PublicMCPPanel";++type AuthMethod = NonNullable<+ ProviderMetadata["mcp_server"]+>["auth_methods"][number];++const METHOD_LABELS: Record<AuthMethod, string> = {+ none: "No sign-in",+ oauth: "Sign in",+ bearer: "API token",+ basic: "Basic authentication",+};++interface Props {+ server: NonNullable<ProviderMetadata["mcp_server"]>;+ onSuccess: (credential?: CredentialsMetaResponse) => void;+}++export function MCPPresetPanel({ server, onSuccess }: Props) {+ const methods = server.auth_methods;+ return (+ <div className="flex flex-col gap-4">+ <Text variant="body" className="text-zinc-600">+ {server.setup_instructions}+ </Text>+ <Link href={server.documentation_url} isExternal variant="secondary">+ Official documentation+ </Link>+ {methods.length === 1 ? (+ <PresetMethod+ server={server}+ onSuccess={onSuccess}+ method={methods[0]}+ />+ ) : (+ <TabsLine defaultValue={methods[0]}>+ <TabsLineList aria-label="Connection method">+ {methods.map((method) => (+ <TabsLineTrigger key={method} value={method}>+ {METHOD_LABELS[method]}+ </TabsLineTrigger>+ ))}+ </TabsLineList>+ {methods.map((method) => (+ <TabsLineContent key={method} value={method}>+ <PresetMethod+ server={server}+ onSuccess={onSuccess}+ method={method}+ />+ </TabsLineContent>+ ))}+ </TabsLine>+ )}+ </div>+ );+}++function PresetMethod({+ server,+ onSuccess,+ method,+}: Props & { method: AuthMethod }) {+ if (method === "none") {+ return server.server_url ? (+ <PublicMCPPanel serverURL={server.server_url} />+ ) : null;+ }+ return (+ <McpConnectPanel+ onSuccess={onSuccess}+ initialServerURL={+ (method === "oauth" ? server.oauth_server_url : null) ??+ server.server_url ??+ ""+ }+ lockServerURL={server.connection_mode === "hosted"}+ allowedAuthMethods={[method]}+ oauthScopes={server.oauth_scopes}+ oauthWriteScopes={server.oauth_write_scopes}+ serverURLOptions={server.server_url_options}+ />+ );+}diff --git a/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/components/ConnectServiceDialog/components/DetailView/MCPServerURLField.tsx b/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/components/ConnectServiceDialog/components/DetailView/MCPServerURLField.tsxnew file mode 100644index 0000000000..aa8450063e--- /dev/null+++ b/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/components/ConnectServiceDialog/components/DetailView/MCPServerURLField.tsx@@ -0,0 +1,66 @@+import { useState } from "react";+import { Input } from "@/components/atoms/Input/Input";+import { Select } from "@/components/atoms/Select/Select";++interface Props {+ serverURL: string;+ onChange: (url: string) => void;+ readOnly: boolean;+ disabled: boolean;+ options?: { label: string; url: string }[];+}++export function MCPServerURLField({+ serverURL,+ onChange,+ readOnly,+ disabled,+ options = [],+}: Props) {+ const [customSelected, setCustomSelected] = useState(false);+ const matched = options.find((option) => option.url === serverURL);+ const selection = customSelected ? "custom" : (matched?.url ?? "");++ function selectURL(value: string) {+ setCustomSelected(value === "custom");+ onChange(value === "custom" ? "" : value);+ }++ function changeURL(value: string) {+ if (options.length) setCustomSelected(true);+ onChange(value);+ }++ return (+ <>+ {!readOnly && options.length > 0 && (+ <Select+ id="mcp-server-region"+ label="Server region"+ placeholder="Choose your account's region"+ value={selection}+ onValueChange={selectURL}+ disabled={disabled}+ options={[+ ...options.map((option) => ({+ label: option.label,+ value: option.url,+ })),+ { label: "Custom URL", value: "custom" },+ ]}+ />+ )}+ <Input+ id="mcp-server-url"+ label="Server URL"+ type="url"+ placeholder="https://mcp.example.com"+ value={serverURL}+ onChange={(event) => changeURL(event.target.value)}+ disabled={disabled}+ readOnly={readOnly || Boolean(matched && !customSelected)}+ autoFocus={!readOnly && options.length === 0}+ />+ </>+ );+}diff --git a/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/components/ConnectServiceDialog/components/DetailView/McpConnectPanel.tsx b/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/components/ConnectServiceDialog/components/DetailView/McpConnectPanel.tsxindex c7b7df0214..c76af379a2 100644--- a/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/components/ConnectServiceDialog/components/DetailView/McpConnectPanel.tsx+++ b/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/components/ConnectServiceDialog/components/DetailView/McpConnectPanel.tsx@@ -1,17 +1,6 @@"use client";-import { useEffect, useRef, useState } from "react";-import { useQueryClient } from "@tanstack/react-query";--import {- postV2DiscoverAvailableToolsOnAnMcpServer,- postV2ExchangeOauthCodeForMcpTokens,- postV2InitiateOauthLoginForAnMcpServer,- postV2StoreABearerTokenForAnMcpServer,-} from "@/app/api/__generated__/endpoints/mcp/mcp";-import { useGetV1ListCredentials } from "@/app/api/__generated__/endpoints/integrations/integrations";import type { CredentialsMetaResponse } from "@/app/api/__generated__/models/credentialsMetaResponse";-import type { MCPOAuthLoginResponse } from "@/app/api/__generated__/models/mCPOAuthLoginResponse";import { Button } from "@/components/atoms/Button/Button";import { Input } from "@/components/atoms/Input/Input";import { Text } from "@/components/atoms/Text/Text";@@ -21,295 +10,139 @@ import {mcpAuthTokenLabel,mcpAuthTokenPlaceholder,} from "@/components/contextual/MCPAuthSchemeField/helpers";-import { useMCPAuthScheme } from "@/components/contextual/MCPAuthSchemeField/useMCPAuthScheme";-import {- prepareMCPAuthCredential,- validateMCPAuthCredential,- type MCPAuthScheme,-} from "@/lib/mcp-auth";-import {- getAPIResponseError,- getErrorMessage,- getErrorStatus,-} from "@/lib/mcp-errors";-import { mcpServerIdentity, normalizeMcpUrl } from "@/lib/mcp-url";-import { openOAuthPopup } from "@/lib/oauth-popup";-import { invalidateConnectionQueries } from "@/lib/react-query/invalidateConnections";+import { useMCPConnectPanel } from "./useMCPConnectPanel";+import type { MCPAuthScheme } from "@/lib/mcp-auth";+import { MCPServerURLField } from "./MCPServerURLField";+import { MultiToggle } from "@/components/molecules/MultiToggle/MultiToggle";interface Props {onSuccess: (credential?: CredentialsMetaResponse) => void;+ initialServerURL?: string;+ lockServerURL?: boolean;+ allowedAuthMethods?: ("oauth" | MCPAuthScheme)[];+ oauthScopes?: string[] | null;+ oauthWriteScopes?: string[];+ serverURLOptions?: { label: string; url: string }[];}-type Phase = "form" | "manual-token";--export function McpConnectPanel({ onSuccess }: Props) {- const queryClient = useQueryClient();- const { data: savedCredentials } = useGetV1ListCredentials({- query: {- select: (response) => (response.status === 200 ? response.data : []),- },+export function McpConnectPanel({+ onSuccess,+ initialServerURL = "",+ lockServerURL = false,+ allowedAuthMethods,+ oauthScopes,+ oauthWriteScopes = [],+ serverURLOptions,+}: Props) {+ const state = useMCPConnectPanel({+ onSuccess,+ initialServerURL,+ allowedAuthMethods,+ oauthScopes,+ oauthWriteScopes,});- const [serverUrl, setServerUrl] = useState("");- const [token, setToken] = useState("");- const [phase, setPhase] = useState<Phase>("form");- const [isSubmitting, setIsSubmitting] = useState(false);- const [error, setError] = useState<string | null>(null);- const oauthAbortRef = useRef<((reason?: string) => void) | null>(null);-- useEffect(() => () => oauthAbortRef.current?.(), []);-- const trimmedUrl = serverUrl.trim();- const trimmedToken = token.trim();- const isUrlValid = isValidHttpUrl(trimmedUrl);- const canConnect = isUrlValid && !isSubmitting;- const canSubmitToken = isUrlValid && trimmedToken.length > 0 && !isSubmitting;- const savedCredential = Array.isArray(savedCredentials)- ? savedCredentials.find(- (credential) =>- credential.provider === "mcp" &&- typeof credential.host === "string" &&- normalizeMcpUrl(credential.host) === normalizeMcpUrl(trimmedUrl),- )- : null;- const savedAuthScheme: MCPAuthScheme =- savedCredential?.mcp_auth_scheme === "basic" ? "basic" : "bearer";- const {- scheme: authScheme,- selectScheme,- detectSchemeFrom,- resetScheme,- } = useMCPAuthScheme(savedAuthScheme, token);-- async function invalidateCredentials() {- await invalidateConnectionQueries(queryClient);- }-- async function handleConnect() {- if (!canConnect) return;- setError(null);- setIsSubmitting(true);- oauthAbortRef.current?.();-- try {- // Only a 400 from the *initiate* call means "server doesn't support- // OAuth" — fall back to manual-token for that. A 400 from anywhere else- // (popup callback, token exchange) is a real error and should surface- // as such instead of forcing the manual-token UI.- let loginRes: Awaited<- ReturnType<typeof postV2InitiateOauthLoginForAnMcpServer>- >;- try {- loginRes = await postV2InitiateOauthLoginForAnMcpServer({- server_url: trimmedUrl,- });- if (loginRes.status !== 200) {- throw getAPIResponseError(loginRes.status, loginRes.data);- }- } catch (e: unknown) {- if (getErrorStatus(e) === 400) {- setPhase("manual-token");- setError(- "This server doesn't support OAuth sign-in. Choose how its API credential should be sent.",- );- return;- }- throw e;- }-- const { login_url, state_token } = loginRes.data as MCPOAuthLoginResponse;-- const { promise, cleanup } = openOAuthPopup(login_url, {- stateToken: state_token,- useCrossOriginListeners: true,- });- oauthAbortRef.current = cleanup.abort;-- const result = await promise;-- const exchanged = await postV2ExchangeOauthCodeForMcpTokens({- code: result.code,- state_token,- iss: result.iss,- });- if (exchanged.status !== 200) {- throw getAPIResponseError(exchanged.status, exchanged.data);- }-- await invalidateCredentials();- onSuccess(exchanged.data);- } catch (e: unknown) {- const message = getErrorMessage(e);- if (message === "OAuth flow timed out") {- setError("OAuth sign-in timed out. Please try again.");- } else {- setError(message);- }- } finally {- setIsSubmitting(false);- oauthAbortRef.current = null;- }- }-- async function handleSubmitToken() {- if (!canSubmitToken) return;-- const invalid = validateMCPAuthCredential(trimmedToken, authScheme);- if (invalid) {- setError(invalid);- return;- }-- setError(null);- setIsSubmitting(true);-- try {- const authValue = prepareMCPAuthCredential(trimmedToken, authScheme);-- // Probe before storing so a rejected credential never replaces a working one.- const probe = await postV2DiscoverAvailableToolsOnAnMcpServer({- server_url: trimmedUrl,- auth_token: authValue,- });- if (probe.status !== 200) {- throw getAPIResponseError(probe.status, probe.data);- }-- const stored = await postV2StoreABearerTokenForAnMcpServer({- server_url: trimmedUrl,- token: authValue,- });- if (stored.status !== 200) {- throw getAPIResponseError(stored.status, stored.data);- }-- await invalidateCredentials();- onSuccess(stored.data);- } catch (e: unknown) {- setError(getErrorMessage(e));- } finally {- setIsSubmitting(false);- }- }-- function handleSwitchToOAuth() {- setPhase("form");- setToken("");- resetScheme();- setError(null);- }-- function handleServerUrlChange(nextUrl: string) {- const serverIdentityChanged =- mcpServerIdentity(serverUrl) !== mcpServerIdentity(nextUrl);-- setServerUrl(nextUrl);- if (!serverIdentityChanged) return;-- setToken("");- resetScheme();- setPhase("form");- setError(null);- }return (<div className="flex flex-col gap-4">- <Text variant="body" className="text-zinc-600">- Enter the URL of your MCP server. We'll try OAuth first and fall- back to a manual API credential if the server doesn't support- OAuth.- </Text>-- <Input- id="mcp-server-url"- label="Server URL"- type="url"- placeholder="https://mcp.example.com"- value={serverUrl}- onChange={(e) => handleServerUrlChange(e.target.value)}- disabled={isSubmitting}- autoFocus+ {!lockServerURL && (+ <Text variant="body" className="text-zinc-600">+ Enter the server URL from the service's setup instructions.+ </Text>+ )}+ <MCPServerURLField+ serverURL={state.serverURL}+ onChange={state.handleServerURLChange}+ disabled={state.isSubmitting}+ readOnly={lockServerURL}+ options={serverURLOptions}/>-- {phase === "manual-token" ? (+ {state.phase === "form" && oauthWriteScopes.length > 0 && (+ <MultiToggle+ items={[+ {+ value: "write",+ label: "Allow changes",+ disabled: state.isSubmitting,+ },+ ]}+ selectedValues={state.allowChanges ? ["write"] : []}+ onChange={(values) => state.setAllowChanges(values.includes("write"))}+ />+ )}+ {state.phase === "manual-token" && (<>- <MCPAuthSchemeField- value={authScheme}- onChange={selectScheme}- disabled={isSubmitting}- className="flex flex-col gap-1"- labelClassName="text-sm font-medium text-zinc-700"- selectClassName="rounded-lg border border-zinc-300 bg-white px-3 py-2 text-zinc-900"- />+ <Text variant="small" className="text-zinc-600">+ {allowedAuthMethods+ ? "Use the credential described in the setup instructions above."+ : "Use an API credential only if this server supports it. Follow the server's documentation for the correct authentication type."}+ </Text>+ {state.manualSchemes.length > 1 && (+ <MCPAuthSchemeField+ value={state.authScheme}+ onChange={state.selectScheme}+ disabled={state.isSubmitting}+ className="flex flex-col gap-1"+ labelClassName="text-sm font-medium text-zinc-700"+ selectClassName="rounded-lg border border-zinc-300 bg-white px-3 py-2 text-zinc-900"+ />+ )}<Inputid="mcp-auth-token"- label={mcpAuthTokenLabel(authScheme)}+ label={mcpAuthTokenLabel(state.authScheme)}type="password"- placeholder={mcpAuthTokenPlaceholder(authScheme)}- value={token}- onChange={(e) => {- const nextToken = e.target.value;- setToken(nextToken);- detectSchemeFrom(nextToken);- }}- disabled={isSubmitting}- hint={mcpAuthTokenHint(authScheme)}+ placeholder={mcpAuthTokenPlaceholder(state.authScheme)}+ value={state.token}+ onChange={(e) => state.handleTokenChange(e.target.value)}+ disabled={state.isSubmitting}+ hint={mcpAuthTokenHint(state.authScheme)}/></>- ) : null}-- {error ? (+ )}+ {state.error && (<divrole="alert"aria-live="polite"className="rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-700">- {error}+ {state.error}</div>- ) : null}-+ )}<div className="flex items-center justify-end gap-2">- {phase === "manual-token" ? (+ {state.phase === "form" && state.manualSchemes.length > 0 && (<Buttonvariant="secondary"size="small"- onClick={handleSwitchToOAuth}- disabled={isSubmitting}+ onClick={state.handleSwitchToToken}>- Try OAuth+ Use an API token instead</Button>- ) : null}- {phase === "form" ? (- <Button- variant="primary"- size="small"- onClick={handleConnect}- disabled={!canConnect}- loading={isSubmitting}- >- Connect- </Button>- ) : (+ )}+ {state.phase === "manual-token" && state.canUseOAuth && (<Button- variant="primary"+ variant="secondary"size="small"- onClick={handleSubmitToken}- disabled={!canSubmitToken}- loading={isSubmitting}+ onClick={state.handleSwitchToOAuth}+ disabled={state.isSubmitting}>- Save token+ Try OAuth</Button>)}+ <Button+ variant="primary"+ size="small"+ onClick={+ state.phase === "form"+ ? state.handleConnect+ : state.handleSubmitToken+ }+ disabled={+ state.phase === "form" ? !state.canConnect : !state.canSubmitToken+ }+ loading={state.isSubmitting}+ >+ {state.phase === "form" ? "Connect" : "Save token"}+ </Button></div></div>);}--function isValidHttpUrl(value: string): boolean {- if (!value) return false;- try {- const u = new URL(value);- return u.protocol === "http:" || u.protocol === "https:";- } catch {- return false;- }-}diff --git a/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/components/ConnectServiceDialog/components/DetailView/ProviderAvatar.tsx b/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/components/ConnectServiceDialog/components/DetailView/ProviderAvatar.tsxindex b5ee772a2e..97d3a1fa63 100644--- a/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/components/ConnectServiceDialog/components/DetailView/ProviderAvatar.tsx+++ b/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/components/ConnectServiceDialog/components/DetailView/ProviderAvatar.tsx@@ -2,6 +2,7 @@import Image from "next/image";import { useState } from "react";+import { integrationIconSrc } from "@/components/molecules/IntegrationLogo/helpers";interface Props {id: string;@@ -9,9 +10,9 @@ interface Props {}export function ProviderAvatar({ id, name }: Props) {- const src = `/integrations/${id}.png`;+ const src = integrationIconSrc(id);const [brokenSrc, setBrokenSrc] = useState<string | null>(null);- if (brokenSrc === src) {+ if (!src || brokenSrc === src) {return (<divaria-hiddendiff --git a/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/components/ConnectServiceDialog/components/DetailView/PublicMCPPanel.tsx b/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/components/ConnectServiceDialog/components/DetailView/PublicMCPPanel.tsxnew file mode 100644index 0000000000..a7ca788b00--- /dev/null+++ b/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/components/ConnectServiceDialog/components/DetailView/PublicMCPPanel.tsx@@ -0,0 +1,55 @@+"use client";++import { Button } from "@/components/atoms/Button/Button";+import { Input } from "@/components/atoms/Input/Input";+import { Text } from "@/components/atoms/Text/Text";+import { useCheckMCPConnection } from "./useCheckMCPConnection";++interface Props {+ serverURL: string;+}++export function PublicMCPPanel({ serverURL }: Props) {+ const { check, isPending, toolCount, error } =+ useCheckMCPConnection(serverURL);+ return (+ <div className="flex flex-col gap-4">+ <Input+ id="public-mcp-server-url"+ label="Server URL"+ type="url"+ value={serverURL}+ readOnly+ />+ <Text variant="small" className="text-zinc-600">+ This server can be used without connecting an account.+ </Text>+ {toolCount !== null && (+ <Text variant="body" role="status">+ {toolCount === 0+ ? "Connected, but this server returned no tools."+ : `${toolCount} ${toolCount === 1 ? "tool" : "tools"} available.`}+ </Text>+ )}+ {toolCount !== null && (+ <Text variant="small" className="text-zinc-600">+ No connection was saved. Use this server URL when adding MCP tools to+ an agent.+ </Text>+ )}+ {error && (+ <Text variant="small" role="alert" className="text-red-700">+ {error}+ </Text>+ )}+ <Button+ variant="primary"+ size="small"+ onClick={check}+ loading={isPending}+ >+ Check connection+ </Button>+ </div>+ );+}diff --git a/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/components/ConnectServiceDialog/components/DetailView/__tests__/McpConnectPanel.test.tsx b/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/components/ConnectServiceDialog/components/DetailView/__tests__/McpConnectPanel.test.tsxindex 4378b0d21e..9d195418f3 100644--- a/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/components/ConnectServiceDialog/components/DetailView/__tests__/McpConnectPanel.test.tsx+++ b/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/components/ConnectServiceDialog/components/DetailView/__tests__/McpConnectPanel.test.tsx@@ -9,7 +9,8 @@ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";import { McpConnectPanel } from "../McpConnectPanel";-vi.mock("@/lib/oauth-popup", () => ({+vi.mock("@/lib/oauth-popup", async (importOriginal) => ({+ ...(await importOriginal<typeof import("@/lib/oauth-popup")>()),openOAuthPopup: vi.fn(),}));@@ -30,8 +31,24 @@ vi.mock("@/app/api/__generated__/endpoints/integrations/integrations", () => ({useGetV1ListCredentials: () => ({ data: mockSavedCredentials }),}));-function makeApiError(status: number, detail = "boom"): Error {- const err = new Error(detail) as Error & {+// What the login route actually answers when a server has no OAuth at all:+// prose for the user, plus the code the panel branches on. Every other 400 it+// writes is a different failure and must not offer the manual-token form.+const noOAuthDetail = {+ detail: {+ code: "no_oauth",+ message: "This MCP server does not advertise OAuth support.",+ },+};++function makeApiError(status: number, detail: unknown = "boom"): Error {+ // `parseApiError` already unwraps a structured detail into the message, so+ // mirror that here: the prose on `message`, the whole body on `response`.+ const message =+ typeof detail === "string"+ ? detail+ : ((detail as { message?: string })?.message ?? "boom");+ const err = new Error(message) as Error & {status: number;response: unknown;};@@ -88,6 +105,70 @@ describe("McpConnectPanel", () => {expect((connectButton as HTMLButtonElement).disabled).toBe(false);});+ it("allows manual authentication without first attempting OAuth", async () => {+ const { postV2InitiateOauthLoginForAnMcpServer } = await import(+ "@/app/api/__generated__/endpoints/mcp/mcp"+ );+ render(+ <McpConnectPanel+ onSuccess={() => {}}+ initialServerURL="https://mcp.example.com"+ />,+ );+ fireEvent.click(+ screen.getByRole("button", { name: /use an api token instead/i }),+ );+ expect(screen.getByPlaceholderText(manualTokenPlaceholder)).toBeDefined();+ expect(postV2InitiateOauthLoginForAnMcpServer).not.toHaveBeenCalled();+ });++ it("can cancel a pending OAuth popup and use a manual token", async () => {+ const {+ postV2InitiateOauthLoginForAnMcpServer,+ postV2ExchangeOauthCodeForMcpTokens,+ } = await import("@/app/api/__generated__/endpoints/mcp/mcp");+ const { openOAuthPopup } = await import("@/lib/oauth-popup");+ vi.mocked(postV2InitiateOauthLoginForAnMcpServer).mockResolvedValueOnce({+ status: 200,+ data: { login_url: "https://login.example.com", state_token: "tok" },+ headers: new Headers(),+ } as never);+ const controller = new AbortController();+ const abort = vi.fn(() => controller.abort());+ vi.mocked(openOAuthPopup).mockImplementation(() => ({+ promise: new Promise((_resolve, reject) =>+ controller.signal.addEventListener("abort", () =>+ reject(new Error("OAuth flow was canceled")),+ ),+ ),+ cleanup: { abort, signal: controller.signal },+ popupBlocked: false,+ fallbackBlocked: false,+ }));+ render(+ <McpConnectPanel+ onSuccess={() => {}}+ initialServerURL="https://mcp.example.com"+ />,+ );+ fireEvent.click(screen.getByRole("button", { name: /^connect$/i }));+ await waitFor(() => expect(openOAuthPopup).toHaveBeenCalled());+ const manual = screen.getByRole<HTMLButtonElement>("button", {+ name: /use an api token instead/i,+ });+ expect(manual.disabled).toBe(false);+ fireEvent.click(manual);+ await waitFor(() =>+ expect(+ screen.getByPlaceholderText<HTMLInputElement>(manualTokenPlaceholder)+ .disabled,+ ).toBe(false),+ );+ expect(abort).toHaveBeenCalledTimes(1);+ expect(screen.queryByRole("alert")).toBeNull();+ expect(postV2ExchangeOauthCodeForMcpTokens).not.toHaveBeenCalled();+ });+it("falls back to manual-token form when initiate returns 400", async () => {const { postV2InitiateOauthLoginForAnMcpServer } = await import("@/app/api/__generated__/endpoints/mcp/mcp"@@ -95,7 +176,7 @@ describe("McpConnectPanel", () => {vi.mocked(postV2InitiateOauthLoginForAnMcpServer).mockResolvedValueOnce({status: 400,- data: { detail: "OAuth not supported" },+ data: noOAuthDetail,headers: new Headers(),} as never);@@ -109,9 +190,74 @@ describe("McpConnectPanel", () => {await waitFor(() => {expect(screen.getByPlaceholderText(manualTokenPlaceholder)).toBeDefined();});- expect(- screen.getByText(/server doesn't support oauth sign-in/i),- ).toBeDefined();+ // The route's own wording, not a generic stand-in: it names the reason+ // this particular server cannot be signed into.+ expect(screen.getByText(/does not advertise oauth support/i)).toBeDefined();+ });++ it("offers the manual form for a catalog service that has no OAuth", async () => {+ const { postV2InitiateOauthLoginForAnMcpServer } = await import(+ "@/app/api/__generated__/endpoints/mcp/mcp"+ );++ // A catalog entry without OAuth is rejected in quite different words from+ // the "does not advertise OAuth" case above. Both mean the same thing to+ // this panel, and only the code says so.+ vi.mocked(postV2InitiateOauthLoginForAnMcpServer).mockResolvedValueOnce({+ status: 400,+ data: {+ detail: {+ code: "no_oauth",+ message:+ "Brevo uses bearer / basic authentication. Create an API key in " ++ "your Brevo dashboard.",+ },+ },+ headers: new Headers(),+ } as never);++ render(<McpConnectPanel onSuccess={() => {}} />);++ fireEvent.change(screen.getByLabelText(/server url/i), {+ target: { value: "https://mcp.example.com" },+ });+ fireEvent.click(screen.getByRole("button", { name: /connect/i }));++ await waitFor(() => {+ expect(screen.getByPlaceholderText(manualTokenPlaceholder)).toBeDefined();+ });+ expect(screen.getByText(/create an api key/i)).toBeDefined();+ });++ it("keeps the OAuth form for a 400 that is not about missing OAuth", async () => {+ const { postV2InitiateOauthLoginForAnMcpServer } = await import(+ "@/app/api/__generated__/endpoints/mcp/mcp"+ );++ // A failed client registration is a problem with this attempt, on a server+ // that does support OAuth. Sending the user off to find an API token would+ // be the wrong advice.+ vi.mocked(postV2InitiateOauthLoginForAnMcpServer).mockResolvedValueOnce({+ status: 400,+ data: {+ detail: "Could not register an OAuth client with this MCP server.",+ },+ headers: new Headers(),+ } as never);++ render(<McpConnectPanel onSuccess={() => {}} />);++ fireEvent.change(screen.getByLabelText(/server url/i), {+ target: { value: "https://mcp.example.com" },+ });+ fireEvent.click(screen.getByRole("button", { name: /connect/i }));++ await waitFor(() => {+ expect(+ screen.getByText(/could not register an oauth client/i),+ ).toBeDefined();+ });+ expect(screen.queryByPlaceholderText(manualTokenPlaceholder)).toBeNull();});it("does NOT switch to manual-token on a 400 from token exchange", async () => {@@ -159,7 +305,7 @@ describe("McpConnectPanel", () => {} = await import("@/app/api/__generated__/endpoints/mcp/mcp");vi.mocked(postV2InitiateOauthLoginForAnMcpServer).mockRejectedValueOnce(- makeApiError(400, "OAuth not supported"),+ makeApiError(400, noOAuthDetail.detail),);const onSuccess = vi.fn();@@ -188,10 +334,13 @@ describe("McpConnectPanel", () => {await waitFor(() => {expect(onSuccess).toHaveBeenCalledTimes(1);});- expect(postV2StoreABearerTokenForAnMcpServer).toHaveBeenCalledWith({- server_url: "https://mcp.example.com",- token: "Bearer secret-bearer-token",- });+ expect(postV2StoreABearerTokenForAnMcpServer).toHaveBeenCalledWith(+ {+ server_url: "https://mcp.example.com",+ token: "Bearer secret-bearer-token",+ },+ expect.objectContaining({ signal: expect.any(AbortSignal) }),+ );});it("submits a selected Basic credential with an explicit prefix", async () => {@@ -202,7 +351,7 @@ describe("McpConnectPanel", () => {vi.mocked(postV2InitiateOauthLoginForAnMcpServer).mockResolvedValueOnce({status: 400,- data: { detail: "OAuth not supported" },+ data: noOAuthDetail,headers: new Headers(),} as never);vi.mocked(postV2StoreABearerTokenForAnMcpServer).mockResolvedValueOnce({@@ -230,10 +379,13 @@ describe("McpConnectPanel", () => {fireEvent.click(screen.getByRole("button", { name: /save token/i }));await waitFor(() => {- expect(postV2StoreABearerTokenForAnMcpServer).toHaveBeenCalledWith({- server_url: "https://mcp.example.com",- token: "Basic cGstbGYtYWJjZA==",- });+ expect(postV2StoreABearerTokenForAnMcpServer).toHaveBeenCalledWith(+ {+ server_url: "https://mcp.example.com",+ token: "Basic cGstbGYtYWJjZA==",+ },+ expect.objectContaining({ signal: expect.any(AbortSignal) }),+ );});});@@ -251,7 +403,7 @@ describe("McpConnectPanel", () => {} = await import("@/app/api/__generated__/endpoints/mcp/mcp");vi.mocked(postV2InitiateOauthLoginForAnMcpServer).mockResolvedValueOnce({status: 400,- data: { detail: "OAuth not supported" },+ data: noOAuthDetail,headers: new Headers(),} as never);vi.mocked(postV2StoreABearerTokenForAnMcpServer).mockResolvedValueOnce({@@ -278,10 +430,13 @@ describe("McpConnectPanel", () => {fireEvent.click(screen.getByRole("button", { name: /save token/i }));await waitFor(() => {- expect(postV2StoreABearerTokenForAnMcpServer).toHaveBeenCalledWith({- server_url: "https://mcp.example.com/",- token: "Basic new-encoded-value",- });+ expect(postV2StoreABearerTokenForAnMcpServer).toHaveBeenCalledWith(+ {+ server_url: "https://mcp.example.com/",+ token: "Basic new-encoded-value",+ },+ expect.objectContaining({ signal: expect.any(AbortSignal) }),+ );});});@@ -302,7 +457,7 @@ describe("McpConnectPanel", () => {};vi.mocked(postV2InitiateOauthLoginForAnMcpServer).mockResolvedValueOnce({status: 400,- data: { detail: "OAuth not supported" },+ data: noOAuthDetail,headers: new Headers(),} as never);vi.mocked(postV2StoreABearerTokenForAnMcpServer).mockResolvedValueOnce({@@ -339,7 +494,7 @@ describe("McpConnectPanel", () => {} = await import("@/app/api/__generated__/endpoints/mcp/mcp");vi.mocked(postV2InitiateOauthLoginForAnMcpServer).mockResolvedValueOnce({status: 400,- data: { detail: "OAuth not supported" },+ data: noOAuthDetail,headers: new Headers(),} as never);@@ -375,7 +530,7 @@ describe("McpConnectPanel", () => {vi.mocked(postV2InitiateOauthLoginForAnMcpServer).mockResolvedValueOnce({status: 400,- data: { detail: "OAuth not supported" },+ data: noOAuthDetail,headers: new Headers(),} as never);vi.mocked(postV2DiscoverAvailableToolsOnAnMcpServer).mockResolvedValue({@@ -414,7 +569,7 @@ describe("McpConnectPanel", () => {vi.mocked(postV2InitiateOauthLoginForAnMcpServer).mockResolvedValueOnce({status: 400,- data: { detail: "OAuth not supported" },+ data: noOAuthDetail,headers: new Headers(),} as never);@@ -447,7 +602,7 @@ describe("McpConnectPanel", () => {);vi.mocked(postV2InitiateOauthLoginForAnMcpServer).mockRejectedValueOnce(- makeApiError(400, "OAuth not supported"),+ makeApiError(400, noOAuthDetail.detail),);render(<McpConnectPanel onSuccess={() => {}} />);@@ -480,12 +635,12 @@ describe("McpConnectPanel", () => {vi.mocked(postV2InitiateOauthLoginForAnMcpServer).mockResolvedValueOnce({status: 400,- data: { detail: "OAuth not supported" },+ data: noOAuthDetail,headers: new Headers(),} as never).mockResolvedValueOnce({status: 400,- data: { detail: "OAuth not supported" },+ data: noOAuthDetail,headers: new Headers(),} as never);@@ -543,7 +698,7 @@ describe("McpConnectPanel", () => {} = await import("@/app/api/__generated__/endpoints/mcp/mcp");vi.mocked(postV2InitiateOauthLoginForAnMcpServer).mockRejectedValueOnce(- makeApiError(400, "OAuth not supported"),+ makeApiError(400, noOAuthDetail.detail),);const onSuccess = vi.fn();diff --git a/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/components/ConnectServiceDialog/components/DetailView/mcpOAuth.ts b/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/components/ConnectServiceDialog/components/DetailView/mcpOAuth.tsnew file mode 100644index 0000000000..aeacf7d3ac--- /dev/null+++ b/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/components/ConnectServiceDialog/components/DetailView/mcpOAuth.ts@@ -0,0 +1,82 @@+import {+ postV2ExchangeOauthCodeForMcpTokens,+ postV2InitiateOauthLoginForAnMcpServer,+} from "@/app/api/__generated__/endpoints/mcp/mcp";+import {+ getAPIResponseError,+ getErrorCode,+ getErrorMessage,+ getErrorStatus,+} from "@/lib/mcp-errors";+import { openOAuthPopup } from "@/lib/oauth-popup";++interface Args {+ serverURL: string;+ scopes?: string[];+ signal: AbortSignal;+}++/** Mirrors `NO_OAUTH_CODE` in `backend/api/features/mcp/routes.py`. */+export const NO_OAUTH_CODE = "no_oauth";++export async function connectMCPOAuth({ serverURL, scopes, signal }: Args) {+ signal.throwIfAborted();+ let login;+ try {+ login = await postV2InitiateOauthLoginForAnMcpServer(+ {+ server_url: serverURL,+ ...(scopes === undefined ? {} : { scopes }),+ },+ { signal },+ );+ signal.throwIfAborted();+ if (login.status !== 200)+ throw getAPIResponseError(login.status, login.data);+ } catch (error) {+ signal.throwIfAborted();+ // The login route writes eight different 400s, each explaining a+ // different failure. Returning a bare null threw all of them away and+ // told the user to find an API token, even when the real cause was a+ // failed client registration on a server that does support OAuth. Hand+ // the reason back, with the route's own verdict on whether this server+ // has any OAuth to offer, so the caller can show one and branch on the+ // other instead of reading the prose.+ if (getErrorStatus(error) === 400)+ return {+ reason: getErrorMessage(error),+ noOAuth: getErrorCode(error) === NO_OAUTH_CODE,+ } as const;+ throw error;+ }+ signal.throwIfAborted();+ const { login_url, state_token } = login.data;+ const { promise, cleanup } = openOAuthPopup(login_url, {+ stateToken: state_token,+ useCrossOriginListeners: true,+ });+ function abortPopup() {+ cleanup.abort();+ }+ signal.addEventListener("abort", abortPopup, { once: true });+ try {+ if (signal.aborted) abortPopup();+ signal.throwIfAborted();+ const result = await promise;+ signal.throwIfAborted();+ const exchanged = await postV2ExchangeOauthCodeForMcpTokens(+ {+ code: result.code,+ state_token,+ iss: result.iss,+ },+ { signal },+ );+ signal.throwIfAborted();+ if (exchanged.status !== 200)+ throw getAPIResponseError(exchanged.status, exchanged.data);+ return exchanged.data;+ } finally {+ signal.removeEventListener("abort", abortPopup);+ }+}diff --git a/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/components/ConnectServiceDialog/components/DetailView/storeMCPToken.ts b/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/components/ConnectServiceDialog/components/DetailView/storeMCPToken.tsnew file mode 100644index 0000000000..259f427923--- /dev/null+++ b/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/components/ConnectServiceDialog/components/DetailView/storeMCPToken.ts@@ -0,0 +1,36 @@+import {+ postV2DiscoverAvailableToolsOnAnMcpServer,+ postV2StoreABearerTokenForAnMcpServer,+} from "@/app/api/__generated__/endpoints/mcp/mcp";+import { prepareMCPAuthCredential, type MCPAuthScheme } from "@/lib/mcp-auth";+import { getAPIResponseError } from "@/lib/mcp-errors";++export async function storeMCPToken(+ serverURL: string,+ token: string,+ scheme: MCPAuthScheme,+ signal: AbortSignal,+) {+ signal.throwIfAborted();+ const authValue = prepareMCPAuthCredential(token, scheme);+ const probe = await postV2DiscoverAvailableToolsOnAnMcpServer(+ {+ server_url: serverURL,+ auth_token: authValue,+ },+ { signal },+ );+ signal.throwIfAborted();+ if (probe.status !== 200) throw getAPIResponseError(probe.status, probe.data);+ const stored = await postV2StoreABearerTokenForAnMcpServer(+ {+ server_url: serverURL,+ token: authValue,+ },+ { signal },+ );+ signal.throwIfAborted();+ if (stored.status !== 200)+ throw getAPIResponseError(stored.status, stored.data);+ return stored.data;+}diff --git a/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/components/ConnectServiceDialog/components/DetailView/useCheckMCPConnection.ts b/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/components/ConnectServiceDialog/components/DetailView/useCheckMCPConnection.tsnew file mode 100644index 0000000000..21bcba3fcb--- /dev/null+++ b/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/components/ConnectServiceDialog/components/DetailView/useCheckMCPConnection.ts@@ -0,0 +1,32 @@+"use client";++import { useState } from "react";+import { postV2DiscoverAvailableToolsOnAnMcpServer } from "@/app/api/__generated__/endpoints/mcp/mcp";+import { getAPIResponseError, getErrorMessage } from "@/lib/mcp-errors";++export function useCheckMCPConnection(serverURL: string) {+ const [isPending, setIsPending] = useState(false);+ const [toolCount, setToolCount] = useState<number | null>(null);+ const [error, setError] = useState<string | null>(null);++ async function check() {+ setIsPending(true);+ setError(null);+ setToolCount(null);+ try {+ const response = await postV2DiscoverAvailableToolsOnAnMcpServer({+ server_url: serverURL,+ use_saved_credentials: false,+ });+ if (response.status !== 200)+ throw getAPIResponseError(response.status, response.data);+ setToolCount(response.data.tools.length);+ } catch (error) {+ setError(getErrorMessage(error));+ } finally {+ setIsPending(false);+ }+ }++ return { check, isPending, toolCount, error };+}diff --git a/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/components/ConnectServiceDialog/components/DetailView/useMCPConnectPanel.ts b/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/components/ConnectServiceDialog/components/DetailView/useMCPConnectPanel.tsnew file mode 100644index 0000000000..4fa48c8dff--- /dev/null+++ b/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/components/ConnectServiceDialog/components/DetailView/useMCPConnectPanel.ts@@ -0,0 +1,208 @@+"use client";++import { useEffect, useRef, useState } from "react";+import { useQueryClient } from "@tanstack/react-query";+import type { CredentialsMetaResponse } from "@/app/api/__generated__/models/credentialsMetaResponse";+import type { MCPAuthScheme } from "@/lib/mcp-auth";+import { getErrorMessage } from "@/lib/mcp-errors";+import { normalizeMcpUrl } from "@/lib/mcp-url";+import { OAUTH_ERROR_FLOW_CANCELED } from "@/lib/oauth-popup";+import { invalidateConnectionQueries } from "@/lib/react-query/invalidateConnections";+import { connectMCPOAuth } from "./mcpOAuth";+import { storeMCPToken } from "./storeMCPToken";+import { useMCPManualAuth } from "./useMCPManualAuth";++interface Args {+ onSuccess: (credential?: CredentialsMetaResponse) => void;+ initialServerURL: string;+ allowedAuthMethods?: ("oauth" | MCPAuthScheme)[];+ oauthScopes?: string[] | null;+ oauthWriteScopes?: string[];+}++export function useMCPConnectPanel({+ onSuccess,+ initialServerURL,+ allowedAuthMethods = ["oauth", "bearer", "basic"],+ oauthScopes,+ oauthWriteScopes = [],+}: Args) {+ const queryClient = useQueryClient();+ const [serverURL, setServerURL] = useState(initialServerURL);+ const initialPhase =+ allowedAuthMethods[0] === "oauth" ? "form" : "manual-token";+ const [phase, setPhase] = useState(initialPhase);+ const [isSubmitting, setIsSubmitting] = useState(false);+ const [allowChanges, setAllowChanges] = useState(false);+ const [error, setError] = useState<string | null>(null);+ const activeRequest = useRef<AbortController | null>(null);+ useEffect(() => () => activeRequest.current?.abort(), []);++ const manualSchemes = allowedAuthMethods.filter(+ (method): method is MCPAuthScheme => method !== "oauth",+ );+ const canUseOAuth = allowedAuthMethods.includes("oauth");+ const manual = useMCPManualAuth(serverURL, manualSchemes);+ const trimmedURL = serverURL.trim();+ const validURL = isValidHttpURL(trimmedURL);+ const canConnect = validURL && !isSubmitting && canUseOAuth;+ const canSubmitToken =+ validURL &&+ !isSubmitting &&+ manualSchemes.length > 0 &&+ manual.token.trim().length > 0;++ async function handleConnect() {+ if (!canConnect) return;+ setError(null);+ setIsSubmitting(true);+ const signal = startRequest();+ try {+ const credential = await connectMCPOAuth({+ serverURL: trimmedURL,+ scopes:+ oauthScopes == null+ ? undefined+ : [+ ...new Set([+ ...oauthScopes,+ ...(allowChanges ? oauthWriteScopes : []),+ ]),+ ],+ signal,+ });+ signal.throwIfAborted();+ if (!credential || "reason" in credential) {+ const reason =+ credential && "reason" in credential ? credential.reason : undefined;+ // Only "this server has no OAuth" should push the user at the manual+ // token tab; every other 400 is its own problem and says so. The route+ // makes that call and sends `no_oauth`, because the same verdict comes+ // back under two quite different messages.+ const noOAuth =+ !credential || ("noOAuth" in credential && credential.noOAuth);+ if (noOAuth && manualSchemes.length) setPhase("manual-token");+ setError(+ reason ??+ (manualSchemes.length+ ? "This server doesn't support OAuth sign-in. Choose how its API credential should be sent."+ : "Sign-in is unavailable for this connection. Check its setup instructions and try again."),+ );+ return;+ }+ await invalidateConnectionQueries(queryClient);+ signal.throwIfAborted();+ onSuccess(credential);+ } catch (error) {+ if (signal.aborted) return;+ const message = getErrorMessage(error);+ if (message === OAUTH_ERROR_FLOW_CANCELED) return;+ setError(+ message === "OAuth flow timed out"+ ? "OAuth sign-in timed out. Please try again."+ : message,+ );+ } finally {+ if (!signal.aborted) setIsSubmitting(false);+ }+ }++ async function handleSubmitToken() {+ if (!canSubmitToken) return;+ const invalid = manual.validateToken();+ if (invalid) {+ setError(invalid);+ return;+ }+ setError(null);+ setIsSubmitting(true);+ const signal = startRequest();+ try {+ const credential = await storeMCPToken(+ trimmedURL,+ manual.token.trim(),+ manual.scheme,+ signal,+ );+ signal.throwIfAborted();+ await invalidateConnectionQueries(queryClient);+ signal.throwIfAborted();+ onSuccess(credential);+ } catch (error) {+ if (signal.aborted) return;+ setError(getErrorMessage(error));+ } finally {+ if (!signal.aborted) setIsSubmitting(false);+ }+ }++ function handleSwitchToOAuth() {+ if (!canUseOAuth) return;+ activeRequest.current?.abort();+ setIsSubmitting(false);+ setPhase("form");+ manual.reset();+ setError(null);+ }++ function handleSwitchToToken() {+ if (!manualSchemes.length) return;+ activeRequest.current?.abort();+ setIsSubmitting(false);+ setPhase("manual-token");+ setError(null);+ }++ function handleServerURLChange(nextURL: string) {+ // Compare the whole URL, not just the origin: two tenants on one host+ // differ only by path, and keeping the typed token across that change+ // would submit one tenant's secret to another.+ const changed = normalizeMcpUrl(serverURL) !== normalizeMcpUrl(nextURL);+ setServerURL(nextURL);+ if (!changed) return;+ activeRequest.current?.abort();+ setIsSubmitting(false);+ manual.reset();+ setAllowChanges(false);+ setPhase(initialPhase);+ setError(null);+ }++ function startRequest() {+ activeRequest.current?.abort();+ const controller = new AbortController();+ activeRequest.current = controller;+ return controller.signal;+ }++ return {+ serverURL,+ token: manual.token,+ phase,+ isSubmitting,+ error,+ allowChanges,+ setAllowChanges,+ authScheme: manual.scheme,+ selectScheme: manual.selectScheme,+ manualSchemes,+ canUseOAuth,+ canConnect,+ canSubmitToken,+ handleConnect,+ handleSubmitToken,+ handleSwitchToOAuth,+ handleSwitchToToken,+ handleServerURLChange,+ handleTokenChange: manual.handleTokenChange,+ };+}++function isValidHttpURL(value: string) {+ try {+ const url = new URL(value);+ return url.protocol === "https:" || url.protocol === "http:";+ } catch {+ return false;+ }+}diff --git a/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/components/ConnectServiceDialog/components/DetailView/useMCPManualAuth.ts b/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/components/ConnectServiceDialog/components/DetailView/useMCPManualAuth.tsnew file mode 100644index 0000000000..d5787f5d63--- /dev/null+++ b/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/components/ConnectServiceDialog/components/DetailView/useMCPManualAuth.ts@@ -0,0 +1,72 @@+import { useState } from "react";+import { useGetV1ListCredentials } from "@/app/api/__generated__/endpoints/integrations/integrations";+import { useMCPAuthScheme } from "@/components/contextual/MCPAuthSchemeField/useMCPAuthScheme";+import {+ detectMCPAuthScheme,+ validateMCPAuthCredential,+ type MCPAuthScheme,+} from "@/lib/mcp-auth";+import { normalizeMcpUrl } from "@/lib/mcp-url";++export function useMCPManualAuth(+ serverURL: string,+ allowedSchemes: MCPAuthScheme[],+) {+ const [token, setToken] = useState("");+ const { data: credentials } = useGetV1ListCredentials({+ query: {+ select: (response) => (response.status === 200 ? response.data : []),+ },+ });+ const saved = Array.isArray(credentials)+ ? credentials.find(+ (credential) =>+ credential.provider === "mcp" &&+ typeof credential.host === "string" &&+ normalizeMcpUrl(credential.host) === normalizeMcpUrl(serverURL),+ )+ : null;+ const savedScheme = saved?.mcp_auth_scheme === "basic" ? "basic" : "bearer";+ const defaultScheme = allowedSchemes.includes(savedScheme)+ ? savedScheme+ : (allowedSchemes[0] ?? "bearer");+ const auth = useMCPAuthScheme(defaultScheme, token);+ const scheme = allowedSchemes.includes(auth.scheme)+ ? auth.scheme+ : defaultScheme;++ function selectScheme(next: MCPAuthScheme) {+ if (allowedSchemes.includes(next)) auth.selectScheme(next);+ }++ function handleTokenChange(value: string) {+ setToken(value);+ const detected = detectMCPAuthScheme(value);+ if (detected && allowedSchemes.includes(detected))+ auth.detectSchemeFrom(value);+ }++ function validateToken() {+ const detected = detectMCPAuthScheme(token);+ if (detected && !allowedSchemes.includes(detected)) {+ return detected === "basic"+ ? "This connection does not support Basic authentication."+ : "This connection does not support Bearer tokens.";+ }+ return validateMCPAuthCredential(token.trim(), scheme);+ }++ function reset() {+ setToken("");+ auth.resetScheme();+ }++ return {+ token,+ scheme,+ selectScheme,+ handleTokenChange,+ validateToken,+ reset,+ };+}diff --git a/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/components/ConnectServiceDialog/components/ProviderRow.tsx b/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/components/ConnectServiceDialog/components/ProviderRow.tsxindex 99fa1de3e0..f8792fecd5 100644--- a/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/components/ConnectServiceDialog/components/ProviderRow.tsx+++ b/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/components/ConnectServiceDialog/components/ProviderRow.tsx@@ -5,6 +5,8 @@ import { useState } from "react";import type { ConnectableProvider } from "../helpers";import { PlusSignIcon } from "@hugeicons/core-free-icons";import { Icon } from "@/components/atoms/Icon/Icon";+import { Badge } from "@/components/atoms/Badge/Badge";+import { integrationIconSrc } from "@/components/molecules/IntegrationLogo/helpers";interface Props {provider: ConnectableProvider;@@ -12,17 +14,18 @@ interface Props {}export function ProviderRow({ provider, onSelect }: Props) {- const src = `/integrations/${provider.id}.png`;+ const src = integrationIconSrc(+ provider.mcpServer?.icon_id ?? (provider.mcpServer ? "mcp" : provider.id),+ );const [brokenSrc, setBrokenSrc] = useState<string | null>(null);- const broken = brokenSrc === src;return (<buttontype="button"onClick={() => onSelect(provider.id)}- className="group flex h-16 w-full items-center gap-3 rounded-xl border border-zinc-200 bg-white px-[0.875rem] py-[0.625rem] text-left transition-colors hover:bg-zinc-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-purple-400 active:bg-zinc-100"+ className="group flex min-h-20 w-full items-center gap-3 rounded-xl border border-zinc-200 bg-white px-[0.875rem] py-[0.625rem] text-left transition-colors hover:bg-zinc-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-purple-400 active:bg-zinc-100">- {broken ? (+ {!src || brokenSrc === src ? (<divaria-hiddenclassName="flex size-9 shrink-0 items-center justify-center rounded-md bg-zinc-100 text-[14px] font-semibold uppercase text-zinc-600"@@ -41,8 +44,19 @@ export function ProviderRow({ provider, onSelect }: Props) {/>)}<span className="flex min-w-0 flex-1 flex-col gap-0.5">- <span className="truncate text-[14px] font-medium leading-[22px] text-zinc-800">- {provider.name}+ <span className="flex flex-wrap items-center gap-x-2 gap-y-1 text-[14px] font-medium leading-[22px] text-zinc-800">+ <span>{provider.name}</span>+ {provider.mcpServer && (+ <Badge variant="info" size="small">+ MCP+ </Badge>+ )}+ {provider.mcpServer &&+ provider.mcpServer.connection_mode !== "hosted" && (+ <Badge variant="warning" size="small">+ Setup required+ </Badge>+ )}</span><span className="truncate text-[12px] leading-[20px] text-zinc-500">{provider.description ?? provider.id}diff --git a/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/components/ConnectServiceDialog/helpers.ts b/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/components/ConnectServiceDialog/helpers.tsindex f1c3d42273..77eaa6e785 100644--- a/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/components/ConnectServiceDialog/helpers.ts+++ b/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/components/ConnectServiceDialog/helpers.ts@@ -14,6 +14,7 @@ export interface ConnectableProvider {supportedAuthTypes: AuthMethod[];authProviderByType?: Partial<Record<AuthMethod, string>>;searchTerms?: string[];+ mcpServer?: ProviderMetadata["mcp_server"];}const KNOWN_AUTH_METHODS: ReadonlySet<AuthMethod> = new Set(@@ -41,10 +42,11 @@ export function toConnectableProviders(const existing = byDisplayProvider.get(displayProvider);const provider = existing ?? {id: displayProvider,- name: formatProviderName(displayProvider),+ name: item.display_name ?? formatProviderName(displayProvider),description: item.description,supportedAuthTypes: [],};+ if (item.mcp_server) provider.mcpServer = item.mcp_server;for (const authType of authTypes) {const alreadySupported = provider.supportedAuthTypes.includes(authType);diff --git a/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/components/ConnectServiceDialog/useConnectServiceDialog.ts b/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/components/ConnectServiceDialog/useConnectServiceDialog.tsindex c1a7687dd9..227e812880 100644--- a/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/components/ConnectServiceDialog/useConnectServiceDialog.ts+++ b/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/components/ConnectServiceDialog/useConnectServiceDialog.ts@@ -16,12 +16,14 @@ interface Args {open: boolean;onOpenChange: (open: boolean) => void;onConnected?: (credential: CredentialsMetaResponse) => void;+ initialProviderId?: string | null;}export function useConnectServiceDialog({open,onOpenChange,onConnected,+ initialProviderId,}: Args) {const [query, setQuery] = useState("");const debouncedQuery = useDebouncedValue(query, 250);@@ -36,12 +38,14 @@ export function useConnectServiceDialog({});useEffect(() => {- if (!open) {+ if (open) {+ setSelectedId(initialProviderId ?? null);+ } else {setQuery("");setSelectedId(null);setDirection(1);}- }, [open]);+ }, [open, initialProviderId]);const allProviders = toConnectableProviders(providersQuery.data ?? []);const providers = filterConnectableProviders(allProviders, debouncedQuery);diff --git a/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/components/IntegrationsList/IntegrationsList.tsx b/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/components/IntegrationsList/IntegrationsList.tsxindex a001b28ab2..2c0d3e2baa 100644--- a/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/components/IntegrationsList/IntegrationsList.tsx+++ b/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/components/IntegrationsList/IntegrationsList.tsx@@ -35,10 +35,13 @@ const REDUCED_MOTION_ITEM_VARIANTS: Variants = {show: { opacity: 1 },};-export function IntegrationsList() {+interface Props {+ query: string;+ onQueryChange: (query: string) => void;+}++export function IntegrationsList({ query, onQueryChange: setQuery }: Props) {const {- query,- setQuery,providers,isLoading,isError,@@ -50,7 +53,7 @@ export function IntegrationsList() {isDeleting,isDeletingId,buildTargets,- } = useIntegrationsList();+ } = useIntegrationsList(query);const reduceMotion = useReducedMotion();const [pendingDeleteIds, setPendingDeleteIds] = useState<string[]>([]);const [pendingForceIds, setPendingForceIds] = useState<string[]>([]);diff --git a/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/components/IntegrationsList/useIntegrationsList.ts b/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/components/IntegrationsList/useIntegrationsList.tsindex cded997f11..83535de41f 100644--- a/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/components/IntegrationsList/useIntegrationsList.ts+++ b/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/components/IntegrationsList/useIntegrationsList.ts@@ -1,7 +1,5 @@"use client";-import { useState } from "react";-import { useGetV1ListCredentials } from "@/app/api/__generated__/endpoints/integrations/integrations";import { filterSystemCredentials } from "@/components/contextual/CredentialsInput/helpers";@@ -17,8 +15,7 @@ import {import { useDebouncedValue } from "@/hooks/useDebouncedValue";import { useIntegrationsSelection } from "./useIntegrationsSelection";-export function useIntegrationsList() {- const [query, setQuery] = useState("");+export function useIntegrationsList(query: string) {const debouncedQuery = useDebouncedValue(query, 250);const credentialsQuery = useGetV1ListCredentials({@@ -88,8 +85,6 @@ export function useIntegrationsList() {const isError = credentialsQuery.isError;return {- query,- setQuery,providers,isLoading,isError,diff --git a/autogpt_platform/frontend/src/components/contextual/SkillsPanel/components/PublishSkillButton/__tests__/PublishSkillButton.test.tsx b/autogpt_platform/frontend/src/components/contextual/SkillsPanel/components/PublishSkillButton/__tests__/PublishSkillButton.test.tsxindex add10a7cec..0013736a93 100644--- a/autogpt_platform/frontend/src/components/contextual/SkillsPanel/components/PublishSkillButton/__tests__/PublishSkillButton.test.tsx+++ b/autogpt_platform/frontend/src/components/contextual/SkillsPanel/components/PublishSkillButton/__tests__/PublishSkillButton.test.tsx@@ -47,6 +47,31 @@ describe("PublishSkillButton", () => {expect(submit.hasAttribute("disabled")).toBe(true);});+ test("excludes MCP presets from native credential requirements", async () => {+ server.use(+ getGetV1ListProvidersMockHandler200([+ { name: "google", description: "Google" },+ {+ name: "mcp_notion",+ display_name: "Notion",+ supported_auth_types: [],+ mcp_server: {+ server_url: "https://mcp.notion.com/mcp",+ documentation_url: "https://developers.notion.com/guides/mcp",+ setup_instructions: "Sign in to Notion.",+ connection_mode: "hosted",+ auth_methods: ["oauth"],+ },+ },+ ]),+ );+ render(<PublishSkillButton skillName="brand-voice-guide" />);+ await user().click(screen.getByTestId("skill-publish-button"));++ expect(await screen.findByText("Google")).toBeDefined();+ expect(screen.queryByText(/Notion/)).toBeNull();+ });+test("submits the skill with its category and integrations", async () => {const u = user();let body: unknown = null;diff --git a/autogpt_platform/frontend/src/components/contextual/SkillsPanel/components/PublishSkillButton/usePublishSkillButton.ts b/autogpt_platform/frontend/src/components/contextual/SkillsPanel/components/PublishSkillButton/usePublishSkillButton.tsindex a714f51419..ce466dce19 100644--- a/autogpt_platform/frontend/src/components/contextual/SkillsPanel/components/PublishSkillButton/usePublishSkillButton.ts+++ b/autogpt_platform/frontend/src/components/contextual/SkillsPanel/components/PublishSkillButton/usePublishSkillButton.ts@@ -70,10 +70,12 @@ export function usePublishSkillButton({ skillName }: Args) {})),providers,setProviders,- providerItems: (providersQuery.data ?? []).map((provider) => ({- value: provider.name,- label: formatProviderName(provider.name),- })),+ providerItems: (providersQuery.data ?? [])+ .filter((provider) => !provider.mcp_server)+ .map((provider) => ({+ value: provider.name,+ label: formatProviderName(provider.name),+ })),submit,};}diff --git a/autogpt_platform/frontend/src/lib/mcp-errors.ts b/autogpt_platform/frontend/src/lib/mcp-errors.tsindex c80022136f..96f6598495 100644--- a/autogpt_platform/frontend/src/lib/mcp-errors.ts+++ b/autogpt_platform/frontend/src/lib/mcp-errors.ts@@ -2,6 +2,7 @@ type APIErrorPayload = {status?: unknown;message?: unknown;detail?: unknown;+ response?: unknown;};export function getErrorStatus(error: unknown): number | null {@@ -18,12 +19,42 @@ export function getErrorMessage(if (typeof error !== "object" || error === null) return fallback;const { message, detail } = error as APIErrorPayload;if (typeof detail === "string" && detail) return detail;+ // Routes that need the client to branch on the failure send+ // `detail: {code, message}`; the prose still belongs on screen, so read it+ // out rather than showing the user a stringified object.+ const structured = getStructuredDetail(detail)?.message;+ if (typeof structured === "string" && structured) return structured;if (typeof message === "string" && message) return message;const value = detail ?? message;if (value === undefined || value === null) return fallback;return JSON.stringify(value) || fallback;}+/** The machine-readable `code` a route attached to its error, when it sent one.+ *+ * A failed call arrives in one of two shapes: the plain object+ * `getAPIResponseError` builds from a non-2xx body, or an `ApiError` whose+ * `response` is that body. Both keep the code in the same place inside it. */+export function getErrorCode(error: unknown): string | null {+ if (typeof error !== "object" || error === null) return null;+ const { detail, response } = error as APIErrorPayload;+ const body =+ typeof response === "object" && response !== null+ ? (response as APIErrorPayload).detail+ : undefined;+ const code =+ getStructuredDetail(detail)?.code ?? getStructuredDetail(body)?.code;+ return typeof code === "string" && code ? code : null;+}++function getStructuredDetail(+ detail: unknown,+): { code?: unknown; message?: unknown } | null {+ if (typeof detail !== "object" || detail === null || Array.isArray(detail))+ return null;+ return detail as { code?: unknown; message?: unknown };+}+export function getAPIResponseError(status: number, data: unknown) {if (typeof data !== "object" || data === null) {return { status, detail: data };diff --git a/docs/platform/contributing/hosted-mcp-catalog.md b/docs/platform/contributing/hosted-mcp-catalog.mdnew file mode 100644index 0000000000..f1d9748afc--- /dev/null+++ b/docs/platform/contributing/hosted-mcp-catalog.md@@ -0,0 +1,18 @@+# Maintaining MCP Integrations++[`mcp_catalog.json`](../../../autogpt_platform/backend/backend/integrations/mcp_catalog.json) defines the official services shown in Integrations and the AutoPilot MCP guide. [`mcp_catalog.py`](../../../autogpt_platform/backend/backend/integrations/mcp_catalog.py) validates the records and exposes them through `get_mcp_catalog()`.++## Add or update a service++- Keep a stable `mcp_...` ID and link directly to the vendor's setup documentation.+- Describe the server's purpose and required plan, admin approval, region, endpoint, and credentials in `description` and `setup_instructions`.+- Use `connection_mode: hosted` with a fixed public HTTPS `server_url`, or `custom` for a user-provided endpoint. Add `server_url_options` for documented regions.+- Order the supported `auth_methods` by preference; the first method is selected initially. Choices are `oauth`, `bearer`, `basic`, and `none`.+- Set `oauth_server_url` when the vendor supplies a separate signed-in endpoint.+- Set documented `oauth_scopes` for the initial grant and separate `oauth_write_scopes` for the optional **Allow changes** choice. An empty default list omits the scope parameter; omission/null uses discovery defaults.++## Validate the change++Check the vendor's current endpoint and authentication contract. Verify initialization and tool listing with the MCP client, then a benign read using the intended permissions. For OAuth, check registration, consent, and refresh with the deployment's callback and an authorized test account.++Update affected catalog, provider, guide, and page integration tests. Cover changes to region selection, custom URLs, token handling, or optional grants. Regenerate API types when the metadata schema changes, and run the relevant backend and frontend checks.diff --git a/docs/platform/integrations-and-credentials.md b/docs/platform/integrations-and-credentials.mdindex 5011047b53..f1b3da15f7 100644--- a/docs/platform/integrations-and-credentials.md+++ b/docs/platform/integrations-and-credentials.md@@ -42,6 +42,16 @@ Depending on the service, you'll be prompted to authenticate in one of three wayCredentials are reusable, but each block or task retains its selected credential reference.{% endhint %}+## Connecting MCP Services++Open **Settings → Integrations**, find a service with the **MCP** badge, and follow its setup instructions. The same services appear in **Connect Service**.++- Choose the offered sign-in or token option for account access, or **No sign-in → Check connection** for public tools.+- If prompted, select your account's region or enter the official server URL for your tenant or deployment.+- Review the requested permissions. **Allow changes**, when offered, adds the service's optional actions.++For catalog updates, see [Maintaining MCP Integrations](contributing/hosted-mcp-catalog.md).+## Managing Credentials1. Open **Settings**.