Commit f32ecf0
authored
Improve editor experience for server.json using schema (#441)
<!-- Provide a brief summary of your changes -->
## Motivation and Context
Currently there are a couple shortcomings I found in the
server.schema.json:
- It uses `https://json-schema.org/draft/2020-12/schema` which is
unfortunately [not supported by VS
Code](microsoft/vscode#165219)
- The Package schema does not require properties that are required by
the service
This means that need to round trip with the publish endpoint (perhaps
spinning CI builds) to get the server.json right. It would be great if
we could shift left and get indications in VS Code easier.
I propose we downgrade the schema to
`http://json-schema.org/draft-07/schema#`. The only difference for us is
the name of `$def` pointers.
I looked that [SchemaStore](https://github.com/SchemaStore/schemastore)
and it looks like `draft-07` is by far the most popular. I believe the
concession of using an older schema is worth it to get VS Code editor
hints.
Schema version | Count in SchemaStore
-- | --
`http://json-schema.org/draft-04/schema#` | 292
`http://json-schema.org/draft-07/schema#` | 1972
`https://json-schema.org/draft/2019-09/schema` | 4
`https://json-schema.org/draft/2020-12/schema` | 4
<!-- Why is this change needed? What problem does it solve? -->
## Open questions
- [ ] Should package `transport` actually be required? Or should `stdio`
be assumed?
- [ ] Should package `registry_base_url` be required? All of the
examples have it it's not required by the publish endpoint.
## How Has This Been Tested?
<!-- Have you tested this in a real application? Which scenarios were
tested? -->
I have tried the new schema inside VS Code and I get helpful warning.
For example, these are the warnings for the old schema.
<img width="1561" height="919" alt="image"
src="https://github.com/user-attachments/assets/474170b8-acf8-4dca-a3d9-66c68c0d1902"
/>
I have run these:
`go run .\tools\validate-examples\main.go`
`go run .\tools\validate-schemas\main.go `
## Breaking Changes
I don't think these are breaking changes. I am expressing what the
publish endpoint enforces at runtime.
## Types of changes
<!-- What types of changes does your code introduce? Put an `x` in all
the boxes that apply: -->
- [ ] 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)
- [x] Documentation update
## Checklist
<!-- Go over all the following points, and put an `x` in all the boxes
that apply. -->
- [ ] I have read the [MCP
Documentation](https://modelcontextprotocol.io)
- [ ] My code follows the repository's style guidelines
- [ ] New and existing tests pass locally
- [ ] I have added appropriate error handling
- [x] I have added or updated documentation as needed
## Additional context
<!-- Add any other context, implementation notes, or design decisions
-->1 parent 78c482b commit f32ecf0
File tree
2 files changed
+34
-24
lines changed- docs/reference/server-json
- tools/validate-examples
2 files changed
+34
-24
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
6 | | - | |
| 5 | + | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
68 | | - | |
| 68 | + | |
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
87 | 94 | | |
88 | 95 | | |
89 | 96 | | |
| |||
104 | 111 | | |
105 | 112 | | |
106 | 113 | | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
107 | 117 | | |
108 | 118 | | |
109 | 119 | | |
| |||
127 | 137 | | |
128 | 138 | | |
129 | 139 | | |
130 | | - | |
| 140 | + | |
131 | 141 | | |
132 | 142 | | |
133 | | - | |
| 143 | + | |
134 | 144 | | |
135 | 145 | | |
136 | | - | |
| 146 | + | |
137 | 147 | | |
138 | 148 | | |
139 | 149 | | |
| |||
142 | 152 | | |
143 | 153 | | |
144 | 154 | | |
145 | | - | |
| 155 | + | |
146 | 156 | | |
147 | 157 | | |
148 | 158 | | |
149 | 159 | | |
150 | 160 | | |
151 | 161 | | |
152 | | - | |
| 162 | + | |
153 | 163 | | |
154 | 164 | | |
155 | 165 | | |
156 | 166 | | |
157 | 167 | | |
158 | 168 | | |
159 | | - | |
| 169 | + | |
160 | 170 | | |
161 | 171 | | |
162 | 172 | | |
| |||
209 | 219 | | |
210 | 220 | | |
211 | 221 | | |
212 | | - | |
| 222 | + | |
213 | 223 | | |
214 | 224 | | |
215 | 225 | | |
| |||
218 | 228 | | |
219 | 229 | | |
220 | 230 | | |
221 | | - | |
| 231 | + | |
222 | 232 | | |
223 | 233 | | |
224 | 234 | | |
| |||
229 | 239 | | |
230 | 240 | | |
231 | 241 | | |
232 | | - | |
| 242 | + | |
233 | 243 | | |
234 | 244 | | |
235 | 245 | | |
| |||
274 | 284 | | |
275 | 285 | | |
276 | 286 | | |
277 | | - | |
| 287 | + | |
278 | 288 | | |
279 | 289 | | |
280 | 290 | | |
| |||
307 | 317 | | |
308 | 318 | | |
309 | 319 | | |
310 | | - | |
| 320 | + | |
311 | 321 | | |
312 | 322 | | |
313 | 323 | | |
| |||
328 | 338 | | |
329 | 339 | | |
330 | 340 | | |
331 | | - | |
| 341 | + | |
332 | 342 | | |
333 | 343 | | |
334 | | - | |
| 344 | + | |
335 | 345 | | |
336 | 346 | | |
337 | 347 | | |
| |||
375 | 385 | | |
376 | 386 | | |
377 | 387 | | |
378 | | - | |
| 388 | + | |
379 | 389 | | |
380 | 390 | | |
381 | 391 | | |
| |||
405 | 415 | | |
406 | 416 | | |
407 | 417 | | |
408 | | - | |
| 418 | + | |
409 | 419 | | |
410 | 420 | | |
411 | 421 | | |
| |||
414 | 424 | | |
415 | 425 | | |
416 | 426 | | |
417 | | - | |
| 427 | + | |
418 | 428 | | |
419 | 429 | | |
420 | 430 | | |
| |||
428 | 438 | | |
429 | 439 | | |
430 | 440 | | |
431 | | - | |
| 441 | + | |
432 | 442 | | |
433 | 443 | | |
434 | 444 | | |
435 | 445 | | |
436 | 446 | | |
437 | 447 | | |
438 | 448 | | |
439 | | - | |
| 449 | + | |
440 | 450 | | |
441 | 451 | | |
442 | | - | |
| 452 | + | |
443 | 453 | | |
444 | 454 | | |
445 | 455 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
160 | 160 | | |
161 | 161 | | |
162 | 162 | | |
163 | | - | |
| 163 | + | |
164 | 164 | | |
165 | 165 | | |
166 | 166 | | |
| |||
0 commit comments