mirror of
https://github.com/baserow/baserow.git
synced 2026-12-04 00:08:25 +00:00
* feat(mcp): add django-oauth-toolkit metadata and scopes for MCP OAuth POC Adds the OAuth provider settings, endpoint scope validator and discovery URLs behind BASEROW_MCP_OAUTH_ENABLED. * feat(mcp): redirect OAuth authorize to Baserow consent and issue endpoint-bound codes The consent API validates the authorization query, binds the code to an MCP endpoint, and returns the client redirect URL. * fix(mcp): reject non-S256 and foreign-resource OAuth requests and read consent client from credentials Shared validation backs both authorize and consent; the token audience is pinned to the MCP resource. * test(mcp): cover CIMD host allowlist for MCP OAuth * feat(mcp): serve Streamable HTTP /mcp with OAuth or endpoint-key bearer auth MCP clients doing OAuth need a single resource URL; endpoint keys keep working as bearers. * feat(mcp): revoke OAuth tokens when their MCP endpoint is deleted Scope is matched as a whole word so endpoint:1 never hits endpoint:12. * feat(mcp): add title and read-only/destructive annotations to MCP tools MCP directories require a title and readOnlyHint/destructiveHint on every tool. * feat(mcp): add consent page for MCP OAuth sign-in * fix(mcp): only issue OAuth tokens through the consent flow Open DCR let a client register for the password grant and request an endpoint scope, skipping consent. DCR and the token endpoint now allow only authorization_code and refresh_token, and only the consent view can add an endpoint scope. * fix(mcp): strip trailing slash from the OAuth issuer and resource URL A PUBLIC_BACKEND_URL ending in / produced a //mcp audience and a mismatched issuer. * fix(mcp): add iss to OAuth deny and error redirects The metadata advertises RFC 9207 support, so every redirect back to the client carries iss. * fix(mcp): pass the authorize query to /mcp-authorize as base64url The login redirect re-encoded the plain query, so the consent request failed after signing in. /mcp-authorize also stays clear of the backend /mcp/* route. * feat(mcp): limit an endpoint to its allowed tools Null keeps every enabled tool, so existing endpoints and keys are unchanged. tools/call now also refuses disabled tools, which match_by_name let through. * feat(mcp): consent picks a workspace and tools Users never see the endpoint row behind an OAuth connection; consent creates or reuses it per client and workspace and stores the chosen tools. * feat(mcp): pick a workspace and tools on the consent page Replaces the MCP endpoint picker; the backend manages the endpoint row now. * fix(mcp): reuse a consent grant only for the same OAuth client Keying on the client name let manual endpoints and same-named clients share a grant. * feat(mcp): drop dynamic client registration, keep CIMD only Clients without CIMD use the endpoint key in the Authorization header. * feat(mcp): redesign the consent page Card with client avatar pair, verified badge, database counts and tool badges. * feat(mcp): list and disconnect OAuth connections, refuse grant keys Endpoints created by OAuth consent only accept their OAuth tokens, so their key is refused on SSE and as a bearer, and they move from the endpoint list to a connected apps API. * feat(mcp): connect URL and connected apps in MCP server settings Shows the one OAuth URL with per-client setup steps and lets users disconnect apps they granted. Endpoint keys stay below under their own title. * fix(mcp): hide OAuth grants from endpoint routes and left workspaces The legacy endpoint routes no longer return grant rows or their key, and the connections list skips grants in workspaces the user left, which can't be used or disconnected. * fix(mcp): load consent on the client so tool checkboxes render ticked Server-rendered checkboxes lacked the checked class, which hydration kept while the state was ticked. * fix(mcp): define django-oauth-toolkit swappable model settings migrate resolves them when checking for model changes on an already migrated DB, which broke CI. * fix(mcp): reset the SSE endpoint key when the key is unknown The early 401 left current_key set, leaking it into later work in the same context. * feat(mcp): give OAuth grants no key and one row per client and workspace * fix(mcp): resolve the /mcp endpoint once and drop the /mcp/ route * feat(mcp): hash OAuth tokens, expire refresh tokens and accept offline_access Resource metadata lists only mcp; the CIMD host allowlist is now BASEROW_MCP_OAUTH_CIMD_ALLOWED_HOSTS. * test(mcp): assert offline_access reaches the token and add refresh expiry control * feat(mcp): rate-limit the OAuth token endpoint per client IP * fix(mcp): validate consent once and only keep a grant when a code is issued * fix(mcp): roll back the grant when the library answers consent with an error oauthlib re-validates while issuing and returns non-fatal errors as a redirect, which committed the grant. * fix(mcp): revoke OAuth grants when a user leaves the workspace * fix(mcp): count only usable tools on connected apps * fix(mcp): start reconnects from the existing grant's tools on the consent page * fix(mcp): give the connections section its own BEM elements * feat(mcp): send mcp_connected for Streamable HTTP clients * fix(mcp): route /mcp, /oauth and OAuth metadata to the backend * fix(mcp): route /mcp-authorize to frontend before /mcp to prevent 404 * feat(mcp): let MCP clients without CIMD register with DCR Registration is anonymous, limited to public code-grant clients with https or loopback redirects, and unused clients are removed after a day. * fix(mcp): reject DCR redirect URIs containing whitespace DOT splits stored redirect URIs on whitespace, so one URI could smuggle in a second. * docs(mcp): document OAuth sign-in for MCP clients * test(mcp): load the URLconf before tests turn OAuth off The OAuth routes are only mounted if the flag is on at URLconf import, so a test that turned it off first left later tests in the worker with 404s. * feat(mcp): periodically clear expired OAuth tokens Rotation and reuse protection leave revoked refresh tokens, used codes and expired access tokens behind. DCR registration tokens now expire so they're cleared too. * style(mcp): drop dead and invalid rules in the OAuth SCSS * fix(mcp): keep unnamed library metadata routes instead of crashing * refactor(mcp): remove unused MCPEndpointHandler.get_by_key * fix(mcp): only accept an OAuth token for its own client's grant * fix(mcp): leave resource_metadata out of the 401 when OAuth is off The metadata route isn't mounted then, so the hint pointed at a 404. * fix(mcp): rate-limit the OAuth authorize redirect per client IP Each anonymous authorize request can fetch and store a CIMD client. * fix(mcp): delete CIMD clients that have no grant Anonymous authorize requests store CIMD clients and nothing removed them. * fix(mcp): say a CIMD host published the client, not that it verified it With the default * allowlist the host is not vouched for. * fix(mcp): name a DCR client without client_name by its redirect host The consent title read "Connect " and the grant had an empty name. * fix(mcp): route MCP and OAuth paths to the backend in the no-caddy nginx config * fix(mcp): reject an access token that has no application It crashed the /mcp request instead of returning invalid_token. * fix(mcp): return the 404 JSON for RFC 7592 PUT and DELETE Django's CSRF check answered them with a 403 page first. * refactor(mcp): move the shared client avatar placeholder out of mcp_authorize The connections list extended a placeholder defined in another component. * fix(mcp): issue a refresh token only for offline_access ADR 009 decision 6 ties refresh tokens to the offline_access scope. * fix(mcp): stop the consent page from being framed The consent page grants a client access, so it is a clickjacking target. * fix(mcp): make the consent page tool toggles keyboard reachable * docs(mcp): say the CIMD host allowlist only covers CIMD clients * docs(mcp): route MCP and OAuth paths in the k8s and AWS examples /mcp is only served by the ASGI app, so the examples sent it to a 404. * fix(mcp): refuse to show the consent form inside a frame Logging in inside a frame reaches the consent page by client-side navigation, which skips the frame headers. * fix(mcp): always issue OAuth refresh tokens Users stay signed in until they disconnect or the app goes unused for 30 days, whether or not the client asks for offline_access. * fix(mcp): keep the endpoint scope when a refresh narrows scopes A refresh asking for scope=mcp issued a token without endpoint:<id>, which failed on /mcp and escaped revocation on Disconnect. * fix(mcp): keep OAuth clients that are still in use after a disconnect Cleanup deleted a disconnected client the next day while the app kept using its client_id. Clients now go after 30 days without a token, and an unknown client on authorize tells the user to re-add the server. * fix(mcp): serve the SSE route with a trailing slash Turning off redirect_slashes made /mcp/<key>/sse/ a 404 instead of a redirect. * fix(mcp): drop the error code from the 401 when no token was sent RFC 6750 section 3.1 says no error code when the request has no credentials. * fix(mcp): delete grantless CIMD clients a day after creation Any anonymous authorize re-fetch bumps a CIMD client's updated, so it can't mark use. CIMD clients are fetched again on demand anyway. * fix(mcp): mark the OAuth client as used after saving its tokens Matches the cleanup's lock order, tokens before the application row. * style(mcp): rewrap the OAuth validator docstring * fix(mcp): describe offline_access as it now behaves Refresh tokens are issued whether or not it is requested. * feat(mcp): audit log MCP OAuth connect and disconnect ADR 009 decision 6: connecting and disconnecting are recorded in the audit log. * test(mcp): give the OAuth action tests a unique module name test_actions.py clashed with other test modules of the same name and broke collection in CI. * fix(mcp): let users disconnect their OAuth grants without endpoint permissions Listing grants and using them only needs membership, so disconnecting must not need the MCP endpoint operations either. * fix(mcp): require the mcp scope on OAuth tokens used at /mcp A refresh asking only for offline_access issued a token without mcp that /mcp still accepted. Refreshes now keep mcp, and /mcp rejects tokens without it. * fix(mcp): ignore the redirect URI's own query when checking for an issued code A client registered with a redirect URI like https://app.example/cb?error=0 never got a code. * fix(mcp): send the OAuth connect PostHog event only after consent commits The consent transaction rolls back when no code is issued, and the event was already sent by then. The audit log entry stays in the transaction. * fix(mcp): keep OAuth grants out of the key endpoint lookup Callers had to remember to pass a key-only queryset; grants have their own lookup. * fix(mcp): show a CIMD client's host in a neutral badge Any host can publish a client metadata document, so a green check made lookalike hosts look trusted. * fix(mcp): show the readable reason when the consent request is rejected * style(mcp): tidy an import and an outdated comment * fix(mcp): name every client on the consent page by its client name Matches Settings, which shows the client name with the host as a badge. A nameless CIMD client falls back to the host that published its metadata. * fix(mcp): show fatal authorize errors on the styled consent page The authorize endpoint answered unknown clients and bad redirect URIs with a bare text 400. * test(mcp): add an e2e spec for the OAuth connect and disconnect flow Enables BASEROW_MCP_OAUTH_ENABLED on the e2e and CI backends so the spec runs. * fix(mcp): send only an error code to the consent error page Free text in the URL could be injected and came back double-encoded after login. The page now maps codes to its own text and shows errors without sign in. * fix(mcp): keep a CIMD client's host in the consent title Any host can publish metadata under any name, so the title reads "Connect {name} from {host}". The neutral badge only repeated the host and is dropped. * test(mcp): check the MCP status before parsing the body in the e2e spec * test(mcp): await the login redirect in the consent middleware spec The unawaited navigation ran the settings middleware after the request mock was restored, making a real request. * fix(mcp): address final review findings on the OAuth flow Authorize errors no longer redirect to client-registered URIs, CIMD redirect URIs follow the DCR rule, consent is rate-limited per user, and deleting a grant any way revokes its tokens. * fix(mcp): accept ChatGPT, Claude and VS Code CIMD documents django-oauth-toolkit 3.4.1 ignores token_endpoint_auth_methods_supported and refuses extra grant types; fixed upstream in #1856 and #1858 but not released. * fix(mcp): update ChatGPT connect steps to the Plugins page * feat(mcp): split MCP server settings into OAuth and Endpoint tabs * fix(mcp): route /mcp without a trailing slash on K8s The OAuth resource is /mcp, which the /mcp/ prefix missed. * fix(mcp): give the CIMD document download one deadline The library's timeout applies per read, so a slow-drip document held a worker. * fix(mcp): bound anonymous client registrations Caps the body at 16 KB and redirect URIs at 10; unsupported URIs are dropped instead of failing the registration. * fix(mcp): rate-limit token revocation, count only failed token calls Revocation loads the client, which can fetch and store a CIMD client. * fix(mcp): preselect the granted workspace when reconnecting It picked the first workspace with databases, so one Allow could move the app with every tool ticked. * fix(mcp): carry the consent request in the path so SSO keeps it SSO sign-in only keeps the return path. The frame headers move to the page so every spelling of the path gets them. * fix(mcp): canonicalize the resource URL, scrub OAuth fields from Sentry SDK clients send the resource normalized; the Sentry denylist only matches exact keys. * fix(mcp): lock the membership while granting an OAuth client A member removed during consent could otherwise keep the new grant. * chore(mcp): count databases through the registry, add missing translations * test(mcp): check the OAuth routes follow the flag * test(e2e): skip the MCP OAuth test only when the route is missing Any other status hid a broken metadata endpoint. * fix(mcp): explain rejected CIMD clients and load failures on the consent page Both showed the invalid request message, which suggested re-adding the server. * fix(mcp): answer a refresh that lost a race with invalid_grant With hashed storage the library returned a blank token and the token view raised a 500. * feat(mcp): mark connected apps whose sign-in has ended Grants stay listed after their refresh token expires, but the app has to sign in again. * docs(mcp): add a self-hosting note for MCP OAuth sign-in Covers the public URL, routing, outbound HTTPS for CIMD, the client IP the limits use and what turning the flag off does. * fix(mcp): sign OAuth apps out on password change or reset Browser sessions already end then; grants stay so apps show as signed out. * feat(mcp): tick only the read tools on a first connection Changing data becomes opt-in; reconnecting still starts from the existing grant. * fix(helm): keep the MCP consent page on the frontend on a shared domain Caddy ingress turns Prefix /mcp into /mcp*, which also caught /mcp-authorize.
This folder contains docker-compose files we use for testing our example apache configuration with Baserow.
These testing files are designed to work with docker-compose so if your apache is not running inside a Docker container you will have to make modifications if using this files as examples.
Please read the ../../docs/installation/install-behind-apache.md for more information on this folder.