> ## Documentation Index
> Fetch the complete documentation index at: https://monitor-docs.solobiz.academy/llms.txt
> Use this file to discover all available pages before exploring further.

# Connect Claude Code

> Add Social Monitor Hub as an MCP server in Claude Code.

Checked against Claude Code 2.1.329 on 2026-11-20. Command syntax changes between versions: if a command fails, use the JSON below.

## Steps

1. Put the key in your shell profile so it survives restarts (an `export` typed inside an agent's tool shell is lost when that shell exits, and the client then gets 401):

   ```bash theme={null}
   echo 'export SOCIAL_MONITOR_KEY=smk_xxxxxxxx_xxxxxxxx' >> ~/.zshrc   # or ~/.bashrc
   ```

   Open a **new** terminal and start `claude` from there.

2. Add the server:

   ```bash theme={null}
   claude mcp add --transport http social-monitor https://monitor.solobiz.academy/api/mcp \
     --header 'Authorization: Bearer ${SOCIAL_MONITOR_KEY}'
   ```

   Single quotes keep `${SOCIAL_MONITOR_KEY}` unexpanded, so the key is not written to the config file. Claude Code expands it at connect time. `claude mcp add` does not validate credentials: a wrong key only fails later.

3. Restart the session, then verify:

   ```bash theme={null}
   claude mcp list
   ```

   Inside a session run `/mcp`. `social-monitor` must show `Connected`.

4. Ask the agent to call `list_channels` and report the channels.

## Scope

| Flag | Stored in | Shared |
| - | - | - |
| (default) local | `~/.claude.json`, per project | No |
| `--scope project` | `.mcp.json` in the repo | Yes, via git. Keep the key out of it: it uses `${SOCIAL_MONITOR_KEY}` |
| `--scope user` | `~/.claude.json` | No, all projects |

## If the command fails: JSON config

Add to `.mcp.json` (project) or `~/.claude.json`:

```json theme={null}
{
  "mcpServers": {
    "social-monitor": {
      "type": "http",
      "url": "https://monitor.solobiz.academy/api/mcp",
      "headers": { "Authorization": "Bearer ${SOCIAL_MONITOR_KEY}" }
    }
  }
}
```

## Troubleshooting

| Symptom | Fix |
| - | - |
| `Failed to connect`, 401 | Key wrong, revoked, or env var not set in the shell that started Claude Code |
| `Pending approval` | Run `claude` interactively and approve the project server |
| Tools missing | Restart the session after adding the server |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.