Commit bce6811
authored
fix: validate protocol version header on initialization requests (#697)
Validate `mcp-protocol-version` HTTP header during `InitializeRequest`
Fix `DEFAULT_NEGOTIATED_PROTOCOL_VERSION` to match the spec
fixes #547
## How Has This Been Tested?
Updated existing test (removed TODO referencing #547) to verify init
request
## Breaking Changes
none
## Types of changes
- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)
- [ ] Documentation update
## Checklist
- [x] I have read the [MCP
Documentation](https://modelcontextprotocol.io)
- [x] My code follows the repository's style guidelines
- [x] New and existing tests pass locally
- [x] I have added appropriate error handling
- [x] I have added or updated documentation as needed1 parent eb24803 commit bce6811
File tree
3 files changed
+49
-24
lines changed- kotlin-sdk-core/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/types
- kotlin-sdk-server/src
- commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/server
- jvmTest/kotlin/io/modelcontextprotocol/kotlin/sdk/server
3 files changed
+49
-24
lines changedLines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| |||
Lines changed: 22 additions & 19 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
367 | 367 | | |
368 | 368 | | |
369 | 369 | | |
| 370 | + | |
370 | 371 | | |
371 | 372 | | |
372 | 373 | | |
| |||
393 | 394 | | |
394 | 395 | | |
395 | 396 | | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
396 | 409 | | |
397 | 410 | | |
398 | 411 | | |
399 | 412 | | |
400 | | - | |
| 413 | + | |
401 | 414 | | |
402 | 415 | | |
403 | 416 | | |
| |||
456 | 469 | | |
457 | 470 | | |
458 | 471 | | |
459 | | - | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
460 | 475 | | |
461 | 476 | | |
462 | 477 | | |
| |||
568 | 583 | | |
569 | 584 | | |
570 | 585 | | |
571 | | - | |
| 586 | + | |
572 | 587 | | |
573 | | - | |
| 588 | + | |
574 | 589 | | |
575 | 590 | | |
576 | 591 | | |
| |||
579 | 594 | | |
580 | 595 | | |
581 | 596 | | |
582 | | - | |
583 | | - | |
584 | | - | |
585 | | - | |
586 | | - | |
587 | | - | |
588 | | - | |
589 | | - | |
590 | | - | |
591 | | - | |
592 | | - | |
593 | 597 | | |
594 | 598 | | |
595 | 599 | | |
| |||
605 | 609 | | |
606 | 610 | | |
607 | 611 | | |
608 | | - | |
609 | | - | |
| 612 | + | |
610 | 613 | | |
611 | 614 | | |
612 | 615 | | |
| |||
715 | 718 | | |
716 | 719 | | |
717 | 720 | | |
718 | | - | |
| 721 | + | |
719 | 722 | | |
720 | 723 | | |
721 | 724 | | |
722 | 725 | | |
723 | 726 | | |
724 | 727 | | |
725 | | - | |
| 728 | + | |
726 | 729 | | |
727 | 730 | | |
728 | 731 | | |
| |||
Lines changed: 26 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
176 | 176 | | |
177 | 177 | | |
178 | 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 | + | |
179 | 204 | | |
180 | 205 | | |
181 | 206 | | |
| |||
191 | 216 | | |
192 | 217 | | |
193 | 218 | | |
194 | | - | |
195 | 219 | | |
196 | 220 | | |
197 | | - | |
| 221 | + | |
198 | 222 | | |
199 | 223 | | |
200 | 224 | | |
201 | 225 | | |
202 | 226 | | |
203 | 227 | | |
204 | | - | |
205 | | - | |
206 | 228 | | |
207 | 229 | | |
208 | 230 | | |
| |||
0 commit comments