Files
baserow/web-frontend/modules/agent/routes.js
alamin-br 2e9746068d feat(agent): let Agents use tools from MCP servers (#6664)
* feat(agent): call tools of remote MCP servers (POC)

Agents can use tools from external apps through MCP servers that an editor adds and reviews.

* feat(agent): connect apps and review their MCP tools (POC)

Editors add MCP servers to an Agent, pick which tools it may call, and see those calls in chat.

* fix(builder): skip integration events for apps without an integrations list

Creating an MCP server on an Agent raised a TypeError toast, because Agents keep no integrations in the store.

* feat(agent): sign in to MCP servers with OAuth (POC)

Popular hosted MCP servers (Linear, Notion, Airtable, Atlassian, Sentry) only accept OAuth sign-in.

* feat(agent): say when an MCP server refuses the key, and require it

A wrong key showed as an unreachable server and an empty tool list.

* fix(agent): bind MCP sign-in to its editor and harden the MCP client

A sign-in link opened by someone else could connect their account to the server.
A provider outage disconnected accounts, and bad tool lists failed or looped.

* feat(agent): copy MCP servers and their tool choices with the Agent

Duplicating or exporting an Agent dropped its connected apps.

* fix(agent): don't ask for an MCP credential the server no longer uses

Switching away from an API key, or replacing a client Baserow registered,
blocked URL changes until a credential nobody had was entered.

* fix(agent): refuse an MCP sign-in when the server changed meanwhile

Moving the server during sign-in made the callback fail with a 500.

* fix(agent): give each MCP exchange an overall deadline

A server sending a little at a time could hold a web worker or a reply forever.

* fix(agent): tell the model what the MCP server answered when a call fails

Invalid arguments and a refused key were reported as an unreachable server,
so the model couldn't fix its call or explain the problem.

* fix(agent): refresh MCP tokens that come without a lifetime

Such a token was never refreshed, so the app stopped working once it expired.

* fix(agent): start imported MCP tools off until reviewed

An export file or template could turn on tools of an app nobody here reviewed.

* fix(agent): hash imported MCP tools from their imported definition

A file could carry a reviewed hash for a definition the server never had.

* fix(agent): only approve the MCP tool definition the editor reviewed

A tools list left open across a refresh could turn on a changed tool unseen.

* fix(agent): bound MCP OAuth requests and expire tokens without a refresh token

A slow token endpoint held the row lock and a reply indefinitely.
An expired token with nothing to refresh it still showed the app as connected.

* fix(agent): drop MCP tools fetched from a server that was moved meanwhile

A refresh racing a URL change stored the old server's tools on the new one.

* fix(agent): let only the editor use up an MCP sign-in, once

Another user's attempt voided the editor's sign-in, and two requests at once
could both exchange the code.

* fix(agent): only copy connected apps the copier may read

A duplicate carries the app's key, so a role that can't read the app shouldn't get it.

* fix(agent): say when the browser blocks the MCP sign-in window

A blocked popup showed a backend 'not connected' error instead.

* chore(agent): remove unused needsReview from the MCP servers composable

* fix(agent): hash MCP tool titles as stored

A copied tool with a title over 255 characters never matched its server again.

* fix(agent): forget the old refresh token on a new MCP sign-in

Signing in as another account could later switch back to the first one.

* fix(agent): wait for a URL change in flight before storing MCP tools

An unlocked read let a refresh store the old server's tools on the new one.

* chore(agent): drop a CancelledError clause that never applies

* fix(agent): review an MCP server's tools after its URL changes

A moved server's new tools were listed off with no review prompt, and clearing
your own client id asked for a secret that would be thrown away.

* fix(agent): always tell the opener how an MCP sign-in ended

An unexpected error left the sign-in window on 'Connecting' and the opener waiting.

* chore(agent): give the removed MCP tool modifier its base class

* fix(agent): keep MCP credentials out of object reprs

A reply's request object printed the server's key in error reports and logs.

* fix(agent): use the current secret of an editor's own MCP client

Adding a secret later kept the old 'no secret' method, so refreshes failed and
the app disconnected.

* fix(agent): don't store MCP tokens for a server moved during sign-in

A URL saved while the provider answered got the old server's tokens, which then
went to the new server.

* fix(agent): clear only the expired MCP token, not a newer sign-in

A reply clearing an expired token could undo a sign-in that had just finished.

* docs(core): note that Agents also narrow imported integration types

* fix(agent): give MCP tools with clashing model names a distinct name

A second tool whose name matched another after the 64-character cut was dropped
while still shown as on.

* fix(agent): send a registered MCP client secret when the server doesn't say how

RFC 7591 defaults to Basic auth; sending nothing made every sign-in fail.

* fix(agent): try the next OAuth metadata URL when one can't be reached

One unreachable candidate ended discovery although the others would answer.

* fix(agent): read only the headers of the MCP OAuth discovery probe

A server streaming its initialize answer made sign-in time out.

* fix(agent): keep a registered MCP client registered when its id is sent back

Writing back the same client id turned Baserow's own client into an editor's one.

* fix(agent): ask for the OAuth client secret in its own words

The error talked about a header, which the OAuth form doesn't have.

* refactor(integrations): move MCP serializers and errors to their own modules

Matches the layout of the other API modules.

* fix(agent): count MCP tools when deciding whether web search fits

Gemini 2.5 can't combine search with function tools, and MCP tools are function tools too.

* fix(integrations): require https sign-in endpoints for https MCP servers

The MCP authorization spec requires it, and the code, refresh token and client secret would otherwise go out in clear text.

* fix(integrations): send an editor's MCP client secret with Basic auth

RFC 6749 makes Basic the method every server supports; the body form is only used when the server lacks it.

* fix(integrations): say when an MCP server doesn't use OAuth

Starting a sign-in for it answered that the integration doesn't exist.

* docs(integrations): document the MCP OAuth helpers

* fix(integrations): only use MCP OAuth tokens with the connection they belong to

A sign-in or refresh racing a move or a disconnect could store or send one server's tokens to another. A generation on the server now ties each sign-in to its connection.

* fix(integrations): don't ask for an MCP credential the change drops anyway

The form had to predict which empty secrets to send around the check; it now sends only what the editor changed.

* refactor(integrations): let integration types mount their own API urls

The MCP endpoints were mounted by the Agent application type.

* fix(integrations): limit the size of MCP and OAuth responses

One Agent's server could make a shared worker load any amount of data. Uses the HTTP request integration's limit.

* feat(integrations): audit MCP tool and account changes and send them to other editors

They changed the integration outside its update action, so they weren't logged and other editors only saw them after a reload.

* fix(agent): keep MCP servers in the integration store and match each sign-in to its result

Other editors' changes now arrive live, late answers no longer land in a modal opened since, and a sign-in finishes even when the provider cuts the popup off. The review also shows each tool's parameters.

* fix(integrations): register with MCP servers when Baserow runs on this machine

An authorization server can't fetch a client metadata document from localhost, so signing in failed on local https instances.

* style(agent): format the connected apps test

* fix(integrations): keep MCP OAuth tokens with their issuer, lock like integration updates, audit before notifying

A zero lifetime now means expired, a new issuer or client drops the old account,
and MCP locks only the integration row so PATCH can't deadlock with them.

* fix(agent): don't run MCP writes that follow a held call

They can't wait for approval yet, so they're refused until the held call is decided.

* fix(agent): keep MCP tool picks with the definition they were made for

Another editor's refresh could re-enable a changed tool, and a new tool crashed the
list. The review now also shows each tool's full input schema.

* fix(agent): scroll the MCP tools modal, not its list

The list had its own scrollbar inside the modal, and the checkbox labels showed cut off in the narrow columns.

* feat(agent): take whether an MCP tool changes data from the server

Editors had to answer it for every tool, and every tool started ticked. The server's read-only hint answers it; a tool without one still counts as changing data.

* feat(agent): ask first before calling MCP tools

MCP tools act with the server's own credential, so editors need the same Allow / Ask first choice as for workspace tools. An approval only holds for the server, account and tool definition it was given for.
2026-11-11 17:47:17 +01:00

15 lines
325 B
JavaScript

import path from 'path'
export const routes = [
{
name: 'agent-mcp-oauth-callback',
path: '/agent/mcp-oauth-callback',
file: path.resolve(__dirname, 'pages/mcpOAuthCallback.vue'),
},
{
name: 'agent-application',
path: '/agent/:agentId',
file: path.resolve(__dirname, 'pages/agent.vue'),
},
]