Skip to content

Commit d42f11e

Browse files
authored
Make value_hint optional to allow constant positional arguments (modelcontextprotocol#172)
<!-- Provide a brief summary of your changes --> ## Motivation and Context <!-- Why is this change needed? What problem does it solve? --> This is one attempt to resolve modelcontextprotocol#169. Instead of adding a new "constant" argument type, I expanded the existing positional one and just dropped the `value_hint` requirement. I am not sure if this has VS Code impact @sandy081, @connor4312. Also, removed unneeded release_date values from the samples. ## How Has This Been Tested? <!-- Have you tested this in a real application? Which scenarios were tested? --> I tested the current server.json samples in the repo against the new (less strict) schema. Of course they passed (aside from an unrelated bug in my previous NuGet sample 🤦). ## Breaking Changes <!-- Will users need to update their code or configurations? --> ## 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. --> - [x] I have read the [MCP Documentation](https://modelcontextprotocol.io) - [x] 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 05422af commit d42f11e

File tree

3 files changed

+61
-19
lines changed

3 files changed

+61
-19
lines changed

docs/server-json/examples.md

Lines changed: 42 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@
1212
"id": "abc123de-f456-7890-ghij-klmnopqrstuv"
1313
},
1414
"version_detail": {
15-
"version": "1.0.2",
16-
"release_date": "2023-06-15T10:30:00Z"
15+
"version": "1.0.2"
1716
},
1817
"packages": [
1918
{
@@ -33,6 +32,39 @@
3332
}
3433
```
3534

35+
## Constant (fixed) arguments needed to start the MCP server
36+
37+
Suppose your MCP server application requires a `mcp start` CLI arguments to start in MCP server mode. Express these as positional arguments like this:
38+
39+
```json
40+
{
41+
"name": "Knapcode.SampleMcpServer",
42+
"description": "Sample NuGet MCP server for a random number and random weather",
43+
"version_detail": {
44+
"version": "0.4.0-beta"
45+
},
46+
"packages": [
47+
{
48+
"registry_name": "nuget",
49+
"name": "Knapcode.SampleMcpServer",
50+
"version": "0.4.0-beta",
51+
"package_arguments": [
52+
{
53+
"type": "positional",
54+
"value": "mcp"
55+
},
56+
{
57+
"type": "positional",
58+
"value": "start"
59+
}
60+
]
61+
}
62+
]
63+
}
64+
```
65+
66+
This will essentially instruct the MCP client to execute `dnx [email protected] -- mcp start` instead of the default `dnx [email protected]` (when no `package_arguments` are provided).
67+
3668
## Filesystem Server with Multiple Packages
3769

3870
```json
@@ -45,8 +77,7 @@
4577
"id": "b94b5f7e-c7c6-d760-2c78-a5e9b8a5b8c9"
4678
},
4779
"version_detail": {
48-
"version": "1.0.2",
49-
"release_date": "2023-06-15T10:30:00Z"
80+
"version": "1.0.2"
5081
},
5182
"packages": [
5283
{
@@ -128,8 +159,7 @@
128159
"id": "xyz789ab-cdef-0123-4567-890ghijklmno"
129160
},
130161
"version_detail": {
131-
"version": "2.0.0",
132-
"release_date": "2024-01-20T14:30:00Z"
162+
"version": "2.0.0"
133163
},
134164
"remotes": [
135165
{
@@ -152,8 +182,7 @@
152182
"id": "def456gh-ijkl-7890-mnop-qrstuvwxyz12"
153183
},
154184
"version_detail": {
155-
"version": "0.5.0",
156-
"release_date": "2024-02-10T09:15:00Z"
185+
"version": "0.5.0"
157186
},
158187
"packages": [
159188
{
@@ -189,11 +218,11 @@ The `dnx` tool ships with the .NET 10 SDK, starting with Preview 6.
189218
"description": "Sample NuGet MCP server for a random number and random weather",
190219
"repository": {
191220
"url": "https://github.com/joelverhagen/Knapcode.SampleMcpServer",
192-
"source": "github"
221+
"source": "github",
222+
"id": "def456gh-ijkl-7890-mnop-qrstuvwxyz13"
193223
},
194224
"version_detail": {
195-
"version": "0.3.0",
196-
"release_date": "2025-07-02T18:54:28.00Z"
225+
"version": "0.3.0-beta"
197226
},
198227
"packages": [
199228
{
@@ -226,8 +255,7 @@ The `dnx` tool ships with the .NET 10 SDK, starting with Preview 6.
226255
"id": "ghi789jk-lmno-1234-pqrs-tuvwxyz56789"
227256
},
228257
"version_detail": {
229-
"version": "3.1.0",
230-
"release_date": "2024-03-05T16:45:00Z"
258+
"version": "3.1.0"
231259
},
232260
"packages": [
233261
{
@@ -313,8 +341,7 @@ The `dnx` tool ships with the .NET 10 SDK, starting with Preview 6.
313341
"id": "klm012no-pqrs-3456-tuvw-xyz789abcdef"
314342
},
315343
"version_detail": {
316-
"version": "1.5.0",
317-
"release_date": "2024-04-01T12:00:00Z"
344+
"version": "1.5.0"
318345
},
319346
"packages": [
320347
{

docs/server-json/schema.json

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,7 @@
196196
{
197197
"type": "object",
198198
"required": [
199-
"type",
200-
"value_hint"
199+
"type"
201200
],
202201
"properties": {
203202
"type": {
@@ -217,7 +216,19 @@
217216
"description": "Whether the argument can be repeated multiple times in the command line.",
218217
"default": false
219218
}
220-
}
219+
},
220+
"anyOf": [
221+
{
222+
"required": [
223+
"value_hint"
224+
]
225+
},
226+
{
227+
"required": [
228+
"value"
229+
]
230+
}
231+
]
221232
}
222233
]
223234
},

docs/server-registry-api/openapi.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,6 @@ components:
247247
- type: object
248248
required:
249249
- type
250-
- value_hint
251250
properties:
252251
type:
253252
type: string
@@ -261,6 +260,11 @@ components:
261260
type: boolean
262261
description: Whether the argument can be repeated multiple times in the command line.
263262
default: false
263+
anyOf:
264+
- required:
265+
- value
266+
- required:
267+
- value_hint
264268

265269
NamedArgument:
266270
description: A command-line `--flag={value}`.

0 commit comments

Comments
 (0)