fix: correct MCP registry remote URL in server.json (#26755)

The MCP Registry rejects our `server.json` remote because the URL uses
`{coder_url}` as the entire base. Registry validation requires remote
URLs to literally begin with `https://`, and template variables are only
allowed after the scheme/host. The previous value
(`{coder_url}/api/experimental/mcp/http`) fails both the JSON schema
`^https?://[^\s]+$` pattern and the semantic remote-URL check.

## Changes

- Use `https://{coder_hostname}/api/experimental/mcp/http` with a
`coder_hostname` variable (users now enter a hostname like
`coder.example.com` instead of a full URL).
- Update the VS Code registry instructions in
`docs/ai-coder/mcp-server.md` to ask for the deployment hostname.

Verified with `mcp-publisher validate` against
`registry.modelcontextprotocol.io`:

```
Validating against https://registry.modelcontextprotocol.io...
✅ server.json is valid
```

This was caught by running the `Publish to MCP Registry` workflow in
validate-only mode (`publish: false`) before any real publish, so
nothing broken reached the public registry.

<details>
<summary>Root cause detail</summary>

The registry validator (`internal/validators`) substitutes known
template variables, then parses the URL. Because `{coder_url}` replaces
the whole scheme+host, the parsed URL has no scheme and is rejected as
an invalid remote URL. Hard-coding `https://` and scoping the variable
to the host satisfies both the schema pattern and `IsValidRemoteURL`
(which also requires `https`). The registry mandates `https` for remotes
regardless, so there is no loss of functionality.

</details>

---
_Generated with Coder Agents._
This commit is contained in:
Ben Potter
2026-06-26 16:32:32 +00:00
committed by GitHub
parent 6189d6e386
commit 73cd34cc5f
2 changed files with 5 additions and 5 deletions
+4 -4
View File
@@ -18,13 +18,13 @@
"remotes": [
{
"type": "streamable-http",
"url": "{coder_url}/api/experimental/mcp/http",
"url": "https://{coder_hostname}/api/experimental/mcp/http",
"variables": {
"coder_url": {
"description": "URL of your Coder deployment (e.g., https://coder.example.com)",
"coder_hostname": {
"description": "Hostname of your Coder deployment (e.g., coder.example.com)",
"isRequired": true,
"format": "string",
"placeholder": "https://coder.example.com"
"placeholder": "coder.example.com"
}
}
}