feat(mcp-actions): Add the ability to configure different plugins for different servers (#33235)

* feat: split MCP actions into per-plugin servers

Add mcpActions.servers config to create multiple MCP server endpoints
scoped by plugin source, with per-server include/exclude filtering.
Add mcpActions.tools for global tool description overrides.

Signed-off-by: benjdlambert <ben@blam.sh>

* feat: namespace tool names, use filter rules for server scoping

- Tool names now use action ID (plugin:name) by default, opt out
  via mcpActions.namespacedToolNames
- Removed pluginSources from server config, use filter.include
  with id glob patterns instead
- Removed tool description overrides (deferred to followup)
- Added server key validation for route safety

Signed-off-by: benjdlambert <ben@blam.sh>

* docs: update README for filter-based server scoping

Signed-off-by: benjdlambert <ben@blam.sh>

* feat: drop SSE routes for split servers

Signed-off-by: benjdlambert <ben@blam.sh>

* fix: handle empty servers config, fix test name

Signed-off-by: benjdlambert <ben@blam.sh>

---------

Signed-off-by: benjdlambert <ben@blam.sh>
This commit is contained in:
Ben Lambert
2026-03-10 11:28:31 +01:00
committed by GitHub
parent 64073a4290
commit c74b69788e
12 changed files with 881 additions and 39 deletions
+63
View File
@@ -0,0 +1,63 @@
/*
* Copyright 2026 The Backstage Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export interface Config {
mcpActions?: {
/**
* When true, MCP tool names include the plugin ID prefix to avoid
* collisions across plugins. For example an action registered as
* "get-entity" by the catalog plugin becomes "catalog:get-entity".
* Defaults to true.
*/
namespacedToolNames?: boolean;
/**
* Named MCP servers, each exposed at /api/mcp-actions/v1/{key}.
* When not configured, the plugin serves a single server at /api/mcp-actions/v1.
*/
servers?: {
[serverKey: string]: {
/** Display name for the MCP server. */
name: string;
/** Description of the MCP server. */
description?: string;
/** Filter rules to include or exclude specific actions. */
filter?: {
include?: Array<{
/** Glob pattern matched against action ID. */
id?: string;
/** Match actions by their attribute flags. */
attributes?: {
destructive?: boolean;
readOnly?: boolean;
idempotent?: boolean;
};
}>;
exclude?: Array<{
/** Glob pattern matched against action ID. */
id?: string;
/** Match actions by their attribute flags. */
attributes?: {
destructive?: boolean;
readOnly?: boolean;
idempotent?: boolean;
};
}>;
};
};
};
};
}