CKB AI

AI Tools for Nervos CKB Developers

What is CKB AI?

CKB AI is a unified MCP server designed to help AI assistants build smart contracts and applications on Nervos CKB. It provides AI with direct access to CKB-specific documentation, blockchain data, and development utilities.

Recommended Base Stack

As AI technology advances and our tooling evolves, these recommendations will change. The following stacks have consistently produced the best results for CKB development.

Recommended Stack: Claude Code + Claude Opus (latest) + CKB AI + Playwright

Alternate Stack: Codex + GPT-5 (latest) + CKB AI + Playwright

Advanced Pairing: Use Claude Code and Codex together for second opinions on plans, implementations, and reviews.

Why MCP?

Specializing AI for CKB development can be approached two ways: training models directly on domain-specific data, or augmenting existing models with external tools and resources. We chose the augmentation approach using MCP.

The AI landscape is evolving rapidly. Which model performs best for programming tasks changes frequently, and there is no way to predict which will lead in the long run.

Training a model directly on CKB data would yield marginally better results, but comes with significant drawbacks:

MCP takes a different approach. It is compatible with all major AI systems, both open and closed source. Rather than making a massive investment that could quickly become outdated, we build a portable knowledge base and tooling that moves with us to whatever the best model is at any given time.

We believe this is the best strategy for both the short term and the foreseeable future.

What CKB AI Provides

CKB AI is a single unified MCP server with the following capabilities:

Capability Description
RPC Tools Direct interface for querying blocks, transactions, cells, and network state. Allows AI to understand the chain and verify its own work.
CKB Tools High-level composite operations that combine multiple RPC calls for common tasks like querying address state, validating transactions, and checking chain status.
Dev Tools Utilities for deploying cells, managing accounts, and requesting testnet funds. Reduces AI workload, increases success rates, and lowers costs.
Documentation Curated documentation and examples formatted for AI. Enables AI to immediately understand CKB development without prior training.
Workflow Prompts Guided workflows for script creation, deployment, blockchain queries, and CKB transfers.

CKB AI does not replace the need to understand CKB development fundamentals.

CKB AI still requires guidance from a knowledgeable engineer to be successful.

Installation

CKB AI Server:

The CKBDEV-hosted server is open for public use:

Claude Code:

claude mcp add --transport http ckb-ai https://mcp.ckbdev.com/ckbai

Codex:

codex mcp add ckb-ai --url https://mcp.ckbdev.com/ckbai

Alternatively, you can run the server locally.

Playwright:

Claude Code:

/plugin install playwright@claude-plugins-official

Codex:

codex mcp add playwright -- npx @playwright/mcp@latest

Configure Your CLAUDE.md or AGENTS.md

AI coding assistants work best when you tailor their repository instructions to fit your workflow. We recommend Karpathy's rules as a starting point for a base configuration.

For CKB projects, add these CKB-specific guidelines to the appropriate file:

## CKB Development

- CRITICAL: Always use the CKB MCP servers as the primary source for CKB development information.
- Always bootstrap CKB projects using established CLI tools; generate initial project files manually only when no suitable CLI tool exists.

Usage Patterns

Where AI Excels

AI-assisted development works well across all parts of CKB application development, but each domain has different characteristics:

Across all domains, AI may struggle with poorly documented libraries and areas where tooling or examples are sparse. If you encounter gaps or work through solutions, please share your feedback so we can continue improving the experience for everyone.

Recommended Libraries and Tools

Domain Recommendation
Frontend Stack Vite + React + TypeScript + Tailwind. This combination has excellent AI support and integrates well with CCC.
Frontend SDK CCC (@ckb-ccc/connector-react). Primary SDK for CKB applications providing transaction building, wallet integration, and cross-chain support.
Backend (Node.js) CCC (@ckb-ccc/core). Server-side transaction building and blockchain interaction.
Backend (Rust) CKB-SDK-Rust (ckb-sdk = "3.2.0"). Rust SDK for transaction building, cell collection, and RPC interaction.
Smart Contracts ckb-script-templates. Production-ready Rust templates for CKB smart contract development.
Local Devnet offckb. Local development environment with pre-funded accounts and pre-deployed system scripts.

Bootstrapping a Project

When starting a new project, explicitly tell AI the exact stack you want. For smart contracts, use ckb-script-templates via cargo generate. AI can sometimes struggle with scaffolding tools, so it may be more effective to perform the initial setup yourself and verify it compiles before handing off to AI. Regardless of approach, do not allow AI to manually generate boilerplate files, as this often leads to subtle errors.

For projects with multiple components (frontend, backend, smart contracts), use a monorepo structure. AI benefits from having all components in close proximity, allowing it to understand how they interact and maintain consistency across the codebase. Alternatively, keep separate repositories in a shared parent folder to achieve similar context visibility.

Use offckb to run a local devnet, or connect directly to testnet. A local devnet with a 1-5 second block time speeds up development cycles. Note that the CKBDEV-hosted CKB AI server connects to testnet by default; using a local devnet requires running a local MCP server instance configured for your devnet.

The Planning Cycle

Before writing code, invest significant time in planning. Instruct AI to fully plan the implementation and return with questions, concerns, and recommendations. Answer these, then have AI reevaluate and repeat the cycle.

┌────────────────────────────────────────────────────────────────┐
│                       THE PLANNING CYCLE                       │
│                                                                │
│      Plan  ───►  Questions / Concerns / Recommendations        │
│        ▲                                       │               │
│        │                                       ▼               │
│        └──────────  Reevaluate  ◄─────────  Answer             │
│                                                                │
│           Repeat until confident. Exit with spec doc.          │
└────────────────────────────────────────────────────────────────┘

Continue this cycle until AI has no remaining questions and the plan appears solid. At this point, have AI write a specification document that captures the full design. Reference this document in your CLAUDE.md or AGENTS.md to prevent drift as context accumulates.

For difficult planning or implementation decisions, it can be useful to ask Claude Code and Codex to review each other's plan or code and provide a second opinion.

Development Workflow

AI performs best when it can verify its own work. The CKB AI server enables AI to check transactions and state directly. Playwright allows AI to test frontend behavior across resolutions, but AI often misses visual problems like crowded layouts or cut-off text unless you specifically instruct it to look for them.

Test-driven development works well when feasible. AI can generate tests, but tends to miss edge cases; review test coverage yourself. Throughout development, monitor AI's progress and prevent it from taking shortcuts that compromise the design.

Smart Contract Considerations

Smart contracts require extra vigilance. The abstract nature of the cell model makes it difficult for AI to reason about correctly, and generated code often contains security vulnerabilities. You must understand how the cell model works and actively guide AI through the design. Provide it with the specific knowledge it needs rather than expecting it to figure things out independently. If you are new to the cell model, seek feedback from experienced developers to help guide the process.

Review and Optimization

After completing a major section, have AI perform a thorough review of its own code. Instruct it to check for proper structure, readability, dead code, and optimization opportunities. At the same time, set clear boundaries: instruct it to optimize at an appropriate level to prevent over-engineering or excessive abstraction. Developer judgment remains essential for keeping the codebase maintainable.

How to Contribute

If you encounter problems or discover solutions, your contributions help improve CKB AI for everyone:

Tools Under Investigation

We are actively investigating the following tools and may add them to our recommended stack in the future. However, they are not yet recommendations.