Files
chainbase-labs__agentkey/tests/kimi-plugin.bats
T
zzAllenn db38a59d7b feat: improve Kimi plugin onboarding (#86)
## Summary

- add a Kimi Code plugin manifest with an inline AgentKey MCP server
definition
- use Kimi's native MCP OAuth flow while keeping browser login explicit
through `/mcp-config login plugin-agentkey:agentkey`
- document the required `/reload`, browser authorization, local-plugin
update flow, and legacy global MCP cleanup
- include the Kimi manifest in release-please and version-sync checks
- add regression coverage for the Kimi manifest shape and OAuth
configuration

## Why

Kimi requires `mcpServers` to be declared inline in the plugin manifest.
The previous path-based configuration was not loaded as a plugin MCP
server, so installation did not produce the expected MCP-aware reload
guidance. With the corrected manifest, Kimi recognizes the MCP server
during installation and shows its standard `/new` or `/reload` prompt.
After reloading, the user completes Kimi's native browser OAuth flow
explicitly with `/mcp-config login plugin-agentkey:agentkey`.

## User impact

After installing the plugin, users receive the reload guidance from
Kimi. They run `/reload`, follow Kimi's OAuth prompt with `/mcp-config
login plugin-agentkey:agentkey`, approve the browser authorization, and
can then use AgentKey normally.

## Validation

- installed the local plugin with Kimi Code CLI 0.31.1 and confirmed the
success screen reports one MCP server plus `Run /new or /reload to apply
plugin changes.`
- verified the managed Kimi plugin copy matches the repository manifest
- validated the Kimi manifest shape and native-OAuth constraints
- verified all six release version values remain synchronized at 1.12.1
- parsed the modified GitHub Actions workflows as YAML
- ran `git diff --check`

The repository CI runs the full Bats suite on Ubuntu and macOS.

---------

Co-authored-by: Allen <0xfatdog@gmail.com>
2026-08-05 16:23:59 +08:00

42 lines
978 B
Bash

#!/usr/bin/env bats
setup() {
REPO_ROOT="$(cd "$BATS_TEST_DIRNAME/.." && pwd)"
MANIFEST="$REPO_ROOT/.kimi-plugin/plugin.json"
}
@test "Kimi plugin declares the AgentKey MCP server inline" {
python3 - "$MANIFEST" <<'PY'
import json
import sys
with open(sys.argv[1], encoding="utf-8") as handle:
manifest = json.load(handle)
servers = manifest.get("mcpServers")
assert isinstance(servers, dict), "mcpServers must be an inline object"
assert servers == {
"agentkey": {
"url": "https://api.agentkey.app/v1/mcp",
}
}
PY
}
@test "Kimi plugin relies on native OAuth instead of static credentials" {
python3 - "$MANIFEST" <<'PY'
import json
import sys
with open(sys.argv[1], encoding="utf-8") as handle:
manifest = json.load(handle)
assert "userConfig" not in manifest
server = manifest["mcpServers"]["agentkey"]
assert "headers" not in server
assert "bearerTokenEnvVar" not in server
PY
[ ! -e "$REPO_ROOT/.kimi-plugin/mcp.json" ]
}