Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
---
title: MCP Server
resources:
- url: https://modelcontextprotocol.io/docs/getting-started/intro
title: MCP Server Standard
---

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

The Cartesi MCP server is a read-only knowledge service your AI assistant connects to for Cartesi-specific context. Instead of guessing CLI flags or hallucinating APIs, your assistant can query curated documentation routes, repositories, articles, and skills. Many of the resources are returned inline without fetching external URLs.

The server runs at `https://server.mcp.mugen.builders/mcp`. No API key or local install is required; add the URL to your MCP client and connect.

Once connected, your assistant can:

- Look up **CLI commands** matched to the Cartesi CLI version you have installed
- Pull **step-by-step skills** for local dev bootstrapping, frontend and backend development, asset deposits, L1 contract interactions, and on-chain deployment
- **Search** documentation routes, repositories, and articles by topic for deeper context
- Prepare **workflow commands** (`cartesi create`, `cartesi build`, `cartesi run`, deposits, and inputs) as instructions to run on your machine; the MCP server does not execute the CLI for you

## Connect your client

<Tabs groupId="mcp-client" values={[
{ label: 'Cursor', value: 'cursor' },
{ label: 'Claude Code', value: 'claude' },
{ label: 'Codex', value: 'codex' },
{ label: 'Claude Desktop', value: 'claude-desktop' },
{ label: 'VS Code Copilot', value: 'vscode' },
]} defaultValue="cursor">

<TabItem value="cursor">

1. Open **Settings**.
2. In the sidebar, click **Tools and MCPs**, then select **New MCP Server**.
3. Cursor opens your MCP config file (`~/.cursor/mcp.json` globally, or `.cursor/mcp.json` in your project). Add:

```json
{
"mcpServers": {
"cartesi-mcp": {
"transport": "http",
"url": "https://server.mcp.mugen.builders/mcp"
}
}
}
```

4. Restart Cursor, then verify under **Settings → Tools and MCPs** that `cartesi-mcp` is connected.

</TabItem>

<TabItem value="claude">

