agentleFS
freemafreema/openclaw-mcp/CLAUDE.md

openclaw-mcp

CLAUDE.md185 starsChanged 2 months agoMITView on GitHub

  • Reads credentials

The file

We split this CLAUDE.md into the rules it gives an agent

7 rules. About 0 are common, 6 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈6

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Distinctive:

    Never run directly on bare metal in production environments

    line 11
  2. Very specific:

    Use the provided docker-compose.yml for the complete stack

    line 13
  3. Distinctive:

    Never commit secrets to the repository

    line 19
  4. Distinctive:

    All MCP tool inputs MUST be validated before processing

    line 23
  5. Distinctive:

    Never pass unsanitized input to system calls or APIs

    line 25
  6. Distinctive:

    Never expose stack traces, internal paths, or credentials in error responses

    line 28
  7. Distinctive:

    All async operations use async/await (no raw promises)

    line 100

≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
CLAUDE.md

OpenClaw MCP Server

Project Overview

OpenClaw MCP (Model Context Protocol) server provides a bridge between Claude (Desktop & Claude.ai) and the OpenClaw AI assistant. It implements the MCP specification to expose OpenClaw capabilities as tools that Claude can invoke.

Security Policy (CRITICAL)

This is a security-critical MCP server. Follow these rules:

Docker-First Deployment (MANDATORY)

  • Users MUST run this server via Docker in production
  • Never run directly on bare metal in production environments
  • Docker provides: process isolation, network segmentation, resource limits, reproducible builds
  • Use the provided docker-compose.yml for the complete stack

Authentication

  • OAuth 2.1 MUST be enabled in production (AUTH_ENABLED=true)
  • Set MCP_CLIENT_ID and MCP_CLIENT_SECRET env vars
  • Generate secrets with: openssl rand -hex 32
  • Never commit secrets to the repository
  • Uses MCP SDK's built-in OAuth server (mcpAuthRouter + requireBearerAuth)

Input Validation

  • All MCP tool inputs MUST be validated before processing
  • Validate string lengths, types, and formats
  • Never pass unsanitized input to system calls or APIs

Error Handling

  • Never expose stack traces, internal paths, or credentials in error responses
  • Log errors server-side, return generic messages to clients

Architecture

Claude Desktop/Claude.ai
    ↕ (MCP Protocol - stdio or Streamable HTTP)
OpenClaw MCP Server (this project)
    ↕ (OpenAI-compatible REST API: POST /v1/chat/completions)
OpenClaw Gateway (http://localhost:18789)

Gateway API

The OpenClaw gateway exposes an OpenAI-compatible endpoint at POST /v1/chat/completions. Authentication uses a Bearer token (OPENCLAW_GATEWAY_TOKEN).

Transports

  • stdio - For local Claude Desktop integration (default)
  • HTTP - For remote Claude.ai integration (Streamable HTTP primary, legacy SSE kept for backward compat; requires OAuth + HTTPS)

Tools

ToolTypeDescription
openclaw_chatsyncSend message to OpenClaw
openclaw_statussyncHealth check
openclaw_chat_asyncasyncQueue message, get task_id
openclaw_task_statusasyncCheck task progress
openclaw_task_listasyncList all tasks
openclaw_task_cancelasyncCancel pending task

Development

Commands

npm run dev          # Watch mode (tsx)
npm run build        # Production build (tsup)
npm run typecheck    # TypeScript type checking
npm run lint         # ESLint
npm run lint:fix     # ESLint with auto-fix
npm run format       # Prettier formatting
npm run test         # Vitest (watch mode)
npm run test:run     # Vitest (single run)
npm run check:all    # Full validation pipeline

Tech Stack

  • TypeScript (ES2022 target, ESM modules)
  • Node.js >=20
  • Build: tsup (bundles to single dist/index.js)
  • Test: vitest
  • Lint: eslint + prettier

File Structure

src/
├── index.ts              # Entry point, MCP server setup
├── cli.ts                # CLI argument parsing (yargs)
├── auth/provider.ts      # OAuth 2.1 server provider (MCP SDK)
├── config/constants.ts   # Server constants
├── mcp/tools/            # MCP tool definitions & handlers
├── mcp/tasks/            # Async task manager
├── openclaw/client.ts    # OpenClaw API client (OpenAI-compatible)
├── openclaw/types.ts     # TypeScript type definitions
├── server/http.ts        # HTTP transport (remote access)
└── utils/                # Logger, errors, response helpers

Conventions

  • ESM imports with .js extensions (required for ESM compatibility)
  • Underscore prefix for unused variables (_var)
  • Single quotes, semicolons, 2-space indent, 100 char width
  • Custom error classes extend OpenClawError
  • All async operations use async/await (no raw promises)

Docker Deployment (Required for Production)

# Quick start
docker compose up -d

# With custom config
cp .env.example .env
# Edit .env with your settings
docker compose up -d

See docs/deployment.md for full production setup including TLS, OAuth, and monitoring.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.