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
- Distinctive: line 11
Never run directly on bare metal in production environments
- Very specific: line 13
Use the provided docker-compose.yml for the complete stack
- Distinctive: line 19
Never commit secrets to the repository
- Distinctive: line 23
All MCP tool inputs MUST be validated before processing
- Distinctive: line 25
Never pass unsanitized input to system calls or APIs
- Distinctive: line 28
Never expose stack traces, internal paths, or credentials in error responses
- Distinctive: line 100
All async operations use async/await (no raw promises)
≈ “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.
Files
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.ymlfor the complete stack
Authentication
- OAuth 2.1 MUST be enabled in production (
AUTH_ENABLED=true) - Set
MCP_CLIENT_IDandMCP_CLIENT_SECRETenv 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
| Tool | Type | Description |
| openclaw_chat | sync | Send message to OpenClaw |
| openclaw_status | sync | Health check |
| openclaw_chat_async | async | Queue message, get task_id |
| openclaw_task_status | async | Check task progress |
| openclaw_task_list | async | List all tasks |
| openclaw_task_cancel | async | Cancel 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 pipelineTech 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 helpersConventions
- 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 -dSee docs/deployment.md for full production setup including TLS, OAuth, and monitoring.
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
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.

