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.25 version 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
buildStdioConfig function - Returns *types.McpExportStdioConfig with command, args, and env
- Update
buildInstallConfigs - Use buildStdioConfig() for ClaudeDesktop and Cursor configs
- Update
ServeInstallPage - Replace template execution with JSON serialization of buildStdioConfig() result
- Remove template - Delete
config_snippet.json.tmpl and 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
Acceptance Criteria
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:
config_snippet.json.tmplimpl.go:buildInstallConfigs()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 placesProposed Solution
Create a single shared
buildStdioConfig()function and eliminate the template.Files to Modify
server/internal/mcpmetadata/impl.gobuildStdioConfig(), updatebuildInstallConfigs()andServeInstallPage()server/internal/mcpmetadata/config_snippet.json.tmplImplementation Steps
buildStdioConfigfunction - Returns*types.McpExportStdioConfigwith command, args, and envbuildInstallConfigs- UsebuildStdioConfig()for ClaudeDesktop and Cursor configsServeInstallPage- Replace template execution with JSON serialization ofbuildStdioConfig()resultconfig_snippet.json.tmpland its embed directiveBenefits
Related
buildInstallConfigs()config_snippet.json.tmpltemplateAcceptance Criteria
buildStdioConfig()function that builds stdio config for MCP clientsbuildInstallConfigs()to usebuildStdioConfig()ServeInstallPage()to usebuildStdioConfig()+ JSON marshal instead of templateconfig_snippet.json.tmpland remove embed directivemise lint:server