fix(test): validate MCP descriptor source locations

This commit is contained in:
Alex Dunmow 2026-08-10 21:10:54 +08:00
parent 911f3f70e0
commit 1ee4db6f0d
2 changed files with 32 additions and 1 deletions

View File

@ -0,0 +1,31 @@
# Plugin manifests publish MCP descriptors
CMS plugins expose ConnectRPC services with method-role mappings. The host can
turn those unary methods into MCP tools, but a wasm plugin previously carried
only its RBAC map; the host had no protobuf method descriptions or input
schemas from which to build a safe MCP catalogue.
Decision: `PluginManifest` carries repeated `MCPToolDescriptor` values at field
38. The Go guest binding derives descriptors from linked protobuf reflection,
includes only mapped unary methods, emits JSON object input schemas, and omits
methods it cannot describe. The host remains responsible for validating every
descriptor against the manifest RBAC map before registration.
Generating descriptors from handwritten plugin metadata was rejected because
it would duplicate protobuf definitions and drift from the actual service.
Publishing every reflected method was rejected because tools without explicit
RBAC mappings would widen the plugin's callable surface.
Consequences:
- Wasm plugin manifests can advertise their own ConnectRPC methods as MCP tools.
- Descriptor capture fails closed for missing services, streaming methods, and
malformed or unsupported protobuf inputs.
- Consumers must use pluginsdk v0.3.2 or newer before calling
`PluginManifest.GetMcpTools`.
- `abi/proto/v1/manifest.proto` remains the language-neutral source of truth;
`abi/v1/manifest.pb.go` is generated output.
Keywords: PluginManifest, MCPToolDescriptor, mcp_tools, GetMcpTools,
captureMCPTools, plugin/wasmguest/mcp.go, abi/proto/v1/manifest.proto,
abi/v1/manifest.pb.go, ConnectRPC, MCP, RBAC, pluginsdk v0.3.2

View File

@ -88,7 +88,7 @@ func registerMCPFixture(t *testing.T) {
}},
}},
SourceCodeInfo: &descriptorpb.SourceCodeInfo{Location: []*descriptorpb.SourceCodeInfo_Location{{
Path: []int32{6, 0, 2, 0}, LeadingComments: proto.String("ListArticles lists Wiki articles.\n\nSupports pagination."),
Path: []int32{6, 0, 2, 0}, Span: []int32{1, 0, 1, 1}, LeadingComments: proto.String("ListArticles lists Wiki articles.\n\nSupports pagination."),
}}},
}, protoregistry.GlobalFiles)
if err != nil {