loading…
Search for a command to run...
loading…
Indexes Kotlin/Native platform klibs to enable fast symbol lookup for iOS APIs. Supports querying classes, members, and platform constants via MCP tools for Kot
Indexes Kotlin/Native platform klibs to enable fast symbol lookup for iOS APIs. Supports querying classes, members, and platform constants via MCP tools for Kotlin Multiplatform development.
MCP server for fast lookup of Kotlin/Native iOS klib APIs.
The server indexes local Kotlin/Native platform klibs into a persistent SQLite database and exposes a compact MCP API for symbol lookup and index maintenance.
KONAN_HOME or ~/.konannpm install -g kmp-api-lookup-mcp
npx -y kmp-api-lookup-mcp
This does not install the package globally. npm downloads and runs the published binary on demand.
git clone https://github.com/SuLG-ik/kmp-api-lookup-mcp.git
cd kmp-api-lookup-mcp
npm install
npm run build
npm link
Add the server to your MCP client configuration.
Common config file locations:
~/Library/Application Support/Claude/claude_desktop_config.json%APPDATA%/Claude/claude_desktop_config.json~/.config/Claude/claude_desktop_config.jsonReady-to-copy example files are included in the repository:
claude_desktop_config.json.example for a global npm installclaude_desktop_config.npx.json.example for running the published package through npxclaude_desktop_config.konan_home.json.example for a global npm install with explicit KONAN_HOMEclaude_desktop_config.from_source.json.example for running the built server from the repositoryIf the package is installed globally:
{
"mcpServers": {
"kmp-api-lookup": {
"command": "kmp-api-lookup-mcp"
}
}
}
If you prefer not to install the package globally:
{
"mcpServers": {
"kmp-api-lookup": {
"command": "npx",
"args": ["-y", "kmp-api-lookup-mcp"]
}
}
}
This is convenient for quick setup, but the first launch can be slower because npx may need to download the package.
If you want to point directly at a specific Kotlin/Native installation:
{
"mcpServers": {
"kmp-api-lookup": {
"command": "kmp-api-lookup-mcp",
"env": {
"KONAN_HOME": "/Users/you/.konan/kotlin-native-prebuilt-macos-aarch64-2.2.21"
}
}
}
}
If you run the server from source:
{
"mcpServers": {
"kmp-api-lookup": {
"command": "node",
"args": ["/absolute/path/to/kmp-api-lookup-mcp/dist/index.js"]
}
}
}
After the server starts, the usual first steps are:
get_klib_index_status to see whether an index already exists.rebuild_klib_index for the Kotlin/Native version and target you need.lookup_symbol.Example rebuild request:
{
"kotlinVersion": "2.2.21",
"target": "ios_simulator_arm64",
"frameworks": ["AVFoundation", "AVKit", "MediaPlayer", "AVFAudio"]
}
KONAN_HOME, ~/.konan, or an explicit pathklib dump-metadata-signaturesklib dump-metadata for full Kotlin signatures, class hierarchy, and importslookup_symbolResolve a Kotlin/Native Apple platform class, member, or top-level platform alias/constant into a compact development card.
Input:
{
"query": "AVPlayer",
"frameworks": ["AVFoundation"],
"detail": "compact",
"queryKind": "auto"
}
Behavior:
AVPlayer returns one class card with:detail is omitted or set to compact, grouped by member name to reduce output sizeproperties list in compact mode with explicit accessors.getter and accessors.setter flags when matching getter/setter methods exist for that propertyMeta class members when detail is set to fullrequiredImports for code generationAVPlayer.play or play returns a compact grouped card with overload signatures and imports.AVPlayerStatus, AVLayerVideoGravity, or AVPlayerItemDidPlayToEndTimeNotification resolve to package-scoped member cards instead of degrading into fuzzy class matches.detail defaults to compact. Use "detail": "full" only when you really need the entire class surface.get_klib_index_statusReturn a compact index summary.
Input:
{}
Output includes:
readylastRebuildAtrebuild_klib_indexBuild or refresh the SQLite index from local klibs.
Input:
{
"kotlinVersion": "2.2.21",
"target": "ios_simulator_arm64",
"frameworks": ["Foundation", "UIKit"],
"force": false,
"dryRun": false,
"cleanBefore": true
}
Rules:
kotlinVersion and konanHome are optional, but you may provide at most one of them.target is omitted, the server prefers ios_simulator_arm64, then ios_arm64, then ios_x64.frameworks is omitted, the rebuild covers all frameworks for the selected target.dryRun=true computes the rebuild plan without writing to SQLite.force=true ignores freshness checks.cleanBefore=true removes existing rows for the affected frameworks before writing fresh records.The server stores data outside the repository.
klib-index.sqlitestate.jsonTypical cache locations:
~/Library/Caches/kmp-api-lookup-mcp/${XDG_CACHE_HOME:-~/.cache}/kmp-api-lookup-mcp/%LOCALAPPDATA%/kmp-api-lookup-mcp/Installations are discovered in this order:
konanHome argument when a tool provides itKONAN_HOME~/.konan/kotlin-native-prebuilt-*Each installation is validated by checking for:
bin/klibklib/platform/{
"mcpServers": {
"kmp-api-lookup": {
"command": "node",
"args": ["/absolute/path/to/kmp-api-lookup-mcp/dist/index.js"]
}
}
}
Optional environment override:
{
"mcpServers": {
"kmp-api-lookup": {
"command": "node",
"args": ["/absolute/path/to/kmp-api-lookup-mcp/dist/index.js"],
"env": {
"KONAN_HOME": "/Users/you/.konan/kotlin-native-prebuilt-macos-aarch64-2.2.21"
}
}
}
}
{
"mcpServers": {
"kmp-api-lookup": {
"command": "kmp-api-lookup-mcp"
}
}
}
{
"mcpServers": {
"kmp-api-lookup": {
"command": "kmp-api-lookup-mcp",
"env": {
"KONAN_HOME": "/Users/you/.konan/kotlin-native-prebuilt-macos-aarch64-2.2.21"
}
}
}
}
npm run dev starts the server from TypeScript sourcesnpm run build compiles to dist/npm start runs the compiled servernpm run typecheck runs TypeScript type checkingnpm test runs Vitestnpm run test:watch starts Vitest in watch modenpm install
npm run typecheck
npm run build
npm test
npm publication is handled by GitHub Actions.
vX.Y.Z where X.Y.Z matches the version in package.json.Publish Package workflow validates the package and publishes it to npm.SuLG-ik/kmp-api-lookup-mcp GitHub repository.The current test suite covers:
dump-metadata-signatures line parsing.
├── src/
│ ├── index.ts
│ ├── config/
│ ├── indexer/
│ ├── server/
│ ├── storage/
│ ├── tools/
│ ├── search-utils.ts
│ └── types.ts
├── test/
├── package.json
├── tsconfig.json
├── tsconfig.build.json
└── vitest.config.ts
Добавь это в claude_desktop_config.json и перезапусти Claude Desktop.
{
"mcpServers": {
"kmp-api-lookup-mcp": {
"command": "npx",
"args": []
}
}
}