Docs

Connect Claude Code

Claude Code connects to khive over HTTP in one of two ways: you sign in with your khive account in the browser, or Claude Code sends an API key that stays in an environment variable.

You need a khive account with a plan. Signing in needs nothing else. An API key comes from the dashboard (see Quickstart, step 1). Signing in was tested with Claude Code 2.1.300, and the API key steps with Claude Code 2.1.299.

Sign in with your khive account

Add khive without a key:

claude mcp add --transport http --scope user khive https://khive.ai/v1/mcp

--scope user makes khive available in all your projects. Claude Code confirms:

Added HTTP MCP server khive with URL: https://khive.ai/v1/mcp to user config

Until you sign in, claude mcp list shows khive as Needs authentication. Start claude. It reports that one MCP server needs authentication. Run /mcp, select khive and choose Authenticate. Claude Code opens your browser. If it does not, it shows a URL you can copy into the browser yourself.

In the browser, sign in to khive with the link or the six-digit code we email you (see Your account). khive then asks you to approve Claude Code. The page names it as Claude Code (application host: claude.ai, redirecting to: localhost) and warns that it is software running on your own machine, because it receives the sign-in at a localhost address. Click Approve. The browser shows Authentication successful, and Claude Code shows:

Authentication successful. Connected to khive.

Run /mcp again and select khive: its status is connected and authenticated, with the number of tools it offers. Continue with Make the first call.

Use an API key

1. Put your API key in your environment

export KHIVE_API_KEY="<your API key>"

Add the line to your shell profile (for example ~/.zshrc), so every terminal you start Claude Code from has the key.

2. Add khive

claude mcp add --transport http --scope user khive https://khive.ai/v1/mcp \
  --header 'Authorization: ApiKey ${KHIVE_API_KEY}'

Keep the single quotes. They stop your shell from expanding the variable, so Claude Code stores the reference ${KHIVE_API_KEY} instead of the key and reads the key from your environment each time it starts. --scope user makes khive available in all your projects. Claude Code confirms:

Added HTTP MCP server khive with URL: https://khive.ai/v1/mcp to user config

Right after you create a key, the API Keys page in the dashboard shows a version of this command with the key written into it. That version also works, but it stores the key itself in Claude Code's configuration file.

3. Check the connection

claude mcp list

khive should be listed as connected:

khive: https://khive.ai/v1/mcp (HTTP) - ✔ Connected

If it shows Failed to connect with HTTP 401 and a warning that KHIVE_API_KEY is missing, the variable is not set in that terminal. Open a new terminal after editing your profile, or run the export line again.

Make the first call

Start claude and ask in plain language. Claude Code picks the tool. If it asks for permission to use a khive tool, allow it.

What tasks do I have in khive?
list_tasks   { "limit": 100 }

Claude Code has a memory of its own, so when you want something kept in khive, say so:

Save to khive that our release notes go out on Thursdays.
remember   { "content": "Release notes go out on Thursdays.", "memory_type": "semantic" }

remember returns the new memory's id. In a new session, ask for it back:

Ask khive what it remembers about our release notes.
recall_memories   { "query": "release notes" }

Claude Code answers from the stored memory, along with its score.

See your usage

Calls from Claude Code count against your plan like calls from any other client. https://khive.ai/dashboard/usage shows Requests this month, Usage (month to date) and Top verbs.

Remove khive

claude mcp remove khive --scope user

This removes khive from Claude Code but leaves its access in place. If you signed in, open Review or disconnect apps on your account page and click Revoke access next to Claude Code (see Your account). If you used a key, open https://khive.ai/dashboard/keys, click Revoke next to it and then Confirm revoke. Calls made with a revoked key are refused.

Questions: contact@khive.ai.