Skip to content

Commit fa149a1

Browse files
committed
feat: add AI chat, federated search, and AI tools documentation
- /api/chat: Anthropic streaming chat via @ai-sdk/anthropic (server-only key) - /api/search: Orama federated search over content/docs + external/onflow-docs - src/components/search.tsx: Cmd+/ search panel with AI answer pane, draggable, localStorage persistence - src/lib/external-search-index.ts: indexes onflow-docs submodule content - content/docs/ai-tools/: new documentation section covering the Cadence MCP server (flow mcp), Claude Code plugin, llm-endpoints, and editor integrations (Claude, Cursor, Codex, Gemini, Antigravity, OpenCode)
1 parent b126e4e commit fa149a1

19 files changed

Lines changed: 1354 additions & 6 deletions

content/docs/ai-tools/index.mdx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
title: AI Tools
3+
---
4+
5+
Cadence is designed for AI-native development. Three integrations make Cadence documentation and language intelligence available to any AI agent:
6+
7+
- **[Skills](/docs/ai-tools/skills)** — inject Cadence knowledge into AI coding agents with one command
8+
- **[MCP Server](/docs/ai-tools/mcp-server)**`flow mcp` from the Flow CLI: gives AI agents type checking, symbol lookup, contract source fetching, and read-only on-chain script execution
9+
- **[LLM Endpoints](/docs/ai-tools/llm-endpoints)** — plain-text documentation endpoints optimized for LLM context windows
10+
11+
## Agent integrations
12+
13+
Step-by-step setup guides for specific AI tools:
14+
15+
- [Antigravity](/docs/ai-tools/integrations/antigravity) — skill and MCP setup
16+
- [Claude](/docs/ai-tools/integrations/claude) — Claude Code, Claude Desktop, Claude API
17+
- [Cursor](/docs/ai-tools/integrations/cursor) — project rules and MCP setup
18+
- [OpenAI Codex](/docs/ai-tools/integrations/codex) — AGENTS.md and context injection
19+
- [Gemini](/docs/ai-tools/integrations/gemini) — Gemini CLI and API
20+
- [OpenCode](/docs/ai-tools/integrations/opencode) — MCP configuration
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
title: Antigravity
3+
---
4+
5+
Configure [Antigravity](https://antigravity.dev) to work with Cadence.
6+
7+
## Add Cadence as project context
8+
9+
Antigravity reads project-level context files automatically. Add a `CADENCE.md` (or merge into your existing `AGENTS.md`) pointing at the [`/llms-full.txt`](../llm-endpoints) endpoint so the model has the full reference loaded on startup:
10+
11+
```markdown
12+
## Cadence Development
13+
14+
This project uses Cadence, the smart contract language for the Flow blockchain.
15+
Full reference: https://cadence-lang.org/llms-full.txt
16+
Quick index: https://cadence-lang.org/llms.txt
17+
18+
Resources use `@` prefix and must be moved with `<-`. Use `access(all)` for public access (not `pub`). Capability-based access control with entitlements.
19+
```
20+
21+
If you also use Claude Code, install the [flow-ai-tools](https://github.com/onflow/flow-ai-tools) marketplace there for richer skill coverage — it ships the full Cadence + Flow skill suite (see [Skills](../skills)).
22+
23+
## Add MCP server
24+
25+
Add the Cadence MCP server to your Antigravity configuration — calls the Flow CLI's built-in `flow mcp` subcommand:
26+
27+
```json
28+
{
29+
"mcpServers": {
30+
"cadence-mcp": {
31+
"command": "flow",
32+
"args": ["mcp"]
33+
}
34+
}
35+
}
36+
```
37+
38+
This gives Antigravity access to all [MCP tools](../mcp-server) — Cadence code checking, type inspection, symbol lookup, contract source fetching, and read-only on-chain script execution. Requires [Flow CLI](https://developers.flow.com/tools/flow-cli) ≥ v2.16.0.
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
---
2+
title: Claude
3+
---
4+
5+
Configure Claude to work with Cadence via skills, MCP, or context injection.
6+
7+
## Claude Code
8+
9+
### Install Flow's skill library
10+
11+
The official [onflow/flow-ai-tools](https://github.com/onflow/flow-ai-tools) marketplace ships the full Cadence + Flow skill suite under one plugin:
12+
13+
```bash
14+
/plugin marketplace add onflow/flow-ai-tools
15+
/plugin install flow-dev@flow-ai-tools
16+
```
17+
18+
See [Skills](../skills) for the full skill list.
19+
20+
### Add MCP server
21+
22+
```bash
23+
claude mcp add --scope user cadence-mcp -- flow mcp
24+
```
25+
26+
This registers the [Cadence MCP server](../mcp-server) — built into the Flow CLI as the `flow mcp` subcommand. Gives Claude Code access to Cadence code checking, type inspection, symbol lookup, contract source fetching, and read-only on-chain script execution. Requires [Flow CLI](https://developers.flow.com/tools/flow-cli) ≥ v2.16.0.
27+
28+
## Claude Desktop
29+
30+
Add the Cadence MCP server to your `claude_desktop_config.json`:
31+
32+
```json
33+
{
34+
"mcpServers": {
35+
"cadence-mcp": {
36+
"command": "flow",
37+
"args": ["mcp"]
38+
}
39+
}
40+
}
41+
```
42+
43+
## Claude API
44+
45+
When building with the Claude API, inject Cadence context into the system prompt:
46+
47+
```bash
48+
# Fetch the full documentation
49+
curl -s https://cadence-lang.org/llms-full.txt
50+
```
51+
52+
Or use the [MCP endpoint](../mcp-server) for programmatic access to documentation and language tools.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
title: OpenAI Codex
3+
---
4+
5+
Configure OpenAI Codex (the CLI agent) to work with Cadence.
6+
7+
## Add Cadence to AGENTS.md
8+
9+
Codex reads `AGENTS.md` from the project root automatically. Add a Cadence section that points it at the [`/llms-full.txt`](../llm-endpoints) endpoint:
10+
11+
```markdown
12+
## Cadence Development
13+
14+
This project uses Cadence, the smart contract language for the Flow blockchain.
15+
Full reference: https://cadence-lang.org/llms-full.txt
16+
Quick index: https://cadence-lang.org/llms.txt
17+
18+
Key conventions:
19+
- Use `access(all)` for public access, not the deprecated `pub`
20+
- Resources use `@` prefix and must be moved with `<-` (never copied)
21+
- Always handle resources — they cannot be lost or copied
22+
- Use capability-based access control with entitlements
23+
```
24+
25+
If you also use Claude Code, install the [flow-ai-tools](https://github.com/onflow/flow-ai-tools) marketplace there for richer skill coverage — it ships the full Cadence + Flow skill suite (see [Skills](../skills)).
26+
27+
## Context injection
28+
29+
For direct API usage, inject the Cadence documentation into the system prompt:
30+
31+
```bash
32+
curl -s https://cadence-lang.org/llms-full.txt
33+
```
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
title: Cursor
3+
---
4+
5+
Configure Cursor to understand Cadence smart contracts.
6+
7+
## Add Cadence as project context
8+
9+
Cursor reads `.cursor/rules/*.mdc` files automatically. Create `.cursor/rules/cadence.mdc` and point it at the [`/llms-full.txt`](../llm-endpoints) endpoint so the model has the full reference:
10+
11+
```mdc
12+
---
13+
description: Cadence smart contract development on Flow
14+
globs: *.cdc
15+
---
16+
17+
When working with `.cdc` files, follow Cadence language conventions:
18+
- Use `access(all)` for public access (not the deprecated `pub`)
19+
- Resources use `@` prefix and must be moved with `<-` (never copied)
20+
- Always handle resources — they cannot be lost or copied
21+
- Use capability-based access control with entitlements
22+
23+
Full Cadence reference: https://cadence-lang.org/llms-full.txt
24+
Quick index: https://cadence-lang.org/llms.txt
25+
```
26+
27+
If you also use Claude Code, install the [flow-ai-tools](https://github.com/onflow/flow-ai-tools) marketplace there for richer skill coverage — it ships the full Cadence + Flow skill suite (see [Skills](../skills)).
28+
29+
## Add MCP server
30+
31+
In Cursor settings → MCP → Add new server:
32+
33+
- **Name**: `cadence-mcp`
34+
- **Type**: `command`
35+
- **Command**: `flow mcp`
36+
37+
This registers the [Cadence MCP server](../mcp-server) — built into the Flow CLI as the `flow mcp` subcommand. Gives Cursor access to Cadence code checking, type inspection, symbol lookup, contract source fetching, and read-only on-chain script execution. Requires [Flow CLI](https://developers.flow.com/tools/flow-cli) ≥ v2.16.0.
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
title: Gemini
3+
---
4+
5+
Configure Google Gemini to work with Cadence.
6+
7+
## Gemini CLI
8+
9+
### Add Cadence to GEMINI.md
10+
11+
Gemini CLI reads `GEMINI.md` from the project root automatically. Create or update it with a Cadence section that points at the [`/llms-full.txt`](../llm-endpoints) endpoint:
12+
13+
```markdown
14+
## Cadence Development
15+
16+
This project uses Cadence, the smart contract language for the Flow blockchain.
17+
Full reference: https://cadence-lang.org/llms-full.txt
18+
Quick index: https://cadence-lang.org/llms.txt
19+
20+
Key conventions:
21+
- Use `access(all)` for public access, not the deprecated `pub`
22+
- Resources use `@` prefix and must be moved with `<-` (never copied)
23+
- Always handle resources — they cannot be lost or copied
24+
- Use capability-based access control with entitlements
25+
```
26+
27+
If you also use Claude Code, install the [flow-ai-tools](https://github.com/onflow/flow-ai-tools) marketplace there for richer skill coverage — it ships the full Cadence + Flow skill suite (see [Skills](../skills)).
28+
29+
## Gemini API
30+
31+
When using the Gemini API, inject Cadence context into the system instruction:
32+
33+
```bash
34+
# Fetch the full documentation
35+
curl -s https://cadence-lang.org/llms-full.txt
36+
```
37+
38+
Or fetch specific pages from the [LLM endpoints](../llm-endpoints).
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
title: Integrations
3+
description: Editor-specific setup for using Cadence with Claude Code, Cursor, OpenAI Codex, Gemini, Antigravity, and OpenCode.
4+
---
5+
6+
Configure your AI coding agent to understand Cadence smart contracts. Each integration uses the same two building blocks:
7+
8+
1. **Project context** — point your agent at [`/llms-full.txt`](../llm-endpoints) (or [`/llms.txt`](../llm-endpoints) for a leaner index) so it has the full Cadence reference loaded.
9+
2. **MCP server** — register the [Cadence MCP server](../mcp-server) (built into the [Flow CLI](https://developers.flow.com/tools/flow-cli) as `flow mcp`) for code checking, type inspection, symbol lookup, contract source fetching, and read-only on-chain script execution.
10+
11+
For Claude Code specifically, the [flow-ai-tools](https://github.com/onflow/flow-ai-tools) marketplace bundles the full Cadence + Flow [skill suite](../skills) under one plugin install.
12+
13+
## Editors
14+
15+
| Editor | Project context | Skills | MCP |
16+
|---|---|---|---|
17+
| [Claude Code](./claude) | via flow-ai-tools skills | ✓ full suite | ✓ stdio |
18+
| [Cursor](./cursor) | `.cursor/rules/cadence.mdc` || ✓ stdio (deeplink) |
19+
| [OpenAI Codex](./codex) | `AGENTS.md` |||
20+
| [Gemini](./gemini) | `GEMINI.md` |||
21+
| [Antigravity](./antigravity) | `CADENCE.md` / `AGENTS.md` || ✓ stdio |
22+
| [OpenCode](./opencode) | `AGENTS.md` || ✓ stdio |
23+
24+
For Claude Desktop and Claude API setup, see the [Claude](./claude) page.
25+
26+
## Don't see your editor?
27+
28+
Any MCP-aware editor can use the Cadence MCP server — point it at `flow mcp` as a stdio command (Flow CLI ≥ v2.16.0). Any agent that reads project-level context files (`AGENTS.md`, etc.) can use the [LLM endpoints](../llm-endpoints) for the full Cadence reference. [Open an issue](https://github.com/onflow/cadence-lang.org/issues) if you'd like first-class instructions for a specific editor.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"title": "Integrations",
3+
"pages": [
4+
"antigravity",
5+
"claude",
6+
"cursor",
7+
"codex",
8+
"gemini",
9+
"opencode",
10+
"..."
11+
]
12+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
title: OpenCode
3+
---
4+
5+
Configure [OpenCode](https://opencode.ai) to work with Cadence.
6+
7+
## Add Cadence as project context
8+
9+
OpenCode reads project-level context files automatically. Add a section to your `AGENTS.md` pointing at the [`/llms-full.txt`](../llm-endpoints) endpoint:
10+
11+
```markdown
12+
## Cadence Development
13+
14+
This project uses Cadence, the smart contract language for the Flow blockchain.
15+
Full reference: https://cadence-lang.org/llms-full.txt
16+
Quick index: https://cadence-lang.org/llms.txt
17+
18+
Resources use `@` prefix and must be moved with `<-`. Use `access(all)` for public access (not `pub`). Capability-based access control with entitlements.
19+
```
20+
21+
If you also use Claude Code, install the [flow-ai-tools](https://github.com/onflow/flow-ai-tools) marketplace there for richer skill coverage — it ships the full Cadence + Flow skill suite (see [Skills](../skills)).
22+
23+
## Add MCP server
24+
25+
Add the Cadence MCP server to your OpenCode configuration — calls the Flow CLI's built-in `flow mcp` subcommand:
26+
27+
```json
28+
{
29+
"mcp": {
30+
"cadence-mcp": {
31+
"type": "local",
32+
"command": ["flow", "mcp"]
33+
}
34+
}
35+
}
36+
```
37+
38+
This gives OpenCode access to all [MCP tools](../mcp-server) — Cadence code checking, type inspection, symbol lookup, contract source fetching, and read-only on-chain script execution. Requires [Flow CLI](https://developers.flow.com/tools/flow-cli) ≥ v2.16.0.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
title: LLM Endpoints
3+
description: "Plain-text endpoints for Cadence docs optimized for LLM context windows: /llms.txt for a page index and /llms-full.txt for the complete documentation as plain text."
4+
---
5+
6+
The site exposes plain-text endpoints optimized for LLM context windows. These are useful for RAG pipelines or injecting Cadence documentation directly into prompts.
7+
8+
## Endpoints
9+
10+
| Endpoint | Description |
11+
|---|---|
12+
| [`/llms.txt`](/llms.txt) | Index of all documentation pages with links |
13+
| [`/llms-full.txt`](/llms-full.txt) | Complete documentation as plain text |
14+
15+
## llms.txt
16+
17+
A lightweight index listing every documentation page with its title and URL. Use this when you need to find the right page before fetching its full content.
18+
19+
```bash
20+
curl https://cadence-lang.org/llms.txt
21+
```
22+
23+
## llms-full.txt
24+
25+
The complete processed markdown for all documentation pages, concatenated into a single file. Use this when you want to inject the entire Cadence knowledge base into an LLM context window.
26+
27+
```bash
28+
curl https://cadence-lang.org/llms-full.txt
29+
```
30+
31+
:::tip
32+
You can also append `.mdx` to any documentation URL to get raw markdown for a single page. For example: `https://cadence-lang.org/docs/language/resources.mdx`
33+
:::

0 commit comments

Comments
 (0)