13 Commits
Author SHA1 Message Date
alamin-br e7381b5384 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.
2026-12-01 15:44:39 +01:00
Jonathan Adelineandpeter_baserow a8bf3b73ae feat: redesign app sidebar (#6798)
* feat: redesign sidebar workspace navigation

* feat: redesign the sidebar footer and account menu

Match the account menu to the sidebar prototype and reuse the admin
navigation in a submenu. Keep Add new above the footer while the
application list scrolls.

* fix: show the sortable indicator only when dragging

* feat: refine workspace sidebar application navigation

* feat: reorganize workspace sidebar shortcuts

* fix: isolate workspace sidebar menus and actions

* fix: cancel sortable drops on hidden lists

* fix(enterprise): allow retrying Direct support

* feat: simplify the workspace overview header

* fix: prevent horizontal overflow around the sidebar

Constrain animated tree groups to the width of the sidebar so long labels truncate. On narrow screens, let the sidebar expand over the content instead of reducing the usable page width.

* fix: fit workspace cards and creation menus on mobile

* test: keep the current table selected after reload

* fix: undo and redo edits across expanded sidebar applications

* fix: keep sidebar groups out of the tab order

* fix: highlight the active database in the tables tour

* feat: label workspace integrations in the settings menu

* fix: keep the workspace sidebar and guided tour usable on phones

* fix: undo sidebar row imports in the destination database

* fix: keep the guided tour highlight on the current step

* fix: show an empty state in the workspace picker

* fix: confirm workspace deletion before moving it to trash

* feat: open registered workspace settings tabs from the sidebar

* fix: keep the sidebar logo the same size across workspaces

---------

Co-authored-by: peter_baserow <peter@baserow.io>
2026-11-23 20:42:20 +04:00
alamin-br ba24b135b2 fix: rotate refresh tokens and revoke the session when an old one is reused (#6519)
* fix: rotate refresh tokens and revoke the session when an old one is reused

A refresh token could be replayed to get new access tokens until it expired,
so a leaked token gave access for up to seven days.

* test: mint the refresh token inside the frozen time

The token was minted at the real time, so refreshing at an earlier frozen time failed once the clock passed it.

* fix: document the rotated refresh token in the token refresh response

The schema checked simplejwt's own rotation setting, which is off, so the API docs left out refresh_token.

* fix: keep the user session valid across refresh token rotation

The previous release crashed on the new cookie payload, and the cookie stopped
working as soon as its refresh token rotated.

* test: sign out through the API in the secure file serve test

Signing out revokes the session, which is what the user session cookie checks now.
2026-10-28 13:39:52 +01:00
alamin-br 585694941f feat(mcp): choose tools per connection and share list_views with Kuma (#6425)
* feat(assistant): add MCP metadata decorator for Kuma tools

* feat(mcp): offer Kuma's read tools over MCP from the same definition

Builder page lookups are now scoped to the chat workspace so a read can't cross workspaces.

* fix(mcp): keep endpoints without an allow-list on today's tools

A null allow-list now means the tools enabled on 2026-10-19, so new tools need an explicit grant. Cross-workspace tests assert the exact exception.

* fix(assistant): treat a workflow in another workspace as missing

A different error for a foreign workflow let a client probe workflow IDs across workspaces.

* feat(mcp): return tool errors as MCP error results

Expected errors reach the client as readable error results without an ERROR log, only unexpected ones are logged.

* chore: add changelog entry for Kuma read tools over MCP

* fix(mcp): keep null grants on legacy tools in the consent screen

A null allowed_tools made the consent screen tick every tool on reconnect.

* chore(mcp): tidy tests and validation error handling

Only argument validation maps pydantic errors to client errors; one raised in a tool body is now an internal error.

* chore(mcp): rewrap get_allowed_tools docstring

* chore(mcp): drop null grant handling from the consent page

The consent API now sends the legacy tool list for a grant with no saved tools, so the page never receives null.

* fix(mcp): keep client errors readable and server errors logged

Row tool errors on develop reached the client verbatim; the new mapping hid some behind "Internal error.".

* fix(mcp): map remaining field errors and document the legacy allow-list

* feat(mcp): keep existing connections on the tools they had

Fill every null allow-list with the legacy tools, so tools added later never reach an existing endpoint. New endpoint keys store their tools explicitly.

* feat(mcp): group tools by area

The consent page lists tools by group and offers presets built from them. It also gets the tools each workspace can't use.

* feat(mcp): read-only and full-access presets on the consent page

The tool list moves into McpToolPicker so Settings can reuse it.

* feat(mcp): change a connection's tools without reconnecting

PATCH on an OAuth connection or an endpoint key replaces its tools, checked against what the endpoint can use, and logs the change in the audit log.

* feat(mcp): edit tools from Settings

Each connected app gets an Edit tools modal and a hint for the tools it has off, since new tools never turn on by themselves.

* chore(mcp): changelog for tool groups and Settings

* test(mcp): point the OAuth e2e test at the tool picker checkboxes

* fix(mcp): keep stored tools on edit and check availability at consent

Sending back a connection's own list failed when one of its tools was unavailable, and
consent stored tools the workspace can't use. Removing tools now needs no permission.

* fix(mcp): keep hidden tools when editing a connection's tools

Ticking any box in Settings dropped granted tools that are only unavailable for now, and a
slow save for one app could close the modal opened for another.

* refactor(mcp): share list_views from core and expose database tools only

Tool definitions live in contrib and know nothing about MCP or Kuma, so the Agent Builder can reuse them. Builder and automation tools ship later with their write tools.

* fix(mcp): reuse REST errors, validate row values and name blocked fields

Bad row values and field-level denials now read like the REST API's errors instead of "Internal error." or a generic denial.

* refactor(mcp): drop tool availability until a tool needs it

No tool overrides is_available since the Kuma tools left this PR. Also loads form field options in one query in list_views and logs stored tool names.
2026-10-21 12:14:33 +02:00
alamin-br 2c5fca6538 feat(mcp): OAuth sign-in for MCP clients with CIMD, DCR and consent (#6312)
* 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.
2026-10-15 08:40:09 +00:00
716d43a9a8 Nuxt 3 migration (#4342)
Update the nuxt3 version.

Co-authored-by: Jonathan Adeline <jonathan@baserow.io>
Co-authored-by: Bram Wiepjes <bramw@protonmail.com>
Co-authored-by: Cezary <cezary@baserow.io>
Co-authored-by: Tsering Paljor <tsering@baserow.io>
Co-authored-by: Przemyslaw Kukulski <przemyslaw+gh@baserow.io>
Co-authored-by: Bram <bram2w@users.noreply.github.com>
2026-01-22 10:27:19 +01:00
Jérémie Pardou 63117027a6 Add builder first e2e tests 2024-11-14 12:30:42 +00:00
Nigel Gott a4e9087663 Resolve "Fix web-frontend not loading for IE and Safari versions less than 16.4" 2023-07-20 15:55:53 +00:00
Nigel Gott eecdb84307 Resolve "Allow searching in Link to table field cells" 2023-07-10 09:13:30 +00:00
Peter Evans 75316a4a6e Resolve "Implement Postgres full-text search" 2023-07-05 16:01:03 +00:00
Nigel Gott 74c1a03f5d Enable all sensible storage backends 2023-05-19 07:21:55 +00:00
Petr Stribny fda53607c7 CI for e2e tests 2023-02-27 16:05:07 +00:00
Petr Stribny 462848efbc Resolve "Add e2e tests" 2023-01-30 13:26:33 +00:00