047 · Connectors
Connectors: the systems the agents reach (databases now, email and others later), described by descriptors rather than code, served by backends behind one interface, each kind declaring the capabilities it has, the query builder among them (spec_047_connectors)
| Status | Done in v0.8.0 (the owner’s request, 2026-10-20): CON-01–CON-20. Databases are the first category (spec_046_databases). CON-21–CON-25: the usability pass (2026-10-26). |
| Source | pkg/engine/connectors/ (connectors.go the types, backend.go the interface, descriptors.go, store.go, serve.go, builtin/ the built-in descriptors), pkg/engine/databases/ (the toolbox backend), pkg/engine/connectors.go, pkg/engine/querybuilder.go, pkg/engine/skills/builtin/sql-query/SKILL.md, pkg/config/hashtrust.go (OpenConnectorTrust), pkg/config/connectorscope.go, pkg/config/connectorfiles.go, pkg/engine/globalconnectors.go, pkg/service/server/connectors.go, pkg/service/server/globalconnectors.go, apps/desktop/web/src/studio/ConnectorsPane.tsx, apps/tray/internal/tray/connectors.go, apps/desktop/web/src/studio/connectorForm.ts |
| Tests | pkg/engine/connectors/connectors_test.go, pkg/config/connectorscope_test.go, pkg/engine/databases/*_test.go, pkg/engine/connectors_test.go, pkg/engine/querybuilder_test.go, pkg/engine/globalconnectors_test.go, pkg/service/server/globalconnectors_test.go, pkg/service/server/connectors_test.go, apps/desktop/web/src/studio/connectorForm.test.ts, apps/tray/internal/tray/connectors_test.go |
| Depends on | spec_046_databases, spec_009_mcp, spec_039_secrets, spec_013_skills, spec_040_studio |
Databases were the first system the agents could reach from Studio; email, issue trackers and others will follow. Each would otherwise be a package, a form and five RPCs of its own. A connector is instead described: a category (Databases) and its kinds (PostgreSQL, SQLite…) are YAML descriptors, like the agents’ Markdown files, saying what a kind’s settings are, which ready-made tools it offers, how it’s made read-only and what it can do. The code is a backend behind one interface (Toolbox, for databases), written once per way of serving and reused by every kind it serves. Adding a kind a backend can already serve is a descriptor, with no code and no new strings to translate.
- CON-01 A category descriptor (
categories/<id>.yaml) has anid, anameandhint, anicon, its MCPserver’s name and its tools’prefix(db:db__shop_list_tables), asecretPrefixfor its connections’ secrets (DB:DB_SHOP_PASSWORD), and thebackendthat serves its files that name no kind. A kind descriptor (kinds/<id>.yaml) has anid, itscategory,nameandhint, itsbackendand the backend’s ownsourcetype, itsfields(akey,label,help, atypeof text, number, secret, list or path,required,default),readOnly(thekeyset tovaluethat makes it read-only, and ahint; a kind without it can’t be), its ready-madetools(id, the backend’stype, astatementfor one that’s a query,aboutfor Studio,agentfor the agents with{connection}filled in,writes,on),queries(the backend’s tooltype, the SQLdialect,placeholders$1or@name, ahintand anexample),schema(astatementwhose rows are the tables, or a backend’sreader), and itscapabilities. - CON-02 A descriptor’s text is a string (English) or a map of languages (
en,es,fr-CA); Studio shows the person’s language, else its base (fr), else English. The built-in descriptors carry all three. - CON-03 The catalog (
connectors.Load) is the built-in descriptors (embedded,pkg/engine/connectors/builtin), then the global ones (~/.blitz/connectors/categories,/kinds), then the workspace’s (.agents/connectors/…). A later descriptor adds a category or kind; one whose ID is taken isn’t used, so a workspace can’t change what a built-in kind means. Unknown fields, an unknown backend or category, a capability the backend lacks or that misses what it needs, duplicate fields or tools, and bad IDs (a category can’t be namedkindsorcategories, nor share another’s server or prefix) are the descriptor’s problem: it’s listed with it, and not used.
- CON-04 A backend (
connectors.Backend, registered in its package’sinit) has anID, theCapabilitiesits kinds may offer, andParse,Check,Render(a connection file to and from the form) andServe(a category’s files as MCP servers). The capabilities are optional interfaces: test (Tester: connect as written and list the tools), try (Tryer: run one tool as written), queries (the user’s own tools, a statement with parameters each), schema (SchemaReader: the tables and their columns) and query-builder (CON-12; needs schema and queries). A kind lists the ones it has, each checked against its backend (by the list and by the interface). - CON-05 The toolbox backend (
pkg/engine/databases) serves the database kinds with MCP Toolbox for Databases in-process (spec_046_databases), with every capability. It reads a schema by running the kind’sschema.statementas a query (PostgreSQL and AlloyDB frominformation_schema.columnswith the tables’ comments; SQLite frompragma_table_info), or BigQuery’sbigqueryreader: the datasets (the allowed ones), their tables, and each table’s metadata (no query is billed), up toMaxSchemaTables.
- CON-06 A connection is one file,
<name>.yaml, in~/.blitz/connectors/<category>/(a global one, every workspace’s: Settings changes it, CON-18) or.agents/connectors/<category>/(the workspace’s: its Studio changes it), written by its kind’s backend with a first line naming its kind (# kind: postgres). A hand-written file without one is its category’s backend’s to read (Toolbox’s takes the first kind of its source’s type).connectors.Listreads every category’s, the global ones first. - CON-07 Saving (
connectors.Save) checks the name (lower case, digits and _), the kind’s required and number settings, read-only only where the kind can be, its tools and queries (names not taken, a statement and a description each, parameter types), and what the backend says; problems mean nothing is written. A secret field’s value is kept as the Blitz secret<SecretPrefix>_<NAME>_<FIELD>in the connection’s scope and the file names it; a rename moves it; deleting a connection deletes every secret its category’s kinds could have given it, so none is left behind even when its file can’t be read (spec_039_secrets). A hand-written.ymlfile is saved where it is. - CON-08 Each category’s files are served as their backends say (
connectors.With), in place of the in-process servers there were; a server of the user’s own with a connector server’s name wins, with a warning. The settings watch notices any connector file, descriptors too, added, changed or removed (AllFiles,Fingerprint), and serves them again (ReloadConnectors).
- CON-09 A workspace’s connection files come with the workspace, so a clone could name the person’s global secrets and an address of its own. One is trusted only when the person saved it, as it is now, in Studio (its content hash is kept in
connector-trust.jsonin the settings folder,config.OpenConnectorTrust), or trusted the project’s settings (spec_031_project_config). An untrusted one is still served, but its${NAME}s are only the workspace’s own secrets, and its tools all ask first, read-only or not. Global connections are the person’s own. Blitz never decides for them: Studio says so on the file and offers Save and trust. A trust decision goes with its file: a rename, a delete or Make global forgets the old path’s (HashTrust.Forget). - CON-09 2026-11-05 (scan N26-engine-sub-1#19, #20, #22: every file of a category goes to one Toolbox with one set of secrets, so an untrusted file’s
${NAME}was filled from the global value a trusted file of the same name had; Studio’s Test, Try it and Read the tables used the global secrets on an untrusted file; and one workspace file that didn’t load stopped the category’s server, the person’s global connections with it). An untrusted file’s${NAME}s are renamed as Toolbox reads it and filled from the workspace’s own secrets alone, kept apart in the server’s environment (MCPServerConfig.WorkspaceOnly), so a global file’s secret never reaches it. Studio’s Test, Try it and Read the tables give an untrusted workspace file the same (connectors.Env.Trusted; a connection with no file yet, typed in the form, is the person’s own). A workspace file that doesn’t load on its own (YAML Toolbox refuses, a secret it names unset, a SQLite file that isn’t there) is left out with a warning ("… isn’t served: …"), and the rest are served. A ready-made tool that writes isn’t written into a read-only connection’s file (ReadyTool.Writes).
- CON-17 Any connection, a global one too, can be turned off in a workspace: its tools aren’t the agents’ there, so the person chooses what each workspace’s agents can reach (which data a project’s answers draw on). It’s on until they turn it off. One that’s off keeps its file and secrets, is listed with Off in this workspace, and can still be tested, tried, read and drafted with in Studio. The choice is the person’s, kept by the workspace (its folder, links resolved) in
connector-scope.jsonin the settings folder (config.OpenConnectorScope), never in the project, so a repository can’t turn a connection on or off; a rename keeps it and a delete forgets it, in every workspace. Turning one on or off serves its category again (CON-08). - CON-20 The tray has the same switch (spec_038_electron EL-111): each workspace’s submenu ends with Connectors, every connection it reaches as a check item, ticked while it’s on there; a click turns it off or on in that workspace alone (
SetConnectorEnabled). It reads the connection files (the global folder’s and the workspace’s, every category’s but the descriptors’ folders) and the person’s choices from disk, as it reads the workflows. Like Studio, it never changes a connection, only whether the workspace uses it; a workspace with connections has a submenu even with no jobs or workflows. - CON-21 2026-10-26 (the owner’s usability pass). A kind descriptor’s
orderplaces it among its category’s kinds, lower first; kinds without one come after, in the order they’re read (orderOf, after the checks, so which duplicate is refused doesn’t change). The built-in ones are simplest to set up first: SQLite 1, PostgreSQL 2, BigQuery 3, AlloyDB 4. - CON-22 2026-10-26. A new connection starts with its kind: the category’s kinds as tiles (name and hint, in
order; a category with one kind skips them), and Change beside the chosen kind goes back to them (the settings they share kept,withKind). A kind picked from the tiles starts read-only where it can be, as a new form with a kind does. Then, in the order they’re filled: Connection URL for a kind with ahostfield (parseConnectionURL: host, port, the path as the database, user and password, the password as the secret it is, only the fields the kind has; the box is cleared once it’s read, since it holds the password, and says what it filled), the kind’s fields (apathfield with Choose…, the app’sChooseFile, typed in a browser: in Studio it opens in the workspace, or the folder of the path the field holds, and a file inside the workspace is kept relative to it,./data/x.db, as DB-17 resolves it;startFolder,relativeTo), the name, then What it holds and Read-only. - CON-23 2026-10-26. A new connection’s name follows its database’s (a file’s base name without
.sqlite,.dband the like; else its project’s:suggestName) until another is typed, and what’s typed is made a valid name as it’s typed (typedName: lower case, other characters_, no leading digits, at most 40;slugNamethe finished form). The tool-name hint, the folder a connection is kept in, the descriptor folder, the category server’s state and the full list of descriptors that can’t be used show with advanced settings; without them a single line says how many kinds can’t be used, with why on hover. - CON-24 2026-10-26. Test and save saves a new connection only once it connects (
Test, for a kind that can); when it can’t, the footer says why with Save anyway. A new connection saved stays open as saved (“now choose its tools”), and its Ready-made tools, Your queries and Test the connection (Test, Read the tables) show from then on; before, a line says they come once it’s saved. - CON-25 2026-10-26. Settings › Connectors holds the global MCP servers below its categories, with advanced settings (spec_009_mcp MCP-46), and Studio › Connectors a workspace’s, beside the global ones (MCP-50), and shows in simple mode (spec_024_desktop DSK-106).
/connectand the composer’s database menu (its Connect a database…, spec_059_data DAT-40) open it (DSK-106).
- CON-18 A workspace’s Studio never changes what other workspaces use. The global connections are the person’s, changed only in Settings › Connectors (the same pane,
ConnectorsPanewith no workspace, after MCP servers): their list, the form, Test, Try it, Read the tables and Write a query, throughConfigService(ListGlobalConnectors,SaveGlobalConnector,DeleteGlobalConnector,TestGlobalConnector,TryGlobalConnectorTool,ReadGlobalConnectorSchema,DraftGlobalConnectorQuery;engine.GlobalConnectors), with no workspace: the built-in and global descriptors only (a kind of a workspace’s own can’t serve every workspace), the global secrets, and the built-in sql-query skill. A change is served in every open workspace at once. Settings asks before closing, or picking another section, with a form’s changes unsaved, as Studio does (spec_040_studio STU-02). Studio lists the global connections, each with its switch (CON-17); one opened shows its form as it is, unchangeable, with Edit in Settings, and no Test or Write a query.WorkspaceService.SaveConnectorandDeleteConnectorrefuse a global one (CONNECTOR_GLOBAL), and a connection saved in Studio is the workspace’s: its form has no choice of where. - CON-19 Make global (Studio, on one of the workspace’s connections;
WorkspaceService.MakeConnectorGlobal,connectors.MakeGlobal) moves it to the global folder with its secrets (from the workspace’s scope to the global one), after a confirmation saying every workspace will have it, that Settings changes it from then on, and that it leaves the workspace’s.agentsfolder (so a team that committed it loses it). Whether it’s on in this workspace goes with it, and a relative path becomes the full one it named (spec_046_databases DB-17). It isn’t offered with unsaved changes, and an untrusted file (CON-09) can’t be made global until the person saves it (CONNECTOR_NOT_TRUSTED): a clone’s file mustn’t reach the global secrets by a click. Problems, with nothing moved: its kind or category is the workspace’s own descriptor, it’s a custom file (moved by hand), or a global connection has its name. There’s no way back from Studio: Settings can delete it, and the workspace can make its own again.
- CON-10
WorkspaceService.ListConnectors(the categories with their folders and their server’s state, the kinds, every descriptor’s origin, file and problem, and the connections, each saying whether it’s trusted and whether it’s on here),SaveConnector(the workspace’s; problems with nothing written;CONNECTOR_NOT_FOUNDfor a previous name that isn’t there,CONNECTOR_GLOBALfor a global one),DeleteConnector(the same),MakeConnectorGlobal(CON-19),SetConnectorEnabled(CON-17;CONNECTOR_NOT_FOUND),TestConnector,TryConnectorTool,ReadConnectorSchema(a problem when it reads no table) andDraftConnectorQuery(CON-12). They replace v0.8.0’s development-only database RPCs. - CON-11 Studio › Connectors (
ConnectorsPane), after Workflows with Secrets (spec_040_studio STU-02): each usable category with its icon, name, hint, server state and +, its connections (kind, scope, not trusted yet, off in this workspace, read-only or not, tool count, description) each with a switch turning it on or off here (CON-17), and the descriptors that can’t be used with why. A connection’s form slides in over the list, drawn from its kind’s descriptor: name and description, the folder it’s kept in, the category’s kinds, the fields with their labels and help, Read-only with the kind’s hint (when it can be), the ready-made tools, and as the kind can: Your queries with Try it and Write a query, Read the tables, and Test; a workspace connection’s has Make global (CON-19), and a global one’s is shown as it is (CON-18). The strings are in English, Spanish and French (DB-15). - CON-11a 2026-11-05 (scan N26-desktop-4#9: Try it ran a statement that may write, a
DELETEsay, at once, while the hint said it asks before it runs). Try it on a query whose statement may write (readsOnlyfalse) asks first (Run a statement that may write?, Run it); one that only reads runs at once.
- CON-12 A kind with query-builder has Write a query in Your queries: the person says what they’re looking for.
Workspace.DraftConnectorQueryreads the connection’s schema as written: none read (it can’t connect, or holds no table it can read) is the draft’s problem, and no model is asked. A schema read is kept forSchemaTTL(5 minutes), by the connection as written and where it is, so drafts in a row read it once. Then the sql-query skill (built in,pkg/engine/skills/builtin/sql-query; a workspace’s own skill of that name is used instead) is the brief of the suggestions model (else the reviewer’s, else the main one), given the connection’s kind and description, its dialect and placeholders, that it’s read-only, the tool names taken, the schema (a table a line with its columns and comments, cut atMaxSchemaText), and the request, redacted. The table and column names go to the model; no rows do. - CON-13 The reply (JSON: name, description, statement, parameters, notes; or a problem when the schema can’t answer) becomes a query the form can take: its name made valid and not taken (
top,top_2), parameter types one of the four, its parameters made the statement’s (by position, one for each$N, a missing one added as text, extra ones dropped; by name, one for each@name), and a note when it may write. Nothing is saved: the dialog shows the query, its notes and how many tables were read, and Use adds it to the form to try and save.
- CON-14 Categories and kinds are descriptors; backends are code, compiled in. Go’s
pluginpackage isn’t used (it doesn’t build on Windows nor hermetically); a system outside Blitz is reached as an MCP server. - CON-15 A descriptor can’t add what its backend can’t serve: a database kind needs its Toolbox source in Blitz’s copy (spec_046_databases DB-01).
- CON-16 The sql-query skill is also there for the agents, like any built-in skill, when they write SQL for a connector.
- More categories (Email first) and an MCP backend, so any MCP server becomes a connector by a descriptor alone.
- Choosing which agents get a connection (every agent in a workspace where it’s on does).
- Running a drafted query to check it before it’s offered (Try it does it by hand).