# Using Openfort with AI

<Cards>
  <Card description="Give your agent access to your Openfort account to create wallets, manage policies, and send transactions." to="#openfort-cli" icon="lucide:terminal" title="Openfort CLI" />

  <Card description="Feed your agent Openfort docs via skills, llms.txt, Markdown pages, and MCP." to="#openfort-docs" icon="lucide:blocks" title="Openfort Docs" />
</Cards>

## Openfort CLI

The [Openfort CLI](/docs/overview/building-with-cli) exposes every command as an MCP tool, allowing AI agents to **create wallets, manage policies, send transactions, and more** — directly from your AI assistant.

Paste this into your agent to set up the Openfort CLI as an MCP server:

:::code-group

```bash [Claude Code]
claude -p "Read https://github.com/openfort-xyz/agent-skills and set up Openfort CLI"
```

```bash [Amp]
amp --execute "Read https://github.com/openfort-xyz/agent-skills and set up Openfort CLI"
```

```bash [Codex CLI]
codex exec "Read https://github.com/openfort-xyz/agent-skills and set up Openfort CLI"
```

:::

### Quick Setup

Register the CLI as an MCP server with a single command:

```bash
openfort mcp add
```

This auto-detects your installed AI agents (Claude Code, Cursor, Amp) and registers the CLI with all of them. To target a specific agent:

```bash
openfort mcp add --agent claude-code
openfort mcp add --agent cursor
openfort mcp add --agent amp
```

Or configure manually:

```json
{
  "mcpServers": {
    "openfort": {
      "command": "npx",
      "args": ["@openfort/cli", "--mcp"],
      "env": {
        "OPENFORT_API_KEY": "sk_test_..."
      }
    }
  }
}
```

:::warning
The CLI MCP server runs commands with your credentials. Make sure `OPENFORT_API_KEY` (and optionally `OPENFORT_WALLET_SECRET` and `OPENFORT_PUBLISHABLE_KEY`) are available as environment variables, or run `openfort login` and `openfort backend-wallet setup` first.
:::

### Available Tools

Every CLI command is exposed as an MCP tool. Subcommand paths are joined with underscores:

| Tool | Description |
| --- | --- |
| `accounts_list` | List all accounts across chains |
| `accounts_evm_create` | Create a new EVM backend wallet |
| `accounts_evm_send-transaction` | Send a gasless EVM transaction |
| `accounts_solana_create` | Create a new Solana backend wallet |
| `accounts_solana_transfer` | Transfer SOL or SPL tokens |
| `contracts_create` | Register a smart contract |
| `policies_create` | Create an access-control policy |
| `policies_evaluate` | Pre-flight check if an operation is allowed |
| `sponsorship_create` | Create a fee sponsorship |
| `transactions_create` | Create a transaction intent |
| `transactions_estimate` | Estimate gas cost |
| `users_list` | List users |
| `sessions_create` | Create a session key |
| `message_hash` | Hash a message with keccak256 |

:::tip
Use both MCP servers together — the docs server for context and the CLI server for execution. For example, an AI agent can look up how policies work via the docs MCP, then create one via the CLI MCP.
:::

## Openfort Docs

### Docs skill

Install the [Openfort Agent Skills](https://github.com/openfort-xyz/agent-skills) to give AI coding agents (Amp, Claude Code, etc.) access to Openfort documentation, source code via MCP, and examples.

```bash
npx skills add openfort-xyz/agent-skills
```

Once installed, the agent uses it automatically when relevant tasks are detected. Check out [`openfort-xyz/agent-skills`](https://github.com/openfort-xyz/agent-skills) for more info on available skills.

Or manually:

```bash
$ git clone https://github.com/openfort-xyz/agent-skills.git
$ cp -r agent-skills/skills/openfort ~/.config/agents/skills/
```

Or add to your project's [`.agents/skills/`](https://github.com/openfort-xyz/agent-skills/tree/main/skills) directory for project-specific access.

### Read docs as Markdown

Every page on this site is available as plain Markdown — append `.md` to any URL:

```text
https://www.openfort.io/docs/products/embedded-wallet/react.md
```

This is useful for copying documentation into AI conversations or for custom integrations.

AI user agents are automatically detected and served raw Markdown instead of rendered HTML. This provides better token efficiency and easier parsing for LLMs.

For LLM consumption, two [`llms.txt`](https://llmstxt.org/) files are served at the root:

| URL | Contents |
|---|---|
| [/llms.txt](https://www.openfort.io/docs/llms.txt) | Concise index of all pages with titles and descriptions |
| [/llms-full.txt](https://www.openfort.io/docs/llms-full.txt) | Complete documentation in a single file |

### MCP server

The docs include a built-in [Model Context Protocol (MCP)](https://modelcontextprotocol.io) server for programmatic navigation of documentation and source code.

:::code-group

```bash [Claude Code]
claude mcp add --transport http openfort-docs https://www.openfort.io/api/mcp
```

```bash [Codex CLI]
codex mcp add openfort-docs --url https://www.openfort.io/api/mcp
```

```bash [Amp]
amp mcp add openfort-docs https://www.openfort.io/api/mcp
```

:::

Or configure manually:

```json
{
  "mcpServers": {
    "openfort-docs": {
      "url": "https://www.openfort.io/api/mcp"
    }
  }
}
```

#### Available Tools

| Tool | Description |
| --- | --- |
| `list_pages` | List all documentation pages with their paths |
| `read_page` | Read the content of a specific documentation page |
| `search_docs` | Search documentation for a query string |

#### Source Code Navigation

The documentation MCP server also provides access to source code repositories:

| Tool | Description |
| --- | --- |
| `list_sources` | List available source code repositories |
| `list_source_files` | List files in a directory |
| `read_source_file` | Read a source code file |
| `get_file_tree` | Get a recursive file tree |
| `search_source` | Search source code for a pattern |
