agenthive-mcp
Officialagenthive-mcp exposes AgentHive's reviewed team memory to MCP clients as six member-level tools, with stdio or HTTP/SSE serving and admin review actions deliberately excluded.
Retrieve a bounded neighborhood of approved team memory around a topic, with tag filtering, exclusion tags, hop depth, and hub cutoff.
Preview retrieval results as an index of ids, titles, tiers, tags, and token costs without bodies, then fetch full bodies for selected node ids.
Report recurring team knowledge gaps, including gaps that already have pending answers awaiting review.
Log a session's learnings as a pending memory node, optionally with tags, links, agent/task ids, outcome, and turn count.
Confirm or contradict memory nodes actually used; contradictions are routed to human review rather than deleting anything.
Connect from Claude Desktop, Claude Code, Cursor, VS Code/Continue, or remote clients via HTTP/SSE using a personal AgentHive token and team id.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@agenthive-mcp retrieve context about the auth refactor before I start"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
agenthive-mcp
A Model Context Protocol (MCP) server that exposes AgentHive's shared, reviewed team memory to LLM clients (Claude Desktop, Claude Code, Cursor, VS Code, etc.) as native tools, instead of a CLAUDE.md / .cursor/rules instruction block that calls AgentHive's HTTP API by hand.
It ships in two halves, because they run in different places:
The MCP server — tools the model decides to call, inside its loop:
retrieve_context,retrieve_index,fetch_nodes,report_gaps,log_session,confirm_memory.The plugin — hooks the harness spawns, outside the loop, on Claude Code, VS Code, Cursor and Copilot Chat: fact injection, a codebase map, tool pruning, a loop guard, and a session-end backstop. A hook cannot call an MCP tool, which is why these are separate and why the plugin talks to the AgentHive API directly.
Install both; neither needs the other to work:
pip install agenthive-mcp
agenthive install --harness claude # the plugin; or: vscode, cursor
agenthive doctorplus your MCP client's own config for the server - see Client integrations.
PyPI:
pip install agenthive-mcp · Image:ghcr.io/polarpoint-io/agenthive-mcp:latest · Repo: https://github.com/polarpoint-io/agenthive-mcp
Table of contents
Related MCP server: AgentGo
Quick start
You need an AgentHive team and a personal token first - see AgentHive's onboarding guide if you don't have one yet.
1. pip (no Docker)
pip install agenthive-mcp
export AGENTHIVE_URL=https://your-agenthive-host
export AGENTHIVE_TOKEN=your_personal_token
export AGENTHIVE_TEAM_ID=your_team_id
agenthive-mcp # stdio
TRANSPORT=http HTTP_PORT=8000 agenthive-mcp # HTTP/SSE2. Docker (stdio — launched by your MCP client)
docker pull ghcr.io/polarpoint-io/agenthive-mcp:latest
docker run --rm -i \
-e AGENTHIVE_URL=https://your-agenthive-host \
-e AGENTHIVE_TOKEN=your_personal_token \
-e AGENTHIVE_TEAM_ID=your_team_id \
ghcr.io/polarpoint-io/agenthive-mcp:latest3. Docker (HTTP/SSE — standalone service)
docker run --rm \
-p 8000:8000 \
-e AGENTHIVE_URL=https://your-agenthive-host \
-e AGENTHIVE_TOKEN=your_personal_token \
-e AGENTHIVE_TEAM_ID=your_team_id \
-e TRANSPORT=http \
ghcr.io/polarpoint-io/agenthive-mcp:latest
# SSE endpoint: http://localhost:8000/sseUse your own token, not a shared or admin one - whatever it can do (member or admin) is what this server can do on your behalf, nothing more or less (see Security notes).
Configuration
Variable | Required | Default | Description |
| yes | — | Base URL of a running AgentHive service |
| yes | — | Your personal AgentHive token |
| yes | — | Your AgentHive team id |
| no |
|
|
| no |
| Bind host (HTTP mode) |
| no |
| Bind port (HTTP mode) |
| no |
| Python log level |
See .env.example for a copy-pasteable template.
Client integrations
Each client supports two transport options — pip (recommended, no Docker required) or Docker.
# Install once
pip install agenthive-mcpClaude Desktop
Edit ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows).
pip (recommended)
{
"mcpServers": {
"agenthive": {
"command": "agenthive-mcp",
"env": {
"AGENTHIVE_URL": "https://your-agenthive-host",
"AGENTHIVE_TOKEN": "your_personal_token",
"AGENTHIVE_TEAM_ID": "your_team_id"
}
}
}
}Docker
{
"mcpServers": {
"agenthive": {
"command": "docker",
"args": [
"run", "--rm", "-i",
"-e", "AGENTHIVE_URL", "-e", "AGENTHIVE_TOKEN", "-e", "AGENTHIVE_TEAM_ID",
"ghcr.io/polarpoint-io/agenthive-mcp:latest"
],
"env": {
"AGENTHIVE_URL": "https://your-agenthive-host",
"AGENTHIVE_TOKEN": "your_personal_token",
"AGENTHIVE_TEAM_ID": "your_team_id"
}
}
}
}Restart Claude Desktop after editing. You should see a hammer icon in the chat confirming the agenthive server is connected with all 6 tools available.
Claude Code
pip (recommended)
pip install agenthive-mcp
claude mcp add agenthive -- agenthive-mcp
# then export your config before running claude:
export AGENTHIVE_URL=https://your-agenthive-host
export AGENTHIVE_TOKEN=your_personal_token
export AGENTHIVE_TEAM_ID=your_team_idDocker
claude mcp add agenthive -- docker run --rm -i \
-e AGENTHIVE_URL -e AGENTHIVE_TOKEN -e AGENTHIVE_TEAM_ID \
ghcr.io/polarpoint-io/agenthive-mcp:latestOr a plain .mcp.json in the repo root works too - same shape as Claude Desktop's config above.
Cursor
Edit ~/.cursor/mcp.json:
pip (recommended)
{
"mcpServers": {
"agenthive": {
"command": "agenthive-mcp",
"env": {
"AGENTHIVE_URL": "https://your-agenthive-host",
"AGENTHIVE_TOKEN": "your_personal_token",
"AGENTHIVE_TEAM_ID": "your_team_id"
}
}
}
}Docker
{
"mcpServers": {
"agenthive": {
"command": "docker",
"args": ["run", "--rm", "-i",
"-e", "AGENTHIVE_URL", "-e", "AGENTHIVE_TOKEN", "-e", "AGENTHIVE_TEAM_ID",
"ghcr.io/polarpoint-io/agenthive-mcp:latest"],
"env": {
"AGENTHIVE_URL": "https://your-agenthive-host",
"AGENTHIVE_TOKEN": "your_personal_token",
"AGENTHIVE_TEAM_ID": "your_team_id"
}
}
}
}VS Code (Continue)
Edit ~/.continue/config.json:
pip (recommended)
{
"mcpServers": [{
"name": "agenthive",
"command": "agenthive-mcp",
"env": {
"AGENTHIVE_URL": "https://your-agenthive-host",
"AGENTHIVE_TOKEN": "your_personal_token",
"AGENTHIVE_TEAM_ID": "your_team_id"
}
}]
}HTTP / SSE (remote or shared server)
If you prefer to run the server as a persistent HTTP service rather than a subprocess - still bound to whichever token you start it with, this is a transport choice, not a different auth model:
# pip
pip install agenthive-mcp
AGENTHIVE_URL=... AGENTHIVE_TOKEN=... AGENTHIVE_TEAM_ID=... TRANSPORT=http HTTP_PORT=8000 agenthive-mcp
# Docker
docker run --rm -p 8000:8000 \
-e AGENTHIVE_URL=... -e AGENTHIVE_TOKEN=... -e AGENTHIVE_TEAM_ID=... \
-e TRANSPORT=http \
ghcr.io/polarpoint-io/agenthive-mcp:latestThen point your MCP client at http://localhost:8000/sse.
Tool reference
Every tool here is a member-role AgentHive call - the same tier your personal token already grants over the API directly. Admin-only calls (list_pending/approve/reject, user management, auto-approve rules) are deliberately not exposed as tools: they exist so a human operates the review gate from the review UI or an admin script, and turning them into agent-callable tools would let an agent approve or reject its own pending memory, which defeats the point of the gate. See AgentHive's ADR.md for why the gate exists, and its README for those calls.
Tool | Description |
| Bounded neighborhood of this team's reviewed, approved memory around a topic ( |
| Same traversal as |
| Full bodies for specific ids from |
| What this team keeps searching for and never finds ( |
| Log what happened this session as a memory node ( |
| Say whether a node you were served was still true in practice ( |
Tool definitions cost tokens too
These definitions are sent on every request for the whole session, so
the tool surface is part of the token bill, not separate from it. The six
above come to roughly 378 tokens. The setup calls - create_agent,
list_agents, create_task, list_tasks - are used once per team and
then never again, so they are off by default; export
AGENTHIVE_MCP_SETUP_TOOLS=1 for the session where you need them and
leave it unset afterwards.
Admin calls are not behind a flag - they are not here at all, for the reason in the paragraph above this table.
Wiring an agent up to actually use these tools
Tools existing in the tool list doesn't make an agent call them unprompted - it needs a line telling it when.
If the repo uses polarpoint-io's platform-standards AGENTS.md template (see ai-capabilities/platform-standards/templates/default-agents-md.md), add it to Zone 3 ("Repo-specific notes" - free, team-owned, and explicitly meant for "context about the domain, gotchas, preferred libraries, links to runbooks"):
## AgentHive
Before starting work, call `retrieve_context` with a short description of
the task. When you're done, call `log_session` summarizing what you did
and learned.Team-specific conventions (which tags to use, the team's AGENTHIVE_TEAM_ID) belong in Zone 2 instead - guarded, but team-owned, meant to extend Zone 1 rather than override it. Don't put either in Zone 1: that's platform-locked, and making AgentHive retrieval mandatory org-wide is a bigger call than one repo should make on its own - it would need a PR to ai-capabilities and platform-team review.
Repos without that template yet can use a plain CLAUDE.md / .cursor/rules line instead - same content, just a different file.
The plugin (Claude Code, VS Code, Cursor, Copilot Chat)
The MCP server can only act when the model chooses to call it. Five
things worth doing cannot wait for that choice, so they run as harness
hooks instead - one implementation in src/agenthive_mcp/hooks.py,
three thin manifests under
plugin/.
What it does | Switch | |
Facts | Injects short team facts at session start, with no anchor and no tool call. The one path that replaces exploration instead of adding to context - which is the only way memory reduces a token bill rather than growing it. |
|
Codemap | Injects a map of what this repo already has - top-level functions/classes/exports per directory - at session start. |
|
Tool pruning | Records which of the loaded tools a session actually used, pools that across the team, and writes a deny list once several people agree. |
|
Loop guard | Notices a turn repeating the same failure and adds one note suggesting a different approach. Local, no model. |
|
Session backstop | Records that a session ended unlogged. Described in full below. | always on |
All default on; set any to off.
Installing it
pip install agenthive-mcp
agenthive install --harness claude # or: vscode, cursor, copilotThat is the whole install. --harness defaults to $AGENTHIVE_HOST, so
on Cursor (where you have to set that variable anyway) agenthive install on its own is enough.
It merges, it does not overwrite. ~/.claude/settings.json is your
file and may already hold your own settings and other people's hooks.
The installer adds its three entries to the events it uses, leaves
everything else alone, backs up what was there to
~/.claude/settings.json.agenthive-bak first, and does nothing at all
on a second run. If the file is not valid JSON it refuses to touch it
rather than guessing.
Look before you leap, if you'd rather:
agenthive install --harness claude --dry-run # print the merged result, write nothing
agenthive install --harness claude --print # just the manifest, for hand-editingAnd to take it back out - exactly the entries it wrote, nothing else:
agenthive uninstall --harness claudeWhere each manifest lands
Harness | Destination | Scope |
Claude Code |
| per user |
VS Code |
| per project - |
Cursor |
| per user |
Copilot Chat |
| per project, same file as VS Code - Copilot Chat runs inside VS Code and reads its hook surface, not a format of its own |
The manifests themselves are in
plugin/
if you'd rather read them before running anything; they are generated
from src/agenthive_mcp/manifests.py and a test fails if the two
disagree, so what you read there is what the installer writes.
On Cursor, AGENTHIVE_HOST is not optional
echo 'export AGENTHIVE_HOST=cursor' >> ~/.zshrc # or ~/.bashrcstop exists in both hook families and carries nothing saying which one
sent it. Without this the sniff can guess Claude Code, and a wrong guess
turns session-end into a silent no-op - no error, nothing in the
review queue, and no sign anything is wrong.
Then give it credentials, and check
The plugin does not inherit your MCP client's env block - the
harness spawns it as a separate process. If your AGENTHIVE_* variables
only live in claude_desktop_config.json or ~/.cursor/mcp.json, the
hook starts unconfigured and writes nothing, silently. Put them in your
shell profile instead (full detail under
Giving the hook its credentials):
# ~/.zshrc or ~/.bashrc
export AGENTHIVE_URL=https://your-agenthive-host
export AGENTHIVE_TEAM_ID=your_team_id
export AGENTHIVE_TOKEN=your_personal_tokenThen, in a new shell:
agenthive doctorwhich prints the harness it detected, whether the config resolved, and whether the server answered - in that order, because that is the order in which it tends to go wrong.
Three guarantees hold across all four: it never stops a turn, it never
calls a model, and it never breaks a session - every handler is wrapped
and the entry point always exits 0. Full detail, including the VS Code
preview caveat and Copilot Business policy, is in
plugin/README.md.
Capturing sessions the agent forgot to log (agenthive-log)
log_session only runs when the model decides to call it. Sessions that
crash, hit the context limit, or end because someone closed the terminal
never reach it, and those are exactly the sessions worth a note.
A lifecycle hook fires regardless - but a hook cannot call an MCP
tool. MCP tools are invoked by the model inside its loop; hooks are
shell commands the harness spawns outside it. The two paths don't
connect. So this package ships a second console script, agenthive-log,
which talks to the AgentHive API directly using the same
AGENTHIVE_URL / AGENTHIVE_TOKEN / AGENTHIVE_TEAM_ID variables the
MCP server reads.
It is a backstop, not a replacement. A hook receives metadata, not understanding - it knows a session ended, not what was learned. Writing a confident-looking node from that would fill the review queue with filler and devalue the one thing in AgentHive that needs a human's attention. So:
if
log_sessionalready succeeded in this session, the hook writes nothing;if it didn't, the hook writes one short node tagged
unsummarisedandhook-captured, recording that a session happened and was never summarised.
The gap becomes visible. It does not get filled with noise.
Giving the hook its credentials
The hook does not inherit the MCP server's environment. If your
AGENTHIVE_* variables live in an env block in claude_desktop_config.json
or ~/.cursor/mcp.json, those configure that subprocess only - the
harness spawns the hook separately and it will start up unconfigured,
log not configured, skipping to stderr, and write nothing. Silently,
as far as the review queue is concerned.
Pick one of these:
Shell profile (simplest when the harness is launched from a shell):
# ~/.zshrc or ~/.bashrc
export AGENTHIVE_URL=https://your-agenthive-host
export AGENTHIVE_TEAM_ID=your_team_id
export AGENTHIVE_TOKEN=your_personal_tokenNote that a GUI-launched app may not see these. On macOS, launchctl setenv or a ~/Library/LaunchAgents entry covers that case.
Inline on the hook command (explicit, no profile dependency - but it puts the token in a config file, so check the file's permissions and keep it out of version control):
{
"version": 1,
"hooks": {
"stop": [{
"command": "env AGENTHIVE_URL=https://your-agenthive-host AGENTHIVE_TEAM_ID=your_team_id AGENTHIVE_TOKEN=your_personal_token agenthive-log"
}]
}
}A wrapper script (best of both - the token stays in one
chmod 600 file, and the hook command stays clean):
#!/usr/bin/env bash
# ~/.local/bin/agenthive-log-hook (chmod +x)
set -a; . "$HOME/.config/agenthive/env"; set +a
exec agenthive-logVerify it either way with the smoke test below - it uses the same code path and the same environment the hook will get.
Claude Code
~/.claude/settings.json:
{
"hooks": {
"SessionEnd": [
{ "hooks": [{ "type": "command", "command": "agenthive-log" }] }
]
}
}Cursor
~/.cursor/hooks.json (or <project>/.cursor/hooks.json, or
/etc/cursor/hooks.json to set it org-wide):
{
"version": 1,
"hooks": {
"stop": [{ "command": "agenthive-log" }]
}
}Hooks defined in more than one location all run, so a
stophook present both globally and in a project fires twice for one session.agenthive-logfingerprints its payload and skips a duplicate inside a 15-minute window, so this is safe - but it's why the dedupe exists.
Safety properties
Property | Behaviour |
Exit code | Always |
Missing config | Logs and skips. Not an error, and it does not suppress a later configured run. |
Failed write | Logs and skips. The send claim is released, so the next firing retries rather than inheriting a marker for a write that never happened. |
Duplicate firing | An atomic |
Suppression scope | Keyed on (API host, team, git top level). A write for one team or repo never silences another's backstop. |
Transcript content | Excluded by default. |
Two residual limitations worth knowing, both deliberate:
Suppression cannot be keyed on a harness session id, because the MCP server has no access to one - it is spawned over stdio and the protocol carries no session identifier. Two concurrent sessions in the same repo against the same team therefore share a key, so a write in either suppresses the other's backstop.
If the MCP server's working directory differs from the hook payload's
cwd, the two keys differ and you get one spare backstop node. That is a reviewable nuisance rather than a loss.
Smoke test
echo '{"hook_event_name":"SessionEnd","session_id":"smoke-test","cwd":"'"$PWD"'"}' \
| agenthive-logIt prints the node id to stderr and exits 0. The node lands in the
review queue tagged unsummarised, where you can reject it.
That last one is deliberate. A transcript contains whatever was pasted
into it, and none of it is wrapped in <private> for us - pasting an
excerpt into shared team memory is how a credential ends up there. The
approval gate would only catch it after it is already stored and
rendered in an admin's browser. Set
AGENTHIVE_HOOK_INCLUDE_TRANSCRIPT=true if your team has decided that
trade is right for them.
Variable | Default | Description |
|
| Append a transcript tail to the backstop node. See above. |
|
| Where the dedupe and "already logged" markers live. |
Backfilling memory from existing docs (import-docs)
A new team usually already has a pile of markdown lying around -
runbooks, READMEs, incident postmortems - that log_session will never
retroactively capture because no agent session wrote it. import-docs
turns a directory of it into the same pending nodes a session's
log_session call would:
agenthive import-docs ./docsOne node per heading-delimited section (not per file - a 400-line
runbook becomes one node per procedure, the same unit AgentHive's
hub_cutoff/index-then-fetch retrieval already assumes a node is), each
tagged doc-import and linked back to its source file.
The path doesn't have to be a local checkout - a git URL works too
(https://, ssh://, git@host:path, or anything ending .git),
and is cloned to a throwaway temp directory for the run and removed
afterward:
agenthive import-docs https://github.com/polarpoint-io/markdown-pol-docs --exclude 'docs/blog/*'Useful for running this from somewhere that doesn't already have the target repo checked out - a scheduled job on a bastion host, say - without a separate clone step of your own to maintain.
This is a terminal command, not an MCP tool an agent can call - see "What is deliberately not a tool here" below for why a bulk action like this stays a human's decision rather than something a session triggers on its own.
Scope it before you point it at a real repo. A docs site is the
common case where this matters: it usually holds genuine operational
material (architecture decisions, runbooks, standards) alongside a
public blog, marketing assets, and page templates that are not team
memory by any reading of the term - and import-docs cannot tell the
difference on its own, because by content alone a blog post reads like
any other markdown file. Run the dry run against the whole tree first;
if the count looks like "every file in the repo" rather than "the docs
that are actually operational knowledge", narrow it with --exclude
before going anywhere near --apply:
agenthive import-docs . --exclude 'docs/blog/*' --exclude 'docs/assets/*' --exclude 'theme/*'--exclude takes an fnmatch glob matched against each file's path
relative to the root you gave; its * already matches across /, so
docs/blog/* excludes everything under docs/blog at any depth - no
** needed. Repeatable.
If the repo already classifies its own docs - mkdocs' own frontmatter
tags: key is common, and often carries exactly the distinction you
want (runbook, kb, adr) - --only-tag uses that instead of
guessing at paths:
agenthive import-docs . --only-tag runbook --only-tag kbOR'd together like AgentHive's own tags filter: a file needs only one
of them. Every imported node keeps its file's frontmatter tags either
way (alongside doc-import and anything from --tag), so they reach
AgentHive as real, filterable tags on the node - retrieve_context(..., tags=["runbook"]) works on them afterward, not just import-docs
itself.
It defaults to a dry run - prints what it would create and writes nothing:
187 chars docs/deploy.md — Rolling back [runbook]
412 chars docs/deploy.md — Blue/green cutover [runbook]
94 chars docs/oncall.md — Paging thresholds [runbook, kb]
3 node(s) would be created, tagged doc-import plus each file's own frontmatter tags (shown above). Each normally starts PENDING until an admin reviews it, unless your AgentHive's own auto-approve/auto-reject rules decide it outright - that's server policy, not something this dry run can predict.
Nothing written - re-run with --apply.Add --apply once the plan looks right. It's safe to re-run by hand -
including before anyone's reviewed the last batch, which is the case
AgentHive's own dedup doesn't cover: create_memory only rejects an
exact title+body repeat against an approved node, so without its own
check this command would resubmit the exact same pending section every
run until someone reviews it. A local marker (same state directory
agenthive-log's hook already uses) remembers what's been submitted
regardless of review status, so a second run on the SAME machine only
queues sections that are new or actually changed:
0 node(s) would be created, tagged doc-import, each normally PENDING until an admin reviews it (unless server policy resolves it outright).
3 already submitted by an earlier run - skipped (would still skip under --apply; --force to include them anyway).
Nothing written - re-run with --apply.Each node's actual outcome - pending, or approved/rejected if your
AgentHive has auto-approve or auto-reject rules configured - is only
known once --apply actually posts it; the summary line breaks the
count down by what the server returned, not an assumption:
pending docs/oncall.md — Paging thresholds
approved docs/deploy.md — Rolling back
2 node(s) logged (1 approved, 1 pending) - a pending one needs an admin's review before it reaches anyone's retrieve_context; an approved one already has.Batching without relying on local state. --limit by itself always
re-slices the same leading N of whatever's left; it only advances to
the next batch because the local dedup marker excludes the previous
batch on a persistent machine. That marker does not survive an
ephemeral CI runner and isn't shared across people running this from
different machines - in either case, --limit alone would reselect
the same first batch forever. --offset N advances explicitly
instead: skip the first N of what's left, then take the next
--limit, no state required.
agenthive import-docs . --offset 50 --limit 50 --apply # the next batch after the first 50Flag | Default | Description |
| (repeatable) | Extra tag alongside the automatic |
| (repeatable) | Skip files whose path matches this glob (e.g. |
| (repeatable) | Skip files whose frontmatter |
| off (whole tree) | Only files git shows changed since this ref. See "Running it automatically" below. |
|
| Drop sections shorter than this - a bare "See also" heading isn't worth a review-queue entry. |
|
| Skip this many of what's left before applying |
| unlimited | Cap how many new nodes one run creates - useful on a first pass over a large docs tree, so the queue fills in batches an admin can actually get through. |
| off | Resubmit sections already submitted by an earlier run, reviewed or not. |
| off (dry run) | Actually write the nodes. Without it, nothing reaches AgentHive. |
Running it automatically (CI)
The local dedup marker above lives under AGENTHIVE_HOOK_STATE_DIR /
XDG_STATE_HOME - fine on a human's own machine, where it persists
between runs on its own. It does not survive an ephemeral CI
runner unless that exact path is wired into the runner's cache step,
and getting that wrong is not a loud failure: the run just quietly
re-walks and resubmits the whole tree every time, because every file
looks "not yet submitted" to a runner with no memory of the last one.
--since REF sidesteps the problem instead of needing the cache fix
at all: it scopes the import to only the markdown git shows changed
between REF and HEAD, so the thing a stateless runner is missing
(what happened last time) is read from the repo's own history, which
the runner already has in its checkout. A GitHub Actions workflow
triggered on push to main, using the previous commit as REF:
name: Backfill AgentHive memory from docs
on:
push:
branches: [main]
jobs:
import:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 2 # need the commit before HEAD for --since
- run: pip install agenthive-mcp
- run: >
agenthive import-docs . --since ${{ github.event.before }}
--exclude 'docs/blog/*' --exclude 'docs/assets/*' --exclude 'theme/*'
--apply
env:
AGENTHIVE_URL: ${{ secrets.AGENTHIVE_URL }}
AGENTHIVE_TOKEN: ${{ secrets.AGENTHIVE_TOKEN }}
AGENTHIVE_TEAM_ID: ${{ secrets.AGENTHIVE_TEAM_ID }}Two things worth deciding deliberately before turning this on, not discovering by accident:
github.event.beforeon the first push after enabling this is the all-zero SHA, which--sincecan't diff against. Run the initial whole-tree backfill by hand first (with--limit, in batches - see above), then let this workflow take over for what changes afterward.Use a token that is not a person's personal one. AgentHive has no separate "service account" concept - a token is just a member's own, same as a human's - so an automated
--applyshould get its own dedicated team member rather than running as someone's personal identity.doc-importalready tags every node it creates either way, so a reviewer can tell these apart from a human'slog_sessionregardless.
What is deliberately not a tool here
AgentHive's memory-processing layer raises four kinds of proposal from how the graph has actually been used: gaps, missing links, tier changes, and auto-approve rules its own review history justifies.
Only the first is exposed as a tool. report_gaps is read-only and
changes what an agent writes at the end of a session, which is the whole
reason it is worth a tool call.
The other three change how the review gate behaves - which memory gets
linked, which gets prioritised, and which skips human review entirely.
Those stay with the humans who own the gate, reachable through the
review UI or an admin script, for the same reason approve and reject
are not tools: an agent that could widen its own auto-approve rules has
been handed the gate it was supposed to be subject to.
Why a separate repo from AgentHive
This started as a module inside the AgentHive repo itself, then moved out: it has its own dependency (mcp), its own release cadence (an IDE integration changes on its own schedule, unrelated to the service's), and no reason to need AgentHive's own container image, Helm chart, or CI matrix rebuilt every time it changes - or vice versa.
It's self-contained: it makes its own plain HTTP calls to a running AgentHive service rather than importing anything from the agenthive repo, so this repo has no dependency on that one at build, install, or test time - only a runtime one, on the base URL of a service you already have running.
Running from source
git clone git@github.com:polarpoint-io/agenthive-mcp.git
cd agenthive-mcp
python -m venv .venv && source .venv/bin/activate
pip install -e .[dev]
export AGENTHIVE_URL=...
export AGENTHIVE_TOKEN=...
export AGENTHIVE_TEAM_ID=...
agenthive-mcp # stdio
TRANSPORT=http HTTP_PORT=8000 agenthive-mcp # HTTP/SSEOr via the Makefile:
make dev # install with dev extras
make test # pytest
make lint # ruff check
make run # stdio
make run-http # HTTP/SSE on :8000
make docker # build the image locallyDevelopment
make dev
make test
make lintThe test suite (tests/test_tools.py) drives the server as a real subprocess over real MCP stdio, using a real mcp.ClientSession - nothing mocked at the protocol layer. The AgentHive side is a small local fake (tests/fake_agenthive.py), not the real service, since this repo shouldn't need AgentHive itself checked out to test its own HTTP plumbing; AgentHive's own approval-gate/retrieval/auth behavior is already covered by its own test suite, in its own repo, against the real server.py. Try this server against a real AgentHive instance manually if you want to confirm the whole chain end to end.
Adding a new tool:
Add a
@mcp.tool()function insrc/agenthive_mcp/server.py, calling_request()fromclient.py. Only for a member-role AgentHive endpoint - see Tool reference.Add a matching route to
tests/fake_agenthive.pyif the endpoint isn't already covered.Add a test in
tests/test_tools.pyusing the existingstdio_client/ClientSessionpattern.
See AGENTS.md for deeper contribution guidance.
Publishing
Releases are fully automated via semantic-release - no manual tagging needed.
How it works
Every push to main runs the CI pipeline:
Test — lint (
ruff) + pytest across Python 3.10 / 3.11 / 3.12Docker — builds and pushes the image to GHCR
Release — semantic-release analyses conventional commits, bumps the version, updates
CHANGELOG.md, publishes to PyPI, and creates a GitHub Release
A release only happens when commits contain a feat:, fix:, or breaking-change - chore:, docs:, ci: commits don't trigger one.
Docker image tags
Tag | When pushed |
| Every merge to |
| Every merge to |
| On a semantic-release version bump |
Required GitHub secrets
Secret | Description |
| Personal access token with |
| PyPI API token for the |
Add both at: GitHub repo → Settings → Secrets and variables → Actions.
Commit conventions
feat: add new tool → minor version bump (0.x.0)
fix: correct response shape → patch bump (0.0.x)
feat!: breaking change → major bump (x.0.0)
chore/docs/ci/test → no releaseSecurity notes
The container runs as a non-root user (
uid 10001).AGENTHIVE_TOKENis read from env vars only - never written to disk.This process holds no state and makes no decisions of its own - every tool call is a pass-through to AgentHive's HTTP API using the caller's own token. It can do exactly what that token already lets it do over the API directly, nothing more.
Admin-only calls (the review gate, user management, auto-approve rules) are deliberately not exposed as tools - see Tool reference.
License
MIT — see LICENSE.
Available Tools
6 toolsconfirm_memoryA
Report on a memory node you actually USED this session.
verdict is "confirmed" or "contradicted". A contradiction never
deletes: the note stops being promoted and goes to a human. Counted
once per person.
Inputs: node_id (required), verdict (required), reason.
fetch_nodesA
Fetch full bodies for specific node ids, in ONE call.
Ids you are not entitled to come back in missing rather than as an
error - that is the review gate working.
Inputs: ids (required).
log_sessionA
Log what this session learned, for the team to reuse.
Call once at the end. The node starts PENDING and is invisible until an admin approves it - that gate is deliberate.
outcome ("succeeded", "partial", "failed") and turns are what
make the team's evidence report possible. Say "failed" when it
failed: a report nobody is honest in looks like data.
Inputs: body (required), title (required), tags, links, +4 more.
report_gapsA
What this team keeps searching for and never finds.
Call at session start. If your work is on this list, your log_session closes a standing gap. Entries flagged awaiting_review already have an answer stuck in the queue - don't write it twice.
Inputs: min_count.
retrieve_contextA
Retrieve this team's reviewed memory around a topic.
Call once at the start of a session so you inherit what teammates
already learned. anchor is the topic to search around. tags
keeps only matching nodes; exclude_tags drops them instead.
Large neighbourhoods come back as an index (titles and per-node costs, no bodies) - follow with fetch_nodes for the ones worth reading.
Inputs: anchor (required), hops, tags, hub_cutoff, +1 more.
retrieve_indexA
Preview what retrieve_context would return, without the bodies.
Returns ids, titles, tiers, tags and what each body would cost.
Follow with fetch_nodes. tags narrows it to nodes carrying at
least one of them; the reserved ones are decision, bugfix,
security_alert, sensitive. exclude_tags does the opposite - drop
any node carrying at least one of them.
Inputs: anchor (required), hops, tags, hub_cutoff, +1 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 6 tools
Each tool maps to a distinct step in the memory lifecycle: preview, retrieve, fetch bodies, confirm existing memory, log new memory, and report gaps. The only real overlap is retrieve_index versus retrieve_context, since retrieve_context can itself return an index for large neighborhoods, but the descriptions clarify preview versus primary retrieval well enough.
All tool names follow the same snake_case verb_noun pattern: retrieve_index, retrieve_context, confirm_memory, fetch_nodes, log_session, report_gaps. Plural nouns are used appropriately for collection-oriented operations.
Six tools is well-scoped for a team memory server, with each tool covering a distinct lifecycle step rather than duplicating functionality. There is no obvious bloat or missing high-level operation.
The surface covers discovery, retrieval, fetching full bodies, confirming or contradicting memory, logging new memory, and reporting gaps. Minor gaps exist around checking the status of one's own pending submissions or editing/retracting a logged node, though admin approval is intentionally outside agent scope.
Maintenance
Related MCP Connectors
A second brain for your AI agent. Shared memory for your team's AI agents, plus public and private knowledge bases — works with ChatGPT, Claude, Cursor and any MCP client.
Real-time chat hub for AI agents — Claude Code, Cursor, Cline, Codex over MCP or REST.
Hand off work between AI agents in any tool. Start Devin or Cursor cloud and share memory.
Persistent memory, hybrid search and a goal graph for AI agents, over stdio or remote HTTP.
Related MCP Servers
- AlicenseNot gradedqualityFmaintenanceEnables AI agents to make outbound phone calls, send SMS, and transcribe recordings via Twilio, while also giving them searchable memory over past Claude Code, Codex CLI, and Cursor sessions stored in local SQLite.111 npmMIT
- AlicenseNot gradedqualityBmaintenanceEnables an AI assistant to delegate coding tasks to local Codex or Claude Code CLIs, monitor their progress, read results, continue sessions, and browse the files in user-approved project workspaces. It exposes these capabilities over Streamable HTTP through a Cloudflare tunnel or locally over stdio, so a remote or cloud client can drive agents running on the user's own machine.60 npm1MIT
- AlicenseNot gradedqualityBmaintenanceConnects ChatGPT and Claude to your own machine so they can read and edit files, search paths and text, run shell, Git, build and test commands, and keep cross-conversation memory and reusable skills. It exposes these capabilities as 14 Model Context Protocol tools over a remote Streamable HTTP endpoint with API key or OAuth authentication, plus an operator dashboard for monitoring and configuration.MIT
- FlicenseNot gradedqualityAmaintenanceExposes a governed, OAuth-gated suite of 38 tools that let web AI assistants like Claude, ChatGPT, and Grok work directly on your local machine — reading and editing files, running whitelisted shell commands, searching, querying SQLite, driving browsers and DevTools, managing background tasks and localhost services, and controlling Git, clipboard, notifications, and Postman. This lets users build, debug, and maintain projects, inspect databases and local APIs, and check on long-running jobs from a browser or phone without granting unrestricted shell access.-