kimiflare 0.13.7 → 0.15.0

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 CHANGED
@@ -60,6 +60,7 @@ Requires Node.js ≥ 20.
60
60
  | **Session persistence** | Every turn is auto-saved. `/resume` lists past sessions (with message counts) in a paginated picker. |
61
61
  | **Smart permissions** | Bash session-allow is keyed by the first token (e.g., allow all `git` commands). Write/edit show a unified diff before you approve. |
62
62
  | **Project context (`/init`)** | Scans your repo and writes a concise `KIMI.md` — build commands, layout, conventions. Auto-loaded on every launch. |
63
+ | **MCP server integration** | Plug in external tools via the Model Context Protocol — local stdio servers or remote SSE endpoints. GitHub, Sentry, docs search, databases, etc. |
63
64
  | **Co-author auto-append** | Detects `git commit` commands and auto-injects `Co-authored-by: kimiflare <kimiflare@proton.me>`. |
64
65
  | **Resilient transport** | Retries Cloudflare capacity errors (code 3040) and 5xx with exponential backoff up to 5 attempts. |
65
66
 
@@ -91,6 +92,46 @@ EOF
91
92
  chmod 600 ~/.config/kimiflare/config.json
92
93
  ```
93
94
 
95
+ ## MCP servers (Model Context Protocol)
96
+
97
+ kimiflare supports external tools via MCP. Add servers to your `~/.config/kimiflare/config.json`:
98
+
99
+ ```json
100
+ {
101
+ "accountId": "YOUR_ACCOUNT_ID",
102
+ "apiToken": "YOUR_API_TOKEN",
103
+ "mcpServers": {
104
+ "github": {
105
+ "type": "local",
106
+ "command": ["npx", "-y", "@modelcontextprotocol/server-github"],
107
+ "env": { "GITHUB_PERSONAL_ACCESS_TOKEN": "ghp_xxx" }
108
+ },
109
+ "fetch": {
110
+ "type": "local",
111
+ "command": ["uvx", "mcp-server-fetch"]
112
+ },
113
+ "my-remote": {
114
+ "type": "remote",
115
+ "url": "https://example.com/mcp",
116
+ "headers": { "Authorization": "Bearer token123" }
117
+ }
118
+ }
119
+ }
120
+ ```
121
+
122
+ - `type`: `"local"` (stdio subprocess) or `"remote"` (SSE/HTTP endpoint)
123
+ - `command`: array with executable and args (local only)
124
+ - `url`: endpoint URL (remote only)
125
+ - `env`: environment variables for local servers
126
+ - `headers`: HTTP headers for remote servers
127
+ - `enabled`: set to `false` to skip a server
128
+
129
+ MCP tools appear prefixed as `mcp_<server>_<tool>` alongside built-in tools.
130
+
131
+ **Commands:**
132
+ - `/mcp list` — show connected servers and tool counts
133
+ - `/mcp reload` — disconnect and reconnect all configured servers
134
+
94
135
  ## Usage
95
136
 
96
137
  ### Interactive TUI
@@ -144,6 +185,8 @@ Supported formats: PNG, JPG, JPEG, WebP, GIF, BMP (up to 5 MB each, 10 per messa
144
185
  | `/resume` | Pick a past conversation to restore. |
145
186
  | `/compact` | Summarize older turns to free context. Suggested automatically at ~80% full. |
146
187
  | `/init` | Scan the repo and write a `KIMI.md` so future agents have project context. |
188
+ | `/mcp list` | List connected MCP servers and their tools. |
189
+ | `/mcp reload` | Disconnect and reconnect all configured MCP servers. |
147
190
  | `/reasoning` | Toggle chain-of-thought display. |
148
191
  | `/clear` | Reset the current conversation. |
149
192
  | `/cost` | Show token usage for the current turn. |
@@ -258,6 +301,89 @@ Contributions are welcome!
258
301
  6. Push: `git push origin feat/your-feature`
259
302
  7. Open a Pull Request
260
303
 
304
+ ## Testing MCP locally
305
+
306
+ You don't need a real MCP server to test the integration. Here's a minimal test server you can save as `test-mcp-server.js`:
307
+
308
+ ```js
309
+ // test-mcp-server.js — a minimal MCP server for testing
310
+ import { Server } from "@modelcontextprotocol/sdk/server/index.js";
311
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
312
+
313
+ const server = new Server({ name: "test-server", version: "1.0.0" }, { capabilities: { tools: {} } });
314
+
315
+ server.setRequestHandler("tools/list", async () => ({
316
+ tools: [
317
+ {
318
+ name: "greet",
319
+ description: "Greet someone by name",
320
+ inputSchema: {
321
+ type: "object",
322
+ properties: { name: { type: "string" } },
323
+ required: ["name"],
324
+ },
325
+ },
326
+ {
327
+ name: "add",
328
+ description: "Add two numbers",
329
+ inputSchema: {
330
+ type: "object",
331
+ properties: { a: { type: "number" }, b: { type: "number" } },
332
+ required: ["a", "b"],
333
+ },
334
+ },
335
+ ],
336
+ }));
337
+
338
+ server.setRequestHandler("tools/call", async (req) => {
339
+ if (req.params.name === "greet") {
340
+ return { content: [{ type: "text", text: `Hello, ${req.params.arguments.name}!` }] };
341
+ }
342
+ if (req.params.name === "add") {
343
+ const sum = req.params.arguments.a + req.params.arguments.b;
344
+ return { content: [{ type: "text", text: String(sum) }] };
345
+ }
346
+ throw new Error("Unknown tool");
347
+ });
348
+
349
+ const transport = new StdioServerTransport();
350
+ await server.connect(transport);
351
+ ```
352
+
353
+ Then add it to your config:
354
+
355
+ ```json
356
+ {
357
+ "mcpServers": {
358
+ "test": {
359
+ "type": "local",
360
+ "command": ["node", "/path/to/test-mcp-server.js"]
361
+ }
362
+ }
363
+ }
364
+ ```
365
+
366
+ Launch kimiflare and try:
367
+ - `/mcp list` — should show `test (local) — 2 tools`
368
+ - `use mcp_test_greet with name "kimiflare"` — should return `Hello, kimiflare!`
369
+ - `use mcp_test_add with a 3 and b 5` — should return `8`
370
+
371
+ For a real-world test, try the [official GitHub MCP server](https://github.com/modelcontextprotocol/servers/tree/main/src/github):
372
+
373
+ ```json
374
+ {
375
+ "mcpServers": {
376
+ "github": {
377
+ "type": "local",
378
+ "command": ["npx", "-y", "@modelcontextprotocol/server-github"],
379
+ "env": { "GITHUB_PERSONAL_ACCESS_TOKEN": "ghp_xxx" }
380
+ }
381
+ }
382
+ }
383
+ ```
384
+
385
+ Then ask: `search for issues labeled bug in sinameraji/kimiflare`
386
+
261
387
  ## License
262
388
 
263
389
  [MIT](LICENSE) © Sina Meraji