diff --git a/docs/adr/0001-plugin-manifests-publish-mcp-descriptors.md b/docs/adr/0001-plugin-manifests-publish-mcp-descriptors.md new file mode 100644 index 0000000..337aa12 --- /dev/null +++ b/docs/adr/0001-plugin-manifests-publish-mcp-descriptors.md @@ -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 diff --git a/plugin/wasmguest/mcp_test.go b/plugin/wasmguest/mcp_test.go index 0c8e6e3..02da35c 100644 --- a/plugin/wasmguest/mcp_test.go +++ b/plugin/wasmguest/mcp_test.go @@ -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 {