turbomcp-grpc 3.1.2

gRPC transport for TurboMCP - high-performance MCP over HTTP/2
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
// MCP (Model Context Protocol) gRPC Service Definition
// Version: 2025-11-25
//
// This proto file defines the gRPC interface for the Model Context Protocol,
// enabling high-performance RPC communication between MCP clients and servers.

syntax = "proto3";

package turbomcp.mcp.v1;

option java_multiple_files = true;
option java_package = "org.turbomcp.mcp.v1";
option java_outer_classname = "McpProto";

// =============================================================================
// MCP Service
// =============================================================================

// The main MCP service providing all protocol operations.
service McpService {
  // Initialize the MCP session
  rpc Initialize(InitializeRequest) returns (InitializeResult);

  // Ping for keepalive/health check
  rpc Ping(PingRequest) returns (PingResponse);

  // List available tools
  rpc ListTools(ListToolsRequest) returns (ListToolsResult);

  // Call a tool
  rpc CallTool(CallToolRequest) returns (CallToolResult);

  // List available resources
  rpc ListResources(ListResourcesRequest) returns (ListResourcesResult);

  // List resource templates
  rpc ListResourceTemplates(ListResourceTemplatesRequest) returns (ListResourceTemplatesResult);

  // Read a resource
  rpc ReadResource(ReadResourceRequest) returns (ReadResourceResult);

  // List available prompts
  rpc ListPrompts(ListPromptsRequest) returns (ListPromptsResult);

  // Get a prompt
  rpc GetPrompt(GetPromptRequest) returns (GetPromptResult);

  // Complete (autocomplete)
  rpc Complete(CompleteRequest) returns (CompleteResult);

  // Subscribe to notifications (server streaming)
  rpc Subscribe(SubscribeRequest) returns (stream Notification);

  // Set logging level
  rpc SetLoggingLevel(SetLoggingLevelRequest) returns (SetLoggingLevelResponse);

  // List roots (client capability)
  rpc ListRoots(ListRootsRequest) returns (ListRootsResult);

  // Sampling (client capability - bidirectional streaming for complex interactions)
  rpc CreateSamplingMessage(CreateSamplingMessageRequest) returns (CreateSamplingMessageResult);

  // Elicitation (human-in-the-loop)
  rpc Elicit(ElicitRequest) returns (ElicitResult);
}

// =============================================================================
// Common Types
// =============================================================================

// JSON-RPC style request ID
message RequestId {
  oneof id {
    int64 number = 1;
    string text = 2;
  }
}

// Implementation info
message Implementation {
  string name = 1;
  string version = 2;
  optional string title = 3;
  optional string description = 4;
  repeated Icon icons = 5;
  optional string website_url = 6;
}

// Role enum
enum Role {
  ROLE_UNSPECIFIED = 0;
  ROLE_USER = 1;
  ROLE_ASSISTANT = 2;
}

// Annotations for tools, resources, prompts
message Annotations {
  repeated string audience = 1;
  double priority = 2;
}

// Icon for visual representation
message Icon {
  oneof icon {
    string uri = 1;
    string data_uri = 2;  // Base64 encoded with MIME type prefix
  }
}

// =============================================================================
// Initialize
// =============================================================================

message InitializeRequest {
  string protocol_version = 1;
  ClientCapabilities capabilities = 2;
  Implementation client_info = 3;
}

message InitializeResult {
  string protocol_version = 1;
  ServerCapabilities capabilities = 2;
  Implementation server_info = 3;
  optional string instructions = 4;
}

message ClientCapabilities {
  optional RootsCapability roots = 1;
  optional SamplingCapability sampling = 2;
  optional ExperimentalCapabilities experimental = 3;
  optional ElicitationCapability elicitation = 4;
  optional ClientTasksCapability tasks = 5;
  optional ExtensionsCapabilities extensions = 6;
}

message ServerCapabilities {
  optional PromptsCapability prompts = 1;
  optional ResourcesCapability resources = 2;
  optional ToolsCapability tools = 3;
  optional LoggingCapability logging = 4;
  optional ExperimentalCapabilities experimental = 5;
  optional CompletionCapability completions = 6;
  optional ServerTasksCapability tasks = 7;
  optional ExtensionsCapabilities extensions = 8;
}

message EmptyCapability {}

message RootsCapability {
  bool list_changed = 1;
}

message SamplingCapability {}

message ElicitationCapability {
  optional EmptyCapability form = 1;
  optional EmptyCapability url = 2;
}

message PromptsCapability {
  bool list_changed = 1;
}

message ResourcesCapability {
  bool subscribe = 1;
  bool list_changed = 2;
}

