fix: route search_web to the Step Plan MCP endpoint - #158
Open
AuroraAeon wants to merge 1 commit into
Open
AuroraAeon wants to merge 1 commit into
AuroraAeon wants to merge 1 commit into
Conversation
step_plan, step_plan_oversea, and profile-less credentials all pointed at the balance-billed /v1/mcp/web_search/mcp path, which answers HTTP 402 quota_exceeded for Step Plan credentials while chat completions with the same key keep working. Route those to the documented /step_plan/... StepSearch MCP endpoints. platform_cn and platform_oversea keep the /v1 path they already used. Also drop the duplicated env-var names in the docs paragraph.
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.
Problem
search_webresolves its MCP endpoint by login profile, but every profile — includingstep_planand profile-less credentials — pointed at the balance-billed/v1/mcp/web_search/mcppath. Step Plan credentials are billed against the monthly Step Plan credit pool, so that path rejects them:The tool fails on every call, while chat completions with the same key keep working (session logs show
cost: 0, i.e. Step Plan credit billing).Reproduced live with one Step Plan key, same region:
POST https://api.stepfun.com/step_plan/v1/mcp/web_search/mcp—initialize+tools/call web_searchPOST https://api.stepfun.com/v1/mcp/web_search/mcp(current default)quota_exceededPOST https://api.stepfun.com/v1/search(REST, for reference)quota_exceededGET https://api.stepfun.com/v1/modelsand.../step_plan/v1/modelsThe StepSearch MCP documentation prescribes the
/step_plan/...URL for MCP clients: https://platform.stepfun.com/docs/zh/step-plan/integrations/search-mcpCredentials without a
profilefield hit this too:ModelRuntime.setRuntimeApiKeypersists--api-key/STEP_API_KEYcredentials as{ type: "api_key", key }with no profile, soreadStepLoginProfile()returnsundefinedand the tool fell back to the/v1endpoint.Changes
SEARCH_WEB_MAINLAND_STEP_PLAN_URL/SEARCH_WEB_OVERSEA_STEP_PLAN_URL.step_planandstep_plan_overseato the documented Step Plan MCP endpoints (credit-billed)./v1.platform_cn/platform_overseakeep the existing balance-billed/v1endpoints — unchanged, since that path is what those profiles already used.docs/step-integration.mdto match, and drop the duplicated env-var names in that paragraph (STEPCODE_SEARCH_API_KEYandSTEPCODE_SEARCH_WEB_MCP_URLwere each listed twice).resolveSearchWebServerUrl, a split expectation for the two overseas profiles, and a regression test for profile-less credentials (the reported failure mode).Verification
npm run check— passes (exit 0).vitest packages/coding-agent/test/step-search-web.test.ts— 9/9 pass../test.sh—test:scripts(34 tests) passes.pnpm -r --if-present test --no-bail) on Windows fails on 29 test files, all Windows-only issues (path separators/vs\,EACCESvsEPERM, ESMc:URL scheme, missingSIGCONT, …). I reran the identical command with all changes stashed on a cleanupstream/main: the failing-file set is identical (29 = 29, zero diff), i.e. this PR introduces no regressions.STEPCODE_SEARCH_WEB_MCP_URLpointed at the Step Plan endpoint,tools/call web_searchreturns real search results end to end.Notes
STEPCODE_SEARCH_WEB_MCP_URLstill accepts a full URL to override any of this. If it is set to a bare origin, the code appendsSEARCH_WEB_MCP_PATH(/v1/mcp/web_search/mcp); making that profile-aware would be a separate follow-up.scripts/build-coding-agent-bundle.mjscallsexecFileSync("npm", ...), which fails with ENOENT/EINVAL on Windows under Node 25, so./test.shcannot build from a fresh checkout there. Happy to open a separate PR for it.