1. Install the [Claude CLI](https://docs.anthropic.com/en/docs/claude-code), then add the server:

```shell
claude mcp add --transport http cartesi https://server.mcp.mugen.builders/mcp
```

2. Restart Claude Code (or start a new conversation).
3. Run `/mcp` and confirm `cartesi` appears in the list of active MCP servers.

</TabItem>

<TabItem value="codex">

1. Add the server:

```shell
codex mcp add cartesi-mcp --url https://server.mcp.mugen.builders/mcp
```

2. Verify it was added:

```shell
codex mcp list
```

</TabItem>

<TabItem value="claude-desktop">

Add to `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) or `%APPDATA%\Claude\claude_desktop_config.json` (Windows):

```json
{
"mcpServers": {
"cartesi-mcp": {
"type": "streamable-http",
"url": "https://server.mcp.mugen.builders/mcp"
}
}
}
```

Restart Claude Desktop after saving.

</TabItem>

<TabItem value="vscode">

Add to `.vscode/mcp.json` in your project:

```json
{
"servers": {
"cartesi-mcp": {
"type": "http",
"url": "https://server.mcp.mugen.builders/mcp"
}
}
}
```

Restart VS Code after saving. Requires GitHub Copilot with MCP support enabled.

</TabItem>

</Tabs>

For any other MCP-compatible client, point it at `https://server.mcp.mugen.builders/mcp` using HTTP transport.

## Getting started

Once connected, a typical workflow looks like this:

1. **Scaffold or extend an app**, e.g. *"Create a Cartesi Rollups v2 JavaScript echo app using cartesi-scaffold"*
2. **Run locally**, e.g. *"Give me the exact cartesi build and cartesi run commands for this project"*
3. **Interact and debug**, e.g. *"How do I send an ERC-20 deposit to my app?"* or *"My advance handler is rejecting inputs; help me debug"*

:::tip Demo
See the MCP server in action: [demo video](https://drive.google.com/file/d/1a0Ad4qgXY8ebjYtJXt0ycq8vtG95VlsM/view?usp=drive_link). Claude scaffolds a Cartesi app from a single prompt, builds and runs it locally, interacts via text input and token deposits, and deploys to Base Sepolia.
:::

## Available tools

The server exposes developer-facing tools in three categories:

**Knowledge search**: find curated Cartesi resources and documentation routes:

- `search_knowledge_resources`: search repos, articles, docs, and skills by topic
- `search_documentation_routes`: find docs pages by keyword
- `get_resource_detail`: fetch metadata and related doc routes for a resource
- `list_resources_for_tag` / `list_resources_for_source`: browse by tag or source
- `list_resource_doc_routes`: list documentation routes linked to a resource
- `get_knowledge_taxonomy` / `summarize_knowledge_base`: explore what the knowledge base covers

**Workflow helpers**: generate step-by-step instructions to run on your machine:

- `prepare_cartesi_create_command`: scaffold a new app with the correct CLI flags for your CLI version
- `prepare_cartesi_build_command` / `prepare_cartesi_run_command`: build and run locally
- `send_input_to_application`: send generic inputs or deposits via the CLI
- `prepare_erc20_deposit_instructions` / `prepare_erc721_deposit_instructions` / `prepare_erc1155_deposit_instructions`: portal deposit workflows
- `get_cartesi_app_logic_guidance`: guidance for advance/inspect handlers, address-book usage, and outputs
- `build_debugging_context`: assemble docs and resources for a debugging query

**Prompts**: reusable prompt templates your assistant can invoke:

- `find_cartesi_docs`: locate the best documentation for a topic
- `debug_cartesi_issue`: investigate an error using curated knowledge
- `explain_repository_context`: understand a Cartesi repo before making changes
187 changes: 187 additions & 0 deletions cartesi-rollups_versioned_docs/version-2.0/build-with-ai/overview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
---
title: Overview
---

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

AI coding assistants can scaffold, implement, and debug Cartesi applications quickly, but without Cartesi-specific context they often guess CLI flags, mix up v1 and v2 APIs, or invent workflows.

Using the right tools, you get faster iteration-handlers, contracts, and frontends from natural-language prompts-and less context switching, with version-aware CLI commands and doc links inline instead of hunting through tabs. This section gives your assistant structured knowledge and tools to build and ship applications quickly and reliably.

## How it works

Multiple pieces work together to learn and build with AIs:

1. **[Documentaion](#documentation-indexing-and-usage)**: Usage of [llms.txt](https://docs.cartesi.io/llms.txt) gives your assistant a machine-readable index of all Cartesi docs.
2. **[MCP server](./mcp-server.mdx)**: Connects your editor to curated Cartesi docs, repos, articles, and skills.
3. **[Skills](./skills.md)**: Loads focused instructions (scaffold, backend, frontend, deploy, debug)
4. **[Prompting](./prompting.md)**: Interactive way to put the knowledge and skills of the AI assistant in practice.

## Documentation indexing and usage

Cartesi docs publish machine-readable indexes so AI assistants can discover pages and fetch raw Markdown without scraping HTML. Use these files when your client does not have MCP connected, or when you want a lightweight doc dump in context.

### Documentation index

Fetch the complete documentation index at: [https://docs.cartesi.io/llms.txt](https://docs.cartesi.io/llms.txt)

`llms.txt` lists every indexed page with links to raw Markdown sources, version-priority notes (default to Rollups v2.0), and a documentation map. Agents should read this file first to discover which pages to fetch for a given task.

### Per-page Markdown

Any docs page can be fetched as Markdown by appending `.md` to its URL. For example:

- Page: `https://docs.cartesi.io/cartesi-rollups/2.0/build-with-ai/overview`
- Source: `https://docs.cartesi.io/cartesi-rollups/2.0/build-with-ai/overview.md`

On any docs page, use the **Copy page** widget in the table of contents sidebar to copy the page as Markdown, open the `.md` URL directly, or send the link to ChatGPT, Claude, or Gemini. Use this when you need a single page in context instead of the full corpus.

### Full documentation file

If your AI tool does not support MCP yet, you can use a static documentation file instead. This gives your assistant the entire Cartesi documentation corpus as one text file.

Download or reference: [https://docs.cartesi.io/llms-full.txt](https://docs.cartesi.io/llms-full.txt)

### Setup Static Documentation

<Tabs groupId="static-docs-client" values={[
{ label: 'Cursor', value: 'cursor' },
{ label: 'Claude Code', value: 'claude' },
{ label: 'Codex', value: 'codex' },
{ label: 'Claude Desktop', value: 'claude-desktop' },
{ label: 'VS Code Copilot', value: 'vscode' },
]} defaultValue="cursor">

<TabItem value="cursor">

[Cursor](https://cursor.com/) can index external documentation for `@docs` references in chat.

1. Open **Cursor Settings** → **Indexing & Docs** → **Docs**.
2. Click **Add new doc** and paste: `https://docs.cartesi.io/llms-full.txt`
3. In chat, reference the docs source (for example `@docs` → your Cartesi entry) when you want the assistant to ground answers in official documentation.

For live Cartesi-specific tools (CLI commands, skills, repo search), also connect the [MCP server](./mcp-server.mdx).

</TabItem>

<TabItem value="claude">

[Claude Code](https://docs.anthropic.com/en/docs/claude-code/overview) can include static doc files in a session.

1. Download the static documentation file from [https://docs.cartesi.io/llms-full.txt](https://docs.cartesi.io/llms-full.txt), or fetch the index at [https://docs.cartesi.io/llms.txt](https://docs.cartesi.io/llms.txt) and pull individual `.md` pages as needed.
2. Save the file in your project directory or another known location.
3. Reference it in chat with `/read` or by attaching the file path so Claude Code has Cartesi documentation for that session.

For ongoing work, add the Cartesi MCP server to your project's `.mcp.json` (see [MCP server](./mcp-server.mdx)) so lookups stay current without re-downloading `llms-full.txt`.

</TabItem>

<TabItem value="codex">

[Codex CLI](https://github.com/openai/codex) loads an `AGENTS.md` file from your project root into context for every session.

1. Download the static documentation file to your project:

```shell
curl -fSL https://docs.cartesi.io/llms-full.txt -o docs/cartesi-llms-full.txt
```

2. Add a pointer in `AGENTS.md` at the repo root so Codex grounds answers in Cartesi docs:

```md
# Cartesi context

This project targets **Cartesi Rollups v2**. When answering questions or
generating code:

- Read `docs/cartesi-llms-full.txt` for the full Cartesi documentation corpus.
- Default to `/cartesi-rollups/2.0/` routes; do not surface v1.x APIs unless asked.
- Prefer fetching individual pages from `https://docs.cartesi.io/<path>.md` when
you need fresh, focused context.
```

3. In a session, reference the file directly with `@docs/cartesi-llms-full.txt` when you want the assistant to ground a specific answer in docs.

For live tooling, also connect the [MCP server](./mcp-server.mdx).

</TabItem>

<TabItem value="claude-desktop">

[Claude Desktop](https://claude.ai/download) supports **Projects** with persistent knowledge files.

1. Download the static documentation file: [https://docs.cartesi.io/llms-full.txt](https://docs.cartesi.io/llms-full.txt)
2. In Claude Desktop, create a new **Project** (for example, "Cartesi Rollups v2").
3. Open **Project knowledge** and upload `llms-full.txt` (rename to `cartesi-llms-full.txt` if you keep multiple sources).
4. Add a short **Project instructions** entry such as:

> Default to Cartesi Rollups v2.0. Use the attached `cartesi-llms-full.txt` as the source of truth. Do not surface v1.x APIs unless explicitly asked.

5. Start a new chat inside the project; Claude will ground answers in the uploaded docs.

For live tools (CLI commands, skills, repo search), connect the [MCP server](./mcp-server.mdx) in Claude Desktop's MCP config.

</TabItem>

<TabItem value="vscode">

[GitHub Copilot in VS Code](https://code.visualstudio.com/docs/copilot/overview) reads custom instructions from `.github/copilot-instructions.md` and lets you attach files to chat with `#file:`.

1. Download the static documentation file into your repo:

```shell
curl -fSL https://docs.cartesi.io/llms-full.txt -o docs/cartesi-llms-full.txt
```

2. Create `.github/copilot-instructions.md` (or extend the existing one) with a Cartesi grounding block:

```md
This repository builds on **Cartesi Rollups v2**.

- Use `docs/cartesi-llms-full.txt` as the source of truth for Cartesi APIs,
CLI commands, and deployment.
- Default to `/cartesi-rollups/2.0/` routes; ignore v1.x guidance unless asked.
- When generating CLI steps, prepare commands for the user to run locally.
```

3. In Copilot Chat, attach the file on demand with `#file:docs/cartesi-llms-full.txt` when you want the assistant to cite specific Cartesi docs.

For live, version-aware tooling, also connect the [MCP server](./mcp-server.mdx) via VS Code's MCP support.

</TabItem>

</Tabs>

Alternatively, you can use the [Cartesi MCP server](./mcp-server.mdx) to get the latest documentation and skills.

## Best Practices

AI-assisted development is powerful, but it is not a substitute for good engineering judgment. Treat every generated command, dependency, and deployment step as untrusted until you understand and verify it.

### Security

- **Never paste private keys, mnemonics, or production secrets into prompts.** Use testnet keys, local dev accounts, and environment variables your assistant never sees.
- **Review before you run.** Agents can propose shell commands, config changes, or contract deployments that look correct but are wrong or harmful. Read diffs and commands before approving them.
- **Audit generated code.** Especially for Solidity, wallet flows, and anything that moves funds. AI can miss edge cases, use deprecated APIs, or introduce subtle bugs.
- **Trust your toolchain.** Only install MCP servers, skills, and editor plugins from sources you recognize. A malicious plugin or MCP server could exfiltrate files, env vars, or keys from your machine.
- **Limit blast radius.** Prefer testnets and disposable wallets for AI-assisted deployment. Do not point agents at mainnet credentials or production infrastructure.

### Costs and model quality

- **Free or lightweight models** are fine for boilerplate and docs lookup, but they hallucinate more often and struggle with multi-step Cartesi workflows.
- **Frontier models** (paid tiers) are usually better at following skills, chaining CLI steps, and debugging but usage-based billing adds up quickly on long agent sessions.
- **Token usage grows fast** when you attach large repos, full doc dumps, or long chat histories. Scope context to what the task needs.

### Agent access and sandboxing

- **Agents may read and write files, run terminals, and call MCP tools** depending on your client settings. Understand what your editor allows before enabling auto-run or broad file access.
- **Use sandboxing where your client supports it**: restrict network access, require approval for terminal commands, and avoid giving an agent unrestricted access to your home directory or `.env` files.
- **The Cartesi MCP server is read-only**, but other MCP servers or built-in tools in your client may not be. Review every MCP server you connect.
- **Separate dev from production.** Do not run AI agents in directories that contain production keys, customer data, or unreleased IP you cannot afford to leak.

### Other limitations

- **Models can still guess.** Even with the Cartesi MCP server and skills, assistants may mix API versions, invent flags, or skip steps. Cross-check against official docs.
- **Early-release tooling.** Cartesi Skills and the MCP server are evolving; expect gaps, breaking changes, and incomplete coverage.
- **You own the outcome.** AI speeds up scaffolding and iteration; shipping safely still requires tests, manual review, and your own deployment discipline.
Loading
Loading