message ToolsCapability {
  bool list_changed = 1;
}

message LoggingCapability {}

message CompletionCapability {}

message ExperimentalCapabilities {
  map<string, bytes> capabilities = 1;  // JSON-encoded capability data
}

message ExtensionsCapabilities {
  map<string, bytes> capabilities = 1;  // JSON-encoded extension data
}

message ClientTasksCapability {
  optional EmptyCapability list = 1;
  optional EmptyCapability cancel = 2;
  optional ClientTaskRequestsCapability requests = 3;
}

message ClientTaskRequestsCapability {
  optional ClientTaskSamplingCapability sampling = 1;
  optional ClientTaskElicitationCapability elicitation = 2;
}

message ClientTaskSamplingCapability {
  optional EmptyCapability create_message = 1;
}

message ClientTaskElicitationCapability {
  optional EmptyCapability create = 1;
}

message ServerTasksCapability {
  optional EmptyCapability list = 1;
  optional EmptyCapability cancel = 2;
  optional ServerTaskRequestsCapability requests = 3;
}

message ServerTaskRequestsCapability {
  optional ServerTaskToolsCapability tools = 1;
}

message ServerTaskToolsCapability {
  optional EmptyCapability call = 1;
}

// =============================================================================
// Ping
// =============================================================================

message PingRequest {}

message PingResponse {}

// =============================================================================
// Tools
// =============================================================================

message ListToolsRequest {
  optional string cursor = 1;
}

message ListToolsResult {
  repeated Tool tools = 1;
  optional string next_cursor = 2;
}

message Tool {
  string name = 1;
  optional string description = 2;
  bytes input_schema = 3;  // JSON Schema as bytes
  optional Annotations annotations = 4;
  repeated Icon icons = 5;
  optional string title = 6;
}

message CallToolRequest {
  string name = 1;
  optional bytes arguments = 2;  // JSON object as bytes
}

message CallToolResult {
  repeated Content content = 1;
  optional bool is_error = 2;
}

// =============================================================================
// Resources
// =============================================================================

message ListResourcesRequest {
  optional string cursor = 1;
}

message ListResourcesResult {
  repeated Resource resources = 1;
  optional string next_cursor = 2;
}

message Resource {
  string uri = 1;
  string name = 2;
  optional string description = 3;
  optional string mime_type = 4;
  optional Annotations annotations = 5;
  repeated Icon icons = 6;
  optional string title = 7;
  optional uint64 size = 8;
}

message ListResourceTemplatesRequest {
  optional string cursor = 1;
}

message ListResourceTemplatesResult {
  repeated ResourceTemplate resource_templates = 1;
  optional string next_cursor = 2;
}

message ResourceTemplate {
  string uri_template = 1;
  string name = 2;
  optional string description = 3;
  optional string mime_type = 4;
  optional Annotations annotations = 5;
  repeated Icon icons = 6;
  optional string title = 7;
}

message ReadResourceRequest {
  string uri = 1;
}

message ReadResourceResult {
  repeated ResourceContent contents = 1;
}

message ResourceContent {
  string uri = 1;
  optional string mime_type = 2;
  oneof content {
    string text = 3;
    bytes blob = 4;  // Base64 decoded binary content
  }
}

// =============================================================================
// Prompts
// =============================================================================

message ListPromptsRequest {
  optional string cursor = 1;
}

message ListPromptsResult {
  repeated Prompt prompts = 1;
  optional string next_cursor = 2;
}

message Prompt {
  string name = 1;
  optional string description = 2;
  repeated PromptArgument arguments = 3;
  repeated Icon icons = 4;
  optional string title = 5;
}

message PromptArgument {
  string name = 1;
  optional string description = 2;
  optional bool required = 3;
}

message GetPromptRequest {
  string name = 1;
  optional bytes arguments = 2;  // JSON object as bytes
}

message GetPromptResult {
  optional string description = 1;
  repeated PromptMessage messages = 2;
}

message PromptMessage {
  Role role = 1;
  Content content = 2;
}

// =============================================================================
// Content Types
// =============================================================================

message Content {
  oneof content {
    TextContent text = 1;
    ImageContent image = 2;
    AudioContent audio = 3;
    ResourceContent resource = 4;
  }
  optional Annotations annotations = 10;
}

message TextContent {
  string text = 1;
}

message ImageContent {
  string data = 1;  // Base64 encoded
  string mime_type = 2;
}

message AudioContent {
  string data = 1;  // Base64 encoded
  string mime_type = 2;
}

// =============================================================================
// Completion
// =============================================================================

