-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Labels
Description
Summary
Consolidate the MCP install config/snippet generation logic into a single shared function to eliminate duplication and ensure consistency.
Current State
The snippet generation logic is duplicated in 2 places:
| Location | What it generates |
|---|---|
config_snippet.json.tmpl |
JSON config for Claude Desktop/Cursor (via Go template) |
impl.go:buildInstallConfigs() |
Export endpoint configs (via Go structs) |
Both produce identical output:
{
"command": "npx",
"args": ["mcp-remote@0.1.25", "<url>", "--header", "Header:${ENV_VAR}"],
"env": { "ENV_VAR": "<your-value-here>" }
}This means:
mcp-remote@0.1.25version is hardcoded in multiple places- Command format can drift between surfaces
- Updates require changes in multiple files
Proposed Solution
Create a single shared buildStdioConfig() function and eliminate the template.
Files to Modify
| File | Change |
|---|---|
server/internal/mcpmetadata/impl.go |
Add buildStdioConfig(), update buildInstallConfigs() and ServeInstallPage() |
server/internal/mcpmetadata/config_snippet.json.tmpl |
Delete |
Implementation Steps
- Create shared
buildStdioConfigfunction - Returns*types.McpExportStdioConfigwith command, args, and env - Update
buildInstallConfigs- UsebuildStdioConfig()for ClaudeDesktop and Cursor configs - Update
ServeInstallPage- Replace template execution with JSON serialization ofbuildStdioConfig()result - Remove template - Delete
config_snippet.json.tmpland its embed directive
Benefits
- Single source of truth for versions and command formats
- Consistent output across install page, export endpoint, and UI
- Easier maintenance when mcp-remote version updates
- Less code overall (remove template + template parsing)
Related
- PR feat(mcp): add MCP JSON export API with API key authentication #1385 introduced the export endpoint with
buildInstallConfigs() - Install page uses
config_snippet.json.tmpltemplate
Acceptance Criteria
- Create
buildStdioConfig()function that builds stdio config for MCP clients - Update
buildInstallConfigs()to usebuildStdioConfig() - Update
ServeInstallPage()to usebuildStdioConfig()+ JSON marshal instead of template - Delete
config_snippet.json.tmpland remove embed directive - Verify install page JSON snippet renders correctly
- Verify export endpoint configs match install page format
- Add/update tests for the shared builder
- Run linter:
mise lint:server
Reactions are currently unavailable