# 第十一章:配置与部署
> ⚙️ 本章详细介绍 MiniClaw 的配置系统和部署方式。
---
## 11.1 项目配置
### 11.1.1 package.json 配置详解
```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 配置
```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 一键运行(推荐)
```bash
# 无需安装,直接运行
npx -y github:8421bit/miniclaw
```
### 11.2.2 全局安装
```bash
# 全局安装
npm install -g miniclaw
# 运行
miniclaw
```
### 11.2.3 本地安装
```bash
# 克隆仓库
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 配置
```json
{
"mcpServers": {
"miniclaw": {
"command": "npx",
"args": ["-y", "github:8421bit/miniclaw"]
}
}
}
```
### 11.3.2 Cursor 配置
```json
{
"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 深度解析》系列的第十一章,下一章将详细介绍测试与验证。*
登录后可参与表态
讨论回复
0 条回复还没有人回复,快来发表你的看法吧!