message CompleteRequest {
  CompletionReference ref = 1;
  CompletionArgument argument = 2;
}

message CompletionReference {
  oneof reference {
    PromptReference prompt = 1;
    ResourceReference resource = 2;
  }
}

message PromptReference {
  string name = 1;
}

message ResourceReference {
  string uri = 1;
}

message CompletionArgument {
  string name = 1;
  string value = 2;
}

message CompleteResult {
  Completion completion = 1;
}

message Completion {
  repeated string values = 1;
  optional int64 total = 2;
  optional bool has_more = 3;
}

// =============================================================================
// Notifications
// =============================================================================

message SubscribeRequest {
  repeated string topics = 1;  // Empty means all notifications
}

message Notification {
  oneof notification {
    ProgressNotification progress = 1;
    LogNotification log = 2;
    ResourceUpdatedNotification resource_updated = 3;
    ResourceListChangedNotification resource_list_changed = 4;
    ToolListChangedNotification tool_list_changed = 5;
    PromptListChangedNotification prompt_list_changed = 6;
    RootsListChangedNotification roots_list_changed = 7;
    CancelledNotification cancelled = 8;
  }
}

message ProgressNotification {
  string progress_token = 1;
  double progress = 2;
  optional double total = 3;
  optional string message = 4;
}

message LogNotification {
  LogLevel level = 1;
  string logger = 2;
  string message = 3;
  optional bytes data = 4;  // JSON as bytes
}

enum LogLevel {
  LOG_LEVEL_UNSPECIFIED = 0;
  LOG_LEVEL_DEBUG = 1;
  LOG_LEVEL_INFO = 2;
  LOG_LEVEL_NOTICE = 3;
  LOG_LEVEL_WARNING = 4;
  LOG_LEVEL_ERROR = 5;
  LOG_LEVEL_CRITICAL = 6;
  LOG_LEVEL_ALERT = 7;
  LOG_LEVEL_EMERGENCY = 8;
}

message ResourceUpdatedNotification {
  string uri = 1;
}

message ResourceListChangedNotification {}

message ToolListChangedNotification {}

message PromptListChangedNotification {}

message RootsListChangedNotification {}

message CancelledNotification {
  string request_id = 1;
  optional string reason = 2;
}

// =============================================================================
// Logging
// =============================================================================

message SetLoggingLevelRequest {
  LogLevel level = 1;
}

message SetLoggingLevelResponse {}

// =============================================================================
// Roots
// =============================================================================

message ListRootsRequest {}

message ListRootsResult {
  repeated Root roots = 1;
}

message Root {
  string uri = 1;
  optional string name = 2;
}

// =============================================================================
// Sampling
// =============================================================================

message CreateSamplingMessageRequest {
  repeated SamplingMessage messages = 1;
  optional string model_preferences = 2;  // JSON as string
  optional string system_prompt = 3;
  optional ContextIncludeStrategy include_context = 4;
  optional double temperature = 5;
  optional int64 max_tokens = 6;
  repeated string stop_sequences = 7;
  optional bytes metadata = 8;  // JSON as bytes
}

enum ContextIncludeStrategy {
  CONTEXT_INCLUDE_STRATEGY_UNSPECIFIED = 0;
  CONTEXT_INCLUDE_STRATEGY_NONE = 1;
  CONTEXT_INCLUDE_STRATEGY_THIS_SERVER = 2;
  CONTEXT_INCLUDE_STRATEGY_ALL_SERVERS = 3;
}

message SamplingMessage {
  Role role = 1;
  Content content = 2;
}

message CreateSamplingMessageResult {
  Role role = 1;
  Content content = 2;
  string model = 3;
  optional string stop_reason = 4;
}

// =============================================================================
// Elicitation
// =============================================================================

message ElicitRequest {
  string message = 1;
  optional ElicitationSchema schema = 2;
}

message ElicitationSchema {
  oneof schema {
    TextElicitation text = 1;
    ConfirmElicitation confirm = 2;
    SelectElicitation select = 3;
  }
}

message TextElicitation {
  optional string default_value = 1;
  optional string placeholder = 2;
}

message ConfirmElicitation {
  optional bool default_value = 1;
}

message SelectElicitation {
  repeated string options = 1;
  optional string default_value = 2;
  optional bool multiple = 3;
}

message ElicitResult {
  ElicitAction action = 1;
  optional bytes content = 2;  // JSON as bytes
}

enum ElicitAction {
  ELICIT_ACTION_UNSPECIFIED = 0;
  ELICIT_ACTION_ACCEPT = 1;
  ELICIT_ACTION_DECLINE = 2;
  ELICIT_ACTION_DISMISS = 3;
}