Rewrite mcp.longbridge.com to .cn for CN region build#1102
Merged
Conversation
Extend the region rewrite mechanism to cover the third root domain (`mcp.longbridge.com`), which was previously untouched. - region.config: add `mcpHostname` field to `RegionConfig` interface; CN region sets it to `https://mcp.longbridge.cn`. - region-utils: `buildRegionUrlReplacements()` now emits the third pair of rules (URL form + bare-text form) for the MCP hostname. - config.mts: `MCP_TOOLS_URL` resolves from `regionCfg?.mcpHostname`, so CN builds fetch tools.json from `mcp.longbridge.cn` instead of `.com` — keeps build-time data sourced from the regional endpoint. Global build is unaffected: with no VITE_REGION the helper still returns no rules for mcp.* (same no-op contract as the other two hostnames).
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.
Merge Verdict
[APPROVE] — Small, mechanical extension of the existing region rewrite to cover a third root domain (
mcp.longbridge.com).Summary
region.config.ts:RegionConfiginterface gains a new required fieldmcpHostname; CN region sets it tohttps://mcp.longbridge.cn.docs/.vitepress/region-utils.ts:buildRegionUrlReplacements()emits a third pair of rules (URL + bare-text) for the MCP hostname — same shape as the existingsiteHostname/apiBaseUrlblocks.docs/.vitepress/config.mts:MCP_TOOLS_URL(used by thefetch-mcp-toolsbuild-time plugin) now resolves to${regionCfg?.mcpHostname || 'https://mcp.longbridge.com'}/mcp/tools.json— CN builds source the tool catalogue from the regional endpoint instead of.com.Risk Analysis
mcp.longbridge.cn/mcp/tools.jsonendpoint not yet livefetch-mcp-toolswill hard-fail the CN build if the URL 404sbuild:release) regressionVITE_REGION,regionCfgis undefined → helper returns[]for MCP rules;MCP_TOOLS_URLfalls back tomcp.longbridge.com;mcp.htmlkeeps 7.com+ 1.cn(original "China mainland" section) identical to sourcemcp/open/openapi.cnsite getting wrong fallbackDesign Decisions
mcpHostnametoRegionConfigrather than hardcoding inside the helper — keeps the regional URL list in one declarative file (region.config.ts) instead of scattering string constants acrossregion-utils.ts. Matches the pattern already set bysiteHostname/apiBaseUrl.mcp-tools.jsonactually reflects the catalogue served by the CN MCP endpoint (potentially region-specific tools), instead of CN docs displaying.cnwhile embedded data was scraped from.com..comwhen a new region is added.Code Notes
https://mcp.longbridge.cn/mcp/tools.jsonis live and returns the same JSON shape as the global endpoint before merge. If not yet deployed, the CN build will fail atfetch-mcp-toolsbuildStartwith an HTTP error.Verification
bun run build:cnsucceeds;rg -l '(open|openapi|mcp)\.longbridge\.com' docs/.vitepress/dist→ zero residual.comacross HTML / MD / JS / install scripts /mcp-tools.json.bun run build:releasesucceeds;dist/docs/mcp.mdper-file domain distribution (1×mcp.longbridge.cn+ 7×mcp.longbridge.com) matches source 1:1.install.ps1is byte-identical to global build output (no accidental rewrite).