feat(ui): support serving under a subpath via MCP_REGISTRY_UI_BASE_PATH#1277
Open
nejch wants to merge 1 commit into
Open
feat(ui): support serving under a subpath via MCP_REGISTRY_UI_BASE_PATH#1277nejch wants to merge 1 commit into
nejch wants to merge 1 commit into
Conversation
nejch
commented
May 10, 2026
| // GetUIHTML returns the embedded HTML for the UI with the given base path | ||
| // substituted into browser-side links and navigation. | ||
| func GetUIHTML(basePath string) string { | ||
| return strings.ReplaceAll(embedUI, "{{UI_BASE_PATH}}", basePath) |
Author
There was a problem hiding this comment.
If this PR is accepted I could change the custom templating here in a follow-up to html/template or so to also accept things like custom titles and so on.
This was just a quick and minimal change.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation and Context
#757 added a simple UI, and although I understand this was a simple example and most production downstream registries will have a custom UI, I like the idea of starting small and staying consistent with https://registry.modelcontextprotocol.io/.
In my case this is at https://api.company.com/mcp/registry behind a reverse proxy, but the UI redirects and expects to be served at the root, so the UI is broken.
This PR adds subpath handling to the browser side template but does not adjust routing itself (this is normally handled by the reverse proxy).
If this is accepted I'd add a few more adjustments as a follow-up, so that downstream registries can use the same UI but a few custom options like the title and so on.
How Has This Been Tested?
docker compose + nginx
Dockerfile.devnginx.confdocker-compose.dev.ymlhttp://localhost:9090/mcp/registry/mcp/registry/docs/mcp/registry/v0.1/servers)/mcp/registryAlso tested with
/my-registryas the base path and without a path to confirm it works with arbitrary prefixes.Breaking Changes
Shouldn't be breaking anything, but see testing example above.
Types of changes
Checklist
Additional context