├── .gitignore ├── LICENSE ├── README.md ├── cmd └── protoc-gen-go-mcp │ ├── buf.gen.yaml │ ├── buf.lock │ ├── buf.yaml │ ├── compatibility_test.go │ ├── compatibility_test.pb.go │ ├── compatibility_test.proto │ └── main.go ├── example ├── README.md ├── buf.gen.yaml ├── buf.yaml ├── gen │ └── go │ │ └── proto │ │ └── example │ │ └── v1 │ │ ├── example.pb.go │ │ ├── example_grpc.pb.go │ │ ├── examplev1connect │ │ └── example.connect.go │ │ └── examplev1mcp │ │ └── example.pb.mcp.go ├── main.go └── proto │ └── example │ └── v1 │ └── example.proto ├── go.mod └── go.sum /.gitignore: -------------------------------------------------------------------------------- 1 | # If you prefer the allow list template instead of the deny list, see community template: 2 | # https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore 3 | # 4 | # Binaries for programs and plugins 5 | *.exe 6 | *.exe~ 7 | *.dll 8 | *.so 9 | *.dylib 10 | 11 | # Test binary, built with `go test -c` 12 | *.test 13 | 14 | # Output of the go coverage tool, specifically when used with LiteIDE 15 | *.out 16 | 17 | # Dependency directories (remove the comment below to include it) 18 | # vendor/ 19 | 20 | # Go workspace file 21 | go.work 22 | go.work.sum 23 | 24 | # env file 25 | .env 26 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # `protoc-gen-go-mcp` 2 | 3 | **`protoc-gen-go-mcp`** is a [Protocol Buffers](https://protobuf.dev) compiler plugin that generates [Model Context Protocol (MCP)](https://modelcontextprotocol.io) servers for your `gRPC` or `ConnectRPC` APIs. 4 | 5 | It generates `*.pb.mcp.go` files for each protobuf service, enabling you to delegate handlers directly to gRPC servers or clients. Under the hood, MCP uses JSON Schema for tool inputs—`protoc-gen-go-mcp` auto-generates these schemas from your method input descriptors. 6 | 7 | > ⚠️ Currently supports [mark3labs/mcp-go](https://github.com/mark3labs/mcp-go) as the MCP server runtime. Future support is planned for official Go SDKs and additional runtimes. 8 | 9 | ## ✨ Features 10 | 11 | - 🚀 Auto-generates MCP handlers from your `.proto` services 12 | - 📦 Outputs JSON Schema for method inputs 13 | - 🔄 Wire up to gRPC or ConnectRPC servers/clients 14 | - 🧩 Easy integration with [`buf`](https://buf.build) 15 | 16 | ## 🔧 Usage 17 | 18 | ### Generate code 19 | 20 | Add entry to your `buf.gen.yaml`: 21 | ``` 22 | ... 23 | plugins: 24 | - local: 25 | - go 26 | - run 27 | - github.com/redpanda-data/protoc-gen-go-mcp/cmd/protoc-gen-go-mcp@latest 28 | out: ./gen/go 29 | opt: paths=source_relative 30 | ``` 31 | 32 | You need to generate the standard `*.pb.go` files as well. `protoc-gen-go-mcp` by defaults uses a separate subfolder `{$servicename}mcp`, and imports the `*pb.go` files - similar to connectrpc-go. 33 | See [here](./example/buf.gen.yaml) for a complete example. 34 | 35 | After running `buf generate`, you will see a new folder for each package with protobuf Service definitions: 36 | 37 | ``` 38 | tree example/gen/ 39 | gen 40 | └── go 41 | └── proto 42 | └── example 43 | └── v1 44 | ├── example.pb.go 45 | └── examplev1mcp 46 | └── example.pb.mcp.go 47 | ``` 48 | 49 | ### Wiring Up MCP with gRPC server (in-process) 50 | 51 | Example for in-process registration: 52 | 53 | ```go 54 | srv := exampleServer{} // your gRPC implementation 55 | 56 | // Register all RPC methods as tools on the MCP server 57 | examplev1mcp.RegisterExampleServiceHandler(mcpServer, &srv) 58 | ``` 59 | 60 | Each RPC method in your protobuf service becomes an MCP tool. 61 | 62 | ➡️ See the [full example](./example) for details. 63 | 64 | ### Wiring up with grpc and connectrpc client 65 | 66 | It is also possible to directly forward MCP tool calls to gRPC clients. 67 | 68 | ```go 69 | examplev1mcp.ForwardToExampleServiceClient(mcpServer, myGrpcClient) 70 | ``` 71 | 72 | Same for connectrpc: 73 | 74 | ```go 75 | examplev1mcp.ForwardToConnectExampleServiceClient(mcpServer, myConnectClient) 76 | ``` 77 | 78 | This directly connects the MCP handler to the connectrpc client, requiring zero boilerplate. 79 | 80 | ## ⚠️ Limitations 81 | 82 | - No interceptor support (yet). Registering with a gRPC server bypasses interceptors. 83 | - Tool name mangling for long RPC names: If the full RPC name exceeds 64 characters (Claude desktop limit), the head of the tool name is mangled to fit. 84 | 85 | ## 🗺️ Roadmap 86 | 87 | - Reflection/proxy mode 88 | - Interceptor middleware support in gRPC server mode 89 | - Support for the official Go MCP SDK (once published) 90 | 91 | ## 💬 Feedback 92 | 93 | We'd love feedback, bug reports, or PRs! Join the discussion and help shape the future of Go and Protobuf MCP tooling. 94 | -------------------------------------------------------------------------------- /cmd/protoc-gen-go-mcp/buf.gen.yaml: -------------------------------------------------------------------------------- 1 | version: v2 2 | managed: 3 | enabled: true 4 | override: 5 | - file_option: go_package_prefix 6 | value: github.com/redpanda-data/protoc-gen-go-mcp/cmd/protoc-gen-go-mcp/main 7 | disable: 8 | - file_option: go_package 9 | module: buf.build/googleapis/googleapis 10 | plugins: 11 | - remote: buf.build/protocolbuffers/go 12 | out: . 13 | opt: paths=source_relative 14 | -------------------------------------------------------------------------------- /cmd/protoc-gen-go-mcp/buf.lock: -------------------------------------------------------------------------------- 1 | # Generated by buf. DO NOT EDIT. 2 | version: v2 3 | deps: 4 | - name: buf.build/googleapis/googleapis 5 | commit: 61b203b9a9164be9a834f58c37be6f62 6 | digest: b5:7811a98b35bd2e4ae5c3ac73c8b3d9ae429f3a790da15de188dc98fc2b77d6bb10e45711f14903af9553fa9821dff256054f2e4b7795789265bc476bec2f088c 7 | -------------------------------------------------------------------------------- /cmd/protoc-gen-go-mcp/buf.yaml: -------------------------------------------------------------------------------- 1 | version: v2 2 | deps: 3 | - buf.build/googleapis/googleapis 4 | modules: 5 | - path: ./ 6 | -------------------------------------------------------------------------------- /cmd/protoc-gen-go-mcp/compatibility_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Redpanda Data, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package main 16 | 17 | import ( 18 | "bytes" 19 | "encoding/json" 20 | "testing" 21 | "time" 22 | 23 | . "github.com/onsi/gomega" 24 | "github.com/santhosh-tekuri/jsonschema/v5" 25 | "google.golang.org/protobuf/encoding/protojson" 26 | "google.golang.org/protobuf/proto" 27 | anypb "google.golang.org/protobuf/types/known/anypb" 28 | "google.golang.org/protobuf/types/known/durationpb" 29 | "google.golang.org/protobuf/types/known/fieldmaskpb" 30 | "google.golang.org/protobuf/types/known/structpb" 31 | "google.golang.org/protobuf/types/known/timestamppb" 32 | "google.golang.org/protobuf/types/known/wrapperspb" 33 | ) 34 | 35 | func init() { 36 | } 37 | 38 | func TestCompat(t *testing.T) { 39 | g := NewWithT(t) 40 | 41 | tests := []struct { 42 | name string 43 | input proto.Message 44 | // If rawJsonInput is set, it's preferred over input. 45 | // It can be used to simulate a wrong input, eg. not using base64 for byte fields. 46 | // input must still be provided, so we know the proto type. 47 | rawJsonInput json.RawMessage 48 | errorExpected bool 49 | errorContains string 50 | }{ 51 | { 52 | name: "any containing struct", 53 | input: func() proto.Message { 54 | val := &structpb.Struct{ 55 | Fields: map[string]*structpb.Value{ 56 | "nested": structpb.NewStringValue("value"), 57 | }, 58 | } 59 | any, err := anypb.New(val) 60 | g.Expect(err).ToNot(HaveOccurred()) 61 | return &WktTestMessage{ 62 | Any: any, 63 | } 64 | }(), 65 | }, 66 | { 67 | name: "bytes value with weird base64", 68 | input: &WktTestMessage{ 69 | BytesValue: wrapperspb.Bytes([]byte{0xde, 0xad, 0xbe, 0xef}), 70 | }, 71 | }, 72 | { 73 | name: "negative duration", 74 | input: &WktTestMessage{ 75 | Duration: durationpb.New(-5 * time.Second), 76 | }, 77 | }, 78 | { 79 | name: "timestamp in the future", 80 | input: &WktTestMessage{ 81 | Timestamp: timestamppb.New(time.Date(3000, 1, 1, 0, 0, 0, 0, time.UTC)), 82 | }, 83 | }, 84 | { 85 | name: "wrapper types with default values", 86 | input: &WktTestMessage{ 87 | StringValue: wrapperspb.String(""), 88 | Int32Value: wrapperspb.Int32(0), 89 | Int64Value: wrapperspb.Int64(0), 90 | BoolValue: wrapperspb.Bool(false), 91 | BytesValue: wrapperspb.Bytes(nil), 92 | }, 93 | }, 94 | { 95 | name: "basic any test", 96 | input: func() proto.Message { 97 | any, err := anypb.New(wrapperspb.String("some-string-in-any")) 98 | g.Expect(err).ToNot(HaveOccurred()) 99 | return &WktTestMessage{ 100 | Any: any, 101 | } 102 | }(), 103 | }, 104 | { 105 | name: "bytes as base64 works", 106 | input: &TestMessage{ 107 | SomeBytes: []byte{1, 200, 125}, 108 | }, 109 | }, 110 | { 111 | name: "bytes must be base64 - fails if it's not", 112 | input: &TestMessage{}, 113 | rawJsonInput: json.RawMessage(`{"some_bytes":"hello this is not base64"}`), 114 | errorExpected: true, 115 | errorContains: "/properties/some_bytes/contentEncoding", 116 | }, 117 | { 118 | name: "a little bit of everything, required field is set", 119 | input: &WktTestMessage{ 120 | Timestamp: timestamppb.New(time.Date(2023, 1, 1, 12, 0, 0, 0, time.UTC)), 121 | Duration: durationpb.New(3 * time.Second), 122 | StructField: &structpb.Struct{Fields: map[string]*structpb.Value{"foo": structpb.NewStringValue("bar")}}, 123 | ValueField: structpb.NewNumberValue(42), 124 | ListValue: &structpb.ListValue{Values: []*structpb.Value{structpb.NewBoolValue(true)}}, 125 | FieldMask: &fieldmaskpb.FieldMask{Paths: []string{"foo", "bar"}}, 126 | StringValue: wrapperspb.String("hello"), 127 | Int32Value: wrapperspb.Int32(123), 128 | Int64Value: wrapperspb.Int64(1234567890123), 129 | BoolValue: wrapperspb.Bool(true), 130 | BytesValue: wrapperspb.Bytes([]byte("hi")), 131 | }, 132 | }, 133 | { 134 | name: "required field absent throws error", 135 | input: &RequiredFieldTest{}, 136 | errorExpected: true, 137 | errorContains: `missing properties: 'required_field'`, 138 | }, 139 | } 140 | 141 | for _, tt := range tests { 142 | t.Run(tt.name, func(t *testing.T) { 143 | g := NewWithT(t) 144 | var input []byte 145 | if tt.rawJsonInput == nil { 146 | marshaled, err := protojson.MarshalOptions{UseProtoNames: true}.Marshal(tt.input) 147 | g.Expect(err).ToNot(HaveOccurred()) 148 | input = marshaled 149 | } else { 150 | input = tt.rawJsonInput 151 | } 152 | 153 | schemaMap := messageSchema(tt.input.ProtoReflect().Descriptor()) 154 | schemaJSON, err := json.Marshal(schemaMap) 155 | g.Expect(err).ToNot(HaveOccurred()) 156 | 157 | // Step 4: Validate the marshaled JSON against the schema 158 | compiler := jsonschema.NewCompiler() 159 | // This is required, so it can assert that strings are base64. 160 | compiler.AssertContent = true 161 | 162 | err = compiler.AddResource("schema.json", bytes.NewReader(schemaJSON)) 163 | g.Expect(err).ToNot(HaveOccurred()) 164 | 165 | schema, err := compiler.Compile("schema.json") 166 | g.Expect(err).ToNot(HaveOccurred()) 167 | 168 | var jsonData interface{} 169 | err = json.Unmarshal(input, &jsonData) 170 | g.Expect(err).ToNot(HaveOccurred()) 171 | 172 | err = schema.Validate(jsonData) 173 | if tt.errorExpected { 174 | g.Expect(err).To(HaveOccurred()) 175 | } else { 176 | g.Expect(err).ToNot(HaveOccurred()) 177 | } 178 | 179 | if tt.errorContains != "" { 180 | g.Expect(err).To(MatchError(ContainSubstring(tt.errorContains))) 181 | } 182 | 183 | }) 184 | } 185 | 186 | } 187 | -------------------------------------------------------------------------------- /cmd/protoc-gen-go-mcp/compatibility_test.pb.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoc-gen-go. DO NOT EDIT. 2 | // versions: 3 | // protoc-gen-go v1.36.6 4 | // protoc (unknown) 5 | // source: compatibility_test.proto 6 | 7 | package main 8 | 9 | import ( 10 | _ "google.golang.org/genproto/googleapis/api/annotations" 11 | protoreflect "google.golang.org/protobuf/reflect/protoreflect" 12 | protoimpl "google.golang.org/protobuf/runtime/protoimpl" 13 | anypb "google.golang.org/protobuf/types/known/anypb" 14 | durationpb "google.golang.org/protobuf/types/known/durationpb" 15 | fieldmaskpb "google.golang.org/protobuf/types/known/fieldmaskpb" 16 | structpb "google.golang.org/protobuf/types/known/structpb" 17 | timestamppb "google.golang.org/protobuf/types/known/timestamppb" 18 | wrapperspb "google.golang.org/protobuf/types/known/wrapperspb" 19 | reflect "reflect" 20 | sync "sync" 21 | unsafe "unsafe" 22 | ) 23 | 24 | const ( 25 | // Verify that this generated code is sufficiently up-to-date. 26 | _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) 27 | // Verify that runtime/protoimpl is sufficiently up-to-date. 28 | _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) 29 | ) 30 | 31 | type TestMessage struct { 32 | state protoimpl.MessageState `protogen:"open.v1"` 33 | SomeBytes []byte `protobuf:"bytes,1,opt,name=some_bytes,json=someBytes,proto3" json:"some_bytes,omitempty"` 34 | unknownFields protoimpl.UnknownFields 35 | sizeCache protoimpl.SizeCache 36 | } 37 | 38 | func (x *TestMessage) Reset() { 39 | *x = TestMessage{} 40 | mi := &file_compatibility_test_proto_msgTypes[0] 41 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 42 | ms.StoreMessageInfo(mi) 43 | } 44 | 45 | func (x *TestMessage) String() string { 46 | return protoimpl.X.MessageStringOf(x) 47 | } 48 | 49 | func (*TestMessage) ProtoMessage() {} 50 | 51 | func (x *TestMessage) ProtoReflect() protoreflect.Message { 52 | mi := &file_compatibility_test_proto_msgTypes[0] 53 | if x != nil { 54 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 55 | if ms.LoadMessageInfo() == nil { 56 | ms.StoreMessageInfo(mi) 57 | } 58 | return ms 59 | } 60 | return mi.MessageOf(x) 61 | } 62 | 63 | // Deprecated: Use TestMessage.ProtoReflect.Descriptor instead. 64 | func (*TestMessage) Descriptor() ([]byte, []int) { 65 | return file_compatibility_test_proto_rawDescGZIP(), []int{0} 66 | } 67 | 68 | func (x *TestMessage) GetSomeBytes() []byte { 69 | if x != nil { 70 | return x.SomeBytes 71 | } 72 | return nil 73 | } 74 | 75 | type RequiredFieldTest struct { 76 | state protoimpl.MessageState `protogen:"open.v1"` 77 | RequiredField string `protobuf:"bytes,13,opt,name=required_field,json=requiredField,proto3" json:"required_field,omitempty"` 78 | unknownFields protoimpl.UnknownFields 79 | sizeCache protoimpl.SizeCache 80 | } 81 | 82 | func (x *RequiredFieldTest) Reset() { 83 | *x = RequiredFieldTest{} 84 | mi := &file_compatibility_test_proto_msgTypes[1] 85 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 86 | ms.StoreMessageInfo(mi) 87 | } 88 | 89 | func (x *RequiredFieldTest) String() string { 90 | return protoimpl.X.MessageStringOf(x) 91 | } 92 | 93 | func (*RequiredFieldTest) ProtoMessage() {} 94 | 95 | func (x *RequiredFieldTest) ProtoReflect() protoreflect.Message { 96 | mi := &file_compatibility_test_proto_msgTypes[1] 97 | if x != nil { 98 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 99 | if ms.LoadMessageInfo() == nil { 100 | ms.StoreMessageInfo(mi) 101 | } 102 | return ms 103 | } 104 | return mi.MessageOf(x) 105 | } 106 | 107 | // Deprecated: Use RequiredFieldTest.ProtoReflect.Descriptor instead. 108 | func (*RequiredFieldTest) Descriptor() ([]byte, []int) { 109 | return file_compatibility_test_proto_rawDescGZIP(), []int{1} 110 | } 111 | 112 | func (x *RequiredFieldTest) GetRequiredField() string { 113 | if x != nil { 114 | return x.RequiredField 115 | } 116 | return "" 117 | } 118 | 119 | type WktTestMessage struct { 120 | state protoimpl.MessageState `protogen:"open.v1"` 121 | Timestamp *timestamppb.Timestamp `protobuf:"bytes,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"` 122 | Duration *durationpb.Duration `protobuf:"bytes,2,opt,name=duration,proto3" json:"duration,omitempty"` 123 | StructField *structpb.Struct `protobuf:"bytes,3,opt,name=struct_field,json=structField,proto3" json:"struct_field,omitempty"` 124 | ValueField *structpb.Value `protobuf:"bytes,4,opt,name=value_field,json=valueField,proto3" json:"value_field,omitempty"` 125 | ListValue *structpb.ListValue `protobuf:"bytes,5,opt,name=list_value,json=listValue,proto3" json:"list_value,omitempty"` 126 | FieldMask *fieldmaskpb.FieldMask `protobuf:"bytes,6,opt,name=field_mask,json=fieldMask,proto3" json:"field_mask,omitempty"` 127 | Any *anypb.Any `protobuf:"bytes,7,opt,name=any,proto3" json:"any,omitempty"` 128 | StringValue *wrapperspb.StringValue `protobuf:"bytes,8,opt,name=string_value,json=stringValue,proto3" json:"string_value,omitempty"` 129 | Int32Value *wrapperspb.Int32Value `protobuf:"bytes,9,opt,name=int32_value,json=int32Value,proto3" json:"int32_value,omitempty"` 130 | Int64Value *wrapperspb.Int64Value `protobuf:"bytes,10,opt,name=int64_value,json=int64Value,proto3" json:"int64_value,omitempty"` 131 | BoolValue *wrapperspb.BoolValue `protobuf:"bytes,11,opt,name=bool_value,json=boolValue,proto3" json:"bool_value,omitempty"` 132 | BytesValue *wrapperspb.BytesValue `protobuf:"bytes,12,opt,name=bytes_value,json=bytesValue,proto3" json:"bytes_value,omitempty"` 133 | unknownFields protoimpl.UnknownFields 134 | sizeCache protoimpl.SizeCache 135 | } 136 | 137 | func (x *WktTestMessage) Reset() { 138 | *x = WktTestMessage{} 139 | mi := &file_compatibility_test_proto_msgTypes[2] 140 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 141 | ms.StoreMessageInfo(mi) 142 | } 143 | 144 | func (x *WktTestMessage) String() string { 145 | return protoimpl.X.MessageStringOf(x) 146 | } 147 | 148 | func (*WktTestMessage) ProtoMessage() {} 149 | 150 | func (x *WktTestMessage) ProtoReflect() protoreflect.Message { 151 | mi := &file_compatibility_test_proto_msgTypes[2] 152 | if x != nil { 153 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 154 | if ms.LoadMessageInfo() == nil { 155 | ms.StoreMessageInfo(mi) 156 | } 157 | return ms 158 | } 159 | return mi.MessageOf(x) 160 | } 161 | 162 | // Deprecated: Use WktTestMessage.ProtoReflect.Descriptor instead. 163 | func (*WktTestMessage) Descriptor() ([]byte, []int) { 164 | return file_compatibility_test_proto_rawDescGZIP(), []int{2} 165 | } 166 | 167 | func (x *WktTestMessage) GetTimestamp() *timestamppb.Timestamp { 168 | if x != nil { 169 | return x.Timestamp 170 | } 171 | return nil 172 | } 173 | 174 | func (x *WktTestMessage) GetDuration() *durationpb.Duration { 175 | if x != nil { 176 | return x.Duration 177 | } 178 | return nil 179 | } 180 | 181 | func (x *WktTestMessage) GetStructField() *structpb.Struct { 182 | if x != nil { 183 | return x.StructField 184 | } 185 | return nil 186 | } 187 | 188 | func (x *WktTestMessage) GetValueField() *structpb.Value { 189 | if x != nil { 190 | return x.ValueField 191 | } 192 | return nil 193 | } 194 | 195 | func (x *WktTestMessage) GetListValue() *structpb.ListValue { 196 | if x != nil { 197 | return x.ListValue 198 | } 199 | return nil 200 | } 201 | 202 | func (x *WktTestMessage) GetFieldMask() *fieldmaskpb.FieldMask { 203 | if x != nil { 204 | return x.FieldMask 205 | } 206 | return nil 207 | } 208 | 209 | func (x *WktTestMessage) GetAny() *anypb.Any { 210 | if x != nil { 211 | return x.Any 212 | } 213 | return nil 214 | } 215 | 216 | func (x *WktTestMessage) GetStringValue() *wrapperspb.StringValue { 217 | if x != nil { 218 | return x.StringValue 219 | } 220 | return nil 221 | } 222 | 223 | func (x *WktTestMessage) GetInt32Value() *wrapperspb.Int32Value { 224 | if x != nil { 225 | return x.Int32Value 226 | } 227 | return nil 228 | } 229 | 230 | func (x *WktTestMessage) GetInt64Value() *wrapperspb.Int64Value { 231 | if x != nil { 232 | return x.Int64Value 233 | } 234 | return nil 235 | } 236 | 237 | func (x *WktTestMessage) GetBoolValue() *wrapperspb.BoolValue { 238 | if x != nil { 239 | return x.BoolValue 240 | } 241 | return nil 242 | } 243 | 244 | func (x *WktTestMessage) GetBytesValue() *wrapperspb.BytesValue { 245 | if x != nil { 246 | return x.BytesValue 247 | } 248 | return nil 249 | } 250 | 251 | var File_compatibility_test_proto protoreflect.FileDescriptor 252 | 253 | const file_compatibility_test_proto_rawDesc = "" + 254 | "\n" + 255 | "\x18compatibility_test.proto\x12\x04main\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x1egoogle/protobuf/duration.proto\x1a\x1cgoogle/protobuf/struct.proto\x1a google/protobuf/field_mask.proto\x1a\x1egoogle/protobuf/wrappers.proto\x1a\x19google/protobuf/any.proto\x1a\x1fgoogle/api/field_behavior.proto\",\n" + 256 | "\vTestMessage\x12\x1d\n" + 257 | "\n" + 258 | "some_bytes\x18\x01 \x01(\fR\tsomeBytes\"?\n" + 259 | "\x11RequiredFieldTest\x12*\n" + 260 | "\x0erequired_field\x18\r \x01(\tB\x03\xe0A\x02R\rrequiredField\"\xca\x05\n" + 261 | "\x0eWktTestMessage\x128\n" + 262 | "\ttimestamp\x18\x01 \x01(\v2\x1a.google.protobuf.TimestampR\ttimestamp\x125\n" + 263 | "\bduration\x18\x02 \x01(\v2\x19.google.protobuf.DurationR\bduration\x12:\n" + 264 | "\fstruct_field\x18\x03 \x01(\v2\x17.google.protobuf.StructR\vstructField\x127\n" + 265 | "\vvalue_field\x18\x04 \x01(\v2\x16.google.protobuf.ValueR\n" + 266 | "valueField\x129\n" + 267 | "\n" + 268 | "list_value\x18\x05 \x01(\v2\x1a.google.protobuf.ListValueR\tlistValue\x129\n" + 269 | "\n" + 270 | "field_mask\x18\x06 \x01(\v2\x1a.google.protobuf.FieldMaskR\tfieldMask\x12&\n" + 271 | "\x03any\x18\a \x01(\v2\x14.google.protobuf.AnyR\x03any\x12?\n" + 272 | "\fstring_value\x18\b \x01(\v2\x1c.google.protobuf.StringValueR\vstringValue\x12<\n" + 273 | "\vint32_value\x18\t \x01(\v2\x1b.google.protobuf.Int32ValueR\n" + 274 | "int32Value\x12<\n" + 275 | "\vint64_value\x18\n" + 276 | " \x01(\v2\x1b.google.protobuf.Int64ValueR\n" + 277 | "int64Value\x129\n" + 278 | "\n" + 279 | "bool_value\x18\v \x01(\v2\x1a.google.protobuf.BoolValueR\tboolValue\x12<\n" + 280 | "\vbytes_value\x18\f \x01(\v2\x1b.google.protobuf.BytesValueR\n" + 281 | "bytesValueB\x99\x01\n" + 282 | "\bcom.mainB\x16CompatibilityTestProtoP\x01ZEgithub.com/redpanda-data/protoc-gen-go-mcp/cmd/protoc-gen-go-mcp/main\xa2\x02\x03MXX\xaa\x02\x04Main\xca\x02\x04Main\xe2\x02\x10Main\\GPBMetadata\xea\x02\x04Mainb\x06proto3" 283 | 284 | var ( 285 | file_compatibility_test_proto_rawDescOnce sync.Once 286 | file_compatibility_test_proto_rawDescData []byte 287 | ) 288 | 289 | func file_compatibility_test_proto_rawDescGZIP() []byte { 290 | file_compatibility_test_proto_rawDescOnce.Do(func() { 291 | file_compatibility_test_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_compatibility_test_proto_rawDesc), len(file_compatibility_test_proto_rawDesc))) 292 | }) 293 | return file_compatibility_test_proto_rawDescData 294 | } 295 | 296 | var file_compatibility_test_proto_msgTypes = make([]protoimpl.MessageInfo, 3) 297 | var file_compatibility_test_proto_goTypes = []any{ 298 | (*TestMessage)(nil), // 0: main.TestMessage 299 | (*RequiredFieldTest)(nil), // 1: main.RequiredFieldTest 300 | (*WktTestMessage)(nil), // 2: main.WktTestMessage 301 | (*timestamppb.Timestamp)(nil), // 3: google.protobuf.Timestamp 302 | (*durationpb.Duration)(nil), // 4: google.protobuf.Duration 303 | (*structpb.Struct)(nil), // 5: google.protobuf.Struct 304 | (*structpb.Value)(nil), // 6: google.protobuf.Value 305 | (*structpb.ListValue)(nil), // 7: google.protobuf.ListValue 306 | (*fieldmaskpb.FieldMask)(nil), // 8: google.protobuf.FieldMask 307 | (*anypb.Any)(nil), // 9: google.protobuf.Any 308 | (*wrapperspb.StringValue)(nil), // 10: google.protobuf.StringValue 309 | (*wrapperspb.Int32Value)(nil), // 11: google.protobuf.Int32Value 310 | (*wrapperspb.Int64Value)(nil), // 12: google.protobuf.Int64Value 311 | (*wrapperspb.BoolValue)(nil), // 13: google.protobuf.BoolValue 312 | (*wrapperspb.BytesValue)(nil), // 14: google.protobuf.BytesValue 313 | } 314 | var file_compatibility_test_proto_depIdxs = []int32{ 315 | 3, // 0: main.WktTestMessage.timestamp:type_name -> google.protobuf.Timestamp 316 | 4, // 1: main.WktTestMessage.duration:type_name -> google.protobuf.Duration 317 | 5, // 2: main.WktTestMessage.struct_field:type_name -> google.protobuf.Struct 318 | 6, // 3: main.WktTestMessage.value_field:type_name -> google.protobuf.Value 319 | 7, // 4: main.WktTestMessage.list_value:type_name -> google.protobuf.ListValue 320 | 8, // 5: main.WktTestMessage.field_mask:type_name -> google.protobuf.FieldMask 321 | 9, // 6: main.WktTestMessage.any:type_name -> google.protobuf.Any 322 | 10, // 7: main.WktTestMessage.string_value:type_name -> google.protobuf.StringValue 323 | 11, // 8: main.WktTestMessage.int32_value:type_name -> google.protobuf.Int32Value 324 | 12, // 9: main.WktTestMessage.int64_value:type_name -> google.protobuf.Int64Value 325 | 13, // 10: main.WktTestMessage.bool_value:type_name -> google.protobuf.BoolValue 326 | 14, // 11: main.WktTestMessage.bytes_value:type_name -> google.protobuf.BytesValue 327 | 12, // [12:12] is the sub-list for method output_type 328 | 12, // [12:12] is the sub-list for method input_type 329 | 12, // [12:12] is the sub-list for extension type_name 330 | 12, // [12:12] is the sub-list for extension extendee 331 | 0, // [0:12] is the sub-list for field type_name 332 | } 333 | 334 | func init() { file_compatibility_test_proto_init() } 335 | func file_compatibility_test_proto_init() { 336 | if File_compatibility_test_proto != nil { 337 | return 338 | } 339 | type x struct{} 340 | out := protoimpl.TypeBuilder{ 341 | File: protoimpl.DescBuilder{ 342 | GoPackagePath: reflect.TypeOf(x{}).PkgPath(), 343 | RawDescriptor: unsafe.Slice(unsafe.StringData(file_compatibility_test_proto_rawDesc), len(file_compatibility_test_proto_rawDesc)), 344 | NumEnums: 0, 345 | NumMessages: 3, 346 | NumExtensions: 0, 347 | NumServices: 0, 348 | }, 349 | GoTypes: file_compatibility_test_proto_goTypes, 350 | DependencyIndexes: file_compatibility_test_proto_depIdxs, 351 | MessageInfos: file_compatibility_test_proto_msgTypes, 352 | }.Build() 353 | File_compatibility_test_proto = out.File 354 | file_compatibility_test_proto_goTypes = nil 355 | file_compatibility_test_proto_depIdxs = nil 356 | } 357 | -------------------------------------------------------------------------------- /cmd/protoc-gen-go-mcp/compatibility_test.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Redpanda Data, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | syntax = "proto3"; 16 | 17 | import "google/protobuf/timestamp.proto"; 18 | import "google/protobuf/duration.proto"; 19 | import "google/protobuf/struct.proto"; 20 | import "google/protobuf/field_mask.proto"; 21 | import "google/protobuf/wrappers.proto"; 22 | import "google/protobuf/any.proto"; 23 | import "google/api/field_behavior.proto"; 24 | 25 | package main; 26 | 27 | message TestMessage { 28 | bytes some_bytes = 1; 29 | } 30 | 31 | message RequiredFieldTest { 32 | string required_field = 13 [(google.api.field_behavior) = REQUIRED]; 33 | } 34 | 35 | message WktTestMessage { 36 | google.protobuf.Timestamp timestamp = 1; 37 | google.protobuf.Duration duration = 2; 38 | google.protobuf.Struct struct_field = 3; 39 | google.protobuf.Value value_field = 4; 40 | google.protobuf.ListValue list_value = 5; 41 | google.protobuf.FieldMask field_mask = 6; 42 | google.protobuf.Any any = 7; 43 | 44 | google.protobuf.StringValue string_value = 8; 45 | google.protobuf.Int32Value int32_value = 9; 46 | google.protobuf.Int64Value int64_value = 10; 47 | google.protobuf.BoolValue bool_value = 11; 48 | google.protobuf.BytesValue bytes_value = 12; 49 | } 50 | -------------------------------------------------------------------------------- /cmd/protoc-gen-go-mcp/main.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Redpanda Data, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | package main 15 | 16 | import ( 17 | "crypto/sha1" 18 | "encoding/json" 19 | "flag" 20 | "fmt" 21 | "go/token" 22 | "math/big" 23 | "path" 24 | "path/filepath" 25 | "strings" 26 | "text/template" 27 | 28 | "github.com/mark3labs/mcp-go/mcp" 29 | "google.golang.org/genproto/googleapis/api/annotations" 30 | "google.golang.org/protobuf/compiler/protogen" 31 | "google.golang.org/protobuf/proto" 32 | "google.golang.org/protobuf/reflect/protoreflect" 33 | "google.golang.org/protobuf/types/pluginpb" 34 | ) 35 | 36 | const ( 37 | generatedFilenameExtension = ".pb.mcp.go" 38 | defaultPackageSuffix = "mcp" 39 | packageSuffixFlagName = "package_suffix" 40 | ) 41 | 42 | func main() { 43 | var flagSet flag.FlagSet 44 | packageSuffix := flagSet.String( 45 | packageSuffixFlagName, 46 | defaultPackageSuffix, 47 | "Generate files into a sub-package of the package containing the base .pb.go files using the given suffix. An empty suffix denotes to generate into the same package as the base pb.go files.", 48 | ) 49 | 50 | protogen.Options{ 51 | ParamFunc: flagSet.Set, 52 | }.Run(func(gen *protogen.Plugin) error { 53 | for _, f := range gen.Files { 54 | if !f.Generate { 55 | continue 56 | } 57 | newFileGenerator(f, gen).Generate(*packageSuffix) 58 | } 59 | return nil 60 | 61 | }) 62 | } 63 | 64 | type fileGenerator struct { 65 | f *protogen.File 66 | gen *protogen.Plugin 67 | 68 | allConsts map[string]struct{} 69 | gf *protogen.GeneratedFile 70 | } 71 | 72 | func newFileGenerator(f *protogen.File, gen *protogen.Plugin) *fileGenerator { 73 | gen.SupportedFeatures |= uint64(pluginpb.CodeGeneratorResponse_FEATURE_PROTO3_OPTIONAL) 74 | 75 | return &fileGenerator{f: f, gen: gen} 76 | } 77 | 78 | const fileTemplate = `// Code generated by protoc-gen-mcp-go. DO NOT EDIT. 79 | // source: {{ .SourcePath }} 80 | 81 | package {{ .GoPackage }} 82 | 83 | import ( 84 | "context" 85 | "github.com/mark3labs/mcp-go/mcp" 86 | mcpserver "github.com/mark3labs/mcp-go/server" 87 | "encoding/json" 88 | "google.golang.org/protobuf/encoding/protojson" 89 | "connectrpc.com/connect" 90 | grpc "google.golang.org/grpc" 91 | ) 92 | 93 | var ( 94 | {{- range $key, $val := .Tools }} 95 | {{$key}}Tool = {{ printf "%#v" $val }} 96 | {{- end }} 97 | ) 98 | 99 | {{- range $serviceName, $methods := .Services }} 100 | // {{$serviceName}}Server is compatible with the grpc-go server interface. 101 | type {{$serviceName}}Server interface { 102 | {{- range $methodName, $tool := $methods }} 103 | {{$methodName}}(ctx context.Context, req *{{$tool.RequestType}}) (*{{$tool.ResponseType}}, error) 104 | {{- end }} 105 | } 106 | {{ end }} 107 | 108 | {{- range $key, $val := .Services }} 109 | func Register{{$key}}Handler(s *mcpserver.MCPServer, srv {{$key}}Server) { 110 | {{- range $tool_name, $tool_val := $val }} 111 | s.AddTool({{$key}}_{{$tool_name}}Tool,func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) { 112 | marshaled, err := json.Marshal(request.Params.Arguments) 113 | if err != nil { 114 | return nil, err 115 | } 116 | 117 | var req {{$tool_val.RequestType}} 118 | if err := (protojson.UnmarshalOptions{DiscardUnknown: true}).Unmarshal(marshaled, &req); err != nil { 119 | return nil, err 120 | } 121 | 122 | resp, err := srv.{{$tool_name}}(ctx, &req) 123 | if err != nil { 124 | return nil, err 125 | } 126 | 127 | marshaled, err = (protojson.MarshalOptions{UseProtoNames: true, EmitDefaultValues: true}).Marshal(resp) 128 | if err != nil { 129 | return nil, err 130 | } 131 | return mcp.NewToolResultText(string(marshaled)), nil 132 | }) 133 | {{- end }} 134 | } 135 | {{- end }} 136 | 137 | {{- range $serviceName, $methods := .Services }} 138 | // {{$serviceName}}Client is compatible with the grpc-go client interface. 139 | type {{$serviceName}}Client interface { 140 | {{- range $methodName, $tool := $methods }} 141 | {{$methodName}}(ctx context.Context, req *{{$tool.RequestType}}, opts ...grpc.CallOption) (*{{$tool.ResponseType}}, error) 142 | {{- end }} 143 | } 144 | {{ end }} 145 | 146 | 147 | {{- range $serviceName, $methods := .Services }} 148 | // Connect{{$serviceName}}Client is compatible with the connectrpc-go client interface. 149 | type Connect{{$serviceName}}Client interface { 150 | {{- range $methodName, $tool := $methods }} 151 | {{$methodName}}(ctx context.Context, req *connect.Request[{{$tool.RequestType}}]) (*connect.Response[{{$tool.ResponseType}}], error) 152 | {{- end }} 153 | } 154 | {{ end }} 155 | 156 | {{- range $key, $val := .Services }} 157 | // ForwardToConnect{{$key}}Client registers a connectrpc client, to forward MCP calls to it. 158 | func ForwardToConnect{{$key}}Client(s *mcpserver.MCPServer, client Connect{{$key}}Client) { 159 | {{- range $tool_name, $tool_val := $val }} 160 | s.AddTool({{$key}}_{{$tool_name}}Tool,func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) { 161 | marshaled, err := json.Marshal(request.Params.Arguments) 162 | if err != nil { 163 | return nil, err 164 | } 165 | 166 | var req {{$tool_val.RequestType}} 167 | if err := (protojson.UnmarshalOptions{DiscardUnknown: true}).Unmarshal(marshaled, &req); err != nil { 168 | return nil, err 169 | } 170 | 171 | resp, err := client.{{$tool_name}}(ctx, connect.NewRequest(&req)) 172 | if err != nil { 173 | return nil, err 174 | } 175 | 176 | marshaled, err = (protojson.MarshalOptions{UseProtoNames: true, EmitDefaultValues: true}).Marshal(resp.Msg) 177 | if err != nil { 178 | return nil, err 179 | } 180 | return mcp.NewToolResultText(string(marshaled)), nil 181 | }) 182 | {{- end }} 183 | } 184 | {{- end }} 185 | 186 | {{- range $key, $val := .Services }} 187 | // ForwardTo{{$key}}Client registers a gRPC client, to forward MCP calls to it. 188 | func ForwardTo{{$key}}Client(s *mcpserver.MCPServer, client {{$key}}Client) { 189 | {{- range $tool_name, $tool_val := $val }} 190 | s.AddTool({{$key}}_{{$tool_name}}Tool,func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) { 191 | marshaled, err := json.Marshal(request.Params.Arguments) 192 | if err != nil { 193 | return nil, err 194 | } 195 | 196 | var req {{$tool_val.RequestType}} 197 | if err := (protojson.UnmarshalOptions{DiscardUnknown: true}).Unmarshal(marshaled, &req); err != nil { 198 | return nil, err 199 | } 200 | 201 | resp, err := client.{{$tool_name}}(ctx, &req) 202 | if err != nil { 203 | return nil, err 204 | } 205 | 206 | marshaled, err = (protojson.MarshalOptions{UseProtoNames: true, EmitDefaultValues: true}).Marshal(resp) 207 | if err != nil { 208 | return nil, err 209 | } 210 | return mcp.NewToolResultText(string(marshaled)), nil 211 | }) 212 | {{- end }} 213 | } 214 | {{- end }} 215 | 216 | 217 | ` 218 | 219 | type tplParams struct { 220 | PackageName string 221 | SourcePath string 222 | GoPackage string 223 | Tools map[string]mcp.Tool 224 | Services map[string]map[string]Tool 225 | } 226 | 227 | type Tool struct { 228 | RequestType string 229 | ResponseType string 230 | MCPTool mcp.Tool 231 | } 232 | 233 | func kindToType(kind protoreflect.Kind) string { 234 | switch kind { 235 | case protoreflect.BoolKind: 236 | return "boolean" 237 | case protoreflect.StringKind: 238 | return "string" 239 | case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind, 240 | protoreflect.Uint32Kind, protoreflect.Fixed32Kind: 241 | return "integer" 242 | case protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind, 243 | protoreflect.Uint64Kind, protoreflect.Fixed64Kind: 244 | return "string" // safely encode as string 245 | case protoreflect.FloatKind, protoreflect.DoubleKind: 246 | return "number" 247 | case protoreflect.BytesKind: 248 | return "string" 249 | case protoreflect.EnumKind: 250 | return "string" // optionally add enum values here 251 | default: 252 | return "string" 253 | } 254 | } 255 | 256 | func isFieldRequired(fd protoreflect.FieldDescriptor) bool { 257 | if proto.HasExtension(fd.Options(), annotations.E_FieldBehavior) { 258 | behaviors := proto.GetExtension(fd.Options(), annotations.E_FieldBehavior).([]annotations.FieldBehavior) 259 | for _, behavior := range behaviors { 260 | if behavior == annotations.FieldBehavior_REQUIRED { 261 | return true 262 | } 263 | } 264 | } 265 | return false 266 | } 267 | 268 | func messageSchema(md protoreflect.MessageDescriptor) map[string]any { 269 | required := []string{} 270 | // Fields that are not oneOf 271 | normalFields := map[string]any{} 272 | // One entry per oneOf block in the message. 273 | oneOf := map[string][]map[string]any{} 274 | 275 | // Process all fields in the message descriptor 276 | for i := 0; i < md.Fields().Len(); i++ { 277 | nestedFd := md.Fields().Get(i) 278 | name := string(nestedFd.Name()) 279 | 280 | // Check if the field is part of a oneof group 281 | if oneof := nestedFd.ContainingOneof(); oneof != nil && !oneof.IsSynthetic() { 282 | if _, ok := oneOf[string(oneof.Name())]; !ok { 283 | oneOf[string(oneof.Name())] = []map[string]any{} 284 | } 285 | oneOf[string(oneof.Name())] = append(oneOf[string(oneof.Name())], map[string]any{ 286 | "properties": map[string]any{ 287 | name: getType(nestedFd), 288 | }, 289 | "required": []string{name}, 290 | }) 291 | } else { 292 | // If not part of a oneof, handle as a normal field 293 | normalFields[name] = getType(nestedFd) 294 | if isFieldRequired(nestedFd) { 295 | required = append(required, name) 296 | } 297 | } 298 | } 299 | 300 | // OpenAPI works differently than protobuf, when it comes to oneOf. 301 | // In proto, not the oneOf name's field name is used, but the actual field name of the oneOf ENTRY. 302 | // Therefore, we use an anyOf, and add one oneOf entry per oneOf protobuf block. 303 | var anyOf []map[string]any 304 | for _, protoOneOf := range oneOf { 305 | anyOf = append(anyOf, map[string]any{ 306 | "oneOf": protoOneOf, 307 | "$comment": "In this schema, there is a oneOf group for evert protobuf oneOf block in the message.", 308 | }) 309 | } 310 | 311 | // Final schema includes both properties and anyOf for flexibility 312 | result := map[string]any{ 313 | "type": "object", 314 | "properties": normalFields, // Regular properties defined 315 | "required": required, 316 | } 317 | if anyOf != nil { 318 | result["anyOf"] = anyOf // Fields in properties are already allowed. anyOf is in addition - which covers all oneOf groups 319 | } 320 | return result 321 | } 322 | 323 | func getType(fd protoreflect.FieldDescriptor) map[string]any { 324 | var schema map[string]any 325 | if fd.IsMap() { 326 | // Add key constraints. Map keys in protobuf can have different primitive types, where JSON can use only string. 327 | keyType := fd.MapKey().Kind() 328 | keyConstraints := map[string]any{ 329 | "type": "string", 330 | } 331 | switch keyType { 332 | case protoreflect.BoolKind: 333 | keyConstraints["enum"] = []string{"true", "false"} 334 | case protoreflect.Uint32Kind, protoreflect.Fixed32Kind, 335 | protoreflect.Uint64Kind, protoreflect.Fixed64Kind: 336 | keyConstraints["pattern"] = "^(0|[1-9]\\d*)$" // unsigned integers, no leading zeros 337 | case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind, 338 | protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind: 339 | keyConstraints["pattern"] = "^-?(0|[1-9]\\d*)$" // signed integers, no leading zeros 340 | default: 341 | } 342 | return map[string]any{ 343 | "type": "object", 344 | "propertyNames": keyConstraints, 345 | "additionalProperties": getType(fd.MapValue()), 346 | } 347 | } else if fd.Kind() == protoreflect.MessageKind { 348 | if fd.Kind() == protoreflect.MessageKind { 349 | fullName := string(fd.Message().FullName()) 350 | 351 | switch fullName { 352 | case "google.protobuf.Timestamp": 353 | return map[string]any{ 354 | "type": "string", 355 | "format": "date-time", 356 | } 357 | case "google.protobuf.Duration": 358 | return map[string]any{ 359 | "type": "string", 360 | "pattern": `^-?[0-9]+(\.[0-9]+)?s$`, 361 | } 362 | case "google.protobuf.Struct": 363 | return map[string]any{ 364 | "type": "object", 365 | "additionalProperties": true, 366 | } 367 | case "google.protobuf.Value": 368 | return map[string]any{} 369 | case "google.protobuf.ListValue": 370 | return map[string]any{ 371 | "type": "array", 372 | "items": map[string]any{}, 373 | } 374 | case "google.protobuf.FieldMask": 375 | return map[string]any{ 376 | "type": "string", 377 | } 378 | case "google.protobuf.Any": 379 | return map[string]any{ 380 | "type": "object", 381 | "properties": map[string]any{ 382 | "@type": map[string]any{ 383 | "type": "string", 384 | }, 385 | "value": map[string]any{}, 386 | }, 387 | "required": []string{"@type"}, 388 | } 389 | case "google.protobuf.DoubleValue", "google.protobuf.FloatValue", 390 | "google.protobuf.Int32Value", "google.protobuf.UInt32Value": 391 | return map[string]any{ 392 | "type": "number", 393 | "nullable": true, 394 | } 395 | case "google.protobuf.Int64Value", "google.protobuf.UInt64Value": 396 | return map[string]any{ 397 | "type": "string", 398 | "nullable": true, 399 | } 400 | case "google.protobuf.StringValue": 401 | return map[string]any{ 402 | "type": "string", 403 | "nullable": true, 404 | } 405 | case "google.protobuf.BoolValue": 406 | return map[string]any{ 407 | "type": "boolean", 408 | "nullable": true, 409 | } 410 | case "google.protobuf.BytesValue": 411 | return map[string]any{ 412 | "type": "string", 413 | "format": "byte", 414 | "nullable": true, 415 | } 416 | } 417 | } 418 | return messageSchema(fd.Message()) 419 | } else if fd.Kind() == protoreflect.EnumKind { 420 | var values []string 421 | 422 | for i := 0; i < fd.Enum().Values().Len(); i++ { 423 | ev := fd.Enum().Values().Get(i) 424 | values = append(values, string(ev.Name())) 425 | } 426 | return map[string]any{ 427 | "type": "string", 428 | "enum": values, 429 | } 430 | } else { 431 | schema = map[string]any{ 432 | "type": kindToType(fd.Kind()), 433 | } 434 | } 435 | 436 | if fd.Kind() == protoreflect.BytesKind { 437 | schema["contentEncoding"] = "base64" 438 | schema["format"] = "byte" 439 | } 440 | 441 | // If array, wrap it with array type (and put actual schema into "items" 442 | if fd.IsList() { 443 | return map[string]any{ 444 | "type": "array", 445 | "items": schema, 446 | } 447 | } 448 | return schema 449 | } 450 | 451 | var strippedCommentPrefixes = []string{"buf:lint:", "@ignore-comment"} 452 | 453 | func cleanComment(comment string) string { 454 | var cleanedLines []string 455 | outer: 456 | for _, line := range strings.Split(comment, "\n") { 457 | trimmed := strings.TrimSpace(line) 458 | for _, strip := range strippedCommentPrefixes { 459 | if strings.HasPrefix(trimmed, strip) { 460 | continue outer 461 | } 462 | } 463 | cleanedLines = append(cleanedLines, trimmed) 464 | } 465 | return strings.Join(cleanedLines, "\n") 466 | } 467 | 468 | func Base32String(b []byte) string { 469 | n := new(big.Int).SetBytes(b) 470 | return n.Text(36) 471 | } 472 | 473 | func MangleHeadIfTooLong(name string, maxLen int) string { 474 | if len(name) <= maxLen { 475 | return name 476 | } 477 | 478 | // Generate short hash of full name 479 | hash := sha1.Sum([]byte(name)) 480 | hashPrefix := Base32String(hash[:])[:6] // e.g. "3fj92a" 481 | 482 | // Leave room for hash prefix + underscore 483 | available := maxLen - len(hashPrefix) - 1 484 | if available <= 0 { 485 | return hashPrefix 486 | } 487 | 488 | // Preserve the end of the name (most specific) 489 | tail := name[len(name)-available:] 490 | return hashPrefix + "_" + tail 491 | } 492 | 493 | func (g *fileGenerator) Generate(packageSuffix string) { 494 | file := g.f 495 | if len(g.f.Services) == 0 { 496 | return 497 | } 498 | goImportPath := file.GoImportPath 499 | if packageSuffix != "" { 500 | if !token.IsIdentifier(packageSuffix) { 501 | g.gen.Error(fmt.Errorf("package_suffix %q is not a valid Go identifier", packageSuffix)) 502 | return 503 | } 504 | file.GoPackageName += protogen.GoPackageName(packageSuffix) 505 | generatedFilenamePrefixToSlash := filepath.ToSlash(file.GeneratedFilenamePrefix) 506 | file.GeneratedFilenamePrefix = path.Join( 507 | path.Dir(generatedFilenamePrefixToSlash), 508 | string(file.GoPackageName), 509 | path.Base(generatedFilenamePrefixToSlash), 510 | ) 511 | goImportPath = protogen.GoImportPath(path.Join( 512 | string(file.GoImportPath), 513 | string(file.GoPackageName), 514 | )) 515 | } 516 | 517 | g.gf = g.gen.NewGeneratedFile( 518 | file.GeneratedFilenamePrefix+generatedFilenameExtension, 519 | goImportPath, 520 | ) 521 | if packageSuffix != "" { 522 | g.gf.Import(file.GoImportPath) 523 | } 524 | 525 | fileTpl := fileTemplate 526 | tpl, err := template.New("gen").Parse(fileTpl) 527 | if err != nil { 528 | g.gen.Error(err) 529 | return 530 | } 531 | 532 | services := map[string]map[string]Tool{} 533 | tools := map[string]mcp.Tool{} 534 | 535 | for _, svc := range g.f.Services { 536 | s := map[string]Tool{} 537 | for _, meth := range svc.Methods { 538 | // Only unary supported at the moment 539 | if meth.Desc.IsStreamingClient() || meth.Desc.IsStreamingServer() { 540 | continue 541 | } 542 | tool := mcp.Tool{ 543 | Name: MangleHeadIfTooLong(strings.ReplaceAll(string(meth.Desc.FullName()), ".", "_"), 64), 544 | Description: cleanComment(string(meth.Comments.Leading)), 545 | } 546 | 547 | m := messageSchema(meth.Input.Desc) 548 | marshaled, err := json.Marshal(m) 549 | if err != nil { 550 | panic(err) 551 | } 552 | tool.RawInputSchema = json.RawMessage(marshaled) 553 | 554 | s[meth.GoName] = Tool{ 555 | RequestType: g.gf.QualifiedGoIdent(meth.Input.GoIdent), 556 | ResponseType: g.gf.QualifiedGoIdent(meth.Output.GoIdent), 557 | MCPTool: tool, 558 | } 559 | tools[svc.GoName+"_"+meth.GoName] = tool 560 | } 561 | services[string(svc.Desc.Name())] = s 562 | } 563 | 564 | params := tplParams{ 565 | PackageName: string(g.f.Desc.Package()), 566 | SourcePath: g.f.Desc.Path(), 567 | GoPackage: string(g.f.GoPackageName), 568 | Services: services, 569 | Tools: tools, 570 | } 571 | err = tpl.Execute(g.gf, params) 572 | if err != nil { 573 | g.gen.Error(err) 574 | } 575 | } 576 | -------------------------------------------------------------------------------- /example/README.md: -------------------------------------------------------------------------------- 1 | # Example 2 | 3 | ## Re-generate protos 4 | 5 | ```shell 6 | buf generate 7 | ``` 8 | 9 | ## Test / list tools 10 | 11 | [f/mcptools](https://github.com/f/mcptools) can be usedful. 12 | 13 | Run `mcptools tools go run .` 14 | -------------------------------------------------------------------------------- /example/buf.gen.yaml: -------------------------------------------------------------------------------- 1 | version: v2 2 | managed: 3 | enabled: true 4 | override: 5 | - file_option: go_package_prefix 6 | value: github.com/redpanda-data/protoc-gen-go-mcp/example/gen/go 7 | disable: 8 | - file_option: go_package 9 | module: buf.build/googleapis/googleapis 10 | plugins: 11 | - remote: buf.build/protocolbuffers/go 12 | out: ./gen/go 13 | opt: paths=source_relative 14 | - remote: buf.build/grpc/go:v1.5.1 15 | out: ./gen/go 16 | opt: 17 | - paths=source_relative 18 | - remote: buf.build/connectrpc/go:v1.18.1 19 | out: ./gen/go 20 | opt: 21 | - paths=source_relative 22 | - local: ["go","run","../cmd/protoc-gen-go-mcp"] 23 | out: ./gen/go 24 | opt: paths=source_relative 25 | -------------------------------------------------------------------------------- /example/buf.yaml: -------------------------------------------------------------------------------- 1 | version: v2 2 | modules: 3 | - path: ./ 4 | -------------------------------------------------------------------------------- /example/gen/go/proto/example/v1/example.pb.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Redpanda Data, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // Code generated by protoc-gen-go. DO NOT EDIT. 16 | // versions: 17 | // protoc-gen-go v1.36.6 18 | // protoc (unknown) 19 | // source: proto/example/v1/example.proto 20 | 21 | package examplev1 22 | 23 | import ( 24 | protoreflect "google.golang.org/protobuf/reflect/protoreflect" 25 | protoimpl "google.golang.org/protobuf/runtime/protoimpl" 26 | reflect "reflect" 27 | sync "sync" 28 | unsafe "unsafe" 29 | ) 30 | 31 | const ( 32 | // Verify that this generated code is sufficiently up-to-date. 33 | _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) 34 | // Verify that runtime/protoimpl is sufficiently up-to-date. 35 | _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) 36 | ) 37 | 38 | type CreateExampleRequest_SomeEnum int32 39 | 40 | const ( 41 | CreateExampleRequest_SOME_ENUM_UNSPECIFIED CreateExampleRequest_SomeEnum = 0 42 | CreateExampleRequest_SOME_ENUM_FIRST CreateExampleRequest_SomeEnum = 1 43 | CreateExampleRequest_SOME_ENUM_SECOND CreateExampleRequest_SomeEnum = 2 44 | ) 45 | 46 | // Enum value maps for CreateExampleRequest_SomeEnum. 47 | var ( 48 | CreateExampleRequest_SomeEnum_name = map[int32]string{ 49 | 0: "SOME_ENUM_UNSPECIFIED", 50 | 1: "SOME_ENUM_FIRST", 51 | 2: "SOME_ENUM_SECOND", 52 | } 53 | CreateExampleRequest_SomeEnum_value = map[string]int32{ 54 | "SOME_ENUM_UNSPECIFIED": 0, 55 | "SOME_ENUM_FIRST": 1, 56 | "SOME_ENUM_SECOND": 2, 57 | } 58 | ) 59 | 60 | func (x CreateExampleRequest_SomeEnum) Enum() *CreateExampleRequest_SomeEnum { 61 | p := new(CreateExampleRequest_SomeEnum) 62 | *p = x 63 | return p 64 | } 65 | 66 | func (x CreateExampleRequest_SomeEnum) String() string { 67 | return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) 68 | } 69 | 70 | func (CreateExampleRequest_SomeEnum) Descriptor() protoreflect.EnumDescriptor { 71 | return file_proto_example_v1_example_proto_enumTypes[0].Descriptor() 72 | } 73 | 74 | func (CreateExampleRequest_SomeEnum) Type() protoreflect.EnumType { 75 | return &file_proto_example_v1_example_proto_enumTypes[0] 76 | } 77 | 78 | func (x CreateExampleRequest_SomeEnum) Number() protoreflect.EnumNumber { 79 | return protoreflect.EnumNumber(x) 80 | } 81 | 82 | // Deprecated: Use CreateExampleRequest_SomeEnum.Descriptor instead. 83 | func (CreateExampleRequest_SomeEnum) EnumDescriptor() ([]byte, []int) { 84 | return file_proto_example_v1_example_proto_rawDescGZIP(), []int{0, 0} 85 | } 86 | 87 | type CreateExampleRequest struct { 88 | state protoimpl.MessageState `protogen:"open.v1"` 89 | SomeInt32 int32 `protobuf:"varint,1,opt,name=some_int32,json=someInt32,proto3" json:"some_int32,omitempty"` 90 | SomeInt64 int64 `protobuf:"varint,2,opt,name=some_int64,json=someInt64,proto3" json:"some_int64,omitempty"` 91 | SomeString string `protobuf:"bytes,3,opt,name=some_string,json=someString,proto3" json:"some_string,omitempty"` 92 | SomeEnum CreateExampleRequest_SomeEnum `protobuf:"varint,4,opt,name=some_enum,json=someEnum,proto3,enum=example.v1.CreateExampleRequest_SomeEnum" json:"some_enum,omitempty"` 93 | Nested *CreateExampleRequest_Nested `protobuf:"bytes,5,opt,name=nested,proto3" json:"nested,omitempty"` 94 | OptionalString *string `protobuf:"bytes,6,opt,name=optional_string,json=optionalString,proto3,oneof" json:"optional_string,omitempty"` 95 | RepeatedString []string `protobuf:"bytes,7,rep,name=repeated_string,json=repeatedString,proto3" json:"repeated_string,omitempty"` 96 | MapWithNestedVal map[string]*CreateExampleRequest_Nested `protobuf:"bytes,8,rep,name=map_with_nested_val,json=mapWithNestedVal,proto3" json:"map_with_nested_val,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` 97 | MapWithNestedValNoStringKey map[int32]*CreateExampleRequest_Nested `protobuf:"bytes,9,rep,name=map_with_nested_val_no_string_key,json=mapWithNestedValNoStringKey,proto3" json:"map_with_nested_val_no_string_key,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` 98 | // Types that are valid to be assigned to SomeOneof: 99 | // 100 | // *CreateExampleRequest_FirstItem 101 | // *CreateExampleRequest_SecondItem 102 | SomeOneof isCreateExampleRequest_SomeOneof `protobuf_oneof:"some_oneof"` 103 | unknownFields protoimpl.UnknownFields 104 | sizeCache protoimpl.SizeCache 105 | } 106 | 107 | func (x *CreateExampleRequest) Reset() { 108 | *x = CreateExampleRequest{} 109 | mi := &file_proto_example_v1_example_proto_msgTypes[0] 110 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 111 | ms.StoreMessageInfo(mi) 112 | } 113 | 114 | func (x *CreateExampleRequest) String() string { 115 | return protoimpl.X.MessageStringOf(x) 116 | } 117 | 118 | func (*CreateExampleRequest) ProtoMessage() {} 119 | 120 | func (x *CreateExampleRequest) ProtoReflect() protoreflect.Message { 121 | mi := &file_proto_example_v1_example_proto_msgTypes[0] 122 | if x != nil { 123 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 124 | if ms.LoadMessageInfo() == nil { 125 | ms.StoreMessageInfo(mi) 126 | } 127 | return ms 128 | } 129 | return mi.MessageOf(x) 130 | } 131 | 132 | // Deprecated: Use CreateExampleRequest.ProtoReflect.Descriptor instead. 133 | func (*CreateExampleRequest) Descriptor() ([]byte, []int) { 134 | return file_proto_example_v1_example_proto_rawDescGZIP(), []int{0} 135 | } 136 | 137 | func (x *CreateExampleRequest) GetSomeInt32() int32 { 138 | if x != nil { 139 | return x.SomeInt32 140 | } 141 | return 0 142 | } 143 | 144 | func (x *CreateExampleRequest) GetSomeInt64() int64 { 145 | if x != nil { 146 | return x.SomeInt64 147 | } 148 | return 0 149 | } 150 | 151 | func (x *CreateExampleRequest) GetSomeString() string { 152 | if x != nil { 153 | return x.SomeString 154 | } 155 | return "" 156 | } 157 | 158 | func (x *CreateExampleRequest) GetSomeEnum() CreateExampleRequest_SomeEnum { 159 | if x != nil { 160 | return x.SomeEnum 161 | } 162 | return CreateExampleRequest_SOME_ENUM_UNSPECIFIED 163 | } 164 | 165 | func (x *CreateExampleRequest) GetNested() *CreateExampleRequest_Nested { 166 | if x != nil { 167 | return x.Nested 168 | } 169 | return nil 170 | } 171 | 172 | func (x *CreateExampleRequest) GetOptionalString() string { 173 | if x != nil && x.OptionalString != nil { 174 | return *x.OptionalString 175 | } 176 | return "" 177 | } 178 | 179 | func (x *CreateExampleRequest) GetRepeatedString() []string { 180 | if x != nil { 181 | return x.RepeatedString 182 | } 183 | return nil 184 | } 185 | 186 | func (x *CreateExampleRequest) GetMapWithNestedVal() map[string]*CreateExampleRequest_Nested { 187 | if x != nil { 188 | return x.MapWithNestedVal 189 | } 190 | return nil 191 | } 192 | 193 | func (x *CreateExampleRequest) GetMapWithNestedValNoStringKey() map[int32]*CreateExampleRequest_Nested { 194 | if x != nil { 195 | return x.MapWithNestedValNoStringKey 196 | } 197 | return nil 198 | } 199 | 200 | func (x *CreateExampleRequest) GetSomeOneof() isCreateExampleRequest_SomeOneof { 201 | if x != nil { 202 | return x.SomeOneof 203 | } 204 | return nil 205 | } 206 | 207 | func (x *CreateExampleRequest) GetFirstItem() string { 208 | if x != nil { 209 | if x, ok := x.SomeOneof.(*CreateExampleRequest_FirstItem); ok { 210 | return x.FirstItem 211 | } 212 | } 213 | return "" 214 | } 215 | 216 | func (x *CreateExampleRequest) GetSecondItem() int32 { 217 | if x != nil { 218 | if x, ok := x.SomeOneof.(*CreateExampleRequest_SecondItem); ok { 219 | return x.SecondItem 220 | } 221 | } 222 | return 0 223 | } 224 | 225 | type isCreateExampleRequest_SomeOneof interface { 226 | isCreateExampleRequest_SomeOneof() 227 | } 228 | 229 | type CreateExampleRequest_FirstItem struct { 230 | FirstItem string `protobuf:"bytes,10,opt,name=first_item,json=firstItem,proto3,oneof"` 231 | } 232 | 233 | type CreateExampleRequest_SecondItem struct { 234 | SecondItem int32 `protobuf:"varint,11,opt,name=second_item,json=secondItem,proto3,oneof"` 235 | } 236 | 237 | func (*CreateExampleRequest_FirstItem) isCreateExampleRequest_SomeOneof() {} 238 | 239 | func (*CreateExampleRequest_SecondItem) isCreateExampleRequest_SomeOneof() {} 240 | 241 | type CreateExampleResponse struct { 242 | state protoimpl.MessageState `protogen:"open.v1"` 243 | SomeString string `protobuf:"bytes,1,opt,name=some_string,json=someString,proto3" json:"some_string,omitempty"` 244 | unknownFields protoimpl.UnknownFields 245 | sizeCache protoimpl.SizeCache 246 | } 247 | 248 | func (x *CreateExampleResponse) Reset() { 249 | *x = CreateExampleResponse{} 250 | mi := &file_proto_example_v1_example_proto_msgTypes[1] 251 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 252 | ms.StoreMessageInfo(mi) 253 | } 254 | 255 | func (x *CreateExampleResponse) String() string { 256 | return protoimpl.X.MessageStringOf(x) 257 | } 258 | 259 | func (*CreateExampleResponse) ProtoMessage() {} 260 | 261 | func (x *CreateExampleResponse) ProtoReflect() protoreflect.Message { 262 | mi := &file_proto_example_v1_example_proto_msgTypes[1] 263 | if x != nil { 264 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 265 | if ms.LoadMessageInfo() == nil { 266 | ms.StoreMessageInfo(mi) 267 | } 268 | return ms 269 | } 270 | return mi.MessageOf(x) 271 | } 272 | 273 | // Deprecated: Use CreateExampleResponse.ProtoReflect.Descriptor instead. 274 | func (*CreateExampleResponse) Descriptor() ([]byte, []int) { 275 | return file_proto_example_v1_example_proto_rawDescGZIP(), []int{1} 276 | } 277 | 278 | func (x *CreateExampleResponse) GetSomeString() string { 279 | if x != nil { 280 | return x.SomeString 281 | } 282 | return "" 283 | } 284 | 285 | type CreateExampleRequest_Nested struct { 286 | state protoimpl.MessageState `protogen:"open.v1"` 287 | SomeField string `protobuf:"bytes,1,opt,name=some_field,json=someField,proto3" json:"some_field,omitempty"` 288 | Nested2 *CreateExampleRequest_Nested_Nested2 `protobuf:"bytes,2,opt,name=nested2,proto3" json:"nested2,omitempty"` 289 | unknownFields protoimpl.UnknownFields 290 | sizeCache protoimpl.SizeCache 291 | } 292 | 293 | func (x *CreateExampleRequest_Nested) Reset() { 294 | *x = CreateExampleRequest_Nested{} 295 | mi := &file_proto_example_v1_example_proto_msgTypes[2] 296 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 297 | ms.StoreMessageInfo(mi) 298 | } 299 | 300 | func (x *CreateExampleRequest_Nested) String() string { 301 | return protoimpl.X.MessageStringOf(x) 302 | } 303 | 304 | func (*CreateExampleRequest_Nested) ProtoMessage() {} 305 | 306 | func (x *CreateExampleRequest_Nested) ProtoReflect() protoreflect.Message { 307 | mi := &file_proto_example_v1_example_proto_msgTypes[2] 308 | if x != nil { 309 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 310 | if ms.LoadMessageInfo() == nil { 311 | ms.StoreMessageInfo(mi) 312 | } 313 | return ms 314 | } 315 | return mi.MessageOf(x) 316 | } 317 | 318 | // Deprecated: Use CreateExampleRequest_Nested.ProtoReflect.Descriptor instead. 319 | func (*CreateExampleRequest_Nested) Descriptor() ([]byte, []int) { 320 | return file_proto_example_v1_example_proto_rawDescGZIP(), []int{0, 0} 321 | } 322 | 323 | func (x *CreateExampleRequest_Nested) GetSomeField() string { 324 | if x != nil { 325 | return x.SomeField 326 | } 327 | return "" 328 | } 329 | 330 | func (x *CreateExampleRequest_Nested) GetNested2() *CreateExampleRequest_Nested_Nested2 { 331 | if x != nil { 332 | return x.Nested2 333 | } 334 | return nil 335 | } 336 | 337 | type CreateExampleRequest_Nested_Nested2 struct { 338 | state protoimpl.MessageState `protogen:"open.v1"` 339 | SomeNestedField string `protobuf:"bytes,1,opt,name=some_nested_field,json=someNestedField,proto3" json:"some_nested_field,omitempty"` 340 | Nested3 *CreateExampleRequest_Nested_Nested2_Nested3 `protobuf:"bytes,2,opt,name=nested3,proto3" json:"nested3,omitempty"` 341 | unknownFields protoimpl.UnknownFields 342 | sizeCache protoimpl.SizeCache 343 | } 344 | 345 | func (x *CreateExampleRequest_Nested_Nested2) Reset() { 346 | *x = CreateExampleRequest_Nested_Nested2{} 347 | mi := &file_proto_example_v1_example_proto_msgTypes[5] 348 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 349 | ms.StoreMessageInfo(mi) 350 | } 351 | 352 | func (x *CreateExampleRequest_Nested_Nested2) String() string { 353 | return protoimpl.X.MessageStringOf(x) 354 | } 355 | 356 | func (*CreateExampleRequest_Nested_Nested2) ProtoMessage() {} 357 | 358 | func (x *CreateExampleRequest_Nested_Nested2) ProtoReflect() protoreflect.Message { 359 | mi := &file_proto_example_v1_example_proto_msgTypes[5] 360 | if x != nil { 361 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 362 | if ms.LoadMessageInfo() == nil { 363 | ms.StoreMessageInfo(mi) 364 | } 365 | return ms 366 | } 367 | return mi.MessageOf(x) 368 | } 369 | 370 | // Deprecated: Use CreateExampleRequest_Nested_Nested2.ProtoReflect.Descriptor instead. 371 | func (*CreateExampleRequest_Nested_Nested2) Descriptor() ([]byte, []int) { 372 | return file_proto_example_v1_example_proto_rawDescGZIP(), []int{0, 0, 0} 373 | } 374 | 375 | func (x *CreateExampleRequest_Nested_Nested2) GetSomeNestedField() string { 376 | if x != nil { 377 | return x.SomeNestedField 378 | } 379 | return "" 380 | } 381 | 382 | func (x *CreateExampleRequest_Nested_Nested2) GetNested3() *CreateExampleRequest_Nested_Nested2_Nested3 { 383 | if x != nil { 384 | return x.Nested3 385 | } 386 | return nil 387 | } 388 | 389 | type CreateExampleRequest_Nested_Nested2_Nested3 struct { 390 | state protoimpl.MessageState `protogen:"open.v1"` 391 | SomeNestedInNestedField string `protobuf:"bytes,1,opt,name=some_nested_in_nested_field,json=someNestedInNestedField,proto3" json:"some_nested_in_nested_field,omitempty"` 392 | OptionalString *string `protobuf:"bytes,2,opt,name=optional_string,json=optionalString,proto3,oneof" json:"optional_string,omitempty"` 393 | unknownFields protoimpl.UnknownFields 394 | sizeCache protoimpl.SizeCache 395 | } 396 | 397 | func (x *CreateExampleRequest_Nested_Nested2_Nested3) Reset() { 398 | *x = CreateExampleRequest_Nested_Nested2_Nested3{} 399 | mi := &file_proto_example_v1_example_proto_msgTypes[6] 400 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 401 | ms.StoreMessageInfo(mi) 402 | } 403 | 404 | func (x *CreateExampleRequest_Nested_Nested2_Nested3) String() string { 405 | return protoimpl.X.MessageStringOf(x) 406 | } 407 | 408 | func (*CreateExampleRequest_Nested_Nested2_Nested3) ProtoMessage() {} 409 | 410 | func (x *CreateExampleRequest_Nested_Nested2_Nested3) ProtoReflect() protoreflect.Message { 411 | mi := &file_proto_example_v1_example_proto_msgTypes[6] 412 | if x != nil { 413 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 414 | if ms.LoadMessageInfo() == nil { 415 | ms.StoreMessageInfo(mi) 416 | } 417 | return ms 418 | } 419 | return mi.MessageOf(x) 420 | } 421 | 422 | // Deprecated: Use CreateExampleRequest_Nested_Nested2_Nested3.ProtoReflect.Descriptor instead. 423 | func (*CreateExampleRequest_Nested_Nested2_Nested3) Descriptor() ([]byte, []int) { 424 | return file_proto_example_v1_example_proto_rawDescGZIP(), []int{0, 0, 0, 0} 425 | } 426 | 427 | func (x *CreateExampleRequest_Nested_Nested2_Nested3) GetSomeNestedInNestedField() string { 428 | if x != nil { 429 | return x.SomeNestedInNestedField 430 | } 431 | return "" 432 | } 433 | 434 | func (x *CreateExampleRequest_Nested_Nested2_Nested3) GetOptionalString() string { 435 | if x != nil && x.OptionalString != nil { 436 | return *x.OptionalString 437 | } 438 | return "" 439 | } 440 | 441 | var File_proto_example_v1_example_proto protoreflect.FileDescriptor 442 | 443 | const file_proto_example_v1_example_proto_rawDesc = "" + 444 | "\n" + 445 | "\x1eproto/example/v1/example.proto\x12\n" + 446 | "example.v1\"\xf3\n" + 447 | "\n" + 448 | "\x14CreateExampleRequest\x12\x1d\n" + 449 | "\n" + 450 | "some_int32\x18\x01 \x01(\x05R\tsomeInt32\x12\x1d\n" + 451 | "\n" + 452 | "some_int64\x18\x02 \x01(\x03R\tsomeInt64\x12\x1f\n" + 453 | "\vsome_string\x18\x03 \x01(\tR\n" + 454 | "someString\x12F\n" + 455 | "\tsome_enum\x18\x04 \x01(\x0e2).example.v1.CreateExampleRequest.SomeEnumR\bsomeEnum\x12?\n" + 456 | "\x06nested\x18\x05 \x01(\v2'.example.v1.CreateExampleRequest.NestedR\x06nested\x12,\n" + 457 | "\x0foptional_string\x18\x06 \x01(\tH\x01R\x0eoptionalString\x88\x01\x01\x12'\n" + 458 | "\x0frepeated_string\x18\a \x03(\tR\x0erepeatedString\x12e\n" + 459 | "\x13map_with_nested_val\x18\b \x03(\v26.example.v1.CreateExampleRequest.MapWithNestedValEntryR\x10mapWithNestedVal\x12\x89\x01\n" + 460 | "!map_with_nested_val_no_string_key\x18\t \x03(\v2A.example.v1.CreateExampleRequest.MapWithNestedValNoStringKeyEntryR\x1bmapWithNestedValNoStringKey\x12\x1f\n" + 461 | "\n" + 462 | "first_item\x18\n" + 463 | " \x01(\tH\x00R\tfirstItem\x12!\n" + 464 | "\vsecond_item\x18\v \x01(\x05H\x00R\n" + 465 | "secondItem\x1a\x89\x03\n" + 466 | "\x06Nested\x12\x1d\n" + 467 | "\n" + 468 | "some_field\x18\x01 \x01(\tR\tsomeField\x12I\n" + 469 | "\anested2\x18\x02 \x01(\v2/.example.v1.CreateExampleRequest.Nested.Nested2R\anested2\x1a\x94\x02\n" + 470 | "\aNested2\x12*\n" + 471 | "\x11some_nested_field\x18\x01 \x01(\tR\x0fsomeNestedField\x12Q\n" + 472 | "\anested3\x18\x02 \x01(\v27.example.v1.CreateExampleRequest.Nested.Nested2.Nested3R\anested3\x1a\x89\x01\n" + 473 | "\aNested3\x12<\n" + 474 | "\x1bsome_nested_in_nested_field\x18\x01 \x01(\tR\x17someNestedInNestedField\x12,\n" + 475 | "\x0foptional_string\x18\x02 \x01(\tH\x00R\x0eoptionalString\x88\x01\x01B\x12\n" + 476 | "\x10_optional_string\x1al\n" + 477 | "\x15MapWithNestedValEntry\x12\x10\n" + 478 | "\x03key\x18\x01 \x01(\tR\x03key\x12=\n" + 479 | "\x05value\x18\x02 \x01(\v2'.example.v1.CreateExampleRequest.NestedR\x05value:\x028\x01\x1aw\n" + 480 | " MapWithNestedValNoStringKeyEntry\x12\x10\n" + 481 | "\x03key\x18\x01 \x01(\x05R\x03key\x12=\n" + 482 | "\x05value\x18\x02 \x01(\v2'.example.v1.CreateExampleRequest.NestedR\x05value:\x028\x01\"P\n" + 483 | "\bSomeEnum\x12\x19\n" + 484 | "\x15SOME_ENUM_UNSPECIFIED\x10\x00\x12\x13\n" + 485 | "\x0fSOME_ENUM_FIRST\x10\x01\x12\x14\n" + 486 | "\x10SOME_ENUM_SECOND\x10\x02B\f\n" + 487 | "\n" + 488 | "some_oneofB\x12\n" + 489 | "\x10_optional_string\"8\n" + 490 | "\x15CreateExampleResponse\x12\x1f\n" + 491 | "\vsome_string\x18\x01 \x01(\tR\n" + 492 | "someString2f\n" + 493 | "\x0eExampleService\x12T\n" + 494 | "\rCreateExample\x12 .example.v1.CreateExampleRequest\x1a!.example.v1.CreateExampleResponseB\xbd\x01\n" + 495 | "\x0ecom.example.v1B\fExampleProtoP\x01ZTgithub.com/redpanda-data/protoc-gen-go-mcp/example/gen/go/proto/example/v1;examplev1\xa2\x02\x03EXX\xaa\x02\n" + 496 | "Example.V1\xca\x02\n" + 497 | "Example\\V1\xe2\x02\x16Example\\V1\\GPBMetadata\xea\x02\vExample::V1b\x06proto3" 498 | 499 | var ( 500 | file_proto_example_v1_example_proto_rawDescOnce sync.Once 501 | file_proto_example_v1_example_proto_rawDescData []byte 502 | ) 503 | 504 | func file_proto_example_v1_example_proto_rawDescGZIP() []byte { 505 | file_proto_example_v1_example_proto_rawDescOnce.Do(func() { 506 | file_proto_example_v1_example_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_proto_example_v1_example_proto_rawDesc), len(file_proto_example_v1_example_proto_rawDesc))) 507 | }) 508 | return file_proto_example_v1_example_proto_rawDescData 509 | } 510 | 511 | var file_proto_example_v1_example_proto_enumTypes = make([]protoimpl.EnumInfo, 1) 512 | var file_proto_example_v1_example_proto_msgTypes = make([]protoimpl.MessageInfo, 7) 513 | var file_proto_example_v1_example_proto_goTypes = []any{ 514 | (CreateExampleRequest_SomeEnum)(0), // 0: example.v1.CreateExampleRequest.SomeEnum 515 | (*CreateExampleRequest)(nil), // 1: example.v1.CreateExampleRequest 516 | (*CreateExampleResponse)(nil), // 2: example.v1.CreateExampleResponse 517 | (*CreateExampleRequest_Nested)(nil), // 3: example.v1.CreateExampleRequest.Nested 518 | nil, // 4: example.v1.CreateExampleRequest.MapWithNestedValEntry 519 | nil, // 5: example.v1.CreateExampleRequest.MapWithNestedValNoStringKeyEntry 520 | (*CreateExampleRequest_Nested_Nested2)(nil), // 6: example.v1.CreateExampleRequest.Nested.Nested2 521 | (*CreateExampleRequest_Nested_Nested2_Nested3)(nil), // 7: example.v1.CreateExampleRequest.Nested.Nested2.Nested3 522 | } 523 | var file_proto_example_v1_example_proto_depIdxs = []int32{ 524 | 0, // 0: example.v1.CreateExampleRequest.some_enum:type_name -> example.v1.CreateExampleRequest.SomeEnum 525 | 3, // 1: example.v1.CreateExampleRequest.nested:type_name -> example.v1.CreateExampleRequest.Nested 526 | 4, // 2: example.v1.CreateExampleRequest.map_with_nested_val:type_name -> example.v1.CreateExampleRequest.MapWithNestedValEntry 527 | 5, // 3: example.v1.CreateExampleRequest.map_with_nested_val_no_string_key:type_name -> example.v1.CreateExampleRequest.MapWithNestedValNoStringKeyEntry 528 | 6, // 4: example.v1.CreateExampleRequest.Nested.nested2:type_name -> example.v1.CreateExampleRequest.Nested.Nested2 529 | 3, // 5: example.v1.CreateExampleRequest.MapWithNestedValEntry.value:type_name -> example.v1.CreateExampleRequest.Nested 530 | 3, // 6: example.v1.CreateExampleRequest.MapWithNestedValNoStringKeyEntry.value:type_name -> example.v1.CreateExampleRequest.Nested 531 | 7, // 7: example.v1.CreateExampleRequest.Nested.Nested2.nested3:type_name -> example.v1.CreateExampleRequest.Nested.Nested2.Nested3 532 | 1, // 8: example.v1.ExampleService.CreateExample:input_type -> example.v1.CreateExampleRequest 533 | 2, // 9: example.v1.ExampleService.CreateExample:output_type -> example.v1.CreateExampleResponse 534 | 9, // [9:10] is the sub-list for method output_type 535 | 8, // [8:9] is the sub-list for method input_type 536 | 8, // [8:8] is the sub-list for extension type_name 537 | 8, // [8:8] is the sub-list for extension extendee 538 | 0, // [0:8] is the sub-list for field type_name 539 | } 540 | 541 | func init() { file_proto_example_v1_example_proto_init() } 542 | func file_proto_example_v1_example_proto_init() { 543 | if File_proto_example_v1_example_proto != nil { 544 | return 545 | } 546 | file_proto_example_v1_example_proto_msgTypes[0].OneofWrappers = []any{ 547 | (*CreateExampleRequest_FirstItem)(nil), 548 | (*CreateExampleRequest_SecondItem)(nil), 549 | } 550 | file_proto_example_v1_example_proto_msgTypes[6].OneofWrappers = []any{} 551 | type x struct{} 552 | out := protoimpl.TypeBuilder{ 553 | File: protoimpl.DescBuilder{ 554 | GoPackagePath: reflect.TypeOf(x{}).PkgPath(), 555 | RawDescriptor: unsafe.Slice(unsafe.StringData(file_proto_example_v1_example_proto_rawDesc), len(file_proto_example_v1_example_proto_rawDesc)), 556 | NumEnums: 1, 557 | NumMessages: 7, 558 | NumExtensions: 0, 559 | NumServices: 1, 560 | }, 561 | GoTypes: file_proto_example_v1_example_proto_goTypes, 562 | DependencyIndexes: file_proto_example_v1_example_proto_depIdxs, 563 | EnumInfos: file_proto_example_v1_example_proto_enumTypes, 564 | MessageInfos: file_proto_example_v1_example_proto_msgTypes, 565 | }.Build() 566 | File_proto_example_v1_example_proto = out.File 567 | file_proto_example_v1_example_proto_goTypes = nil 568 | file_proto_example_v1_example_proto_depIdxs = nil 569 | } 570 | -------------------------------------------------------------------------------- /example/gen/go/proto/example/v1/example_grpc.pb.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Redpanda Data, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // Code generated by protoc-gen-go-grpc. DO NOT EDIT. 16 | // versions: 17 | // - protoc-gen-go-grpc v1.5.1 18 | // - protoc (unknown) 19 | // source: proto/example/v1/example.proto 20 | 21 | package examplev1 22 | 23 | import ( 24 | context "context" 25 | grpc "google.golang.org/grpc" 26 | codes "google.golang.org/grpc/codes" 27 | status "google.golang.org/grpc/status" 28 | ) 29 | 30 | // This is a compile-time assertion to ensure that this generated file 31 | // is compatible with the grpc package it is being compiled against. 32 | // Requires gRPC-Go v1.64.0 or later. 33 | const _ = grpc.SupportPackageIsVersion9 34 | 35 | const ( 36 | ExampleService_CreateExample_FullMethodName = "/example.v1.ExampleService/CreateExample" 37 | ) 38 | 39 | // ExampleServiceClient is the client API for ExampleService service. 40 | // 41 | // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. 42 | type ExampleServiceClient interface { 43 | // @ignore-comment Ignore these linter rules, because we intentionally return a generic Operation message for all long-running operations. 44 | // buf:lint:ignore RPC_RESPONSE_STANDARD_NAME 45 | // buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE 46 | // CreateCluster create a Redpanda cluster. The input contains the spec, that describes the cluster. 47 | // A Operation is returned. This task allows the caller to find out when the long-running operation of creating a cluster has finished. 48 | CreateExample(ctx context.Context, in *CreateExampleRequest, opts ...grpc.CallOption) (*CreateExampleResponse, error) 49 | } 50 | 51 | type exampleServiceClient struct { 52 | cc grpc.ClientConnInterface 53 | } 54 | 55 | func NewExampleServiceClient(cc grpc.ClientConnInterface) ExampleServiceClient { 56 | return &exampleServiceClient{cc} 57 | } 58 | 59 | func (c *exampleServiceClient) CreateExample(ctx context.Context, in *CreateExampleRequest, opts ...grpc.CallOption) (*CreateExampleResponse, error) { 60 | cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) 61 | out := new(CreateExampleResponse) 62 | err := c.cc.Invoke(ctx, ExampleService_CreateExample_FullMethodName, in, out, cOpts...) 63 | if err != nil { 64 | return nil, err 65 | } 66 | return out, nil 67 | } 68 | 69 | // ExampleServiceServer is the server API for ExampleService service. 70 | // All implementations must embed UnimplementedExampleServiceServer 71 | // for forward compatibility. 72 | type ExampleServiceServer interface { 73 | // @ignore-comment Ignore these linter rules, because we intentionally return a generic Operation message for all long-running operations. 74 | // buf:lint:ignore RPC_RESPONSE_STANDARD_NAME 75 | // buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE 76 | // CreateCluster create a Redpanda cluster. The input contains the spec, that describes the cluster. 77 | // A Operation is returned. This task allows the caller to find out when the long-running operation of creating a cluster has finished. 78 | CreateExample(context.Context, *CreateExampleRequest) (*CreateExampleResponse, error) 79 | mustEmbedUnimplementedExampleServiceServer() 80 | } 81 | 82 | // UnimplementedExampleServiceServer must be embedded to have 83 | // forward compatible implementations. 84 | // 85 | // NOTE: this should be embedded by value instead of pointer to avoid a nil 86 | // pointer dereference when methods are called. 87 | type UnimplementedExampleServiceServer struct{} 88 | 89 | func (UnimplementedExampleServiceServer) CreateExample(context.Context, *CreateExampleRequest) (*CreateExampleResponse, error) { 90 | return nil, status.Errorf(codes.Unimplemented, "method CreateExample not implemented") 91 | } 92 | func (UnimplementedExampleServiceServer) mustEmbedUnimplementedExampleServiceServer() {} 93 | func (UnimplementedExampleServiceServer) testEmbeddedByValue() {} 94 | 95 | // UnsafeExampleServiceServer may be embedded to opt out of forward compatibility for this service. 96 | // Use of this interface is not recommended, as added methods to ExampleServiceServer will 97 | // result in compilation errors. 98 | type UnsafeExampleServiceServer interface { 99 | mustEmbedUnimplementedExampleServiceServer() 100 | } 101 | 102 | func RegisterExampleServiceServer(s grpc.ServiceRegistrar, srv ExampleServiceServer) { 103 | // If the following call pancis, it indicates UnimplementedExampleServiceServer was 104 | // embedded by pointer and is nil. This will cause panics if an 105 | // unimplemented method is ever invoked, so we test this at initialization 106 | // time to prevent it from happening at runtime later due to I/O. 107 | if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { 108 | t.testEmbeddedByValue() 109 | } 110 | s.RegisterService(&ExampleService_ServiceDesc, srv) 111 | } 112 | 113 | func _ExampleService_CreateExample_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { 114 | in := new(CreateExampleRequest) 115 | if err := dec(in); err != nil { 116 | return nil, err 117 | } 118 | if interceptor == nil { 119 | return srv.(ExampleServiceServer).CreateExample(ctx, in) 120 | } 121 | info := &grpc.UnaryServerInfo{ 122 | Server: srv, 123 | FullMethod: ExampleService_CreateExample_FullMethodName, 124 | } 125 | handler := func(ctx context.Context, req interface{}) (interface{}, error) { 126 | return srv.(ExampleServiceServer).CreateExample(ctx, req.(*CreateExampleRequest)) 127 | } 128 | return interceptor(ctx, in, info, handler) 129 | } 130 | 131 | // ExampleService_ServiceDesc is the grpc.ServiceDesc for ExampleService service. 132 | // It's only intended for direct use with grpc.RegisterService, 133 | // and not to be introspected or modified (even as a copy) 134 | var ExampleService_ServiceDesc = grpc.ServiceDesc{ 135 | ServiceName: "example.v1.ExampleService", 136 | HandlerType: (*ExampleServiceServer)(nil), 137 | Methods: []grpc.MethodDesc{ 138 | { 139 | MethodName: "CreateExample", 140 | Handler: _ExampleService_CreateExample_Handler, 141 | }, 142 | }, 143 | Streams: []grpc.StreamDesc{}, 144 | Metadata: "proto/example/v1/example.proto", 145 | } 146 | -------------------------------------------------------------------------------- /example/gen/go/proto/example/v1/examplev1connect/example.connect.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Redpanda Data, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // Code generated by protoc-gen-connect-go. DO NOT EDIT. 16 | // 17 | // Source: proto/example/v1/example.proto 18 | 19 | package examplev1connect 20 | 21 | import ( 22 | connect "connectrpc.com/connect" 23 | context "context" 24 | errors "errors" 25 | v1 "github.com/redpanda-data/protoc-gen-go-mcp/example/gen/go/proto/example/v1" 26 | http "net/http" 27 | strings "strings" 28 | ) 29 | 30 | // This is a compile-time assertion to ensure that this generated file and the connect package are 31 | // compatible. If you get a compiler error that this constant is not defined, this code was 32 | // generated with a version of connect newer than the one compiled into your binary. You can fix the 33 | // problem by either regenerating this code with an older version of connect or updating the connect 34 | // version compiled into your binary. 35 | const _ = connect.IsAtLeastVersion1_13_0 36 | 37 | const ( 38 | // ExampleServiceName is the fully-qualified name of the ExampleService service. 39 | ExampleServiceName = "example.v1.ExampleService" 40 | ) 41 | 42 | // These constants are the fully-qualified names of the RPCs defined in this package. They're 43 | // exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. 44 | // 45 | // Note that these are different from the fully-qualified method names used by 46 | // google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to 47 | // reflection-formatted method names, remove the leading slash and convert the remaining slash to a 48 | // period. 49 | const ( 50 | // ExampleServiceCreateExampleProcedure is the fully-qualified name of the ExampleService's 51 | // CreateExample RPC. 52 | ExampleServiceCreateExampleProcedure = "/example.v1.ExampleService/CreateExample" 53 | ) 54 | 55 | // ExampleServiceClient is a client for the example.v1.ExampleService service. 56 | type ExampleServiceClient interface { 57 | // @ignore-comment Ignore these linter rules, because we intentionally return a generic Operation message for all long-running operations. 58 | // buf:lint:ignore RPC_RESPONSE_STANDARD_NAME 59 | // buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE 60 | // CreateCluster create a Redpanda cluster. The input contains the spec, that describes the cluster. 61 | // A Operation is returned. This task allows the caller to find out when the long-running operation of creating a cluster has finished. 62 | CreateExample(context.Context, *connect.Request[v1.CreateExampleRequest]) (*connect.Response[v1.CreateExampleResponse], error) 63 | } 64 | 65 | // NewExampleServiceClient constructs a client for the example.v1.ExampleService service. By 66 | // default, it uses the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, 67 | // and sends uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the 68 | // connect.WithGRPC() or connect.WithGRPCWeb() options. 69 | // 70 | // The URL supplied here should be the base URL for the Connect or gRPC server (for example, 71 | // http://api.acme.com or https://acme.com/grpc). 72 | func NewExampleServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) ExampleServiceClient { 73 | baseURL = strings.TrimRight(baseURL, "/") 74 | exampleServiceMethods := v1.File_proto_example_v1_example_proto.Services().ByName("ExampleService").Methods() 75 | return &exampleServiceClient{ 76 | createExample: connect.NewClient[v1.CreateExampleRequest, v1.CreateExampleResponse]( 77 | httpClient, 78 | baseURL+ExampleServiceCreateExampleProcedure, 79 | connect.WithSchema(exampleServiceMethods.ByName("CreateExample")), 80 | connect.WithClientOptions(opts...), 81 | ), 82 | } 83 | } 84 | 85 | // exampleServiceClient implements ExampleServiceClient. 86 | type exampleServiceClient struct { 87 | createExample *connect.Client[v1.CreateExampleRequest, v1.CreateExampleResponse] 88 | } 89 | 90 | // CreateExample calls example.v1.ExampleService.CreateExample. 91 | func (c *exampleServiceClient) CreateExample(ctx context.Context, req *connect.Request[v1.CreateExampleRequest]) (*connect.Response[v1.CreateExampleResponse], error) { 92 | return c.createExample.CallUnary(ctx, req) 93 | } 94 | 95 | // ExampleServiceHandler is an implementation of the example.v1.ExampleService service. 96 | type ExampleServiceHandler interface { 97 | // @ignore-comment Ignore these linter rules, because we intentionally return a generic Operation message for all long-running operations. 98 | // buf:lint:ignore RPC_RESPONSE_STANDARD_NAME 99 | // buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE 100 | // CreateCluster create a Redpanda cluster. The input contains the spec, that describes the cluster. 101 | // A Operation is returned. This task allows the caller to find out when the long-running operation of creating a cluster has finished. 102 | CreateExample(context.Context, *connect.Request[v1.CreateExampleRequest]) (*connect.Response[v1.CreateExampleResponse], error) 103 | } 104 | 105 | // NewExampleServiceHandler builds an HTTP handler from the service implementation. It returns the 106 | // path on which to mount the handler and the handler itself. 107 | // 108 | // By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf 109 | // and JSON codecs. They also support gzip compression. 110 | func NewExampleServiceHandler(svc ExampleServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) { 111 | exampleServiceMethods := v1.File_proto_example_v1_example_proto.Services().ByName("ExampleService").Methods() 112 | exampleServiceCreateExampleHandler := connect.NewUnaryHandler( 113 | ExampleServiceCreateExampleProcedure, 114 | svc.CreateExample, 115 | connect.WithSchema(exampleServiceMethods.ByName("CreateExample")), 116 | connect.WithHandlerOptions(opts...), 117 | ) 118 | return "/example.v1.ExampleService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { 119 | switch r.URL.Path { 120 | case ExampleServiceCreateExampleProcedure: 121 | exampleServiceCreateExampleHandler.ServeHTTP(w, r) 122 | default: 123 | http.NotFound(w, r) 124 | } 125 | }) 126 | } 127 | 128 | // UnimplementedExampleServiceHandler returns CodeUnimplemented from all methods. 129 | type UnimplementedExampleServiceHandler struct{} 130 | 131 | func (UnimplementedExampleServiceHandler) CreateExample(context.Context, *connect.Request[v1.CreateExampleRequest]) (*connect.Response[v1.CreateExampleResponse], error) { 132 | return nil, connect.NewError(connect.CodeUnimplemented, errors.New("example.v1.ExampleService.CreateExample is not implemented")) 133 | } 134 | -------------------------------------------------------------------------------- /example/gen/go/proto/example/v1/examplev1mcp/example.pb.mcp.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoc-gen-mcp-go. DO NOT EDIT. 2 | // source: proto/example/v1/example.proto 3 | 4 | package examplev1mcp 5 | 6 | import ( 7 | v1 "github.com/redpanda-data/protoc-gen-go-mcp/example/gen/go/proto/example/v1" 8 | ) 9 | 10 | import ( 11 | "context" 12 | "github.com/mark3labs/mcp-go/mcp" 13 | mcpserver "github.com/mark3labs/mcp-go/server" 14 | "encoding/json" 15 | "google.golang.org/protobuf/encoding/protojson" 16 | "connectrpc.com/connect" 17 | grpc "google.golang.org/grpc" 18 | ) 19 | 20 | var ( 21 | ExampleService_CreateExampleTool = mcp.Tool{Name: "example_v1_ExampleService_CreateExample", Description: "CreateCluster create a Redpanda cluster. The input contains the spec, that describes the cluster.\nA Operation is returned. This task allows the caller to find out when the long-running operation of creating a cluster has finished.\n", InputSchema: mcp.ToolInputSchema{Type: "", Properties: map[string]interface{}(nil), Required: []string(nil)}, RawInputSchema: json.RawMessage{0x7b, 0x22, 0x61, 0x6e, 0x79, 0x4f, 0x66, 0x22, 0x3a, 0x5b, 0x7b, 0x22, 0x24, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x22, 0x3a, 0x22, 0x49, 0x6e, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2c, 0x20, 0x74, 0x68, 0x65, 0x72, 0x65, 0x20, 0x69, 0x73, 0x20, 0x61, 0x20, 0x6f, 0x6e, 0x65, 0x4f, 0x66, 0x20, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x65, 0x76, 0x65, 0x72, 0x74, 0x20, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x20, 0x6f, 0x6e, 0x65, 0x4f, 0x66, 0x20, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x22, 0x2c, 0x22, 0x6f, 0x6e, 0x65, 0x4f, 0x66, 0x22, 0x3a, 0x5b, 0x7b, 0x22, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0x3a, 0x7b, 0x22, 0x66, 0x69, 0x72, 0x73, 0x74, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x22, 0x3a, 0x7b, 0x22, 0x74, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x22, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x22, 0x7d, 0x7d, 0x2c, 0x22, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x22, 0x3a, 0x5b, 0x22, 0x66, 0x69, 0x72, 0x73, 0x74, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x22, 0x5d, 0x7d, 0x2c, 0x7b, 0x22, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0x3a, 0x7b, 0x22, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x22, 0x3a, 0x7b, 0x22, 0x74, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x22, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x65, 0x72, 0x22, 0x7d, 0x7d, 0x2c, 0x22, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x22, 0x3a, 0x5b, 0x22, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x22, 0x5d, 0x7d, 0x5d, 0x7d, 0x5d, 0x2c, 0x22, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0x3a, 0x7b, 0x22, 0x6d, 0x61, 0x70, 0x5f, 0x77, 0x69, 0x74, 0x68, 0x5f, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x5f, 0x76, 0x61, 0x6c, 0x22, 0x3a, 0x7b, 0x22, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0x3a, 0x7b, 0x22, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0x3a, 0x7b, 0x22, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x32, 0x22, 0x3a, 0x7b, 0x22, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0x3a, 0x7b, 0x22, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x33, 0x22, 0x3a, 0x7b, 0x22, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0x3a, 0x7b, 0x22, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x22, 0x3a, 0x7b, 0x22, 0x74, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x22, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x22, 0x7d, 0x2c, 0x22, 0x73, 0x6f, 0x6d, 0x65, 0x5f, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x5f, 0x69, 0x6e, 0x5f, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x22, 0x3a, 0x7b, 0x22, 0x74, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x22, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x22, 0x7d, 0x7d, 0x2c, 0x22, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x22, 0x3a, 0x5b, 0x5d, 0x2c, 0x22, 0x74, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x22, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x22, 0x7d, 0x2c, 0x22, 0x73, 0x6f, 0x6d, 0x65, 0x5f, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x22, 0x3a, 0x7b, 0x22, 0x74, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x22, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x22, 0x7d, 0x7d, 0x2c, 0x22, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x22, 0x3a, 0x5b, 0x5d, 0x2c, 0x22, 0x74, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x22, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x22, 0x7d, 0x2c, 0x22, 0x73, 0x6f, 0x6d, 0x65, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x22, 0x3a, 0x7b, 0x22, 0x74, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x22, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x22, 0x7d, 0x7d, 0x2c, 0x22, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x22, 0x3a, 0x5b, 0x5d, 0x2c, 0x22, 0x74, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x22, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x22, 0x7d, 0x2c, 0x22, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x22, 0x3a, 0x7b, 0x22, 0x74, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x22, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x22, 0x7d, 0x2c, 0x22, 0x74, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x22, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x22, 0x7d, 0x2c, 0x22, 0x6d, 0x61, 0x70, 0x5f, 0x77, 0x69, 0x74, 0x68, 0x5f, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x5f, 0x76, 0x61, 0x6c, 0x5f, 0x6e, 0x6f, 0x5f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x6b, 0x65, 0x79, 0x22, 0x3a, 0x7b, 0x22, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0x3a, 0x7b, 0x22, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0x3a, 0x7b, 0x22, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x32, 0x22, 0x3a, 0x7b, 0x22, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0x3a, 0x7b, 0x22, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x33, 0x22, 0x3a, 0x7b, 0x22, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0x3a, 0x7b, 0x22, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x22, 0x3a, 0x7b, 0x22, 0x74, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x22, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x22, 0x7d, 0x2c, 0x22, 0x73, 0x6f, 0x6d, 0x65, 0x5f, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x5f, 0x69, 0x6e, 0x5f, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x22, 0x3a, 0x7b, 0x22, 0x74, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x22, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x22, 0x7d, 0x7d, 0x2c, 0x22, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x22, 0x3a, 0x5b, 0x5d, 0x2c, 0x22, 0x74, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x22, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x22, 0x7d, 0x2c, 0x22, 0x73, 0x6f, 0x6d, 0x65, 0x5f, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x22, 0x3a, 0x7b, 0x22, 0x74, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x22, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x22, 0x7d, 0x7d, 0x2c, 0x22, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x22, 0x3a, 0x5b, 0x5d, 0x2c, 0x22, 0x74, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x22, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x22, 0x7d, 0x2c, 0x22, 0x73, 0x6f, 0x6d, 0x65, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x22, 0x3a, 0x7b, 0x22, 0x74, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x22, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x22, 0x7d, 0x7d, 0x2c, 0x22, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x22, 0x3a, 0x5b, 0x5d, 0x2c, 0x22, 0x74, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x22, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x22, 0x7d, 0x2c, 0x22, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x22, 0x3a, 0x7b, 0x22, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x22, 0x3a, 0x22, 0x5e, 0x2d, 0x3f, 0x28, 0x30, 0x7c, 0x5b, 0x31, 0x2d, 0x39, 0x5d, 0x5c, 0x5c, 0x64, 0x2a, 0x29, 0x24, 0x22, 0x2c, 0x22, 0x74, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x22, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x22, 0x7d, 0x2c, 0x22, 0x74, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x22, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x22, 0x7d, 0x2c, 0x22, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x22, 0x3a, 0x7b, 0x22, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0x3a, 0x7b, 0x22, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x32, 0x22, 0x3a, 0x7b, 0x22, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0x3a, 0x7b, 0x22, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x33, 0x22, 0x3a, 0x7b, 0x22, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0x3a, 0x7b, 0x22, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x22, 0x3a, 0x7b, 0x22, 0x74, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x22, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x22, 0x7d, 0x2c, 0x22, 0x73, 0x6f, 0x6d, 0x65, 0x5f, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x5f, 0x69, 0x6e, 0x5f, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x22, 0x3a, 0x7b, 0x22, 0x74, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x22, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x22, 0x7d, 0x7d, 0x2c, 0x22, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x22, 0x3a, 0x5b, 0x5d, 0x2c, 0x22, 0x74, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x22, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x22, 0x7d, 0x2c, 0x22, 0x73, 0x6f, 0x6d, 0x65, 0x5f, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x22, 0x3a, 0x7b, 0x22, 0x74, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x22, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x22, 0x7d, 0x7d, 0x2c, 0x22, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x22, 0x3a, 0x5b, 0x5d, 0x2c, 0x22, 0x74, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x22, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x22, 0x7d, 0x2c, 0x22, 0x73, 0x6f, 0x6d, 0x65, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x22, 0x3a, 0x7b, 0x22, 0x74, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x22, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x22, 0x7d, 0x7d, 0x2c, 0x22, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x22, 0x3a, 0x5b, 0x5d, 0x2c, 0x22, 0x74, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x22, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x22, 0x7d, 0x2c, 0x22, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x22, 0x3a, 0x7b, 0x22, 0x74, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x22, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x22, 0x7d, 0x2c, 0x22, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x22, 0x3a, 0x7b, 0x22, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x22, 0x3a, 0x7b, 0x22, 0x74, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x22, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x22, 0x7d, 0x2c, 0x22, 0x74, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x22, 0x61, 0x72, 0x72, 0x61, 0x79, 0x22, 0x7d, 0x2c, 0x22, 0x73, 0x6f, 0x6d, 0x65, 0x5f, 0x65, 0x6e, 0x75, 0x6d, 0x22, 0x3a, 0x7b, 0x22, 0x65, 0x6e, 0x75, 0x6d, 0x22, 0x3a, 0x5b, 0x22, 0x53, 0x4f, 0x4d, 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x22, 0x2c, 0x22, 0x53, 0x4f, 0x4d, 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x46, 0x49, 0x52, 0x53, 0x54, 0x22, 0x2c, 0x22, 0x53, 0x4f, 0x4d, 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x53, 0x45, 0x43, 0x4f, 0x4e, 0x44, 0x22, 0x5d, 0x2c, 0x22, 0x74, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x22, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x22, 0x7d, 0x2c, 0x22, 0x73, 0x6f, 0x6d, 0x65, 0x5f, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x22, 0x3a, 0x7b, 0x22, 0x74, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x22, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x65, 0x72, 0x22, 0x7d, 0x2c, 0x22, 0x73, 0x6f, 0x6d, 0x65, 0x5f, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x22, 0x3a, 0x7b, 0x22, 0x74, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x22, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x22, 0x7d, 0x2c, 0x22, 0x73, 0x6f, 0x6d, 0x65, 0x5f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x22, 0x3a, 0x7b, 0x22, 0x74, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x22, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x22, 0x7d, 0x7d, 0x2c, 0x22, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x22, 0x3a, 0x5b, 0x5d, 0x2c, 0x22, 0x74, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x22, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x22, 0x7d}} 22 | ) 23 | 24 | // ExampleServiceServer is compatible with the grpc-go server interface. 25 | type ExampleServiceServer interface { 26 | CreateExample(ctx context.Context, req *v1.CreateExampleRequest) (*v1.CreateExampleResponse, error) 27 | } 28 | 29 | func RegisterExampleServiceHandler(s *mcpserver.MCPServer, srv ExampleServiceServer) { 30 | s.AddTool(ExampleService_CreateExampleTool, func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) { 31 | marshaled, err := json.Marshal(request.Params.Arguments) 32 | if err != nil { 33 | return nil, err 34 | } 35 | 36 | var req v1.CreateExampleRequest 37 | if err := (protojson.UnmarshalOptions{DiscardUnknown: true}).Unmarshal(marshaled, &req); err != nil { 38 | return nil, err 39 | } 40 | 41 | resp, err := srv.CreateExample(ctx, &req) 42 | if err != nil { 43 | return nil, err 44 | } 45 | 46 | marshaled, err = (protojson.MarshalOptions{UseProtoNames: true, EmitDefaultValues: true}).Marshal(resp) 47 | if err != nil { 48 | return nil, err 49 | } 50 | return mcp.NewToolResultText(string(marshaled)), nil 51 | }) 52 | } 53 | 54 | // ExampleServiceClient is compatible with the grpc-go client interface. 55 | type ExampleServiceClient interface { 56 | CreateExample(ctx context.Context, req *v1.CreateExampleRequest, opts ...grpc.CallOption) (*v1.CreateExampleResponse, error) 57 | } 58 | 59 | // ConnectExampleServiceClient is compatible with the connectrpc-go client interface. 60 | type ConnectExampleServiceClient interface { 61 | CreateExample(ctx context.Context, req *connect.Request[v1.CreateExampleRequest]) (*connect.Response[v1.CreateExampleResponse], error) 62 | } 63 | 64 | // ForwardToConnectExampleServiceClient registers a connectrpc client, to forward MCP calls to it. 65 | func ForwardToConnectExampleServiceClient(s *mcpserver.MCPServer, client ConnectExampleServiceClient) { 66 | s.AddTool(ExampleService_CreateExampleTool, func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) { 67 | marshaled, err := json.Marshal(request.Params.Arguments) 68 | if err != nil { 69 | return nil, err 70 | } 71 | 72 | var req v1.CreateExampleRequest 73 | if err := (protojson.UnmarshalOptions{DiscardUnknown: true}).Unmarshal(marshaled, &req); err != nil { 74 | return nil, err 75 | } 76 | 77 | resp, err := client.CreateExample(ctx, connect.NewRequest(&req)) 78 | if err != nil { 79 | return nil, err 80 | } 81 | 82 | marshaled, err = (protojson.MarshalOptions{UseProtoNames: true, EmitDefaultValues: true}).Marshal(resp.Msg) 83 | if err != nil { 84 | return nil, err 85 | } 86 | return mcp.NewToolResultText(string(marshaled)), nil 87 | }) 88 | } 89 | 90 | // ForwardToExampleServiceClient registers a gRPC client, to forward MCP calls to it. 91 | func ForwardToExampleServiceClient(s *mcpserver.MCPServer, client ExampleServiceClient) { 92 | s.AddTool(ExampleService_CreateExampleTool, func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) { 93 | marshaled, err := json.Marshal(request.Params.Arguments) 94 | if err != nil { 95 | return nil, err 96 | } 97 | 98 | var req v1.CreateExampleRequest 99 | if err := (protojson.UnmarshalOptions{DiscardUnknown: true}).Unmarshal(marshaled, &req); err != nil { 100 | return nil, err 101 | } 102 | 103 | resp, err := client.CreateExample(ctx, &req) 104 | if err != nil { 105 | return nil, err 106 | } 107 | 108 | marshaled, err = (protojson.MarshalOptions{UseProtoNames: true, EmitDefaultValues: true}).Marshal(resp) 109 | if err != nil { 110 | return nil, err 111 | } 112 | return mcp.NewToolResultText(string(marshaled)), nil 113 | }) 114 | } 115 | -------------------------------------------------------------------------------- /example/main.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Redpanda Data, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package main 16 | 17 | import ( 18 | "context" 19 | "fmt" 20 | 21 | "github.com/mark3labs/mcp-go/server" 22 | examplev1 "github.com/redpanda-data/protoc-gen-go-mcp/example/gen/go/proto/example/v1" 23 | "github.com/redpanda-data/protoc-gen-go-mcp/example/gen/go/proto/example/v1/examplev1connect" 24 | "github.com/redpanda-data/protoc-gen-go-mcp/example/gen/go/proto/example/v1/examplev1mcp" 25 | ) 26 | 27 | // Ensure our interface and the official gRPC interface are grpcClient 28 | var ( 29 | grpcClient examplev1.ExampleServiceClient 30 | mcpClient = examplev1mcp.ExampleServiceClient(grpcClient) 31 | ) 32 | 33 | // Ensure our interface and the official connect-go interface are compatible 34 | var ( 35 | connectClient examplev1connect.ExampleServiceClient 36 | connectMcpClient = examplev1mcp.ConnectExampleServiceClient(connectClient) 37 | ) 38 | 39 | func main() { 40 | // Create MCP server 41 | s := server.NewMCPServer( 42 | "Example auto-generated gRPC-MCP", 43 | "1.0.0", 44 | ) 45 | 46 | srv := exampleServer{} 47 | 48 | examplev1mcp.RegisterExampleServiceHandler(s, &srv) 49 | 50 | examplev1mcp.ForwardToConnectExampleServiceClient(s, connectClient) 51 | examplev1mcp.ForwardToExampleServiceClient(s, grpcClient) 52 | 53 | if err := server.ServeStdio(s); err != nil { 54 | fmt.Printf("Server error: %v\n", err) 55 | } 56 | 57 | } 58 | 59 | type exampleServer struct { 60 | } 61 | 62 | func (t *exampleServer) CreateExample(ctx context.Context, in *examplev1.CreateExampleRequest) (*examplev1.CreateExampleResponse, error) { 63 | return &examplev1.CreateExampleResponse{ 64 | SomeString: "HAHA " + in.GetNested().GetNested2().GetNested3().GetOptionalString(), 65 | }, nil 66 | } 67 | -------------------------------------------------------------------------------- /example/proto/example/v1/example.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Redpanda Data, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | syntax = "proto3"; 16 | package example.v1; 17 | 18 | message CreateExampleRequest { 19 | int32 some_int32 = 1; 20 | int64 some_int64 = 2; 21 | string some_string = 3; 22 | enum SomeEnum { 23 | SOME_ENUM_UNSPECIFIED = 0; 24 | SOME_ENUM_FIRST = 1; 25 | SOME_ENUM_SECOND = 2; 26 | } 27 | SomeEnum some_enum = 4; 28 | message Nested { 29 | string some_field = 1; 30 | message Nested2 { 31 | string some_nested_field = 1; 32 | message Nested3 { 33 | string some_nested_in_nested_field = 1; 34 | optional string optional_string = 2; 35 | } 36 | Nested3 nested3 = 2; 37 | } 38 | Nested2 nested2 = 2; 39 | } 40 | 41 | Nested nested = 5; 42 | optional string optional_string = 6; 43 | repeated string repeated_string = 7; 44 | map map_with_nested_val = 8; 45 | map map_with_nested_val_no_string_key = 9; 46 | oneof some_oneof { 47 | string first_item = 10; 48 | int32 second_item = 11; 49 | } 50 | } 51 | 52 | message CreateExampleResponse { 53 | string some_string = 1; 54 | } 55 | 56 | service ExampleService { 57 | 58 | // @ignore-comment Ignore these linter rules, because we intentionally return a generic Operation message for all long-running operations. 59 | // buf:lint:ignore RPC_RESPONSE_STANDARD_NAME 60 | // buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE 61 | // CreateCluster create a Redpanda cluster. The input contains the spec, that describes the cluster. 62 | // A Operation is returned. This task allows the caller to find out when the long-running operation of creating a cluster has finished. 63 | rpc CreateExample(CreateExampleRequest) returns (CreateExampleResponse); 64 | } 65 | -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/redpanda-data/protoc-gen-go-mcp 2 | 3 | go 1.23.5 4 | 5 | require ( 6 | connectrpc.com/connect v1.18.1 7 | github.com/mark3labs/mcp-go v0.20.0 8 | github.com/onsi/gomega v1.37.0 9 | github.com/santhosh-tekuri/jsonschema/v5 v5.3.1 10 | google.golang.org/genproto/googleapis/api v0.0.0-20250218202821-56aae31c358a 11 | google.golang.org/grpc v1.67.1 12 | google.golang.org/protobuf v1.36.6 13 | ) 14 | 15 | require ( 16 | github.com/google/go-cmp v0.7.0 // indirect 17 | github.com/google/uuid v1.6.0 // indirect 18 | github.com/yosida95/uritemplate/v3 v3.0.2 // indirect 19 | golang.org/x/net v0.37.0 // indirect 20 | golang.org/x/sys v0.31.0 // indirect 21 | golang.org/x/text v0.23.0 // indirect 22 | google.golang.org/genproto/googleapis/rpc v0.0.0-20250212204824-5a70512c5d8b // indirect 23 | gopkg.in/yaml.v3 v3.0.1 // indirect 24 | ) 25 | -------------------------------------------------------------------------------- /go.sum: -------------------------------------------------------------------------------- 1 | connectrpc.com/connect v1.18.1 h1:PAg7CjSAGvscaf6YZKUefjoih5Z/qYkyaTrBW8xvYPw= 2 | connectrpc.com/connect v1.18.1/go.mod h1:0292hj1rnx8oFrStN7cB4jjVBeqs+Yx5yDIC2prWDO8= 3 | github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= 4 | github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 5 | github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= 6 | github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= 7 | github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI= 8 | github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8= 9 | github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= 10 | github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= 11 | github.com/google/pprof v0.0.0-20241210010833-40e02aabc2ad h1:a6HEuzUHeKH6hwfN/ZoQgRgVIWFJljSWa/zetS2WTvg= 12 | github.com/google/pprof v0.0.0-20241210010833-40e02aabc2ad/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144= 13 | github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= 14 | github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= 15 | github.com/mark3labs/mcp-go v0.20.0 h1:NYZDZ10GBKHVz4SdQ2tPFSDFQFKCTrTZJLn4wj6jAaw= 16 | github.com/mark3labs/mcp-go v0.20.0/go.mod h1:KmJndYv7GIgcPVwEKJjNcbhVQ+hJGJhrCCB/9xITzpE= 17 | github.com/onsi/ginkgo/v2 v2.23.3 h1:edHxnszytJ4lD9D5Jjc4tiDkPBZ3siDeJJkUZJJVkp0= 18 | github.com/onsi/ginkgo/v2 v2.23.3/go.mod h1:zXTP6xIp3U8aVuXN8ENK9IXRaTjFnpVB9mGmaSRvxnM= 19 | github.com/onsi/gomega v1.37.0 h1:CdEG8g0S133B4OswTDC/5XPSzE1OeP29QOioj2PID2Y= 20 | github.com/onsi/gomega v1.37.0/go.mod h1:8D9+Txp43QWKhM24yyOBEdpkzN8FvJyAwecBgsU4KU0= 21 | github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= 22 | github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= 23 | github.com/santhosh-tekuri/jsonschema/v5 v5.3.1 h1:lZUw3E0/J3roVtGQ+SCrUrg3ON6NgVqpn3+iol9aGu4= 24 | github.com/santhosh-tekuri/jsonschema/v5 v5.3.1/go.mod h1:uToXkOrWAZ6/Oc07xWQrPOhJotwFIyu2bBVN41fcDUY= 25 | github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= 26 | github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= 27 | github.com/yosida95/uritemplate/v3 v3.0.2 h1:Ed3Oyj9yrmi9087+NczuL5BwkIc4wvTb5zIM+UJPGz4= 28 | github.com/yosida95/uritemplate/v3 v3.0.2/go.mod h1:ILOh0sOhIJR3+L/8afwt/kE++YT040gmv5BQTMR2HP4= 29 | golang.org/x/net v0.37.0 h1:1zLorHbz+LYj7MQlSf1+2tPIIgibq2eL5xkrGk6f+2c= 30 | golang.org/x/net v0.37.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8= 31 | golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik= 32 | golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= 33 | golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY= 34 | golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4= 35 | golang.org/x/tools v0.30.0 h1:BgcpHewrV5AUp2G9MebG4XPFI1E2W41zU1SaqVA9vJY= 36 | golang.org/x/tools v0.30.0/go.mod h1:c347cR/OJfw5TI+GfX7RUPNMdDRRbjvYTS0jPyvsVtY= 37 | google.golang.org/genproto/googleapis/api v0.0.0-20250218202821-56aae31c358a h1:nwKuGPlUAt+aR+pcrkfFRrTU1BVrSmYyYMxYbUIVHr0= 38 | google.golang.org/genproto/googleapis/api v0.0.0-20250218202821-56aae31c358a/go.mod h1:3kWAYMk1I75K4vykHtKt2ycnOgpA6974V7bREqbsenU= 39 | google.golang.org/genproto/googleapis/rpc v0.0.0-20250212204824-5a70512c5d8b h1:FQtJ1MxbXoIIrZHZ33M+w5+dAP9o86rgpjoKr/ZmT7k= 40 | google.golang.org/genproto/googleapis/rpc v0.0.0-20250212204824-5a70512c5d8b/go.mod h1:8BS3B93F/U1juMFq9+EDk+qOT5CO1R9IzXxG3PTqiRk= 41 | google.golang.org/grpc v1.67.1 h1:zWnc1Vrcno+lHZCOofnIMvycFcc0QRGIzm9dhnDX68E= 42 | google.golang.org/grpc v1.67.1/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= 43 | google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY= 44 | google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY= 45 | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= 46 | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 47 | gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= 48 | gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 49 | --------------------------------------------------------------------------------