kimi-debug-tunnel
Kimi Debug Tunnel is a multi-session orchestration server for Kimi Code CLI, providing 28 MCP tools and a REST/WebSocket API to manage AI sessions from a Project Manager perspective.
Session Management
Create sessions with configurable working directory, model, permission policy, thinking level, and memory injection
List, inspect, and check tunnel/connection status of all sessions
Task Execution & Communication
Send prompts with fire-and-return semantics, auto-mode, and thinking control
Run multi-step flows (auto-create session + sequential steps) and execute adaptive workflow templates
Handle paused workflows with retry, skip, abort, or manual override decisions
Real-time Monitoring & Logging
Poll session state (active/awaiting/done/error/idle) via WebSocket cache
List I/O records (user prompts + assistant replies, filtering tool noise)
Read full conversation logs with pagination, incremental updates, and thinking content toggle
Background-watch sessions for passive completion tracking; chain watch cycles to auto-submit next instructions; write results to file
Shared Memory System (3-layer)
Write/read/list/delete key-value memory entries across namespaces with auto-versioning
L1 project knowledge → L2 session context → L3 learned patterns
Archive session findings to promote L2 learnings to L1 project knowledge
View memory status (entry count, namespace distribution, last update)
Workflow Templates
Learn reusable YAML workflow templates from natural language descriptions or historical session I/O
List available templates with name, version, and step count
Permission Policy Management
Enforce built-in (read-only, safe-edit, full-access) or custom YAML policies
Approve or deny blocked tool calls at runtime (once or session scope)
Real-time Push & Debug
Stream responses to connected WebSocket debug clients
Web dashboard and REST endpoints for session health monitoring and attention alerts
Robust
WireClientwith heartbeat detection and automatic reconnection
Provides a Tampermonkey userscript for interacting with the orchestrator server from the browser.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@kimi-debug-tunnelexecute prompt: write a Python hello world"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Kimi Session Orchestrator
Kimi Code CLI 的 Loop Engineering PM 编排系统。 29 个 MCP 工具——不手动 prompt Agent,而是设计自动 prompt Agent 的循环系统。
解决什么问题
问题 | 方案 |
上下文腐化 — session 越跑越笨,偏离规范 |
|
无法确认完工 — Agent 说"好了"但实际没好 |
|
冷启动灾难 — 每次新 session 从零开始 |
|
重复告知规范 — Agent 不记得项目约定 |
|
超时截断 — 耗时任务被 MCP 30s 超时杀死 | 即发即返 + Bash 后台 Python 轮询(v2.16 首次调用自动写入 poll.py → 后续短命令引用 + poll-result-{sid}.txt),OS 进程退出自动通知 |
痛点 | 行业现状 | 本项目 |
上下文不可见 | 浏览器端无任何指示 |
|
会话交接繁琐 | 手写总结,容易遗漏 |
|
多 Agent 编排 | 缺编排层,状态不可见 |
|
跨项目知识不共享 | 项目级记忆绑定单仓库 |
|
服务端崩溃 | 任务丢失,需手动重做 | 五层离线防御 + |
Related MCP server: EX MCP Server
快速开始
git clone https://github.com/FirenzeClaw/kimi-session-orchestrator.git
cd kimi-session-orchestrator
# 0. 确认 Python ≥ 3.7(后台轮询依赖)
python3 --version || python --version
npm install && npm run build
# 1. 启动 Kimi Server
kimi web --no-open
# 2. 设置 token 并启动 Tunnel
export KIMI_SERVER_TOKEN="<printed-at-startup>"
npm start注册到 ~/.kimi-code/mcp.json:
{
"mcpServers": {
"kimi-session-orchestrator": {
"command": "node",
"args": ["<绝对路径>/dist/index.js"],
"env": { "KIMI_SERVER_TOKEN": "<token>" }
}
}
}/reload 即可使用。详见 完整安装指南。
架构
用户 ──HTTP/WS──▶ Express Server ──REST──▶ Kimi Server
│ │
┌─────────────┼──────────────┐ │
▼ ▼ ▼ │
WorkflowEngine SessionWatcher PolicyEngine │
MemoryStore(SQLite) MessageQueue OrchestrationStore
│
MCP stdio ──▶ Kimi Code CLI工具概览
类别 | 工具 |
Session |
|
任务 |
|
监控 |
|
记忆 |
|
验证 |
|
权限 |
|
工作流 |
|
推送 |
|
完整工具参数见 API.md。
Skill
10 个配套 skill,分为 Agent 级(新 session 自动加载)和 PM 级(按需调用):
Skill | 级别 | 一句话 |
| Agent | 启动协议:auto 检测 → Q1 角色维度 → 按需加载 guide |
| PM |
|
| PM | 从 SPEC/PRD/PLAN/TASK 提取 AC、复杂度和 Loop Contract |
| PM | 一句话需求 → 5 轮追问 → 基线锁定 → Loop Contract |
| PM | 定时自动化编排:cron.yaml 双写、自举续期链、run_lock 防重叠 |
| PM | 退役→接班全自动 pipeline,近乎无损接力 |
| Agent | 困境分析——task session 独立上下文 + 零污染 |
| Agent | 本地子 Agent 困境分析(原版) |
| Agent | 无需 API 认证,wire.jsonl 尾部状态推断 |
| Agent | MCP 异步工具设计模式——解决 >30s 超时 |
安装:
# Agent 级
cp -r skills/kimi-session-orchestrator ~/.agents/skills/
cp -r skills/xmind-orchestrated ~/.agents/skills/
cp -r skills/xmind ~/.agents/skills/
cp skills/agent-session-monitor.md ~/.agents/skills/agent-session-monitor/SKILL.md
cp skills/mcp-async-tool.md ~/.agents/skills/mcp-async-tool/SKILL.md
# PM 级
cp -r skills/session-retire ~/.kimi-code/skills/
cp -r skills/loop-orchestrator ~/.kimi-code/skills/
cp -r skills/loop-contract-from-docs ~/.kimi-code/skills/
cp -r skills/loop-contract-from-idea ~/.kimi-code/skills/
cp -r skills/cron-scheduler ~/.kimi-code/skills/记忆系统
三层架构——PM 一次性录入,session 自动继承。
L1: 项目知识库 (.kimi-tunnel/memory.db)
PM: memory_set(ns, key, value)
Session: create_session(memory_level) → 自动注入索引 → 自主 memory_get
L2: Session 上下文 (session:<id>/*)
运行时更新,退役后 memory_archive 归档到 L1
L3: 学习沉淀 (learn skill → 向量库)
从 L1+L2 提取可复用模式v2.13+:支持跨项目双层注入——buildInjection() 按 profile.cwd 自动生成全局正文 + 子项目索引导航表。
文档
文档 | 说明 |
Kimi Server REST API(51 端点) | |
PM 统筹准入规范 | |
Loop Engineering 概念与项目对照 | |
Loop Engineering 全面参考(16 章,7 篇来源聚合) | |
7 个功能规格(001-007,含 cross-model grader 与 cron-scheduler) | |
架构设计文档(含 Loop Contract 双 Skill 设计) | |
已修复问题记录(5 个) |
安装与部署
前置条件
Node.js ≥ 22(
node:sqlite内置 + tsc 编译)Python ≥ 3.7(后台轮询脚本
poll_command运行时依赖)Kimi Code CLI ≥ 0.22.3
Git Bash(Windows)或 bash
环境变量
变量 | 必需 | 默认 | 说明 |
| ✅ | — | Kimi Server 启动时打印的 Bearer Token |
| 否 | 自动检测 | 覆盖 Kimi Server 地址(端口自动从 lock 检测) |
| 否 |
| Tunnel HTTP/WS 监听端口 |
| 否 |
| Kimi Code 数据目录 |
部署红线
# | 规则 |
1 | ⛔ 不要硬编码 |
2 |
|
3 | 安装后执行 |
4 | 更新代码后需重装 skill: |
Linux
与上方完全一致,仅路径用绝对路径。自动端口检测、MCP stdio、跨平台 API 均兼容。
项目结构
src/ — TypeScript 核心(index, mcp-server, wire-client, workflow-engine, memory-store 等)
tools/ — 29 个 MCP 工具
shared/ — 浏览器端 JS(API 客户端、状态管理、渲染、注入)
ext/ — Chrome MV3 扩展
userscript/ — Tampermonkey 用户脚本
skills/ — 10 个配套 Skill(含 Loop Contract 双 Skill + cron-scheduler)
templates/ — 工作流 YAML 模板
docs/ — 规格、设计文档、问题记录
specs/ — 功能规格(001-005)FAQ
最常见根因:mcp.json 中硬编码了 KIMI_SERVER_URL。删除该行——Tunnel 自动从 lock 文件检测端口。确认 kimi web 运行中 + token 正确。
确保 ~/.kimi-code/mcp.json 中注册了 kimi-session-orchestrator,然后 /reload。全局 mcp.json 对所有 session 生效——配置一次即可。
Tunnel 内置五层防御:过期 lock 清理 + 10s 心跳 + 断连判定 + 指数退避重连 + WS 独立重连。短时中断自动恢复,运行中的 task session 不受影响。
kimi web 未运行或已崩溃。v2.9.1 起 MCP stdio 优先启动,wire 离线时工具返回友好报错而非进程崩溃。
端口 3456 被 WSL2 绑定的 winnat 驱动划入动态排除范围。验证:
netsh int ipv4 show excludedportrange protocol=tcp | findstr 3456如果有 3430-3529 输出说明命中。修复(管理员终端):
net stop winnat
netsh int ipv4 add excludedportrange protocol=tcp startport=54000 numberofports=100
net start winnat原理:为 winnat 固定预留 54000-54099,释放随机占用的 3430-3529。WSL2 网络短暂中断(3-5 秒),数据和进程不受影响。
参与贡献
Bug / 功能请求 · Fork → PR · 提交前 npm run build 零错误。
License
MIT
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/FirenzeClaw/kimi-session-orchestrator'
If you have feedback or need assistance with the MCP directory API, please join our Discord server