kai-mcp 0.9.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +66 -0
- package/bin/kai-mcp.js +15 -0
- package/install.js +69 -0
- package/package.json +32 -0
package/README.md
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# kai-mcp
|
|
2
|
+
|
|
3
|
+
MCP server for [Kai](https://kailayer.com) — semantic code intelligence for AI coding assistants.
|
|
4
|
+
|
|
5
|
+
## Quick Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
claude mcp add kai -- npx -y kai-mcp
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## What It Does
|
|
12
|
+
|
|
13
|
+
Gives your AI coding assistant (Claude Code, Cursor, etc.) access to Kai's semantic graph — call graphs, dependency maps, impact analysis, and test coverage — via the [Model Context Protocol](https://modelcontextprotocol.io).
|
|
14
|
+
|
|
15
|
+
## Setup
|
|
16
|
+
|
|
17
|
+
### Claude Code
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
claude mcp add kai -- npx -y kai-mcp
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### Cursor
|
|
24
|
+
|
|
25
|
+
Add to `.cursor/mcp.json`:
|
|
26
|
+
|
|
27
|
+
```json
|
|
28
|
+
{
|
|
29
|
+
"mcpServers": {
|
|
30
|
+
"kai": {
|
|
31
|
+
"command": "npx",
|
|
32
|
+
"args": ["-y", "kai-mcp"]
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Generic stdio
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
npx -y kai-mcp
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Tools
|
|
45
|
+
|
|
46
|
+
| Tool | Description |
|
|
47
|
+
|------|-------------|
|
|
48
|
+
| `kai_symbols` | List symbols in a file (functions, classes, methods) |
|
|
49
|
+
| `kai_callers` | Find all callers of a symbol |
|
|
50
|
+
| `kai_callees` | Find all symbols called by a symbol |
|
|
51
|
+
| `kai_dependents` | Find files that depend on a file |
|
|
52
|
+
| `kai_dependencies` | Find files a file depends on |
|
|
53
|
+
| `kai_tests` | Find tests covering a file |
|
|
54
|
+
| `kai_diff` | Semantic diff between two refs |
|
|
55
|
+
| `kai_context` | Bundled context for a file/symbol |
|
|
56
|
+
| `kai_impact` | Transitive downstream impact analysis |
|
|
57
|
+
| `kai_status` | Check graph freshness |
|
|
58
|
+
| `kai_refresh` | Re-capture the semantic graph |
|
|
59
|
+
|
|
60
|
+
No setup required — the server lazily initializes the Kai semantic graph on first use.
|
|
61
|
+
|
|
62
|
+
## Links
|
|
63
|
+
|
|
64
|
+
- [Full docs](https://github.com/kailayerhq/kai/blob/main/docs/mcp.md)
|
|
65
|
+
- [Kai](https://kailayer.com)
|
|
66
|
+
- [GitHub](https://github.com/kailayerhq/kai)
|
package/bin/kai-mcp.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
const { execFileSync } = require("child_process");
|
|
5
|
+
const path = require("path");
|
|
6
|
+
|
|
7
|
+
const kai = path.join(__dirname, "kai");
|
|
8
|
+
|
|
9
|
+
try {
|
|
10
|
+
execFileSync(kai, ["mcp", "serve"], { stdio: "inherit" });
|
|
11
|
+
} catch (err) {
|
|
12
|
+
if (err.status != null) process.exit(err.status);
|
|
13
|
+
console.error("Failed to start kai MCP server:", err.message);
|
|
14
|
+
process.exit(1);
|
|
15
|
+
}
|
package/install.js
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
const { execSync } = require("child_process");
|
|
5
|
+
const fs = require("fs");
|
|
6
|
+
const path = require("path");
|
|
7
|
+
const https = require("https");
|
|
8
|
+
const zlib = require("zlib");
|
|
9
|
+
|
|
10
|
+
const REPO = "kailayerhq/kai";
|
|
11
|
+
const VERSION = require("./package.json").version;
|
|
12
|
+
|
|
13
|
+
function getPlatform() {
|
|
14
|
+
const platform = process.platform;
|
|
15
|
+
if (platform === "darwin") return "darwin";
|
|
16
|
+
if (platform === "linux") return "linux";
|
|
17
|
+
throw new Error(`Unsupported platform: ${platform}`);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function getArch() {
|
|
21
|
+
const arch = process.arch;
|
|
22
|
+
if (arch === "x64") return "amd64";
|
|
23
|
+
if (arch === "arm64") return "arm64";
|
|
24
|
+
throw new Error(`Unsupported architecture: ${arch}`);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function download(url) {
|
|
28
|
+
return new Promise((resolve, reject) => {
|
|
29
|
+
https.get(url, (res) => {
|
|
30
|
+
if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
|
|
31
|
+
return download(res.headers.location).then(resolve, reject);
|
|
32
|
+
}
|
|
33
|
+
if (res.statusCode !== 200) {
|
|
34
|
+
return reject(new Error(`Download failed: HTTP ${res.statusCode} from ${url}`));
|
|
35
|
+
}
|
|
36
|
+
const chunks = [];
|
|
37
|
+
res.on("data", (chunk) => chunks.push(chunk));
|
|
38
|
+
res.on("end", () => resolve(Buffer.concat(chunks)));
|
|
39
|
+
res.on("error", reject);
|
|
40
|
+
}).on("error", reject);
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
async function main() {
|
|
45
|
+
const os = getPlatform();
|
|
46
|
+
const arch = getArch();
|
|
47
|
+
const asset = `kai-${os}-${arch}.gz`;
|
|
48
|
+
const url = `https://github.com/${REPO}/releases/download/v${VERSION}/${asset}`;
|
|
49
|
+
|
|
50
|
+
console.log(`Downloading kai v${VERSION} (${os}/${arch})...`);
|
|
51
|
+
|
|
52
|
+
const gzData = await download(url);
|
|
53
|
+
const binary = zlib.gunzipSync(gzData);
|
|
54
|
+
|
|
55
|
+
const binDir = path.join(__dirname, "bin");
|
|
56
|
+
fs.mkdirSync(binDir, { recursive: true });
|
|
57
|
+
|
|
58
|
+
const binPath = path.join(binDir, "kai");
|
|
59
|
+
fs.writeFileSync(binPath, binary);
|
|
60
|
+
fs.chmodSync(binPath, 0o755);
|
|
61
|
+
|
|
62
|
+
console.log(`Installed kai to ${binPath}`);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
main().catch((err) => {
|
|
66
|
+
console.error(`Failed to install kai binary: ${err.message}`);
|
|
67
|
+
console.error("You can install manually: curl -sSL https://get.kailayer.com | sh");
|
|
68
|
+
process.exit(1);
|
|
69
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "kai-mcp",
|
|
3
|
+
"version": "0.9.5",
|
|
4
|
+
"description": "MCP server for Kai — semantic code intelligence for AI coding assistants",
|
|
5
|
+
"bin": {
|
|
6
|
+
"kai-mcp": "bin/kai-mcp.js"
|
|
7
|
+
},
|
|
8
|
+
"scripts": {
|
|
9
|
+
"postinstall": "node install.js"
|
|
10
|
+
},
|
|
11
|
+
"keywords": [
|
|
12
|
+
"mcp",
|
|
13
|
+
"model-context-protocol",
|
|
14
|
+
"kai",
|
|
15
|
+
"semantic",
|
|
16
|
+
"code-intelligence",
|
|
17
|
+
"claude",
|
|
18
|
+
"cursor"
|
|
19
|
+
],
|
|
20
|
+
"license": "Apache-2.0",
|
|
21
|
+
"repository": {
|
|
22
|
+
"type": "git",
|
|
23
|
+
"url": "https://github.com/kailayerhq/kai.git",
|
|
24
|
+
"directory": "packages/kai-mcp"
|
|
25
|
+
},
|
|
26
|
+
"homepage": "https://kailayer.com",
|
|
27
|
+
"files": [
|
|
28
|
+
"bin/",
|
|
29
|
+
"install.js",
|
|
30
|
+
"README.md"
|
|
31
|
+
]
|
|
32
|
+
}
|