【MiniClaw 深度解析】第十一章:配置与部署

*本文档是《MiniClaw 深度解析》系列的第十一章,下一章将详细介绍测试与验证。*

目录
  1. 第十一章:配置与部署
  2. 11.1 项目配置
  3. 11.1.1 package.json 配置详解
  4. 11.1.2 tsconfig.json 配置
  5. 11.2 部署方式
  6. 11.2.1 npx 一键运行(推荐)
  7. 11.2.2 全局安装
  8. 11.2.3 本地安装
  9. 11.3 MCP 客户端配置
  10. 11.3.1 Claude Code 配置
  11. 11.3.2 Cursor 配置
  12. 11.4 环境变量
  13. 11.4.1 可用环境变量
  14. 本章小结

第十一章:配置与部署

⚙️ 本章详细介绍 MiniClaw 的配置系统和部署方式。

11.1 项目配置

11.1.1 package.json 配置详解

{
  "name": "miniclaw",
  "version": "0.5.0",
  "description": "Micro-Kernel Agent - A nervous system for AI",
  "type": "module",
  "main": "dist/index.js",
  "bin": {
    "miniclaw": "dist/index.js"
  },
  "files": [
    "dist",
    "templates"
  ],
  "scripts": {
    "build": "tsc",
    "start": "node dist/index.js"
  },
  "dependencies": {
    "@modelcontextprotocol/sdk": "^1.0.0",
    "node-cron": "^3.0.0",
    "zod": "^3.22.0"
  },
  "devDependencies": {
    "@types/node": "^20.0.0",
    "@types/node-cron": "^3.0.0",
    "typescript": "^5.0.0"
  }
}

11.1.2 tsconfig.json 配置

{
  "compilerOptions": {
    "target": "ES2022",
    "module": "NodeNext",
    "moduleResolution": "NodeNext",
    "outDir": "./dist",
    "rootDir": "./src",
    "strict": true,
    "esModuleInterop": true,
    "skipLibCheck": true,
    "forceConsistentCasingInFileNames": true
  },
  "include": ["src/**/*"],
  "exclude": ["node_modules", "dist"]
}


11.2 部署方式

11.2.1 npx 一键运行(推荐)

# 无需安装,直接运行
npx -y github:8421bit/miniclaw

11.2.2 全局安装

# 全局安装
npm install -g miniclaw

# 运行
miniclaw

11.2.3 本地安装

# 克隆仓库
git clone https://github.com/8421bit/miniclaw.git
cd miniclaw

# 安装依赖
npm install

# 构建
npm run build

# 运行
npm start


11.3 MCP 客户端配置

11.3.1 Claude Code 配置

{
  "mcpServers": {
    "miniclaw": {
      "command": "npx",
      "args": ["-y", "github:8421bit/miniclaw"]
    }
  }
}

11.3.2 Cursor 配置

{
  "mcpServers": {
    "miniclaw": {
      "command": "npx",
      "args": ["-y", "github:8421bit/miniclaw"]
    }
  }
}


11.4 环境变量

11.4.1 可用环境变量

┌─────────────────────────────────────────────────────────────────────┐
│                    环境变量配置                                      │
├──────────────────────────┬──────────────────────────────────────────┤
│         变量名           │                  说明                    │
├──────────────────────────┼──────────────────────────────────────────┤
│  MINICLAW_HOME           │  MiniClaw 主目录路径                     │
│                          │  默认:~/.miniclaw                       │
├──────────────────────────┼──────────────────────────────────────────┤
│  MINICLAW_CONTEXT_BUDGET │  Token 预算上限                          │
│                          │  默认:8000                              │
├──────────────────────────┼──────────────────────────────────────────┤
│  MINICLAW_DEBUG          │  调试模式                                │
│                          │  可选:true/false                        │
├──────────────────────────┼──────────────────────────────────────────┤
│  MINICLAW_LOG_LEVEL      │  日志级别                                │
│                          │  可选:debug/info/warn/error             │
└──────────────────────────┴──────────────────────────────────────────┘


本章小结

┌─────────────────────────────────────────────────────────────────────┐
│                     第十一章 核心要点                                │
├─────────────────────────────────────────────────────────────────────┤
│                                                                     │
│  ⚙️ 项目配置                                                        │
│     • package.json                                                  │
│     • tsconfig.json                                                 │
│     • 依赖管理                                                      │
│                                                                     │
│  🚀 部署方式                                                        │
│     • npx 一键运行(推荐)                                          │
│     • 全局安装                                                      │
│     • 本地安装                                                      │
│                                                                     │
│  🔌 MCP 客户端配置                                                  │
│     • Claude Code                                                   │
│     • Cursor                                                        │
│     • 其他客户端                                                    │
│                                                                     │
│  🔧 环境变量                                                        │
│     • MINICLAW_HOME                                                 │
│     • MINICLAW_CONTEXT_BUDGET                                       │
│     • MINICLAW_DEBUG                                                │
│                                                                     │
└─────────────────────────────────────────────────────────────────────┘


*本文档是《MiniClaw 深度解析》系列的第十一章,下一章将详细介绍测试与验证。*

👍 1

想参与讨论或点赞?登录后使用完整功能

讨论回复(0)

暂无回复,登录后可参与讨论
合作

智谱 GLM-5 已上线

在智谱开放平台 BigModel.cn 打造 AI 应用。新一代旗舰模型 GLM-5 在推理、代码、智能体综合能力达到开源模型 SOTA。

领取 2000万 Tokens