feat: named MCP tool sets served at their own URL

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
hugocasa
2026-11-13 17:36:12 +01:00
co-authored by Claude Opus 5.5
parent 2e3e9fc2e5
commit e7bce3860f
35 changed files with 1207 additions and 77 deletions
+1 -1
View File
File diff suppressed because one or more lines are too long
@@ -0,0 +1,15 @@
{
"db_name": "PostgreSQL",
"query": "\n UPDATE workspace_settings\n SET\n ai_config = source_ws.ai_config,\n large_file_storage = source_ws.large_file_storage,\n ducklake = source_ws.ducklake,\n dbt_warehouses = source_ws.dbt_warehouses,\n mcp_tool_sets = source_ws.mcp_tool_sets,\n datatable = source_ws.datatable,\n git_app_installations = source_ws.git_app_installations,\n add_admins_and_developers_to_forks = source_ws.add_admins_and_developers_to_forks\n FROM workspace_settings source_ws\n WHERE source_ws.workspace_id = $1\n AND workspace_settings.workspace_id = $2\n ",
"describe": {
"columns": [],
"parameters": {
"Left": [
"Text",
"Text"
]
},
"nullable": []
},
"hash": "0734fedf96224932c067fa9be615b8301addc2d10abb2a3e35d43b56201baf83"
}
@@ -0,0 +1,244 @@
{
"db_name": "PostgreSQL",
"query": "\n SELECT\n workspace_id,\n slack_team_id,\n teams_team_id,\n teams_team_name,\n teams_team_guid,\n slack_name,\n slack_command_script,\n teams_command_script,\n slack_email,\n slack_oauth_client_id,\n slack_oauth_client_secret,\n customer_id,\n plan,\n webhook,\n webhook_events,\n ai_config,\n dbt_warehouses,\n mcp_tool_sets,\n large_file_storage,\n datatable,\n ducklake,\n git_sync,\n deploy_ui,\n default_app,\n default_scripts,\n mute_critical_alerts,\n color,\n operator_settings,\n git_app_installations,\n auto_invite,\n error_handler,\n success_handler,\n variable_expiration_handler,\n public_app_execution_limit_per_minute,\n error_handler_fallback_to_instance_alerts,\n guest_jwt_public_key,\n guest_jwt_jwks_url,\n add_admins_and_developers_to_forks\n FROM\n workspace_settings\n WHERE\n workspace_id = $1\n ",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "workspace_id",
"type_info": "Varchar"
},
{
"ordinal": 1,
"name": "slack_team_id",
"type_info": "Varchar"
},
{
"ordinal": 2,
"name": "teams_team_id",
"type_info": "Text"
},
{
"ordinal": 3,
"name": "teams_team_name",
"type_info": "Text"
},
{
"ordinal": 4,
"name": "teams_team_guid",
"type_info": "Text"
},
{
"ordinal": 5,
"name": "slack_name",
"type_info": "Varchar"
},
{
"ordinal": 6,
"name": "slack_command_script",
"type_info": "Varchar"
},
{
"ordinal": 7,
"name": "teams_command_script",
"type_info": "Text"
},
{
"ordinal": 8,
"name": "slack_email",
"type_info": "Varchar"
},
{
"ordinal": 9,
"name": "slack_oauth_client_id",
"type_info": "Varchar"
},
{
"ordinal": 10,
"name": "slack_oauth_client_secret",
"type_info": "Varchar"
},
{
"ordinal": 11,
"name": "customer_id",
"type_info": "Varchar"
},
{
"ordinal": 12,
"name": "plan",
"type_info": "Varchar"
},
{
"ordinal": 13,
"name": "webhook",
"type_info": "Text"
},
{
"ordinal": 14,
"name": "webhook_events",
"type_info": "TextArray"
},
{
"ordinal": 15,
"name": "ai_config",
"type_info": "Jsonb"
},
{
"ordinal": 16,
"name": "dbt_warehouses",
"type_info": "Jsonb"
},
{
"ordinal": 17,
"name": "mcp_tool_sets",
"type_info": "Jsonb"
},
{
"ordinal": 18,
"name": "large_file_storage",
"type_info": "Jsonb"
},
{
"ordinal": 19,
"name": "datatable",
"type_info": "Jsonb"
},
{
"ordinal": 20,
"name": "ducklake",
"type_info": "Jsonb"
},
{
"ordinal": 21,
"name": "git_sync",
"type_info": "Jsonb"
},
{
"ordinal": 22,
"name": "deploy_ui",
"type_info": "Jsonb"
},
{
"ordinal": 23,
"name": "default_app",
"type_info": "Varchar"
},
{
"ordinal": 24,
"name": "default_scripts",
"type_info": "Jsonb"
},
{
"ordinal": 25,
"name": "mute_critical_alerts",
"type_info": "Bool"
},
{
"ordinal": 26,
"name": "color",
"type_info": "Varchar"
},
{
"ordinal": 27,
"name": "operator_settings",
"type_info": "Jsonb"
},
{
"ordinal": 28,
"name": "git_app_installations",
"type_info": "Jsonb"
},
{
"ordinal": 29,
"name": "auto_invite",
"type_info": "Jsonb"
},
{
"ordinal": 30,
"name": "error_handler",
"type_info": "Jsonb"
},
{
"ordinal": 31,
"name": "success_handler",
"type_info": "Jsonb"
},
{
"ordinal": 32,
"name": "variable_expiration_handler",
"type_info": "Jsonb"
},
{
"ordinal": 33,
"name": "public_app_execution_limit_per_minute",
"type_info": "Int4"
},
{
"ordinal": 34,
"name": "error_handler_fallback_to_instance_alerts",
"type_info": "Bool"
},
{
"ordinal": 35,
"name": "guest_jwt_public_key",
"type_info": "Text"
},
{
"ordinal": 36,
"name": "guest_jwt_jwks_url",
"type_info": "Text"
},
{
"ordinal": 37,
"name": "add_admins_and_developers_to_forks",
"type_info": "Bool"
}
],
"parameters": {
"Left": [
"Text"
]
},
"nullable": [
false,
true,
true,
true,
true,
true,
true,
true,
false,
true,
true,
true,
true,
true,
true,
true,
true,
true,
true,
true,
true,
true,
true,
true,
true,
true,
true,
true,
false,
true,
true,
true,
true,
true,
false,
true,
true,
false
]
},
"hash": "0eb27f0609977fa1d30a5e72fd7b1134a8e184872ece98705c30eb3a77117d51"
}
@@ -0,0 +1,15 @@
{
"db_name": "PostgreSQL",
"query": "INSERT INTO workspace_settings (workspace_id, slack_team_id, slack_name, slack_command_script, slack_email, customer_id, plan, webhook, webhook_events, ai_config, large_file_storage, git_sync, default_app, default_scripts, deploy_ui, mute_critical_alerts, color, operator_settings, role_overrides, teams_command_script, teams_team_id, teams_team_name, git_app_installations, git_credentials, ducklake, dbt_warehouses, mcp_tool_sets, slack_oauth_client_id, slack_oauth_client_secret, slack_signing_secret, datatable, teams_team_guid, auto_invite, error_handler, success_handler, public_app_execution_limit_per_minute, error_handler_fallback_to_instance_alerts, guest_jwt_public_key, guest_jwt_jwks_url, add_admins_and_developers_to_forks, remote_deploy_target, remote_deploy_target_changed_at, variable_expiration_handler) SELECT $1, slack_team_id, slack_name, slack_command_script, slack_email, customer_id, plan, webhook, webhook_events, ai_config, large_file_storage, git_sync, default_app, default_scripts, deploy_ui, mute_critical_alerts, color, operator_settings, role_overrides, teams_command_script, teams_team_id, teams_team_name, git_app_installations, git_credentials, ducklake, dbt_warehouses, mcp_tool_sets, slack_oauth_client_id, slack_oauth_client_secret, slack_signing_secret, datatable, teams_team_guid, auto_invite, error_handler, success_handler, public_app_execution_limit_per_minute, error_handler_fallback_to_instance_alerts, guest_jwt_public_key, guest_jwt_jwks_url, add_admins_and_developers_to_forks, remote_deploy_target, remote_deploy_target_changed_at, variable_expiration_handler FROM workspace_settings WHERE workspace_id = $2",
"describe": {
"columns": [],
"parameters": {
"Left": [
"Varchar",
"Text"
]
},
"nullable": []
},
"hash": "1ecc9cacf02398a7cee0719788e76e28c34052b083bcb51e7e5c104690128d5b"
}
@@ -0,0 +1,15 @@
{
"db_name": "PostgreSQL",
"query": "UPDATE workspace_settings SET mcp_tool_sets = $1 WHERE workspace_id = $2",
"describe": {
"columns": [],
"parameters": {
"Left": [
"Jsonb",
"Text"
]
},
"nullable": []
},
"hash": "4357736f4c8a74d384eff726369d364210c006055a72f52b1d00dc0efd6e5990"
}
@@ -1,15 +0,0 @@
{
"db_name": "PostgreSQL",
"query": "INSERT INTO workspace_settings (workspace_id, slack_team_id, slack_name, slack_command_script, slack_email, customer_id, plan, webhook, webhook_events, ai_config, large_file_storage, git_sync, default_app, default_scripts, deploy_ui, mute_critical_alerts, color, operator_settings, role_overrides, teams_command_script, teams_team_id, teams_team_name, git_app_installations, git_credentials, ducklake, dbt_warehouses, slack_oauth_client_id, slack_oauth_client_secret, slack_signing_secret, datatable, teams_team_guid, auto_invite, error_handler, success_handler, public_app_execution_limit_per_minute, error_handler_fallback_to_instance_alerts, guest_jwt_public_key, guest_jwt_jwks_url, add_admins_and_developers_to_forks, remote_deploy_target, remote_deploy_target_changed_at, variable_expiration_handler) SELECT $1, slack_team_id, slack_name, slack_command_script, slack_email, customer_id, plan, webhook, webhook_events, ai_config, large_file_storage, git_sync, default_app, default_scripts, deploy_ui, mute_critical_alerts, color, operator_settings, role_overrides, teams_command_script, teams_team_id, teams_team_name, git_app_installations, git_credentials, ducklake, dbt_warehouses, slack_oauth_client_id, slack_oauth_client_secret, slack_signing_secret, datatable, teams_team_guid, auto_invite, error_handler, success_handler, public_app_execution_limit_per_minute, error_handler_fallback_to_instance_alerts, guest_jwt_public_key, guest_jwt_jwks_url, add_admins_and_developers_to_forks, remote_deploy_target, remote_deploy_target_changed_at, variable_expiration_handler FROM workspace_settings WHERE workspace_id = $2",
"describe": {
"columns": [],
"parameters": {
"Left": [
"Varchar",
"Text"
]
},
"nullable": []
},
"hash": "4693a6932e0f09f8d0a929bde83cc0aa58df96928eed3c05c515476771538c3a"
}
@@ -0,0 +1,23 @@
{
"db_name": "PostgreSQL",
"query": "SELECT mcp_tool_sets -> $2 FROM workspace_settings WHERE workspace_id = $1",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "?column?",
"type_info": "Jsonb"
}
],
"parameters": {
"Left": [
"Text",
"Text"
]
},
"nullable": [
null
]
},
"hash": "8a901804bfd11e21be439930b4f41778719238d72a032ec4a72b24c8a53250bd"
}
+1 -1
View File
@@ -1 +1 @@
458eeca8c31ba093a72eeb1ed9d82a83e18477db
b355c69d700cd66491af67259910b2b57a41f443
@@ -0,0 +1 @@
ALTER TABLE workspace_settings DROP COLUMN IF EXISTS mcp_tool_sets;
@@ -0,0 +1 @@
ALTER TABLE workspace_settings ADD COLUMN IF NOT EXISTS mcp_tool_sets JSONB;
+82
View File
@@ -0,0 +1,82 @@
//! A named tool set narrows and never grants: a member signed in to it gets the set's
//! runnables they can see, the set is read on every request, and its URL refuses any other
//! token so the client signs in to the set.
#![cfg(feature = "mcp")]
use serde_json::{json, Value};
use sqlx::{Pool, Postgres};
use windmill_test_utils::*;
async fn list_tools(port: u16, path: &str, token: &str) -> anyhow::Result<(u16, Value)> {
let response = reqwest::Client::new()
.post(format!("http://localhost:{port}{path}"))
.bearer_auth(token)
.header("accept", "application/json, text/event-stream")
.header("mcp-protocol-version", "2025-06-18")
.json(&json!({"jsonrpc": "2.0", "id": 1, "method": "tools/list", "params": {}}))
.send()
.await?;
let status = response.status().as_u16();
let body = response.text().await?;
let data = body
.lines()
.find_map(|l| l.strip_prefix("data: "))
.unwrap_or(&body);
Ok((status, serde_json::from_str(data).unwrap_or(Value::Null)))
}
fn names(list: &Value) -> Vec<String> {
list["result"]["tools"]
.as_array()
.unwrap_or_else(|| panic!("no tools in {list}"))
.iter()
.map(|t| t["name"].as_str().unwrap_or_default().to_string())
.collect()
}
#[sqlx::test(fixtures("base"))]
async fn tool_set_narrows_to_what_the_member_can_see(db: Pool<Postgres>) -> anyhow::Result<()> {
initialize_tracing().await;
sqlx::raw_sql(
r#"
INSERT INTO folder (workspace_id, name, display_name, owners, extra_perms) VALUES
('test-workspace', 'ops', 'ops', ARRAY['u/test-user'], '{"u/test-user-3": false}'),
('test-workspace', 'internal', 'internal', ARRAY['u/test-user'], '{}');
INSERT INTO script (workspace_id, created_by, content, schema, summary, description, path, hash, language, lock) VALUES
('test-workspace', 'test-user', 'export function main() { return 1 }', '{}', '', '', 'f/ops/check_order', 7788301, 'bun', ''),
('test-workspace', 'test-user', 'export function main() { return 1 }', '{}', '', '', 'f/internal/secret', 7788302, 'bun', '');
UPDATE workspace_settings
SET mcp_tool_sets = '{"support": {"scripts": ["f/ops/*", "f/internal/secret"]}}'
WHERE workspace_id = 'test-workspace';
INSERT INTO token (token_hash, token_prefix, email, label, super_admin, scopes, workspace_id) VALUES
(encode(sha256('SET_TOKEN'::bytea), 'hex'), 'SET_TOKEN_', 'test3@windmill.dev', 'mcp', false,
ARRAY['mcp:set:support', 'mcp:runnables_as_tools'], 'test-workspace'),
(encode(sha256('FULL_TOKEN'::bytea), 'hex'), 'FULL_TOKEN', 'test3@windmill.dev', 'mcp', false,
ARRAY['mcp:all', 'mcp:session'], 'test-workspace');
"#,
)
.execute(&db)
.await?;
let server = ApiServer::start_mcp(db.clone()).await?;
let port = server.addr.port();
const SET_URL: &str = "/api/mcp/w/test-workspace/s/support/mcp";
let (_, list) = list_tools(port, SET_URL, "SET_TOKEN").await?;
assert_eq!(names(&list), ["check_order"], "{list}");
let (status, _) = list_tools(port, SET_URL, "FULL_TOKEN").await?;
assert_eq!(status, 401, "a token not signed in to the set");
sqlx::query(
"UPDATE workspace_settings SET mcp_tool_sets = NULL WHERE workspace_id = 'test-workspace'",
)
.execute(&db)
.await?;
let (_, list) = list_tools(port, SET_URL, "SET_TOKEN").await?;
assert!(
names(&list).is_empty(),
"a deleted set leaves no tool: {list}"
);
Ok(())
}
@@ -138,6 +138,7 @@ pub fn workspaced_service() -> Router {
post(edit_large_file_storage_config),
)
.route("/edit_dbt_warehouses", post(edit_dbt_warehouses))
.route("/edit_mcp_tool_sets", post(edit_mcp_tool_sets))
.route("/edit_ducklake_config", post(edit_ducklake_config))
.route("/list_ducklakes", get(list_ducklakes))
.route("/list_datatables", get(list_datatables))
@@ -320,6 +321,8 @@ pub struct WorkspaceSettings {
#[serde(skip_serializing_if = "Option::is_none")]
pub dbt_warehouses: Option<serde_json::Value>,
#[serde(skip_serializing_if = "Option::is_none")]
pub mcp_tool_sets: Option<serde_json::Value>,
#[serde(skip_serializing_if = "Option::is_none")]
pub large_file_storage: Option<serde_json::Value>,
#[serde(skip_serializing_if = "Option::is_none")]
pub ducklake: Option<serde_json::Value>,
@@ -1201,6 +1204,7 @@ async fn get_settings(
webhook_events,
ai_config,
dbt_warehouses,
mcp_tool_sets,
large_file_storage,
datatable,
ducklake,
@@ -2274,6 +2278,49 @@ async fn edit_dbt_warehouses(
Ok("Updated the workspace's dbt warehouses".to_string())
}
#[derive(serde::Deserialize)]
struct EditMcpToolSets {
mcp_tool_sets: Option<windmill_common::mcp_tool_sets::McpToolSets>,
}
/// The workspace's named MCP tool sets, each served at `/api/mcp/w/{workspace}/s/{name}/mcp`.
async fn edit_mcp_tool_sets(
authed: ApiAuthed,
Extension(db): Extension<DB>,
Path(w_id): Path<String>,
Json(new_config): Json<EditMcpToolSets>,
) -> Result<String> {
require_admin(authed.is_admin, &authed.username)?;
let sets = new_config.mcp_tool_sets.filter(|s| !s.is_empty());
if let Some(sets) = sets.as_ref() {
windmill_common::mcp_tool_sets::validate_tool_sets(sets)?;
}
let value = sets
.map(serde_json::to_value)
.transpose()
.map_err(|e| Error::internal_err(format!("serializing the MCP tool sets: {e}")))?;
let mut tx = db.begin().await?;
audit_log(
&mut *tx,
&authed,
"workspaces.edit_mcp_tool_sets",
ActionKind::Update,
&w_id,
Some(&authed.email),
Some([("mcp_tool_sets", format!("{value:?}").as_str())].into()),
)
.await?;
sqlx::query!(
"UPDATE workspace_settings SET mcp_tool_sets = $1 WHERE workspace_id = $2",
value,
&w_id
)
.execute(&mut *tx)
.await?;
tx.commit().await?;
Ok("Updated the workspace's MCP tool sets".to_string())
}
/// A fork's isolated storage is purged at deletion from the storage recorded at creation: under
/// another location, its objects would outlive the fork untracked, and a same-id fork would
/// read them.
@@ -7973,6 +8020,7 @@ async fn update_workspace_settings(
large_file_storage = source_ws.large_file_storage,
ducklake = source_ws.ducklake,
dbt_warehouses = source_ws.dbt_warehouses,
mcp_tool_sets = source_ws.mcp_tool_sets,
datatable = source_ws.datatable,
git_app_installations = source_ws.git_app_installations,
add_admins_and_developers_to_forks = source_ws.add_admins_and_developers_to_forks
@@ -15885,6 +15933,7 @@ pub enum SettingsEdit {
DeleteSlackOAuth,
Ducklake,
DbtWarehouses,
McpToolSets,
DeployUi,
GuestJwtKey,
PublicAppRateLimit,
@@ -15957,6 +16006,7 @@ pub async fn apply_settings_edit(
DeleteSlackOAuth => delete_slack_oauth_config(a, d, p).await?,
Ducklake => edit_ducklake_config(a, d, p, settings_edit_body(edit, body)?).await?,
DbtWarehouses => edit_dbt_warehouses(a, d, p, settings_edit_body(edit, body)?).await?,
McpToolSets => edit_mcp_tool_sets(a, d, p, settings_edit_body(edit, body)?).await?,
#[cfg(feature = "enterprise")]
DeployUi => edit_deploy_ui_config(a, d, p, settings_edit_body(edit, body)?).await?,
#[cfg(not(feature = "enterprise"))]
@@ -152,7 +152,7 @@ pub(crate) async fn change_workspace_id(
// Duplicate workspace settings (keep copy in old workspace for reference)
info!("Duplicating workspace_settings table");
sqlx::query!(
"INSERT INTO workspace_settings (workspace_id, slack_team_id, slack_name, slack_command_script, slack_email, customer_id, plan, webhook, webhook_events, ai_config, large_file_storage, git_sync, default_app, default_scripts, deploy_ui, mute_critical_alerts, color, operator_settings, role_overrides, teams_command_script, teams_team_id, teams_team_name, git_app_installations, git_credentials, ducklake, dbt_warehouses, slack_oauth_client_id, slack_oauth_client_secret, slack_signing_secret, datatable, teams_team_guid, auto_invite, error_handler, success_handler, public_app_execution_limit_per_minute, error_handler_fallback_to_instance_alerts, guest_jwt_public_key, guest_jwt_jwks_url, add_admins_and_developers_to_forks, remote_deploy_target, remote_deploy_target_changed_at, variable_expiration_handler) SELECT $1, slack_team_id, slack_name, slack_command_script, slack_email, customer_id, plan, webhook, webhook_events, ai_config, large_file_storage, git_sync, default_app, default_scripts, deploy_ui, mute_critical_alerts, color, operator_settings, role_overrides, teams_command_script, teams_team_id, teams_team_name, git_app_installations, git_credentials, ducklake, dbt_warehouses, slack_oauth_client_id, slack_oauth_client_secret, slack_signing_secret, datatable, teams_team_guid, auto_invite, error_handler, success_handler, public_app_execution_limit_per_minute, error_handler_fallback_to_instance_alerts, guest_jwt_public_key, guest_jwt_jwks_url, add_admins_and_developers_to_forks, remote_deploy_target, remote_deploy_target_changed_at, variable_expiration_handler FROM workspace_settings WHERE workspace_id = $2",
"INSERT INTO workspace_settings (workspace_id, slack_team_id, slack_name, slack_command_script, slack_email, customer_id, plan, webhook, webhook_events, ai_config, large_file_storage, git_sync, default_app, default_scripts, deploy_ui, mute_critical_alerts, color, operator_settings, role_overrides, teams_command_script, teams_team_id, teams_team_name, git_app_installations, git_credentials, ducklake, dbt_warehouses, mcp_tool_sets, slack_oauth_client_id, slack_oauth_client_secret, slack_signing_secret, datatable, teams_team_guid, auto_invite, error_handler, success_handler, public_app_execution_limit_per_minute, error_handler_fallback_to_instance_alerts, guest_jwt_public_key, guest_jwt_jwks_url, add_admins_and_developers_to_forks, remote_deploy_target, remote_deploy_target_changed_at, variable_expiration_handler) SELECT $1, slack_team_id, slack_name, slack_command_script, slack_email, customer_id, plan, webhook, webhook_events, ai_config, large_file_storage, git_sync, default_app, default_scripts, deploy_ui, mute_critical_alerts, color, operator_settings, role_overrides, teams_command_script, teams_team_id, teams_team_name, git_app_installations, git_credentials, ducklake, dbt_warehouses, mcp_tool_sets, slack_oauth_client_id, slack_oauth_client_secret, slack_signing_secret, datatable, teams_team_guid, auto_invite, error_handler, success_handler, public_app_execution_limit_per_minute, error_handler_fallback_to_instance_alerts, guest_jwt_public_key, guest_jwt_jwks_url, add_admins_and_developers_to_forks, remote_deploy_target, remote_deploy_target_changed_at, variable_expiration_handler FROM workspace_settings WHERE workspace_id = $2",
&rw.new_id,
&old_id
)
+47
View File
@@ -4447,6 +4447,8 @@ paths:
$ref: "#/components/schemas/DucklakeSettings"
dbt_warehouses:
$ref: "#/components/schemas/DbtWarehouses"
mcp_tool_sets:
$ref: "#/components/schemas/McpToolSets"
datatable:
$ref: "#/components/schemas/DataTableSettings"
git_sync:
@@ -5609,6 +5611,31 @@ paths:
application/json:
schema: {}
/w/{workspace}/workspaces/edit_mcp_tool_sets:
post:
summary: edit the workspace's MCP tool sets
operationId: editMcpToolSets
tags:
- workspace
parameters:
- $ref: "#/components/parameters/WorkspaceId"
requestBody:
description: MCP tool sets, by name
required: true
content:
application/json:
schema:
type: object
properties:
mcp_tool_sets:
$ref: "#/components/schemas/McpToolSets"
responses:
"200":
description: status
content:
application/json:
schema: {}
/w/{workspace}/dbt/run_progress:
post:
summary: record the running job's settled dbt nodes
@@ -39065,6 +39092,26 @@ components:
required:
- resource_path
McpToolSets:
type: object
description: >-
Named selections of scripts and flows, each served at
/api/mcp/w/{workspace}/s/{name}/mcp. A member signed in to a set gets the
scripts and flows of the set they can run, as tools.
additionalProperties:
type: object
properties:
scripts:
type: array
items:
type: string
flows:
type: array
items:
type: string
instructions:
type: string
DbtWarehouseConnection:
type: object
properties:
File diff suppressed because one or more lines are too long
+42 -3
View File
@@ -575,12 +575,18 @@ pub async fn run_server(
// Setup MCP server
#[allow(unused_variables)]
let (mcp_router, gateway_mcp_router, gateway_session_router, mcp_cancellation_token) = {
let (
mcp_router,
gateway_mcp_router,
gateway_session_router,
tool_set_mcp_router,
mcp_cancellation_token,
) = {
#[cfg(feature = "mcp")]
if server_mode || mcp_mode {
use mcp::{
add_www_authenticate_header, add_www_authenticate_header_gateway,
extract_workspace_from_token, reject_token_query_param,
extract_tool_set_endpoint, extract_workspace_from_token, reject_token_query_param,
};
let (mcp_router, session_router, mcp_cancellation_token) = setup_mcp_server(
db.clone(),
@@ -599,6 +605,14 @@ pub async fn run_server(
.layer(axum::middleware::from_fn(reject_token_query_param))
.layer(axum::middleware::from_fn(add_www_authenticate_header))
.layer(axum::middleware::from_fn(extract_and_store_workspace_id));
// A named tool set's URL: signed in to through Windmill's own consent page only, so
// without the external issuer's layer.
let tool_set_mcp_router = mcp_router
.clone()
.route_layer(from_extractor::<ApiAuthed>())
.layer(axum::middleware::from_fn(reject_token_query_param))
.layer(axum::middleware::from_fn(add_www_authenticate_header))
.layer(axum::middleware::from_fn(extract_tool_set_endpoint));
// Gateway MCP router — resolves workspace from token
let gateway_mcp_router = mcp_router
.route_layer(from_extractor::<ApiAuthed>())
@@ -622,10 +636,17 @@ pub async fn run_server(
workspaced_mcp_router,
gateway_mcp_router,
gateway_session_router,
tool_set_mcp_router,
Some(mcp_cancellation_token),
)
} else {
(Router::new(), Router::new(), Router::new(), None)
(
Router::new(),
Router::new(),
Router::new(),
Router::new(),
None,
)
}
#[cfg(not(feature = "mcp"))]
@@ -633,6 +654,7 @@ pub async fn run_server(
Router::new(),
Router::new(),
Router::new(),
Router::new(),
Option::<()>::None,
)
};
@@ -977,6 +999,10 @@ pub async fn run_server(
"/mcp/w/{workspace_id}/mcp",
mcp_router.clone().layer(mcp_cors.clone()),
)
.nest(
"/mcp/w/{workspace_id}/s/{tool_set}/mcp",
tool_set_mcp_router.layer(mcp_cors.clone()),
)
.nest("/mcp/gateway", gateway_mcp_router.layer(mcp_cors.clone()))
.merge(gateway_session_router.layer(mcp_cors.clone()))
.nest("/agent_workers", {
@@ -1192,6 +1218,19 @@ pub async fn run_server(
}
},
)
.route(
"/.well-known/oauth-protected-resource/api/mcp/w/{workspace_id}/s/{tool_set}/mcp",
{
#[cfg(feature = "mcp")]
{
get(mcp::oauth_server::tool_set_protected_resource_metadata)
}
#[cfg(not(feature = "mcp"))]
{
get(|| async { axum::http::StatusCode::NOT_FOUND })
}
},
)
// Gateway OAuth well-known endpoints
.route(
"/.well-known/oauth-authorization-server/api/mcp/gateway/oauth/server",
+99 -4
View File
@@ -37,10 +37,13 @@ use std::sync::Arc;
use std::time::Duration;
use tokio_util::sync::CancellationToken;
use windmill_common::mcp_tool_sets::{
get_tool_set, tool_set_of, tool_set_scopes, SET_SCOPE_PREFIX,
};
use windmill_mcp::common::SESSION_SCOPE;
use windmill_mcp::server::{
LocalSessionManager, McpToken, MultiWorkspaceMcp, NoEndpointTools, Runner, SessionRunner,
StreamableHttpServerConfig, StreamableHttpService,
StreamableHttpServerConfig, StreamableHttpService, ToolSetInstructions,
};
use windmill_mcp::WorkspaceId;
@@ -606,6 +609,74 @@ fn serves_session_toolset(scopes: &[String]) -> bool {
#[derive(Clone, Copy)]
pub struct McpEndpoint(pub &'static str);
/// The tool set a set URL serves: `/api/mcp/w/{workspace}/s/{tool_set}/mcp`.
#[derive(Clone)]
pub struct ToolSetEndpoint(pub String);
/// Store a tool set URL's workspace and set in request extensions.
pub async fn extract_tool_set_endpoint(
Path((workspace_id, tool_set)): Path<(String, String)>,
mut request: Request<axum::body::Body>,
next: Next,
) -> Response {
request.extensions_mut().insert(WorkspaceId(workspace_id));
request.extensions_mut().insert(ToolSetEndpoint(tool_set));
next.run(request).await
}
/// Puts the current paths of the tool set a token is signed in to in place of its scopes, so an
/// admin's edit reaches open connections and a deleted set leaves no tool. On a set's URL, a
/// token signed in to anything else is refused, which sends the client back to sign in.
async fn expand_tool_set(db: &DB, request: &mut Request<axum::body::Body>) -> Result<(), Response> {
let served = request
.extensions()
.get::<ToolSetEndpoint>()
.map(|e| e.0.clone());
let held = request
.extensions()
.get::<ApiAuthed>()
.and_then(|a| a.scopes.as_deref())
.and_then(tool_set_of)
.map(str::to_string);
if let Some(served) = served {
if held.as_deref() != Some(served.as_str()) {
return Err((
axum::http::StatusCode::UNAUTHORIZED,
format!("This URL serves the MCP tool set `{served}`: sign in to it"),
)
.into_response());
}
}
let Some(name) = held else {
return Ok(());
};
request.extensions_mut().insert(NoEndpointTools);
// Without a bound workspace the token keeps its unexpanded scopes, which reach no runnable.
let Some(w_id) = request
.extensions()
.get::<WorkspaceId>()
.map(|w| w.0.clone())
else {
return Ok(());
};
let set = get_tool_set(db, &w_id, &name)
.await
.map_err(|e| e.into_response())?;
let scopes = match &set {
Some(set) => tool_set_scopes(&name, set),
None => vec![format!("{SET_SCOPE_PREFIX}{name}")],
};
if let Some(authed) = request.extensions_mut().get_mut::<ApiAuthed>() {
authed.scopes = Some(scopes);
}
if let Some(instructions) = set.and_then(|s| s.instructions) {
request
.extensions_mut()
.insert(ToolSetInstructions(instructions));
}
Ok(())
}
/// Extract workspace ID from path and store it in request extensions
pub async fn extract_and_store_workspace_id(
Path(params): Path<String>,
@@ -626,6 +697,10 @@ fn www_authenticate_value(base_url: &str, endpoint: &str) -> String {
} else {
"mcp:all"
};
www_authenticate_with_scope(base_url, endpoint, scope)
}
fn www_authenticate_with_scope(base_url: &str, endpoint: &str, scope: &str) -> String {
format!(
"Bearer resource_metadata=\"{base_url}/.well-known/oauth-protected-resource{endpoint}\", \
scope=\"{scope}\""
@@ -652,14 +727,24 @@ pub async fn add_www_authenticate_header(
.body(axum::body::Body::from("Missing workspace_id in request"))
.unwrap();
};
let tool_set = request
.extensions()
.get::<ToolSetEndpoint>()
.map(|e| e.0.clone());
let response = next.run(request).await;
// Only add header to 401 Unauthorized responses
if response.status() == StatusCode::UNAUTHORIZED {
let base_url = BASE_URL.load();
let www_authenticate =
www_authenticate_value(&base_url, &format!("/api/mcp/w/{}/mcp", workspace_id));
let www_authenticate = match tool_set {
Some(set) => www_authenticate_with_scope(
&base_url,
&format!("/api/mcp/w/{workspace_id}/s/{set}/mcp"),
&format!("{SET_SCOPE_PREFIX}{set}"),
),
None => www_authenticate_value(&base_url, &format!("/api/mcp/w/{}/mcp", workspace_id)),
};
// Reconstruct response with the new header
let (mut parts, body) = response.into_parts();
@@ -812,6 +897,7 @@ pub async fn setup_mcp_server(
let cancellation_token = CancellationToken::new();
let session_manager = Arc::new(LocalSessionManager::default());
let tool_set_db = db.clone();
let backend = WindmillBackend::new(db, user_db, base_internal_url, auth_cache);
let session_runner = SessionRunner::new(backend.clone());
let runner = Runner::new(backend);
@@ -847,10 +933,15 @@ pub async fn setup_mcp_server(
"/",
axum::routing::any({
let (service, session_service) = (service.clone(), session_service.clone());
move |request: Request<axum::body::Body>| {
let db = tool_set_db.clone();
move |mut request: Request<axum::body::Body>| {
let (service, session_service) = (service.clone(), session_service.clone());
let db = db.clone();
async move {
use tower::ServiceExt;
if let Err(response) = expand_tool_set(&db, &mut request).await {
return response;
}
let session = request.extensions().get::<ApiAuthed>().is_some_and(|a| {
serves_session_toolset(a.scopes.as_deref().unwrap_or_default())
});
@@ -874,8 +965,12 @@ pub async fn setup_mcp_server(
"/mcp",
axum::routing::any(move |mut request: Request<axum::body::Body>| {
let (service, session_service) = (service.clone(), session_service.clone());
let db = tool_set_db.clone();
async move {
use tower::ServiceExt;
if let Err(response) = expand_tool_set(&db, &mut request).await {
return response;
}
let response = if request.extensions().get::<McpSelection>().is_some() {
request.extensions_mut().insert(NoEndpointTools);
service.oneshot(request).await
+2 -2
View File
@@ -13,6 +13,6 @@ mod utils;
pub mod oauth_server;
pub use core::{
add_www_authenticate_header, add_www_authenticate_header_gateway,
extract_and_store_workspace_id, extract_workspace_from_token, list_tools_service,
reject_token_query_param, setup_mcp_server, toolset_service, McpEndpoint,
extract_and_store_workspace_id, extract_tool_set_endpoint, extract_workspace_from_token,
list_tools_service, reject_token_query_param, setup_mcp_server, toolset_service, McpEndpoint,
};
+59 -2
View File
@@ -20,7 +20,11 @@ use windmill_common::{
use crate::db::ApiAuthed;
use windmill_api_auth::forbid_elevated_job_token;
use windmill_mcp::{common::SESSION_SCOPE, parse_mcp_scopes};
use windmill_common::mcp_tool_sets::{get_tool_set, tool_set_of, SET_SCOPE_PREFIX};
use windmill_mcp::{
common::{scope::RUNNABLES_AS_TOOLS_SCOPE, SESSION_SCOPE},
parse_mcp_scopes,
};
/// Token expiration for MCP OAuth tokens (1 week in seconds)
const MCP_OAUTH_TOKEN_EXPIRATION_SECS: u64 = 7 * 24 * 60 * 60;
@@ -248,7 +252,15 @@ fn granting_scopes() -> Vec<String> {
fn supported_scopes() -> Vec<String> {
let mut scopes = granting_scopes();
scopes.extend(["mcp:read_only", "mcp:read_run", "mcp:runnables_as_tools"].map(String::from));
scopes.extend(
[
"mcp:read_only",
"mcp:read_run",
"mcp:runnables_as_tools",
"mcp:set:*",
]
.map(String::from),
);
scopes
}
@@ -323,6 +335,22 @@ pub async fn protected_resource_metadata_by_path(
))
}
/// GET /.well-known/oauth-protected-resource/api/mcp/w/:workspace_id/s/:tool_set/mcp
///
/// Always names Windmill's own authorization server, external issuer or not: a tool set is
/// signed in to through Windmill's consent page.
pub async fn tool_set_protected_resource_metadata(
Path((workspace_id, tool_set)): Path<(String, String)>,
) -> Json<ProtectedResourceMetadata> {
let base_url = BASE_URL.load();
Json(ProtectedResourceMetadata {
resource: format!("{base_url}/api/mcp/w/{workspace_id}/s/{tool_set}/mcp"),
authorization_servers: vec![format!("{base_url}/api/w/{workspace_id}/mcp/oauth/server")],
scopes_supported: Some(vec![format!("{SET_SCOPE_PREFIX}{tool_set}")]),
bearer_methods_supported: Some(vec!["header".to_string()]),
})
}
/// Schemes that a browser executes as script or uses to read local content. The
/// consent page navigates the user's browser to the registered redirect_uri
/// (`window.location` / anchor `href`), so accepting any of these turns dynamic
@@ -949,6 +977,35 @@ async fn oauth_approve_inner(
scopes.push(SESSION_SCOPE.to_string());
}
// A tool set is resolved in the token's own workspace on every request, so its grant is
// that set alone, bound to the workspace it exists in.
if let Some(name) = tool_set_of(&scopes).map(str::to_string) {
let Some(workspace_id) = workspace_id else {
return Err(Error::BadRequest(
"A tool set belongs to one workspace: sign in from its URL".to_string(),
));
};
if scopes
.iter()
.filter(|s| s.starts_with(SET_SCOPE_PREFIX))
.count()
> 1
{
return Err(Error::BadRequest(
"A connection signs in to one tool set".to_string(),
));
}
if get_tool_set(db, workspace_id, &name).await?.is_none() {
return Err(Error::NotFound(format!(
"Workspace {workspace_id} has no MCP tool set `{name}`"
)));
}
scopes = vec![
format!("{SET_SCOPE_PREFIX}{name}"),
RUNNABLES_AS_TOOLS_SCOPE.to_string(),
];
}
// The approver's own token bounds what it may grant: a scope-restricted MCP
// token must not approve a broader one (e.g. mcp:scripts:f/x -> mcp:all). An
// unrestricted approver (interactive session, scopes None) grants freely,
@@ -81,6 +81,7 @@ struct SettingsRow {
slack_oauth_client_secret: Option<String>,
ducklake: Option<Value>,
dbt_warehouses: Option<Value>,
mcp_tool_sets: Option<Value>,
deploy_ui: Option<Value>,
teams_command_script: Option<String>,
public_app_execution_limit_per_minute: Option<i32>,
@@ -355,7 +356,7 @@ pub async fn load_settings_document(
ai_config, large_file_storage,
git_sync, default_app, default_scripts, workspace.name AS name, mute_critical_alerts,
color, operator_settings, datatable, slack_team_id, slack_name, slack_command_script,
slack_oauth_client_id, slack_oauth_client_secret, ducklake, dbt_warehouses, deploy_ui,
slack_oauth_client_id, slack_oauth_client_secret, ducklake, dbt_warehouses, mcp_tool_sets, deploy_ui,
teams_command_script, public_app_execution_limit_per_minute,
guest_jwt_public_key, guest_jwt_jwks_url, error_handler_fallback_to_instance_alerts,
add_admins_and_developers_to_forks
@@ -416,7 +417,7 @@ pub async fn load_settings_document(
// In the order `wmill sync pull` has always written settings.yaml. A key that predates the
// document and is not marked `always` is written only when set, as it always was; a key
// added since is always written, so a pulled file states it and from then on manages it.
let entries: [(&str, Option<Value>, bool); 33] = [
let entries: [(&str, Option<Value>, bool); 34] = [
("auto_invite", row.auto_invite, false),
("webhook", webhook.map(Value::String), false),
("webhook_events", row.webhook_events.map(|e| json!(e)), true),
@@ -465,6 +466,7 @@ pub async fn load_settings_document(
),
("ducklake", row.ducklake, true),
("dbt_warehouses", row.dbt_warehouses, true),
("mcp_tool_sets", row.mcp_tool_sets, true),
("deploy_ui", row.deploy_ui, true),
(
"teams_command_script",
@@ -771,6 +773,7 @@ const KNOWN_KEYS: &[&str] = &[
"slack_oauth_client_secret",
"ducklake",
"dbt_warehouses",
"mcp_tool_sets",
"deploy_ui",
"teams_command_script",
"public_app_execution_limit_per_minute",
@@ -1628,6 +1631,14 @@ fn plan_document(
|v| json!({ "dbt_warehouses": v }),
);
let mcp_tool_sets = p.managed("mcp_tool_sets");
p.simple(
"mcp_tool_sets",
mcp_tool_sets,
Target::Edit(SettingsEdit::McpToolSets),
|v| json!({ "mcp_tool_sets": v }),
);
let deploy_ui = p.managed("deploy_ui");
p.simple(
"deploy_ui",
+1
View File
@@ -98,6 +98,7 @@ pub mod job_provenance;
pub mod jobs;
pub mod jwt;
pub mod login_rate_limit;
pub mod mcp_tool_sets;
pub mod more_serde;
pub mod oauth2;
#[cfg(all(feature = "enterprise", feature = "openidconnect", feature = "private"))]
@@ -0,0 +1,146 @@
//! Named MCP tool sets: a workspace admin's selection of scripts and flows, served at its own
//! MCP URL. A set narrows and never grants: a member signed in to it gets the runnables of the
//! set they can see and run themselves.
use std::collections::BTreeMap;
use serde::{Deserialize, Serialize};
use crate::{
db::DB,
error::{Error, Result},
};
/// Marks a token signed in to a tool set: `mcp:set:<name>`.
pub const SET_SCOPE_PREFIX: &str = "mcp:set:";
const MAX_NAME_LEN: usize = 50;
const MAX_INSTRUCTIONS_LEN: usize = 4000;
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct McpToolSet {
/// Script paths: `*`, an exact path, or a `<prefix>/*` subtree.
#[serde(default)]
pub scripts: Vec<String>,
/// Flow paths, as for scripts.
#[serde(default)]
pub flows: Vec<String>,
/// Added to the server's instructions for clients connected to this set.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub instructions: Option<String>,
}
/// By name, as stored in `workspace_settings.mcp_tool_sets`.
pub type McpToolSets = BTreeMap<String, McpToolSet>;
pub fn validate_tool_set_name(name: &str) -> Result<()> {
let usable = !name.is_empty()
&& name.len() <= MAX_NAME_LEN
&& name
.chars()
.all(|c| c.is_ascii_lowercase() || c.is_ascii_digit() || c == '_' || c == '-');
if usable {
Ok(())
} else {
Err(Error::BadRequest(format!(
"`{name}` is not a usable tool set name: use up to {MAX_NAME_LEN} lowercase letters, digits, `_` and `-`"
)))
}
}
pub fn validate_tool_sets(sets: &McpToolSets) -> Result<()> {
for (name, set) in sets {
validate_tool_set_name(name)?;
if set.scripts.is_empty() && set.flows.is_empty() {
return Err(Error::BadRequest(format!(
"tool set `{name}` selects no scripts or flows"
)));
}
for path in set.scripts.iter().chain(&set.flows) {
// Paths are joined with commas into selection scopes, and only `*`, an exact path
// and a trailing `/*` are matched.
let base = path.strip_suffix("/*").unwrap_or(path);
let usable = path == "*"
|| (!base.is_empty()
&& !base.contains(['*', ',', ' '])
&& ["u/", "f/", "g/"].iter().any(|p| base.starts_with(p)));
if !usable {
return Err(Error::BadRequest(format!(
"`{path}` in tool set `{name}` is not a script or flow path: use `*`, a path, or `<folder path>/*`"
)));
}
}
if set
.instructions
.as_ref()
.is_some_and(|i| i.len() > MAX_INSTRUCTIONS_LEN)
{
return Err(Error::BadRequest(format!(
"the instructions of tool set `{name}` are longer than {MAX_INSTRUCTIONS_LEN} characters"
)));
}
}
Ok(())
}
pub async fn get_tool_set(db: &DB, w_id: &str, name: &str) -> Result<Option<McpToolSet>> {
let value = sqlx::query_scalar!(
"SELECT mcp_tool_sets -> $2 FROM workspace_settings WHERE workspace_id = $1",
w_id,
name
)
.fetch_optional(db)
.await?
.flatten();
value
.map(serde_json::from_value)
.transpose()
.map_err(|e| Error::internal_err(format!("reading tool set `{name}`: {e}")))
}
/// The set a token is signed in to, if any.
pub fn tool_set_of(scopes: &[String]) -> Option<&str> {
scopes.iter().find_map(|s| s.strip_prefix(SET_SCOPE_PREFIX))
}
/// What a token signed in to `name` acts with: the set as a selection of scripts and flows, with
/// no endpoint tools.
pub fn tool_set_scopes(name: &str, set: &McpToolSet) -> Vec<String> {
let mut scopes = vec![
format!("{SET_SCOPE_PREFIX}{name}"),
"mcp:runnables_as_tools".to_string(),
];
if !set.scripts.is_empty() {
scopes.push(format!("mcp:scripts:{}", set.scripts.join(",")));
}
if !set.flows.is_empty() {
scopes.push(format!("mcp:flows:{}", set.flows.join(",")));
}
scopes
}
#[cfg(test)]
mod tests {
use super::*;
fn set(paths: &[&str]) -> McpToolSets {
BTreeMap::from([(
"support".to_string(),
McpToolSet {
scripts: paths.iter().map(|p| p.to_string()).collect(),
flows: vec![],
instructions: None,
},
)])
}
#[test]
fn paths_are_patterns_the_matchers_read() {
assert!(validate_tool_sets(&set(&["*", "f/ops/*", "u/alice/report"])).is_ok());
for bad in ["f/ops/*/x", "f/a,f/b", "ops/x", "f/*x", ""] {
assert!(validate_tool_sets(&set(&[bad])).is_err(), "{bad}");
}
assert!(validate_tool_sets(&set(&[])).is_err());
assert!(validate_tool_set_name("Support").is_err());
}
}
+28
View File
@@ -3,6 +3,8 @@
//! Contains utilities for parsing and matching MCP token scopes to determine
//! which scripts, flows, and endpoints a token has access to.
use windmill_common::mcp_tool_sets::SET_SCOPE_PREFIX;
/// Configuration for MCP scopes parsed from token scopes
#[derive(Debug, Clone, Default)]
pub struct McpScopeConfig {
@@ -31,6 +33,10 @@ pub struct McpScopeConfig {
/// No endpoint tools on any URL: set by `mcp:read_only`, `mcp:read_run` and
/// `mcp:runnables_as_tools`, and by the server on `/api/mcp` for a selection.
pub no_endpoints: bool,
/// Named tool sets (`mcp:set:<name>`). The scope selects nothing itself: the server adds the
/// set's paths as `mcp:scripts:`/`mcp:flows:` on each request, so an unexpanded set token
/// reaches no runnable.
pub sets: Vec<String>,
}
impl McpScopeConfig {
@@ -106,6 +112,9 @@ impl McpScopeConfig {
if requested.all {
return false;
}
if !requested.sets.iter().all(|s| self.sets.contains(s)) {
return false;
}
if requested.favorites && !self.favorites {
return false;
}
@@ -243,6 +252,12 @@ pub fn parse_mcp_scopes(scopes: &[String]) -> Result<McpScopeConfig, String> {
continue;
}
if let Some(name) = scope.strip_prefix(SET_SCOPE_PREFIX) {
config.sets.push(name.to_string());
config.no_endpoints = true;
continue;
}
if let Some(ids) = scope.strip_prefix("mcp:workspaces:") {
config
.workspaces
@@ -331,6 +346,19 @@ fn resource_matches_pattern(resource_path: &str, pattern: &str) -> bool {
mod tests {
use super::*;
#[test]
fn a_tool_set_is_approved_only_by_a_holder_of_it() {
let parse = |s: &[&str]| {
parse_mcp_scopes(&s.iter().map(|s| s.to_string()).collect::<Vec<_>>()).unwrap()
};
let set = parse(&["mcp:set:support"]);
assert!(set.no_endpoints && set.scripts.is_empty() && set.flows.is_empty());
assert!(!parse(&["mcp:scripts:f/x/*"]).contains(&set));
assert!(!parse(&["mcp:set:other"]).contains(&set));
assert!(parse(&["mcp:set:support"]).contains(&set));
assert!(parse(&["mcp:all"]).contains(&set));
}
#[test]
fn test_parse_legacy_scopes() {
let scopes = vec!["mcp:all".to_string()];
+5
View File
@@ -27,6 +27,11 @@ pub struct MultiWorkspaceMcp;
#[derive(Clone, Debug)]
pub struct NoEndpointTools;
/// What the admin wrote for the tool set a connection is signed in to, added to the tools
/// server's instructions.
#[derive(Clone, Debug)]
pub struct ToolSetInstructions(pub String);
/// Raw bearer token wrapper for Axum extensions. In multi-workspace mode the
/// runner needs the raw token to re-resolve auth for each requested workspace.
#[derive(Clone, Debug)]
+3 -1
View File
@@ -13,7 +13,9 @@ mod session;
pub mod tools;
// Re-export main types
pub use crate::common::types::{McpToken, MultiWorkspaceMcp, NoEndpointTools, WorkspaceInfo};
pub use crate::common::types::{
McpToken, MultiWorkspaceMcp, NoEndpointTools, ToolSetInstructions, WorkspaceInfo,
};
pub use backend::{
BackendResult, McpAuth, McpBackend, McpRequest, PathFilter, RunOutcome, SessionAccess,
};
+27 -4
View File
@@ -11,8 +11,8 @@ use crate::common::transform::{
short_name_last_segments,
};
use crate::common::types::{
McpToken, MultiWorkspaceMcp, NoEndpointTools, ResourceInfo, SchemaType, ToolableItem,
WorkspaceId,
McpToken, MultiWorkspaceMcp, NoEndpointTools, ResourceInfo, SchemaType, ToolSetInstructions,
ToolableItem, WorkspaceId,
};
use crate::server::backend::{McpAuth, McpBackend, McpRequest, PathFilter, RunOutcome};
use crate::server::endpoints::{
@@ -23,7 +23,7 @@ use crate::server::tools::create_tool_from_item;
use rmcp::handler::server::ServerHandler;
use rmcp::model::{
CacheScope, CallToolRequestParams, CallToolResponse, CallToolResult, ContentBlock,
Implementation, InitializeRequestParams, InitializeResult, ListPromptsResult,
DiscoverResult, Implementation, InitializeRequestParams, InitializeResult, ListPromptsResult,
ListResourceTemplatesResult, ListResourcesResult, ListToolsResult, PaginatedRequestParams,
ProtocolVersion, ServerCapabilities, ServerInfo, SubscriptionFilter,
};
@@ -178,6 +178,19 @@ impl<B: McpBackend> Runner<B> {
Self { backend: Arc::new(backend), list_changes: Arc::default() }
}
/// The server's instructions, followed by those of the tool set the caller signed in to.
fn info_for(&self, context: &RequestContext<RoleServer>) -> ServerInfo {
let info = self.get_info();
let set = context
.extensions
.get::<HttpParts>()
.and_then(|parts| parts.extensions.get::<ToolSetInstructions>());
match (set, info.instructions.clone()) {
(Some(set), Some(own)) => info.with_instructions(format!("{own}\n\n{}", set.0)),
_ => info,
}
}
/// Extract authentication, the workspace mode and the HTTP request itself
/// from the request context
pub(super) fn extract_context(
@@ -568,7 +581,7 @@ impl<B: McpBackend> ServerHandler for Runner<B> {
context: RequestContext<RoleServer>,
) -> Result<InitializeResult, ErrorData> {
context.peer.set_peer_info(request.clone());
let mut info = self.get_info();
let mut info = self.info_for(&context);
if let Some(tools) = info.capabilities.tools.as_mut() {
tools.list_changed = None;
}
@@ -578,6 +591,16 @@ impl<B: McpBackend> ServerHandler for Runner<B> {
Ok(info)
}
async fn discover(
&self,
context: RequestContext<RoleServer>,
) -> Result<DiscoverResult, ErrorData> {
Ok(DiscoverResult::from_server_info(
SUPPORTED_PROTOCOL_VERSIONS.to_vec(),
self.info_for(&context),
))
}
/// `None` for a request that asks for nothing this server sends, so the client is
/// told the subscription is unsupported rather than acked with an empty filter.
fn accepted_subscription_filter(
+2
View File
@@ -70,6 +70,7 @@ export interface SimplifiedSettings {
slack_oauth_client_secret?: string;
ducklake?: any;
dbt_warehouses?: any;
mcp_tool_sets?: any;
deploy_ui?: any;
teams_command_script?: string | null;
public_app_execution_limit_per_minute?: number | null;
@@ -86,6 +87,7 @@ export const SETTINGS_MANAGED_ONLY_WHEN_PRESENT = [
"datatable_permissions",
"ducklake",
"dbt_warehouses",
"mcp_tool_sets",
"deploy_ui",
"teams_command_script",
"public_app_execution_limit_per_minute",
+2 -1
View File
@@ -8527,6 +8527,7 @@ write a secret you were not given: keep the placeholder.
| \`protection_rules\` | \`{ <rule name>: { rules: [...], bypass_groups: [...], bypass_users: [...], fork_role_mapping?: { <role here>: <role in its forks> } } }\`, rules among \`DisableDirectDeployment\`, \`DisableWorkspaceForking\`, \`RestrictDeployToDeployers\`, \`RestrictAnonymousAppDeployment\`, \`RestrictPublicRunSharing\`, \`RestrictGuestAppDeployment\`, \`RequireIsolatedForks\`. A rule the value omits is deleted. The dev workspace lock is not listed and cannot be set here. |
| \`ducklake\` | \`{ ducklakes: { <name>: { catalog, storage, ... } } }\`. |
| \`dbt_warehouses\` | dbt warehouse connections. |
| \`mcp_tool_sets\` | \`{ <name>: { scripts?: [paths], flows?: [paths], instructions? } }\`: selections of scripts and flows, each served at \`/api/mcp/w/<workspace>/s/<name>/mcp\`. Paths are exact or end in \`/*\`. A member signed in to a set gets the ones they can run. |
| \`default_app\` | Path of the app shown as the workspace home. |
| \`default_scripts\` | \`{ order?, hidden?, default_script_content? }\` for the script language picker. |
| \`deploy_ui\` | \`{ include_path?, include_type? }\`: what the deploy-to-workspace UI offers. |
@@ -8554,7 +8555,7 @@ With \`includeSettings: true\` in \`wmill.yaml\`, \`wmill sync pull\` writes the
\`settings.yaml\`, secrets encrypted with the workspace key (plaintext only with \`plainSecrets\`), and
\`wmill sync push\` applies it. Unlike a partial apply, a push treats the file as the whole
document: a setting the file omits is cleared, except \`operator_settings\`, \`role_overrides\`, \`color\`, the auto-invite
instance groups, and the keys \`ducklake\`, \`dbt_warehouses\`, \`deploy_ui\`, \`teams_command_script\`,
instance groups, and the keys \`ducklake\`, \`dbt_warehouses\`, \`mcp_tool_sets\`, \`deploy_ui\`, \`teams_command_script\`,
\`public_app_execution_limit_per_minute\`, \`guest_jwt_public_key\`, \`guest_jwt_jwks_url\`,
\`error_handler_fallback_to_instance_alerts\` and
\`add_admins_and_developers_to_forks\`, which are managed only when the file states them.
@@ -29,6 +29,9 @@
* endpoints are left out, and since `mcp:all` is the full toolset, "All scripts/flows"
* is written as `mcp:scripts:* mcp:flows:*`. */
runnablesOnly?: boolean
/** A workspace tool set: no favorites, which are each member's own, and no hub scripts, as
* a set holds scripts and flows alone. Implies `runnablesOnly`. */
toolSet?: boolean
}
let {
@@ -36,8 +39,10 @@
scope = $bindable(),
initialScope,
readOnly = false,
runnablesOnly = false
runnablesOnly: _runnablesOnly = false,
toolSet = false
}: Props = $props()
const runnablesOnly = $derived(_runnablesOnly || toolSet)
// Mirrors ITEMS_FETCH_MAX_LIMIT in backend/windmill-api/src/mcp/utils.rs: the
// server exposes at most this many scripts and this many flows (per type) as
@@ -68,7 +73,9 @@
const parsedInitial = parseInitialScope(initialScope)
let selectedMode = $state<'favorites' | 'all' | 'folder' | 'custom'>(parsedInitial.mode)
let selectedMode = $state<'favorites' | 'all' | 'folder' | 'custom'>(
toolSet && parsedInitial.mode === 'favorites' ? 'folder' : parsedInitial.mode
)
let selectedFolders = $state<string[]>(parsedInitial.folders)
let allFolders = $state<string[]>([])
let loadingFolders = $state(false)
@@ -568,12 +575,14 @@
<span class="block mb-1 text-emphasis text-xs font-semibold">Scope</span>
<ToggleButtonGroup bind:selected={selectedMode} allowEmpty={false}>
{#snippet children({ item })}
<ToggleButton
{item}
value="favorites"
label="Favorites only"
tooltip="Make only your favorite scripts and flows available as tools"
/>
{#if !toolSet}
<ToggleButton
{item}
value="favorites"
label="Favorites only"
tooltip="Make only your favorite scripts and flows available as tools"
/>
{/if}
<ToggleButton
{item}
value="all"
@@ -617,7 +626,7 @@
</div>
{/if}
<div>
<div class:hidden={toolSet}>
<span class="block mb-1 text-emphasis text-xs font-semibold">Hub scripts (optional)</span>
{#if loadingApps}
<div>Loading...</div>
@@ -0,0 +1,188 @@
<script module lang="ts">
import type { GetSettingsResponse } from '$lib/gen'
import { randomUUID } from '$lib/utils/uuid'
export type McpToolSetRow = { id: string; name: string; scope: string; instructions: string }
export type McpToolSetsType = { sets: McpToolSetRow[] }
type StoredSet = { scripts?: string[]; flows?: string[]; instructions?: string }
export function convertMcpToolSetsFromBackend(
stored: GetSettingsResponse['mcp_tool_sets']
): McpToolSetsType {
return {
sets: Object.entries((stored ?? {}) as Record<string, StoredSet>).map(([name, set]) => ({
id: randomUUID(),
name,
scope: [
set.scripts?.length ? `mcp:scripts:${set.scripts.join(',')}` : '',
set.flows?.length ? `mcp:flows:${set.flows.join(',')}` : ''
]
.filter(Boolean)
.join(' '),
instructions: set.instructions ?? ''
}))
}
}
export function convertMcpToolSetsToBackend(
settings: McpToolSetsType
): Record<string, StoredSet> {
// Null-prototype, so a set named `constructor` is a key like any other.
const out: Record<string, StoredSet> = Object.create(null)
for (const row of settings.sets) {
const name = row.name.trim()
if (!name) throw 'Every tool set needs a name'
if (name in out) throw `Two tool sets are named ${name}`
const scripts: string[] = []
const flows: string[] = []
for (const scope of row.scope.split(' ').filter(Boolean)) {
if (scope.startsWith('mcp:scripts:')) {
scripts.push(...scope.slice('mcp:scripts:'.length).split(',').filter(Boolean))
} else if (scope.startsWith('mcp:flows:')) {
flows.push(...scope.slice('mcp:flows:'.length).split(',').filter(Boolean))
} else if (scope === 'mcp:favorites') {
throw `Favorites are each member's own: pick folders, scripts or flows for ${name}`
}
}
if (scripts.length === 0 && flows.length === 0) throw `${name} selects no scripts or flows`
out[name] = { scripts, flows, instructions: row.instructions.trim() || undefined }
}
return out
}
</script>
<script lang="ts">
import { Plus } from 'lucide-svelte'
import { Button } from '$lib/components/common'
import CloseButton from '../common/CloseButton.svelte'
import TextInput from '../text_input/TextInput.svelte'
import McpScopeSelector from '../mcp/McpScopeSelector.svelte'
import ClipboardPanel from '../details/ClipboardPanel.svelte'
import SettingsFooter from './SettingsFooter.svelte'
import SettingsPageHeader from '../settings/SettingsPageHeader.svelte'
import { WorkspaceService } from '$lib/gen'
import { workspaceStore } from '$lib/stores'
import { sendUserToast } from '$lib/toast'
import { apiBaseUrl } from '$lib/apiBaseUrl.svelte'
import { clone } from '$lib/utils'
import { logFeatureUsage } from '$lib/utils/featureUsage'
let {
mcpToolSets = $bindable(),
mcpToolSetsSaved = $bindable(),
onDiscard = undefined
}: {
mcpToolSets: McpToolSetsType
mcpToolSetsSaved: McpToolSetsType
onDiscard?: () => void
} = $props()
const strip = (s: McpToolSetsType) =>
s.sets.map(({ name, scope, instructions }) => ({ name, scope, instructions }))
let hasUnsavedChanges = $derived(
JSON.stringify(strip(mcpToolSets)) !== JSON.stringify(strip(mcpToolSetsSaved))
)
function setUrl(name: string) {
return `${apiBaseUrl('mcp')}/api/mcp/w/${$workspaceStore}/s/${name.trim() || '<name>'}/mcp`
}
async function onSave() {
try {
const mcp_tool_sets = convertMcpToolSetsToBackend(mcpToolSets)
const savedNames = new Set(mcpToolSetsSaved.sets.map((s) => s.name.trim()))
await WorkspaceService.editMcpToolSets({
workspace: $workspaceStore!,
requestBody: { mcp_tool_sets }
})
if (Object.keys(mcp_tool_sets).some((name) => !savedNames.has(name))) {
logFeatureUsage('mcp_tool_set', 'created')
}
mcpToolSetsSaved = clone(mcpToolSets)
sendUserToast('MCP tool sets saved')
} catch (e) {
sendUserToast(e, true)
throw e
}
}
</script>
<SettingsPageHeader
title="MCP tool sets"
description="A tool set is a selection of scripts and flows served at its own MCP URL. Give the URL to the members who should use it: they sign in to Windmill from their AI client and get each script and flow of the set they can run, as a tool. A set never grants access: a member gets only what their own permissions already allow."
/>
<div class="flex flex-col gap-4">
{#each mcpToolSets.sets as set, i (set.id)}
<div class="flex flex-col gap-3 rounded-md border p-4">
<div class="flex items-start gap-2">
<div class="flex flex-col gap-1 grow">
<span class="text-xs font-semibold text-emphasis">Name</span>
<TextInput
bind:value={set.name}
inputProps={{ placeholder: 'support' }}
class="max-w-64"
/>
</div>
<CloseButton
small
on:close={() => {
mcpToolSets.sets = mcpToolSets.sets.filter((_, j) => j !== i)
}}
/>
</div>
<div class="flex flex-col gap-1">
<span class="text-xs font-semibold text-emphasis">Scripts and flows</span>
<McpScopeSelector
workspaceId={$workspaceStore ?? ''}
initialScope={set.scope}
bind:scope={set.scope}
toolSet
/>
</div>
<div class="flex flex-col gap-1">
<span class="text-xs font-semibold text-emphasis">Instructions</span>
<span class="text-2xs text-secondary">
Sent to the AI client along with the tools, for example which flow answers which question.
</span>
<TextInput
underlyingInputEl="textarea"
bind:value={set.instructions}
inputProps={{
rows: 3,
placeholder: 'For questions about orders, use the order lookup flow.'
}}
/>
</div>
<div class="flex flex-col gap-1">
<span class="text-xs font-semibold text-emphasis">URL</span>
<ClipboardPanel content={setUrl(set.name)} />
</div>
</div>
{/each}
<div class="flex justify-center">
<Button
unifiedSize="md"
variant="default"
startIcon={{ icon: Plus }}
onclick={() => {
mcpToolSets.sets = [
...mcpToolSets.sets,
{ id: randomUUID(), name: '', scope: '', instructions: '' }
]
}}
>
New tool set
</Button>
</div>
</div>
<SettingsFooter
class="mt-6 mb-16"
inline
{hasUnsavedChanges}
{onSave}
onDiscard={() => onDiscard?.()}
saveLabel="Save tool sets"
/>
@@ -13,6 +13,7 @@
import { UserService, WorkspaceService } from '$lib/gen'
import { listEveryWorkspace } from '$lib/mcpAuth'
import { sendUserToast } from '$lib/toast'
import { logFeatureUsage } from '$lib/utils/featureUsage'
import Check from 'lucide-svelte/icons/check'
// Get OAuth params from URL
@@ -32,7 +33,9 @@
askedScopes.includes('mcp:read_run')
? askedScopes.filter((s) => s !== 'mcp:read_only' && s !== 'mcp:read_run')
: askedScopes
let scopes = $state<string[]>([])
// A tool set's URL asks for that set, which its workspace's admins chose: nothing to pick.
const toolSet = askedScopes.find((s) => s.startsWith('mcp:set:'))?.slice('mcp:set:'.length)
let scopes = $state<string[]>(toolSet ? [`mcp:set:${toolSet}`, 'mcp:runnables_as_tools'] : [])
let access = $state<McpAccess>()
let oauthState = page.url.searchParams.get('state') || ''
let codeChallenge = page.url.searchParams.get('code_challenge') || ''
@@ -176,6 +179,7 @@
params.set('state', data.state)
}
const url = `${redirectUri}?${params.toString()}`
if (toolSet) logFeatureUsage('mcp_tool_set', 'connected')
success = true
successRedirectUrl = url
loading = false
@@ -278,33 +282,40 @@
</div>
{/if}
<div class="mb-6 flex flex-col gap-1">
<McpAccessPicker
workspaceId={scopeWorkspaceId ?? ''}
workspaces={isGateway
? allWorkspaces
? memberWorkspaces.map((w) => w.value)
: pickedWorkspaces
: [workspaceId]}
initialScopes={requestedScopes}
bind:scopes
bind:access={() => access, setAccess}
>
{#snippet afterAccess()}
{#if isSuperAdmin}
<Toggle
bind:checked={() => superAdmin, setSuperAdmin}
options={{
right: 'Superadmin rights',
rightTooltip:
'The token carries your superadmin rights: admin in every workspace of the instance, including ones you are not a member of.'
}}
size="xs"
/>
{/if}
{/snippet}
</McpAccessPicker>
</div>
{#if toolSet}
<p class="mb-6 text-center text-xs text-secondary">
It gets the <span class="font-semibold text-emphasis">{toolSet}</span> tool set: the scripts
and flows its admins put in it that you can run, each as a tool.
</p>
{:else}
<div class="mb-6 flex flex-col gap-1">
<McpAccessPicker
workspaceId={scopeWorkspaceId ?? ''}
workspaces={isGateway
? allWorkspaces
? memberWorkspaces.map((w) => w.value)
: pickedWorkspaces
: [workspaceId]}
initialScopes={requestedScopes}
bind:scopes
bind:access={() => access, setAccess}
>
{#snippet afterAccess()}
{#if isSuperAdmin}
<Toggle
bind:checked={() => superAdmin, setSuperAdmin}
options={{
right: 'Superadmin rights',
rightTooltip:
'The token carries your superadmin rights: admin in every workspace of the instance, including ones you are not a member of.'
}}
size="xs"
/>
{/if}
{/snippet}
</McpAccessPicker>
</div>
{/if}
<div class="flex flex-row justify-around gap-x-4">
<Button variant="border" size="lg" disabled={loading} onClick={onDeny}>Deny</Button>
@@ -91,6 +91,10 @@
convertDbtSettingsFromBackend,
type DbtSettingsType
} from '$lib/components/workspaceSettings/DbtSettings.svelte'
import McpToolSetsSettings, {
convertMcpToolSetsFromBackend,
type McpToolSetsType
} from '$lib/components/workspaceSettings/McpToolSetsSettings.svelte'
import DucklakeSettings, {
convertDucklakeSettingsFromBackend,
type DucklakeSettingsType
@@ -362,6 +366,8 @@
let dbtSettings: DbtSettingsType = $state({ warehouses: [] })
let dbtSavedSettings: DbtSettingsType = $state(untrack(() => dbtSettings))
let mcpToolSets: McpToolSetsType = $state({ sets: [] })
let mcpToolSetsSaved: McpToolSetsType = $state(untrack(() => mcpToolSets))
let ducklakeSettings: DucklakeSettingsType = $state({ ducklakes: [] })
let ducklakeSavedSettings: DucklakeSettingsType = $state(untrack(() => ducklakeSettings))
@@ -587,6 +593,7 @@
| 'volume_storage'
| 'ducklake'
| 'dbt'
| 'mcp_tool_sets'
| 'git_sync'
| 'default_app'
| 'native_triggers'
@@ -913,6 +920,8 @@
dataTableSettings = convertDataTableSettingsFromBackend(settings.datatable)
dbtSettings = convertDbtSettingsFromBackend(settings.dbt_warehouses)
dbtSavedSettings = clone(dbtSettings)
mcpToolSets = convertMcpToolSetsFromBackend(settings.mcp_tool_sets)
mcpToolSetsSaved = clone(mcpToolSets)
ducklakeSettings = convertDucklakeSettingsFromBackend(settings.ducklake)
ducklakeSavedSettings = clone(ducklakeSettings)
@@ -1451,6 +1460,11 @@
return getDucklakeSettingsInitialAndModifiedValues()
case 'dbt':
return getDbtSettingsInitialAndModifiedValues()
case 'mcp_tool_sets':
return {
savedValue: { mcpToolSets: mcpToolSetsSaved },
modifiedValue: { mcpToolSets }
}
case 'dev_workspace':
return getDeploySettingsInitialAndModifiedValues()
case 'webhook':
@@ -1541,6 +1555,9 @@
case 'dbt':
dbtSettings = clone(dbtSavedSettings)
break
case 'mcp_tool_sets':
mcpToolSets = clone(mcpToolSetsSaved)
break
case 'default_app':
discardDefaultAppSettingsChanges()
break
@@ -1569,6 +1586,12 @@
aiId: 'workspace-settings-ai',
aiDescription: 'Windmill AI workspace settings'
},
{
id: 'mcp_tool_sets',
label: 'MCP tool sets',
aiId: 'workspace-settings-mcp-tool-sets',
aiDescription: 'Named selections of scripts and flows served at their own MCP URL'
},
{
id: 'premium',
label: 'Premium plans',
@@ -2717,6 +2740,14 @@ export async function main(
s3ResourceSettings = clone(s3ResourceSavedSettings)
}}
/>
{:else if tab == 'mcp_tool_sets'}
<McpToolSetsSettings
bind:mcpToolSets
bind:mcpToolSetsSaved
onDiscard={() => {
mcpToolSets = clone(mcpToolSetsSaved)
}}
/>
{:else if tab == 'dbt'}
<DbtSettings
bind:dbtSettings
+1
View File
@@ -1634,6 +1634,7 @@ write a secret you were not given: keep the placeholder.
| \`protection_rules\` | \`{ <rule name>: { rules: [...], bypass_groups: [...], bypass_users: [...], fork_role_mapping?: { <role here>: <role in its forks> } } }\`, rules among \`DisableDirectDeployment\`, \`DisableWorkspaceForking\`, \`RestrictDeployToDeployers\`, \`RestrictAnonymousAppDeployment\`, \`RestrictPublicRunSharing\`, \`RestrictGuestAppDeployment\`, \`RequireIsolatedForks\`. A rule the value omits is deleted. The dev workspace lock is not listed and cannot be set here. |
| \`ducklake\` | \`{ ducklakes: { <name>: { catalog, storage, ... } } }\`. |
| \`dbt_warehouses\` | dbt warehouse connections. |
| \`mcp_tool_sets\` | \`{ <name>: { scripts?: [paths], flows?: [paths], instructions? } }\`: selections of scripts and flows, each served at \`/api/mcp/w/<workspace>/s/<name>/mcp\`. Paths are exact or end in \`/*\`. A member signed in to a set gets the ones they can run. |
| \`default_app\` | Path of the app shown as the workspace home. |
| \`default_scripts\` | \`{ order?, hidden?, default_script_content? }\` for the script language picker. |
| \`deploy_ui\` | \`{ include_path?, include_type? }\`: what the deploy-to-workspace UI offers. |
@@ -50,6 +50,7 @@ write a secret you were not given: keep the placeholder.
| `protection_rules` | `{ <rule name>: { rules: [...], bypass_groups: [...], bypass_users: [...], fork_role_mapping?: { <role here>: <role in its forks> } } }`, rules among `DisableDirectDeployment`, `DisableWorkspaceForking`, `RestrictDeployToDeployers`, `RestrictAnonymousAppDeployment`, `RestrictPublicRunSharing`, `RestrictGuestAppDeployment`, `RequireIsolatedForks`. A rule the value omits is deleted. The dev workspace lock is not listed and cannot be set here. |
| `ducklake` | `{ ducklakes: { <name>: { catalog, storage, ... } } }`. |
| `dbt_warehouses` | dbt warehouse connections. |
| `mcp_tool_sets` | `{ <name>: { scripts?: [paths], flows?: [paths], instructions? } }`: selections of scripts and flows, each served at `/api/mcp/w/<workspace>/s/<name>/mcp`. Paths are exact or end in `/*`. A member signed in to a set gets the ones they can run. |
| `default_app` | Path of the app shown as the workspace home. |
| `default_scripts` | `{ order?, hidden?, default_script_content? }` for the script language picker. |
| `deploy_ui` | `{ include_path?, include_type? }`: what the deploy-to-workspace UI offers. |
@@ -77,7 +78,7 @@ With `includeSettings: true` in `wmill.yaml`, `wmill sync pull` writes the docum
`settings.yaml`, secrets encrypted with the workspace key (plaintext only with `plainSecrets`), and
`wmill sync push` applies it. Unlike a partial apply, a push treats the file as the whole
document: a setting the file omits is cleared, except `operator_settings`, `role_overrides`, `color`, the auto-invite
instance groups, and the keys `ducklake`, `dbt_warehouses`, `deploy_ui`, `teams_command_script`,
instance groups, and the keys `ducklake`, `dbt_warehouses`, `mcp_tool_sets`, `deploy_ui`, `teams_command_script`,
`public_app_execution_limit_per_minute`, `guest_jwt_public_key`, `guest_jwt_jwks_url`,
`error_handler_fallback_to_instance_alerts` and
`add_admins_and_developers_to_forks`, which are managed only when the file states them.
+2 -1
View File
@@ -45,6 +45,7 @@ write a secret you were not given: keep the placeholder.
| `protection_rules` | `{ <rule name>: { rules: [...], bypass_groups: [...], bypass_users: [...], fork_role_mapping?: { <role here>: <role in its forks> } } }`, rules among `DisableDirectDeployment`, `DisableWorkspaceForking`, `RestrictDeployToDeployers`, `RestrictAnonymousAppDeployment`, `RestrictPublicRunSharing`, `RestrictGuestAppDeployment`, `RequireIsolatedForks`. A rule the value omits is deleted. The dev workspace lock is not listed and cannot be set here. |
| `ducklake` | `{ ducklakes: { <name>: { catalog, storage, ... } } }`. |
| `dbt_warehouses` | dbt warehouse connections. |
| `mcp_tool_sets` | `{ <name>: { scripts?: [paths], flows?: [paths], instructions? } }`: selections of scripts and flows, each served at `/api/mcp/w/<workspace>/s/<name>/mcp`. Paths are exact or end in `/*`. A member signed in to a set gets the ones they can run. |
| `default_app` | Path of the app shown as the workspace home. |
| `default_scripts` | `{ order?, hidden?, default_script_content? }` for the script language picker. |
| `deploy_ui` | `{ include_path?, include_type? }`: what the deploy-to-workspace UI offers. |
@@ -73,7 +74,7 @@ With `includeSettings: true` in `wmill.yaml`, `wmill sync pull` writes the docum
`settings.yaml`, secrets encrypted with the workspace key (plaintext only with `plainSecrets`), and
`wmill sync push` applies it. Unlike a partial apply, a push treats the file as the whole
document: a setting the file omits is cleared, except `operator_settings`, `role_overrides`, `color`, the auto-invite
instance groups, and the keys `ducklake`, `dbt_warehouses`, `deploy_ui`, `teams_command_script`,
instance groups, and the keys `ducklake`, `dbt_warehouses`, `mcp_tool_sets`, `deploy_ui`, `teams_command_script`,
`public_app_execution_limit_per_minute`, `guest_jwt_public_key`, `guest_jwt_jwks_url`,
`error_handler_fallback_to_instance_alerts` and
`add_admins_and_developers_to_forks`, which are managed only when the file states them.