Skip to content

fix(sdk): probe MCP auth status through connection - #2731

Merged
7Sageer merged 2 commits into
MoonshotAI:mainfrom
pvzheroes125:fix/mcp-auth-status-reuse-probe
Aug 7, 2026
Merged

fix(sdk): probe MCP auth status through connection#2731
7Sageer merged 2 commits into
MoonshotAI:mainfrom
pvzheroes125:fix/mcp-auth-status-reuse-probe

Conversation

@pvzheroes125

Copy link
Copy Markdown
Contributor

Related Issue

Follow-up to the global MCP auth-status RPC added in #2706.

Problem

The auth-status RPC only reported OAuth when the config explicitly contained auth: "oauth". Kimi Code already classifies an uncredentialed HTTP MCP as needs-auth when the existing connection probe receives a 401, but the status RPC did not reuse that result.

What changed

  • Reuse one private global MCP connection probe for both testGlobalMcpServer and auth-status detection.
  • Map the existing needs-auth result to oauth-required for markerless HTTP servers without static headers or stored tokens.
  • Preserve existing stdio, bearer, explicit OAuth, persisted-token, and SSE behavior.
  • Add a new patch changeset for the CLI and SDK.

The connection manager, 401 classification, OAuth begin/service/provider, token refresh, and configuration schema are unchanged.

Validation

  • Focused v1, v2, and parity auth-status tests: 7 passed.
  • @moonshot-ai/agent-core typecheck passed.
  • @moonshot-ai/kimi-code-sdk typecheck passed.
  • Type-aware oxlint: 0 errors; two pre-existing warnings outside the changed hunks.
  • Read-only final diff audit: PASS.

Checklist

  • I have read the CONTRIBUTING document.
  • I have explained the problem above.
  • I have added tests that prove the fix works.
  • Added a patch changeset.
  • This PR needs no docs update.

@changeset-bot

changeset-bot Bot commented Aug 7, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: e041cc3

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@moonshot-ai/kimi-code Patch
@moonshot-ai/kimi-code-sdk Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new

pkg-pr-new Bot commented Aug 7, 2026

Copy link
Copy Markdown
pnpm dlx https://pkg.pr.new/@moonshot-ai/kimi-code@e041cc3
npx https://pkg.pr.new/@moonshot-ai/kimi-code@e041cc3

commit: e041cc3

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0a2b0cbf3d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/node-sdk/src/sdk-rpc-client-v2.ts Outdated

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

Reviewed commit: 0a2b0cbf3d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

Reviewed commit: e041cc38ab

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@7Sageer
7Sageer merged commit 437a1b8 into MoonshotAI:main Aug 7, 2026
14 checks passed
@github-actions github-actions Bot mentioned this pull request Aug 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants