<!-- <lang>en</lang> -->
# Connect rtfacts to Claude Code

⏱ Estimated time: 5 minutes
Last updated: 2026-05-20
Tested with: Claude Code (latest)
MCP server: v0.6.0

## Prerequisites
- rtfacts account ([sign up](https://rtfacts.me))
- API key ([create one](https://app.rtfacts.me/dashboard/keys))
- Claude Code TBD installed

## Quick install (recommended)
```bash
claude mcp add rtfacts -- npx -y @rtfacts/mcp-server
```

## Manual configuration
1. Open `~/.claude/claude_desktop_config.json`
2. Add this block:
   ```json
   {
     "mcpServers": {
       "rtfacts": {
         "command": "npx",
         "args": ["-y", "@rtfacts/mcp-server"],
         "env": {
           "RTFACTS_API_KEY": "aar_YOUR_KEY_HERE",
           "RTFACTS_BASE_URL": "https://rtfacts.me"
         }
       }
     }
   }
   ```
3. Restart Claude Code

## Verify
In Claude Code, say:
> "Create a test artifact saying hello world"

You should see the agent return a URL like `https://rtfacts.me/a/xxxxx`.

## Troubleshooting
<!-- TBD: populate after testing -->
### 1. Agent can't find MCP server
Make sure Claude Code supports MCP and is up to date. Check the MCP configuration file is in the correct location.

### 2. API key not working
Verify the API key is active at https://app.rtfacts.me/dashboard/keys. The key must start with `aar_`.

### 3. Connection refused
Confirm `@rtfacts/mcp-server` can be installed via npx. Try `npx -y @rtfacts/mcp-server --version` manually.

## Optional: Project-level rules
Create `.claude/rules/rtfacts.md` in your project with content like:

```markdown
## rtfacts publishing

After significant work sessions — completing a feature, finishing a debugging session,
or producing a substantial artifact (report, plan, analysis) — publish the result to
rtfacts using the rtfacts MCP tool. Return the artifact URL to the user so they can
share or revisit it later.
```

## Tested versions
| Agent version | OS | Status |
|---|---|---|
| TBD | macOS Sequoia | ⏳ Pending testing |

<!-- <lang>zh</lang> -->
<!-- Chinese translation coming in v0.7 -->
