From e7381b538463ca9932524ced853a2ac2ac21d006 Mon Sep 17 00:00:00 2001 From: alamin-br Date: Tue, 1 Dec 2026 15:44:39 +0100 Subject: [PATCH] feat(mcp): always turn on OAuth sign-in and add the MCP tools changelog (#6930) * chore: add changelog entry for the MCP shared tools The tools PRs left it for when the milestone was done. * feat(mcp): always turn on OAuth sign-in BASEROW_MCP_OAUTH_ENABLED is removed before it ships, so OAuth sign-in is on everywhere. The settings page opens the endpoint tab when the OAuth connections fail to load. --- .github/workflows/ci.yml | 1 - backend/src/baserow/api/mcp/oauth_views.py | 16 --------- backend/src/baserow/config/settings/base.py | 4 --- backend/src/baserow/config/settings/test.py | 2 -- backend/src/baserow/config/urls.py | 3 +- backend/src/baserow/core/mcp/auth.py | 33 ++++++++----------- .../core/identities/test_identity_accounts.py | 1 - .../core/mcp/oauth/test_connections.py | 16 --------- .../core/mcp/oauth/test_consent_api.py | 20 ----------- .../core/mcp/oauth/test_oauth_lifecycle.py | 14 -------- .../tests/baserow/core/mcp/oauth/test_urls.py | 27 +-------------- .../core/mcp/test_mcp_streamable_http.py | 24 -------------- ...tools_and_you_choose_which_tools_each.json | 14 ++++++++ docker-compose.no-caddy.yml | 1 - docker-compose.yml | 1 - docs/development/mcp-server.md | 6 ++-- .../install-using-standalone-images.md | 3 +- docs/installation/mcp-oauth.md | 9 ++--- docs/testing/mcp-test-plan.md | 1 - e2e-tests/README.md | 1 - e2e-tests/justfile | 1 - e2e-tests/tests/auth/mcpOAuth.spec.ts | 5 --- .../settings/McpEndpointSettings.vue | 28 ++++++++-------- .../settings/McpOAuthConnections.vue | 8 ++--- .../settings/mcpEndpointSettings.spec.js | 30 ++++++++--------- .../settings/mcpOAuthConnections.spec.js | 20 +---------- 26 files changed, 70 insertions(+), 219 deletions(-) create mode 100644 changelog/entries/unreleased/feature/6345_mcp_apps_can_use_kumas_tools_and_you_choose_which_tools_each.json diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2682fb2921..46e5956ad4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -709,7 +709,6 @@ jobs: -e EMAIL_SMTP_HOST=mailhog \ -e EMAIL_SMTP_PORT=1025 \ -e BASEROW_DATABASE_BUTTON_DISPATCH_USER_RATE_LIMITS=3/m \ - -e BASEROW_MCP_OAUTH_ENABLED=true \ -e PRIVATE_BACKEND_URL=http://backend:8000 \ -p 8000:8000 \ ${{ needs.build-backend.outputs.image }} gunicorn & diff --git a/backend/src/baserow/api/mcp/oauth_views.py b/backend/src/baserow/api/mcp/oauth_views.py index c3c28c81ee..edefa8ba1e 100644 --- a/backend/src/baserow/api/mcp/oauth_views.py +++ b/backend/src/baserow/api/mcp/oauth_views.py @@ -3,7 +3,6 @@ from urllib.parse import urlparse from django.conf import settings from django.db import transaction from django.db.models import Count -from django.http import Http404 from oauth2_provider.exceptions import OAuthToolkitError from oauth2_provider.models import get_application_model @@ -47,11 +46,6 @@ from .oauth_serializers import ConsentSerializer from .serializers import UpdateAllowedToolsSerializer -def _require_oauth_enabled(): - if not settings.BASEROW_MCP_OAUTH_ENABLED: - raise Http404() - - def _loopback_only(application) -> bool: """ True when every redirect URI is a loopback address. Any local program can @@ -189,7 +183,6 @@ class MCPOAuthConsentView(APIView): throttle_classes = (*APIView.throttle_classes, MCPOAuthConsentRateThrottle) def get(self, request): - _require_oauth_enabled() query = request.query_params.get("query", "") try: authorize_request, credentials = validate_query( @@ -283,7 +276,6 @@ class MCPOAuthConsentView(APIView): ) @validate_body(ConsentSerializer) def post(self, request, data): - _require_oauth_enabled() # Validated outside the transaction, because validation may fetch the # client's metadata document over HTTP. The library re-checks the client # when it issues the code, which only refetches a stale document. @@ -371,11 +363,6 @@ class MCPOAuthConnectionsView(APIView): endpoint, with the URL MCP clients connect to. """ - if not settings.BASEROW_MCP_OAUTH_ENABLED: - return Response( - {"oauth_enabled": False, "mcp_url": None, "connections": []} - ) - endpoints = list( # A grant in a workspace the user left can't be used. MCPEndpoint.objects.filter( @@ -393,7 +380,6 @@ class MCPOAuthConnectionsView(APIView): tools = mcp_tool_registry.get_enabled_tools() return Response( { - "oauth_enabled": True, "mcp_url": settings.MCP_RESOURCE_URL, "connections": [ _serialize_connection( @@ -426,7 +412,6 @@ class MCPOAuthConnectionView(APIView): gets the new tools on its next request. """ - _require_oauth_enabled() endpoint = MCPEndpointHandler().get_oauth_grant( request.user, connection_id, @@ -460,7 +445,6 @@ class MCPOAuthConnectionView(APIView): its tokens. Only needs the grant to be the user's, like listing it. """ - _require_oauth_enabled() endpoint = MCPEndpointHandler().get_oauth_grant(request.user, connection_id) DisconnectMCPOAuthClientActionType.do(request.user, endpoint) return Response(status=status.HTTP_204_NO_CONTENT) diff --git a/backend/src/baserow/config/settings/base.py b/backend/src/baserow/config/settings/base.py index 70a784782c..cefaff577f 100644 --- a/backend/src/baserow/config/settings/base.py +++ b/backend/src/baserow/config/settings/base.py @@ -1024,10 +1024,6 @@ else: "PUBLIC_WEB_FRONTEND_URL", "http://localhost:3000" ) -BASEROW_MCP_OAUTH_ENABLED = str_to_bool( - os.getenv("BASEROW_MCP_OAUTH_ENABLED") or "false" -) - def _canonical_url(url: str) -> str: """ diff --git a/backend/src/baserow/config/settings/test.py b/backend/src/baserow/config/settings/test.py index c1e3ec6bdc..f3b5dfd0e7 100644 --- a/backend/src/baserow/config/settings/test.py +++ b/backend/src/baserow/config/settings/test.py @@ -158,8 +158,6 @@ STORAGES["default"] = {"BACKEND": BASE_FILE_STORAGE} BASEROW_LOGIN_ACTION_LOG_LIMIT = RateLimit.from_string("1000/s") -BASEROW_MCP_OAUTH_ENABLED = True - BASEROW_WEBHOOKS_ALLOW_PRIVATE_ADDRESS = False INTEGRATIONS_ALLOW_PRIVATE_ADDRESS = False BASEROW_DATA_SYNC_ALLOW_PRIVATE_ADDRESS = False diff --git a/backend/src/baserow/config/urls.py b/backend/src/baserow/config/urls.py index 2d2bfe137d..5620c008e2 100644 --- a/backend/src/baserow/config/urls.py +++ b/backend/src/baserow/config/urls.py @@ -30,7 +30,6 @@ urlpatterns = ( if settings.DEBUG and "silk" in settings.INSTALLED_APPS: urlpatterns += [path("silk/", include("silk.urls", namespace="silk"))] -if settings.BASEROW_MCP_OAUTH_ENABLED: - urlpatterns += [path("", include("baserow.core.mcp.oauth.urls"))] +urlpatterns += [path("", include("baserow.core.mcp.oauth.urls"))] handler400 = "baserow.api.exceptions.bad_request" diff --git a/backend/src/baserow/core/mcp/auth.py b/backend/src/baserow/core/mcp/auth.py index 356be7587c..25a5862abc 100644 --- a/backend/src/baserow/core/mcp/auth.py +++ b/backend/src/baserow/core/mcp/auth.py @@ -13,25 +13,22 @@ INSUFFICIENT_SCOPE = "insufficient_scope" def www_authenticate(error: str | None = None) -> str: """ - The `WWW-Authenticate` header value for a rejected `/mcp` request. With OAuth on, - it points MCP clients at the protected resource metadata so they can start the - OAuth flow. With it off, that metadata isn't served, so it isn't mentioned. + The `WWW-Authenticate` header value for a rejected `/mcp` request. It points + MCP clients at the protected resource metadata so they can start the OAuth flow. """ from baserow.core.mcp.oauth.validators import MCP_SCOPE - params = [] - if settings.BASEROW_MCP_OAUTH_ENABLED: - metadata = ( - f"{settings.MCP_AUTHORIZATION_SERVER_URL}" - "/.well-known/oauth-protected-resource/mcp" - ) - params.append(f'resource_metadata="{metadata}"') + metadata = ( + f"{settings.MCP_AUTHORIZATION_SERVER_URL}" + "/.well-known/oauth-protected-resource/mcp" + ) + params = [f'resource_metadata="{metadata}"'] if error == INSUFFICIENT_SCOPE: params += [f'error="{INSUFFICIENT_SCOPE}"', f'scope="{MCP_SCOPE}"'] elif error: params.append(f'error="{error}"') - return "Bearer " + ", ".join(params) if params else "Bearer" + return "Bearer " + ", ".join(params) def _load_member_endpoint(**lookup) -> MCPEndpoint | None: @@ -96,10 +93,9 @@ def _resolve_oauth_token(value: str): def _resolve_bearer_sync(value: str): - if settings.BASEROW_MCP_OAUTH_ENABLED: - result = _resolve_oauth_token(value) - if result is not None: - return result + result = _resolve_oauth_token(value) + if result is not None: + return result endpoint = _load_member_endpoint(key=value) if endpoint is None: @@ -110,10 +106,9 @@ def _resolve_bearer_sync(value: str): async def resolve_bearer(value: str) -> tuple[MCPEndpoint | None, str | None]: """ Resolves a bearer value to an MCP endpoint. The value is either an OAuth access - token (when `BASEROW_MCP_OAUTH_ENABLED`) or an endpoint key. Returns the endpoint - and `None`, or `None` and an error code (`invalid_token` or - `insufficient_scope`). The endpoint is returned only while its user is a member - of its workspace. + token or an endpoint key. Returns the endpoint and `None`, or `None` and an + error code (`invalid_token` or `insufficient_scope`). The endpoint is returned + only while its user is a member of its workspace. """ return await sync_to_async(_resolve_bearer_sync)(value) diff --git a/backend/tests/baserow/core/identities/test_identity_accounts.py b/backend/tests/baserow/core/identities/test_identity_accounts.py index e349cbbf32..983a79bcf6 100644 --- a/backend/tests/baserow/core/identities/test_identity_accounts.py +++ b/backend/tests/baserow/core/identities/test_identity_accounts.py @@ -142,7 +142,6 @@ def test_identity_cannot_use_human_database_token( def test_identity_cannot_use_current_human_mcp_credentials( identity_account, data_fixture, settings, credential ): - settings.BASEROW_MCP_OAUTH_ENABLED = True workspace = IdentityHandler.get_workspace(identity_account) if credential == "key": endpoint = data_fixture.create_mcp_endpoint( diff --git a/backend/tests/baserow/core/mcp/oauth/test_connections.py b/backend/tests/baserow/core/mcp/oauth/test_connections.py index b2a41565ca..ae7cb40991 100644 --- a/backend/tests/baserow/core/mcp/oauth/test_connections.py +++ b/backend/tests/baserow/core/mcp/oauth/test_connections.py @@ -47,7 +47,6 @@ def test_list_connections(client, api_client, data_fixture, settings): response = api_client.get(reverse(LIST_URL), HTTP_AUTHORIZATION=f"JWT {token}") assert response.status_code == 200 data = response.json() - assert data["oauth_enabled"] is True assert data["mcp_url"] == settings.MCP_RESOURCE_URL assert [c["id"] for c in data["connections"]] == [ full["endpoint_id"], @@ -104,21 +103,6 @@ def test_list_connections_hides_grants_in_workspaces_the_user_left( assert [c["id"] for c in response.json()["connections"]] == [kept_id] -@pytest.mark.django_db -def test_list_connections_when_oauth_disabled(api_client, data_fixture, settings): - url = reverse(LIST_URL) - settings.BASEROW_MCP_OAUTH_ENABLED = False - user, token = data_fixture.create_user_and_token() - data_fixture.create_mcp_endpoint(user=user, oauth_client_id="https://x/y.json") - response = api_client.get(url, HTTP_AUTHORIZATION=f"JWT {token}") - assert response.status_code == 200 - assert response.json() == { - "oauth_enabled": False, - "mcp_url": None, - "connections": [], - } - - @pytest.mark.django_db def test_list_connections_requires_auth(api_client): assert api_client.get(reverse(LIST_URL)).status_code == 401 diff --git a/backend/tests/baserow/core/mcp/oauth/test_consent_api.py b/backend/tests/baserow/core/mcp/oauth/test_consent_api.py index f478e9b22a..39e49e3c29 100644 --- a/backend/tests/baserow/core/mcp/oauth/test_consent_api.py +++ b/backend/tests/baserow/core/mcp/oauth/test_consent_api.py @@ -43,26 +43,6 @@ def _post(api_client, token, query, workspace, tools=None, allow=True): ) -@pytest.mark.django_db -def test_consent_is_404_when_oauth_is_disabled( - client, api_client, data_fixture, settings -): - # Resolving first loads the root urlconf with the OAuth routes mounted, so - # later tests in this process still have them. - url = reverse(URL) - settings.BASEROW_MCP_OAUTH_ENABLED = False - user, token = data_fixture.create_user_and_token() - workspace = data_fixture.create_workspace(user=user) - query = _query(client) - - get = api_client.get(url, {"query": query}, HTTP_AUTHORIZATION=f"JWT {token}") - post = _post(api_client, token, query, workspace) - - assert get.status_code == 404 - assert post.status_code == 404 - assert not MCPEndpoint.objects.filter(oauth_client_id__isnull=False).exists() - - @pytest.mark.django_db def test_invalid_body_uses_the_baserow_error_envelope(client, api_client, data_fixture): _, token = data_fixture.create_user_and_token() diff --git a/backend/tests/baserow/core/mcp/oauth/test_oauth_lifecycle.py b/backend/tests/baserow/core/mcp/oauth/test_oauth_lifecycle.py index 59773c5535..45e1131b9f 100644 --- a/backend/tests/baserow/core/mcp/oauth/test_oauth_lifecycle.py +++ b/backend/tests/baserow/core/mcp/oauth/test_oauth_lifecycle.py @@ -1,6 +1,5 @@ from datetime import timedelta -from django.test import override_settings from django.utils import timezone import pytest @@ -80,16 +79,3 @@ def test_revoke_endpoint_tokens_matches_scope_exactly(data_fixture): assert not RefreshToken.objects.filter(token="r-a1").exists() assert AccessToken.objects.filter(id=twelve.id).exists() assert RefreshToken.objects.filter(token="r-a12").exists() - - -@pytest.mark.django_db -def test_flag_off_refuses_oauth_token_but_accepts_key(client, api_client, data_fixture): - user, token = data_fixture.create_user_and_token() - workspace = data_fixture.create_workspace(user=user) - tokens = obtain_tokens(client, api_client, token, workspace) - endpoint = data_fixture.create_mcp_endpoint(user=user, workspace=workspace) - with override_settings(BASEROW_MCP_OAUTH_ENABLED=False): - _, error = async_to_sync(resolve_bearer)(tokens["access_token"]) - assert error == "invalid_token" - found, error = async_to_sync(resolve_bearer)(endpoint.key) - assert error is None and found.id == endpoint.id diff --git a/backend/tests/baserow/core/mcp/oauth/test_urls.py b/backend/tests/baserow/core/mcp/oauth/test_urls.py index 664bc73ab6..774ed01e7b 100644 --- a/backend/tests/baserow/core/mcp/oauth/test_urls.py +++ b/backend/tests/baserow/core/mcp/oauth/test_urls.py @@ -2,13 +2,10 @@ import importlib from unittest.mock import patch from django.http import HttpResponse -from django.urls import Resolver404, path -from django.urls.resolvers import RegexPattern, URLResolver +from django.urls import path -import pytest from oauth2_provider import urls as oauth2_urls -from baserow.config import urls as root_urls from baserow.core.mcp.oauth import urls @@ -21,25 +18,3 @@ def test_unnamed_library_metadata_patterns_are_kept(): assert unnamed in urls.metadata_patterns finally: importlib.reload(urls) - - -@pytest.mark.parametrize("enabled", [False, True]) -def test_oauth_routes_follow_the_flag(settings, enabled): - # A fresh resolver, because the cached one was built from the URLconf as first - # imported. - def resolves(url): - resolver = URLResolver(RegexPattern(r"^/"), root_urls.urlpatterns) - try: - resolver.resolve(url) - except Resolver404: - return False - return True - - settings.BASEROW_MCP_OAUTH_ENABLED = enabled - try: - importlib.reload(root_urls) - assert resolves("/oauth/register/") is enabled - assert resolves("/.well-known/oauth-authorization-server") is enabled - finally: - settings.BASEROW_MCP_OAUTH_ENABLED = True - importlib.reload(root_urls) diff --git a/backend/tests/baserow/core/mcp/test_mcp_streamable_http.py b/backend/tests/baserow/core/mcp/test_mcp_streamable_http.py index 03b9906405..87cca4487c 100644 --- a/backend/tests/baserow/core/mcp/test_mcp_streamable_http.py +++ b/backend/tests/baserow/core/mcp/test_mcp_streamable_http.py @@ -479,30 +479,6 @@ def test_token_without_an_application_gets_401(data_fixture): assert 'error="invalid_token"' in response.headers["www-authenticate"] -@pytest.mark.django_db(transaction=True) -def test_oauth_token_rejected_when_oauth_disabled(data_fixture, settings): - user = data_fixture.create_user() - workspace = data_fixture.create_workspace(user=user) - endpoint = data_fixture.create_mcp_endpoint(user=user, workspace=workspace) - grant = _create_grant(data_fixture, user, workspace) - _create_raw_token( - user, - "flag-off-token", - f"mcp endpoint:{grant.id}", - [settings.MCP_RESOURCE_URL], - client_id=grant.oauth_client_id, - ) - assert _post(LIST, "flag-off-token").status_code == 200 - - settings.BASEROW_MCP_OAUTH_ENABLED = False - response = _post(LIST, "flag-off-token") - assert response.status_code == 401 - # The metadata routes aren't mounted, so the challenge doesn't point at them. - assert response.headers["www-authenticate"] == 'Bearer error="invalid_token"' - assert _post(INIT).headers["www-authenticate"] == "Bearer" - assert _post(LIST, endpoint.key).status_code == 200 - - def _get(path): async def inner(): app = BaserowMCPServer().sse_app() diff --git a/changelog/entries/unreleased/feature/6345_mcp_apps_can_use_kumas_tools_and_you_choose_which_tools_each.json b/changelog/entries/unreleased/feature/6345_mcp_apps_can_use_kumas_tools_and_you_choose_which_tools_each.json new file mode 100644 index 0000000000..c7795de1b1 --- /dev/null +++ b/changelog/entries/unreleased/feature/6345_mcp_apps_can_use_kumas_tools_and_you_choose_which_tools_each.json @@ -0,0 +1,14 @@ +{ + "type": "feature", + "message": "MCP apps can use Kuma's tools, and you choose which tools each connected app may use", + "issue_origin": "github", + "issue_number": 6345, + "domain": "core", + "bullet_points": [ + "Tools for tables, fields, rows and views", + "Tools for automations, applications and dashboards", + "Workspace search, row comments, view settings and the audit log", + "Change a connected app's tools in My settings without reconnecting" + ], + "created_at": "2026-11-30" +} diff --git a/docker-compose.no-caddy.yml b/docker-compose.no-caddy.yml index ca77fa3fb6..b51613973e 100644 --- a/docker-compose.no-caddy.yml +++ b/docker-compose.no-caddy.yml @@ -144,7 +144,6 @@ x-backend-variables: BASEROW_DJANGO_REQUEST_LOG_LEVEL: FEATURE_FLAGS: BASEROW_PRESENCE_VISIBLE_USERS: - BASEROW_MCP_OAUTH_ENABLED: BASEROW_MCP_OAUTH_CIMD_ENABLED: BASEROW_MCP_OAUTH_CIMD_ALLOWED_HOSTS: BASEROW_MCP_OAUTH_TOKEN_RATE_LIMITS: diff --git a/docker-compose.yml b/docker-compose.yml index 554a916e44..1be8e70cd3 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -155,7 +155,6 @@ x-backend-variables: BASEROW_DJANGO_REQUEST_LOG_LEVEL: FEATURE_FLAGS: BASEROW_PRESENCE_VISIBLE_USERS: - BASEROW_MCP_OAUTH_ENABLED: BASEROW_MCP_OAUTH_CIMD_ENABLED: BASEROW_MCP_OAUTH_CIMD_ALLOWED_HOSTS: BASEROW_MCP_OAUTH_TOKEN_RATE_LIMITS: diff --git a/docs/development/mcp-server.md b/docs/development/mcp-server.md index 25343e6440..b4ecd68efe 100644 --- a/docs/development/mcp-server.md +++ b/docs/development/mcp-server.md @@ -56,8 +56,6 @@ just run-asgi MCP clients can sign in with OAuth instead of a pasted key. See [ADR 009](../decisions/009-mcp-oauth-authorization.md) for the design. -Set `BASEROW_MCP_OAUTH_ENABLED=true` to turn it on. It is off by default. - All clients share one URL, `/mcp`. The user picks a workspace and the allowed tools on the consent screen. Each grant is stored as an `MCPEndpoint` row with `oauth_client_id` set. Its tokens carry the scope `mcp endpoint:`, which ties them to that row. Deleting the row revokes the tokens. Grants are also revoked when the user leaves the workspace. A password change or reset deletes the user's tokens but keeps the grants, so the apps have to sign in again. @@ -84,7 +82,7 @@ Access tokens last one hour. Clients always get a refresh token, whether or not ### Running it locally ```bash -BASEROW_MCP_OAUTH_ENABLED=true just run-dev-server +just run-dev-server claude mcp add --transport http baserow http://localhost:8000/mcp ``` @@ -94,7 +92,7 @@ See the [test plan](../testing/mcp-test-plan.md#1-connect-an-mcp-client) for oth ### ChatGPT app domain verification -OpenAI verifies the domain of a submitted ChatGPT app by fetching `/.well-known/openai-apps-challenge`. Set `BASEROW_MCP_OPENAI_APPS_CHALLENGE` to the token shown in OpenAI's portal and the backend returns it as plain text. When it's empty the route returns a 404. Like the other OAuth routes, it only exists with `BASEROW_MCP_OAUTH_ENABLED=true`. +OpenAI verifies the domain of a submitted ChatGPT app by fetching `/.well-known/openai-apps-challenge`. Set `BASEROW_MCP_OPENAI_APPS_CHALLENGE` to the token shown in OpenAI's portal and the backend returns it as plain text. When it's empty the route returns a 404. ## Tools diff --git a/docs/installation/install-using-standalone-images.md b/docs/installation/install-using-standalone-images.md index b74f514159..5a8f4b1fb0 100644 --- a/docs/installation/install-using-standalone-images.md +++ b/docs/installation/install-using-standalone-images.md @@ -53,8 +53,7 @@ images: need to: * Redirect `/api/` and `/ws/` requests to the backend gunicorn service without dropping these prefixes. - * With `BASEROW_MCP_OAUTH_ENABLED=true`, also send `/mcp`, `/oauth/`, - `/.well-known/oauth-authorization-server` and + * Also send `/mcp`, `/oauth/`, `/.well-known/oauth-authorization-server` and `/.well-known/oauth-protected-resource` to the backend. See [MCP OAuth sign-in](mcp-oauth.md). * Serve the files in the `/baserow/media` folder in the backend gunicorn service diff --git a/docs/installation/mcp-oauth.md b/docs/installation/mcp-oauth.md index f0e18cb79d..07ce64c1cf 100644 --- a/docs/installation/mcp-oauth.md +++ b/docs/installation/mcp-oauth.md @@ -1,8 +1,8 @@ # MCP OAuth sign-in for self-hosted Baserow -With `BASEROW_MCP_OAUTH_ENABLED=true`, MCP clients such as Claude, ChatGPT, Cursor and -VS Code connect to `/mcp` and sign the user in with OAuth instead -of a pasted endpoint key. Users find the URL, and copy-ready setup for Claude Code, +MCP clients such as Claude, ChatGPT, Cursor and VS Code connect to +`/mcp` and sign the user in with OAuth instead of a pasted +endpoint key. Users find the URL, and copy-ready setup for Claude Code, Cursor, VS Code, Codex and Gemini CLI, under *My settings β†’ MCP server*. Steps for each app are in the [MCP server user docs](https://baserow.io/user-docs/mcp-server), and the plugins and skills are in the @@ -34,6 +34,3 @@ self-hosted install: the first `X-Forwarded-For` entry. The proxy in front of Baserow must replace that header rather than append to what the client sent, or a client can pick its own IP. Behind a proxy that doesn't set it at all, every client shares one limit. -* **Turning it off.** Setting `BASEROW_MCP_OAUTH_ENABLED=false` pauses the connected - apps, it doesn't revoke them. Their grants and tokens are kept and work again when - the flag is turned back on. Users can disconnect apps in *My settings β†’ MCP server*. diff --git a/docs/testing/mcp-test-plan.md b/docs/testing/mcp-test-plan.md index d486407ac1..3805fe667c 100644 --- a/docs/testing/mcp-test-plan.md +++ b/docs/testing/mcp-test-plan.md @@ -3,7 +3,6 @@ ## Prerequisites - A running Baserow instance (local dev or deployed) -- For OAuth: `BASEROW_MCP_OAUTH_ENABLED=true` on the backend - An MCP-compatible client (see step 1) ## 1. Connect an MCP client diff --git a/e2e-tests/README.md b/e2e-tests/README.md index 8f939b6f2d..a7ad4985f9 100644 --- a/e2e-tests/README.md +++ b/e2e-tests/README.md @@ -19,5 +19,4 @@ The suite runs two ways, and which mail variable applies depends on which. | `E2E_SLACK_STUB` | `./run-e2e-tests-locally.sh` and `yarn run test` | Set to `yes` when the backend under test has `BASEROW_INTEGRATIONS_SLACK_API_URL` pointed at the WireMock stub in `stubs/slack`, which `just e2e` and CI do. The one test in `button_field_slack.spec.ts` that clicks is skipped otherwise, since it would reach slack.com. Locally the script starts the stub on `E2E_SLACK_STUB_PORT` (default 8101); run the dev backend with `BASEROW_INTEGRATIONS_SLACK_API_URL=http://localhost:8101/api` and `BASEROW_INTEGRATIONS_ALLOW_PRIVATE_ADDRESS=true`. | | `E2E_KUMA_MODEL_STUB` | `yarn run test` | Set to `yes` when the backend and its Celery worker run Kuma against the stub in `stubs/kuma-model` (`BASEROW_ENTERPRISE_ASSISTANT_LLM_MODEL=openai/kuma-e2e` and `OPENAI_BASE_URL` pointing at the stub), which `just e2e` and CI do. The Kuma background run tests are skipped otherwise. | | `E2E_HTTP_STUB_URL` | both | The endpoint the HTTP action tests call. The local runner starts httpbin in Docker when the backend allows private addresses, and falls back to the public httpbin.org otherwise. | -| `BASEROW_MCP_OAUTH_ENABLED` | the backend under test | Set to `true` on the backend, which `just e2e` and CI do. `tests/auth/mcpOAuth.spec.ts` is skipped when the backend answers 404 on `/.well-known/oauth-authorization-server`. | | `E2E_BUTTON_RATE_LIMIT` | both | How many external clicks a user gets per minute. The tests that click until they are refused are skipped when it is unset, since the runner cannot set it for a dev backend. | diff --git a/e2e-tests/justfile b/e2e-tests/justfile index 370007aea8..0f922bf406 100644 --- a/e2e-tests/justfile +++ b/e2e-tests/justfile @@ -273,7 +273,6 @@ up: _ensure-images -e EMAIL_SMTP_PORT=1025 \ -e BASEROW_DATABASE_BUTTON_DISPATCH_USER_RATE_LIMITS={{ button_rate_limit }}/m \ -e BASEROW_FRONTEND_COOKIE_PREFIX={{ frontend_cookie_prefix }} \ - -e BASEROW_MCP_OAUTH_ENABLED=true \ -e PRIVATE_BACKEND_URL=http://e2e-backend:8000 \ -e PUBLIC_BACKEND_URL="{{ public_backend_url }}" \ -e PUBLIC_WEB_FRONTEND_URL="{{ public_frontend_url }}" \ diff --git a/e2e-tests/tests/auth/mcpOAuth.spec.ts b/e2e-tests/tests/auth/mcpOAuth.spec.ts index 7b897e1914..b19b95dc66 100644 --- a/e2e-tests/tests/auth/mcpOAuth.spec.ts +++ b/e2e-tests/tests/auth/mcpOAuth.spec.ts @@ -72,11 +72,6 @@ test("An MCP client connects with OAuth and is disconnected in settings", async const metadataResponse = await request.get( `${backendUrl}/.well-known/oauth-authorization-server` ); - // Only a missing route means the flag is off; any other error must fail. - test.skip( - metadataResponse.status() === 404, - "BASEROW_MCP_OAUTH_ENABLED is off on the backend under test" - ); expect(metadataResponse.status()).toBe(200); const metadata = await metadataResponse.json(); diff --git a/web-frontend/modules/core/components/settings/McpEndpointSettings.vue b/web-frontend/modules/core/components/settings/McpEndpointSettings.vue index 2e36084ae4..0775282ccf 100644 --- a/web-frontend/modules/core/components/settings/McpEndpointSettings.vue +++ b/web-frontend/modules/core/components/settings/McpEndpointSettings.vue @@ -3,7 +3,6 @@