Skip to content

feat(sdk): expose global MCP auth status - #2706

Merged
7Sageer merged 2 commits into
MoonshotAI:mainfrom
pvzheroes125:agent/expose-global-mcp-auth-status
Aug 7, 2026
Merged

feat(sdk): expose global MCP auth status#2706
7Sageer merged 2 commits into
MoonshotAI:mainfrom
pvzheroes125:agent/expose-global-mcp-auth-status

Conversation

@pvzheroes125

Copy link
Copy Markdown
Contributor

Related Issue

N/A — this is a focused SDK gap: hosts can list global MCP configuration but cannot read persisted OAuth authorization state without reaching into private credential storage or starting an authorization flow.

Problem

Global MCP configuration and OAuth runtime state intentionally have different owners. listGlobalMcpServers returns durable configuration only, so a host cannot tell whether an OAuth-configured server already has persisted credentials. Using beginGlobalMcpServerAuth as a status probe is unsafe because an unauthenticated server starts a real browser authorization flow.

What changed

  • Add listGlobalMcpServerAuthStatuses to the v1 Core API and the v1/v2 Node SDK surfaces.
  • Classify each global server as not-applicable, bearer-token, oauth-required, or oauth-authorized.
  • Reuse the existing credential store's hasTokens check; the new method performs no network request and starts no OAuth flow.
  • Keep listGlobalMcpServers and the persisted MCP configuration schema unchanged.
  • Cover v1, v2, and v1↔v2 parity with focused tests.

oauth-authorized means persisted tokens exist for the server name and URL; it does not validate token freshness or server acceptance over the network. Plain remote servers without explicit auth: "oauth" remain not-applicable.

Verification:

  • @moonshot-ai/agent-core typecheck
  • @moonshot-ai/agent-core-v2 typecheck and import-boundary check
  • @moonshot-ai/kimi-code-sdk typecheck
  • focused v1, v2, and parity tests (3 passed)
  • changed-file type-aware lint (0 errors)
  • git diff --check

The three complete Node SDK test files still contain 23 pre-existing Windows-specific failures involving path normalization, localized ENOENT text, and one background-output timing assertion; none are in this diff, and the three added tests pass independently.

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue, or explained the problem above.
  • I have added tests that prove my feature works.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update.

@changeset-bot

changeset-bot Bot commented Aug 6, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 2129763

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

This PR includes changesets to release 1 package
Name Type
@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

Copy link
Copy Markdown
Contributor Author

@codex review

@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: c138582cfb

ℹ️ 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

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: 2129763779

ℹ️ 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".

@pvzheroes125
pvzheroes125 marked this pull request as ready for review August 7, 2026 04:53
@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@2129763
npx https://pkg.pr.new/@moonshot-ai/kimi-code@2129763

commit: 2129763

@7Sageer
7Sageer merged commit 0b2e803 into MoonshotAI:main Aug 7, 2026
6 of 15 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