Skip to content

feat(kimi-code): add ACP server support#239

Draft
robinfai wants to merge 1 commit into
MoonshotAI:mainfrom
robinfai:acp
Draft

feat(kimi-code): add ACP server support#239
robinfai wants to merge 1 commit into
MoonshotAI:mainfrom
robinfai:acp

Conversation

@robinfai
Copy link
Copy Markdown

Related Issue

Closes #133

Problem

See linked issue.

Kimi Code did not expose an ACP server entry point, so ACP-capable clients could not start, authenticate, create sessions, stream prompt turns, or use Kimi Code session capabilities through the Agent Client Protocol.

What changed

Adds a kimi acp stdio server backed by @agentclientprotocol/sdk.

Implemented ACP support for:

  • initialize
  • authentication method discovery and authenticate
  • session/new
  • session/prompt
  • session/cancel
  • session/close
  • session/list
  • session/resume
  • unstable session/fork
  • unstable session/set_model

The ACP bridge maps prompt content, assistant/thinking/tool updates, tool permission requests, configured models, and session-scoped MCP servers into the existing Kimi Code SDK/session flow. ACP-provided MCP servers are passed through create/resume/fork session paths, with stdio and HTTP transports supported.

Unsupported ACP inputs such as audio prompt blocks, additionalDirectories, session/list cursors, SSE MCP servers, and ACP-transport MCP servers return invalid_params instead of silently degrading.

Also included:

  • CLI/docs updates for kimi acp
  • ACP adapter/unit tests
  • SDK/core tests for session-scoped MCP config
  • a changeset for @moonshot-ai/kimi-code and @moonshot-ai/kimi-code-sdk

ACP Compatibility Validation

Validated supported behavior:

  • initialize returns Kimi Code agent metadata, auth methods, prompt image/context capabilities, HTTP MCP support, and session close/list/resume/fork capabilities.
  • authenticate checks existing Kimi Code config, configured model/provider state, OAuth readiness, model-env configuration, and terminal auth availability when the ACP client supports it.
  • session/new, session/prompt, session/cancel, and session/close are covered.
  • session/list, session/resume, unstable session/fork, and unstable session/set_model are covered.
  • stdout remains reserved for JSON-RPC protocol messages in stdio mode.
  • ACP prompt blocks for text, image, resource links, embedded text resources, and embedded image resources are mapped to Kimi Code SDK input.
  • ACP stdio and HTTP MCP servers are mapped into session-scoped Kimi Code MCP config.
  • Kimi Code assistant text, thinking, tool calls, tool results, warnings, and MCP status events are streamed as ACP session updates.
  • Kimi Code tool approval requests are mapped to ACP permission requests.

Intentional MVP boundaries:

  • audio prompt blocks return invalid_params
  • additionalDirectories returns invalid_params
  • session/list cursor pagination returns invalid_params
  • SSE MCP servers return invalid_params
  • ACP-transport MCP servers return invalid_params

Validation performed:

  • ACP registry auth check helper passed.
  • pnpm run lint passed with 0 errors; existing repository warnings remain.
  • pnpm run typecheck passed.
  • pnpm test passed.
  • tsdown build for apps/kimi-code passed.
  • Merge check against latest MoonshotAI/kimi-code/main passed with no conflicts.
  • Temporary merged validation against latest main passed pnpm run lint, pnpm run typecheck, and pnpm test.
  • changeset status --since upstream/main reports minor bumps for @moonshot-ai/kimi-code and @moonshot-ai/kimi-code-sdk.

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
Copy link
Copy Markdown

changeset-bot Bot commented May 30, 2026

🦋 Changeset detected

Latest commit: 797d9ea

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 Minor
@moonshot-ai/kimi-code-sdk Minor

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

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.

acp协议支持

1 participant