Skip to content

Commit c90666f

Browse files
tadasantclaude
andcommitted
docs: Add Local Server URL templating example
Add example showing LocalTransport templating with Package arguments to clarify the difference between Local vs Remote templating contexts: - Local: {port} references --port argument or valueHint from Package - Remote: {tenant_id} references variables object in RemoteTransport This helps users understand when to use Package arguments vs Remote variables for their URL templating needs. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 9c3e5be commit c90666f

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

docs/reference/server-json/generic-server-json.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -696,6 +696,40 @@ This example demonstrates URL templating for remote servers, useful for multi-te
696696

697697
Clients configure the tenant identifier, and the `{tenant_id}` variable in the URL gets replaced with the provided variable value to connect to the appropriate tenant endpoint (e.g., `https://api.example.github.io/mcp/us-cell1` or `https://api.example.github.io/mcp/emea-cell1`).
698698

699+
### Local Server with URL Templating
700+
701+
This example demonstrates URL templating for local/package servers, where variables reference parent Package arguments or environment variables:
702+
703+
```json
704+
{
705+
"name": "io.github.example/configurable-server",
706+
"description": "Local MCP server with configurable port",
707+
"version": "1.0.0",
708+
"packages": [
709+
{
710+
"registryType": "npm",
711+
"identifier": "@example/mcp-server",
712+
"version": "1.0.0",
713+
"transport": {
714+
"type": "streamable-http",
715+
"url": "http://localhost:{port}/mcp"
716+
},
717+
"packageArguments": [
718+
{
719+
"type": "named",
720+
"name": "--port",
721+
"description": "Port for the server to listen on",
722+
"default": "3000",
723+
"valueHint": "port"
724+
}
725+
]
726+
}
727+
]
728+
}
729+
```
730+
731+
The `{port}` variable in the URL references either the `--port` argument name or the `port` valueHint from packageArguments. When the package runs with `--port 8080`, the URL becomes `http://localhost:8080/mcp`.
732+
699733
### Deprecated Server Example
700734

701735
```json

tools/validate-examples/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func main() {
3333

3434
func runValidation() error {
3535
// Define what we validate and how
36-
expectedServerJSONCount := 14
36+
expectedServerJSONCount := 15
3737
targets := []validationTarget{
3838
{
3939
path: filepath.Join("docs", "reference", "server-json", "generic-server-json.md"),

0 commit comments

Comments
 (0)