← 返回
开发者工具 Key 中文

Claude Code Agent

Integrates MCP tool servers for orchestration, state persistence with IndexedDB/localStorage, and session sync across devices in OpenClaw/Clawdbot.
集成MCP工具服务器以实现编排,支持IndexedDB/localStorage状态持久化,并在OpenClaw/Clawdbot中实现跨设备会话同步。
enderfga
开发者工具 clawhub v0.2.0 1 版本 99666.9 Key: 需要
★ 0
Stars
📥 3,591
下载
💾 8
安装
1
版本
#latest

概述

OpenClaw Claude Code Skill

Description

MCP (Model Context Protocol) integration for OpenClaw/Clawdbot. Use when you need to:

  • Connect and orchestrate MCP tool servers (filesystem, GitHub, etc.)
  • Persist state across sessions with IndexedDB/localStorage
  • Sync sessions across multiple devices

Triggers: "MCP", "tool server", "sub-agent orchestration", "session sync", "state persistence", "Claude Code integration"

Installation

npm install openclaw-claude-code-skill

Core APIs

MCP Server Management

import { 
  initializeMcpSystem, 
  addMcpServer, 
  executeMcpAction, 
  getAllTools 
} from "openclaw-claude-code-skill";

// 1. Initialize all configured servers
await initializeMcpSystem();

// 2. Add a new MCP server
await addMcpServer("fs", {
  command: "npx",
  args: ["-y", "@modelcontextprotocol/server-filesystem", "/tmp"]
});

// 3. Get available tools
const tools = await getAllTools();

// 4. Call a tool
const result = await executeMcpAction("fs", {
  method: "tools/call",
  params: { name: "read_file", arguments: { path: "/tmp/test.txt" } }
});

State Persistence

import { createPersistStore, indexedDBStorage } from "openclaw-claude-code-skill";

const useStore = createPersistStore(
  { count: 0, items: [] },
  (set, get) => ({
    increment: () => set({ count: get().count + 1 }),
    addItem: (item: string) => set({ items: [...get().items, item] })
  }),
  { name: "my-store" },
  indexedDBStorage  // or omit for localStorage
);

// Check hydration status
if (useStore.getState()._hasHydrated) {
  console.log("State restored!");
}

Session Synchronization

import { mergeSessions, mergeWithUpdate, mergeKeyValueStore } from "openclaw-claude-code-skill";

// Merge chat sessions from multiple sources
const mergedSessions = mergeSessions(localSessions, remoteSessions);

// Merge configs with timestamp-based resolution
const mergedConfig = mergeWithUpdate(localConfig, remoteConfig);

Key Functions

FunctionPurpose
-------------------
initializeMcpSystem()Start all MCP servers from config
addMcpServer(id, config)Add new server dynamically
removeMcpServer(id)Remove a server
pauseMcpServer(id)Pause a server
resumeMcpServer(id)Resume a paused server
executeMcpAction(id, req)Call a tool on specific server
getAllTools()List all available tools
getClientsStatus()Get status of all MCP clients
setConfigPath(path)Set custom config file location
createPersistStore()Create Zustand store with persistence
mergeSessions()Merge session arrays
mergeWithUpdate()Merge with timestamp resolution
mergeKeyValueStore()Merge key-value stores

Configuration

Create mcp_config.json:

{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem", "/tmp"],
      "status": "active"
    },
    "github": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-github"],
      "env": { "GITHUB_TOKEN": "your-token" },
      "status": "active"
    }
  }
}

Set custom config path:

import { setConfigPath } from "openclaw-claude-code-skill";
setConfigPath("/path/to/mcp_config.json");

Requirements

  • Node.js 18+
  • TypeScript (optional but recommended)

Links

版本历史

共 1 个版本

  • v0.2.0 当前
    2026-03-28 12:07 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

developer-tools

Github

steipete
使用 `gh` CLI 与 GitHub 交互,通过 `gh issue`、`gh pr`、`gh run` 和 `gh api` 管理议题、PR、CI 运行及高级查询。
★ 668 📥 323,946
productivity

Async Task

enderfga
通过异步启动、更新和完成任务并立即返回响应,运行和管理超出 HTTP 超时的长任务。
★ 1 📥 3,668
developer-tools

Gog

steipete
Google Workspace 命令行工具,支持 Gmail、日历、云端硬盘、通讯录、表格和文档。
★ 921 📥 185,763