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

# Installation

> Install SHARC MCP server and configure your environment

SHARC runs as an MCP (Model Context Protocol) server that connects to your AI assistant. Most users never need to install it manually — your client downloads it on demand via `npx`.

## Requirements

* **Node.js 18+** (required — the SHARC MCP server runs on Node)
* **SHARC API key** — sign in at [sharc.sh](https://www.sharc.sh) with Google or GitHub, then create a key at [Dashboard → API Keys](https://www.sharc.sh/dashboard/api-keys)
* **An MCP-compatible client** — Claude Code, Codex, Droid, OpenCode, Cursor, etc.

<Note>
  Bun is **not supported**. Bun blocks postinstall scripts by default, which prevents the AST splitter's native parsers from installing correctly. Use `npx` (npm) or `pnpm dlx` instead.
</Note>

## Recommended: run via `npx`

Almost every MCP client wraps SHARC as `npx -y @sharc-code/mcp@latest`. This downloads and runs the latest version on demand — no global install required.

```bash theme={null}
npx -y @sharc-code/mcp@latest
```

The first run takes a few seconds to fetch dependencies; subsequent runs are cached.

If you prefer pnpm:

```bash theme={null}
pnpm dlx @sharc-code/mcp@latest
```

## Client setup

Pick your MCP client for a one-command install:

<CardGroup cols={2}>
  <Card title="Claude Code" href="/getting-started/claude-code" icon="code">
    `claude mcp add` — single-command setup.
  </Card>

  <Card title="Codex" href="/getting-started/codex" icon="terminal">
    `codex mcp add` for the CLI/TUI, or use the Codex GUI.
  </Card>

  <Card title="Droid" href="/getting-started/droid" icon="robot">
    `droid mcp add` — Factory's terminal agent.
  </Card>

  <Card title="OpenCode" href="/getting-started/opencode" icon="square-terminal">
    Drop a snippet into `opencode.json`.
  </Card>
</CardGroup>

For Cursor, Windsurf, VS Code, Zed, Claude Desktop, and other clients, see [Other MCP clients](/getting-started/other-clients).

## Environment variable

SHARC needs a single environment variable. Every client config below sets it for you.

| Variable        | Required | Description                                   |
| --------------- | -------- | --------------------------------------------- |
| `SHARC_API_KEY` | Yes      | Your authentication key (format `sk_mcp_...`) |

## Verify the install

After configuring your client, ask the assistant to list available tools. You should see seven SHARC tools:

* `index_codebase`
* `search_code`
* `clear_index`
* `get_indexing_status`
* `start_watch`
* `stop_watch`
* `get_watch_status`

## Troubleshooting

### "Invalid API key"

* Ensure the key starts with `sk_mcp_`
* Confirm it is set on the SHARC server entry (not a different MCP server)
* Check the key is still active in [Dashboard → API Keys](https://www.sharc.sh/dashboard/api-keys)

### Tools not appearing

1. Restart your client after editing config
2. Check the client's MCP logs for a startup error
3. Verify Node.js 18+ is on your PATH: `node --version`
