agenthive-mcp 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Surj Bains
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,431 @@
1
+ Metadata-Version: 2.4
2
+ Name: agenthive-mcp
3
+ Version: 1.0.0
4
+ Summary: MCP server exposing AgentHive's shared team memory as native tools for Cursor and Claude Code
5
+ Author: Surj Bains
6
+ License: MIT License
7
+
8
+ Copyright (c) 2026 Surj Bains
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Project-URL: Homepage, https://github.com/polarpoint-io/agenthive-mcp
29
+ Project-URL: AgentHive, https://github.com/polarpoint-io/agenthive
30
+ Keywords: mcp,agenthive,memory,coding-agents,platform-engineering
31
+ Classifier: Development Status :: 3 - Alpha
32
+ Classifier: Intended Audience :: Developers
33
+ Classifier: License :: OSI Approved :: MIT License
34
+ Classifier: Programming Language :: Python :: 3
35
+ Classifier: Programming Language :: Python :: 3.10
36
+ Classifier: Programming Language :: Python :: 3.11
37
+ Classifier: Programming Language :: Python :: 3.12
38
+ Requires-Python: >=3.10
39
+ Description-Content-Type: text/markdown
40
+ License-File: LICENSE
41
+ Requires-Dist: mcp<2,>=1.2.0
42
+ Provides-Extra: dev
43
+ Requires-Dist: pytest>=8; extra == "dev"
44
+ Requires-Dist: anyio>=4.0; extra == "dev"
45
+ Requires-Dist: ruff>=0.4; extra == "dev"
46
+ Dynamic: license-file
47
+
48
+ # agenthive-mcp
49
+
50
+ ![agenthive-mcp hero](docs/hero.svg)
51
+
52
+ [![CI](https://github.com/polarpoint-io/agenthive-mcp/actions/workflows/ci.yml/badge.svg)](https://github.com/polarpoint-io/agenthive-mcp/actions/workflows/ci.yml)
53
+ [![License](https://img.shields.io/github/license/polarpoint-io/agenthive-mcp)](LICENSE)
54
+
55
+ A Model Context Protocol (MCP) server that exposes [AgentHive](https://github.com/polarpoint-io/agenthive)'s shared, reviewed team memory to LLM clients (Claude Desktop, Claude Code, Cursor, VS Code, etc.) - `retrieve_context`, `log_session`, `create_agent`, `list_agents`, `create_task`, and `list_tasks` as native tools, instead of a `CLAUDE.md` / `.cursor/rules` instruction block that calls AgentHive's HTTP API by hand.
56
+
57
+ > **PyPI**: `pip install agenthive-mcp` &nbsp;·&nbsp; **Image**: `ghcr.io/polarpoint-io/agenthive-mcp:latest` &nbsp;·&nbsp; **Repo**: <https://github.com/polarpoint-io/agenthive-mcp>
58
+
59
+ ## Table of contents
60
+
61
+ - [Quick start](#quick-start)
62
+ - [Configuration](#configuration)
63
+ - [Client integrations](#client-integrations)
64
+ - [Tool reference](#tool-reference)
65
+ - [Wiring an agent up to actually use these tools](#wiring-an-agent-up-to-actually-use-these-tools)
66
+ - [Why a separate repo from AgentHive](#why-a-separate-repo-from-agenthive)
67
+ - [Running from source](#running-from-source)
68
+ - [Development](#development)
69
+ - [Publishing](#publishing)
70
+ - [Security notes](#security-notes)
71
+
72
+
73
+ ## Quick start
74
+
75
+ You need an AgentHive team and a personal token first - see [AgentHive's onboarding guide](https://github.com/polarpoint-io/agenthive/blob/main/ONBOARDING.md) if you don't have one yet.
76
+
77
+ ### 1. pip (no Docker)
78
+
79
+ ```bash
80
+ pip install agenthive-mcp
81
+ export AGENTHIVE_URL=https://your-agenthive-host
82
+ export AGENTHIVE_TOKEN=your_personal_token
83
+ export AGENTHIVE_TEAM_ID=your_team_id
84
+
85
+ agenthive-mcp # stdio
86
+ TRANSPORT=http HTTP_PORT=8000 agenthive-mcp # HTTP/SSE
87
+ ```
88
+
89
+ ### 2. Docker (stdio — launched by your MCP client)
90
+
91
+ ```bash
92
+ docker pull ghcr.io/polarpoint-io/agenthive-mcp:latest
93
+
94
+ docker run --rm -i \
95
+ -e AGENTHIVE_URL=https://your-agenthive-host \
96
+ -e AGENTHIVE_TOKEN=your_personal_token \
97
+ -e AGENTHIVE_TEAM_ID=your_team_id \
98
+ ghcr.io/polarpoint-io/agenthive-mcp:latest
99
+ ```
100
+
101
+ ### 3. Docker (HTTP/SSE — standalone service)
102
+
103
+ ```bash
104
+ docker run --rm \
105
+ -p 8000:8000 \
106
+ -e AGENTHIVE_URL=https://your-agenthive-host \
107
+ -e AGENTHIVE_TOKEN=your_personal_token \
108
+ -e AGENTHIVE_TEAM_ID=your_team_id \
109
+ -e TRANSPORT=http \
110
+ ghcr.io/polarpoint-io/agenthive-mcp:latest
111
+ # SSE endpoint: http://localhost:8000/sse
112
+ ```
113
+
114
+ Use 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](#security-notes)).
115
+
116
+
117
+ ## Configuration
118
+
119
+ | Variable | Required | Default | Description |
120
+ |---|---|---|---|
121
+ | `AGENTHIVE_URL` | yes | — | Base URL of a running AgentHive service |
122
+ | `AGENTHIVE_TOKEN` | yes | — | Your personal AgentHive token |
123
+ | `AGENTHIVE_TEAM_ID` | yes | — | Your AgentHive team id |
124
+ | `TRANSPORT` | no | `stdio` | `stdio` or `http` |
125
+ | `HTTP_HOST` | no | `0.0.0.0` | Bind host (HTTP mode) |
126
+ | `HTTP_PORT` | no | `8000` | Bind port (HTTP mode) |
127
+ | `LOG_LEVEL` | no | `INFO` | Python log level |
128
+
129
+ See [`.env.example`](.env.example) for a copy-pasteable template.
130
+
131
+
132
+ ## Client integrations
133
+
134
+ Each client supports two transport options — **pip** (recommended, no Docker required) or **Docker**.
135
+
136
+ ```bash
137
+ # Install once
138
+ pip install agenthive-mcp
139
+ ```
140
+
141
+ ---
142
+
143
+ ### Claude Desktop
144
+
145
+ Edit `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) or `%APPDATA%\Claude\claude_desktop_config.json` (Windows).
146
+
147
+ **pip (recommended)**
148
+ ```json
149
+ {
150
+ "mcpServers": {
151
+ "agenthive": {
152
+ "command": "agenthive-mcp",
153
+ "env": {
154
+ "AGENTHIVE_URL": "https://your-agenthive-host",
155
+ "AGENTHIVE_TOKEN": "your_personal_token",
156
+ "AGENTHIVE_TEAM_ID": "your_team_id"
157
+ }
158
+ }
159
+ }
160
+ }
161
+ ```
162
+
163
+ **Docker**
164
+ ```json
165
+ {
166
+ "mcpServers": {
167
+ "agenthive": {
168
+ "command": "docker",
169
+ "args": [
170
+ "run", "--rm", "-i",
171
+ "-e", "AGENTHIVE_URL", "-e", "AGENTHIVE_TOKEN", "-e", "AGENTHIVE_TEAM_ID",
172
+ "ghcr.io/polarpoint-io/agenthive-mcp:latest"
173
+ ],
174
+ "env": {
175
+ "AGENTHIVE_URL": "https://your-agenthive-host",
176
+ "AGENTHIVE_TOKEN": "your_personal_token",
177
+ "AGENTHIVE_TEAM_ID": "your_team_id"
178
+ }
179
+ }
180
+ }
181
+ }
182
+ ```
183
+
184
+ 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.
185
+
186
+ ---
187
+
188
+ ### Claude Code
189
+
190
+ **pip (recommended)**
191
+ ```bash
192
+ pip install agenthive-mcp
193
+
194
+ claude mcp add agenthive -- agenthive-mcp
195
+ # then export your config before running claude:
196
+ export AGENTHIVE_URL=https://your-agenthive-host
197
+ export AGENTHIVE_TOKEN=your_personal_token
198
+ export AGENTHIVE_TEAM_ID=your_team_id
199
+ ```
200
+
201
+ **Docker**
202
+ ```bash
203
+ claude mcp add agenthive -- docker run --rm -i \
204
+ -e AGENTHIVE_URL -e AGENTHIVE_TOKEN -e AGENTHIVE_TEAM_ID \
205
+ ghcr.io/polarpoint-io/agenthive-mcp:latest
206
+ ```
207
+
208
+ Or a plain `.mcp.json` in the repo root works too - same shape as Claude Desktop's config above.
209
+
210
+ ---
211
+
212
+ ### Cursor
213
+
214
+ Edit `~/.cursor/mcp.json`:
215
+
216
+ **pip (recommended)**
217
+ ```json
218
+ {
219
+ "mcpServers": {
220
+ "agenthive": {
221
+ "command": "agenthive-mcp",
222
+ "env": {
223
+ "AGENTHIVE_URL": "https://your-agenthive-host",
224
+ "AGENTHIVE_TOKEN": "your_personal_token",
225
+ "AGENTHIVE_TEAM_ID": "your_team_id"
226
+ }
227
+ }
228
+ }
229
+ }
230
+ ```
231
+
232
+ **Docker**
233
+ ```json
234
+ {
235
+ "mcpServers": {
236
+ "agenthive": {
237
+ "command": "docker",
238
+ "args": ["run", "--rm", "-i",
239
+ "-e", "AGENTHIVE_URL", "-e", "AGENTHIVE_TOKEN", "-e", "AGENTHIVE_TEAM_ID",
240
+ "ghcr.io/polarpoint-io/agenthive-mcp:latest"],
241
+ "env": {
242
+ "AGENTHIVE_URL": "https://your-agenthive-host",
243
+ "AGENTHIVE_TOKEN": "your_personal_token",
244
+ "AGENTHIVE_TEAM_ID": "your_team_id"
245
+ }
246
+ }
247
+ }
248
+ }
249
+ ```
250
+
251
+ ---
252
+
253
+ ### VS Code (Continue)
254
+
255
+ Edit `~/.continue/config.json`:
256
+
257
+ **pip (recommended)**
258
+ ```json
259
+ {
260
+ "mcpServers": [{
261
+ "name": "agenthive",
262
+ "command": "agenthive-mcp",
263
+ "env": {
264
+ "AGENTHIVE_URL": "https://your-agenthive-host",
265
+ "AGENTHIVE_TOKEN": "your_personal_token",
266
+ "AGENTHIVE_TEAM_ID": "your_team_id"
267
+ }
268
+ }]
269
+ }
270
+ ```
271
+
272
+ ---
273
+
274
+ ### HTTP / SSE (remote or shared server)
275
+
276
+ 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:
277
+
278
+ ```bash
279
+ # pip
280
+ pip install agenthive-mcp
281
+ AGENTHIVE_URL=... AGENTHIVE_TOKEN=... AGENTHIVE_TEAM_ID=... TRANSPORT=http HTTP_PORT=8000 agenthive-mcp
282
+
283
+ # Docker
284
+ docker run --rm -p 8000:8000 \
285
+ -e AGENTHIVE_URL=... -e AGENTHIVE_TOKEN=... -e AGENTHIVE_TEAM_ID=... \
286
+ -e TRANSPORT=http \
287
+ ghcr.io/polarpoint-io/agenthive-mcp:latest
288
+ ```
289
+
290
+ Then point your MCP client at `http://localhost:8000/sse`.
291
+
292
+
293
+ ## Tool reference
294
+
295
+ 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.
296
+
297
+ | Tool | Description |
298
+ |---|---|
299
+ | `retrieve_context` | Bounded neighborhood of this team's reviewed, approved memory around a topic (`anchor`, `hops=2`, `hub_cutoff=15`) |
300
+ | `log_session` | Log what happened this session as a memory node (`title`, `body`, `tags`, `links`, `agent_id`, `task_id`) - starts `pending` |
301
+ | `create_agent` | Register an agent identity (`name`, `description`, `system_prompt`) so sessions can be attributed to it |
302
+ | `list_agents` | List agent identities already registered with the team |
303
+ | `create_task` | Register a task (`name`, `description`) so sessions can be scoped to it |
304
+ | `list_tasks` | List tasks already registered with the team |
305
+
306
+
307
+ ## Wiring an agent up to actually use these tools
308
+
309
+ Tools existing in the tool list doesn't make an agent call them unprompted - it needs a line telling it when.
310
+
311
+ If the repo uses polarpoint-io's platform-standards `AGENTS.md` template (see [`ai-capabilities/platform-standards/templates/default-agents-md.md`](https://github.com/polarpoint-io/ai-capabilities/blob/main/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"):
312
+
313
+ ```markdown
314
+ ## AgentHive
315
+
316
+ Before starting work, call `retrieve_context` with a short description of
317
+ the task. When you're done, call `log_session` summarizing what you did
318
+ and learned.
319
+ ```
320
+
321
+ 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.
322
+
323
+ Repos without that template yet can use a plain `CLAUDE.md` / `.cursor/rules` line instead - same content, just a different file.
324
+
325
+
326
+ ## Why a separate repo from AgentHive
327
+
328
+ 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.
329
+
330
+ 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.
331
+
332
+
333
+ ## Running from source
334
+
335
+ ```bash
336
+ git clone git@github.com:polarpoint-io/agenthive-mcp.git
337
+ cd agenthive-mcp
338
+ python -m venv .venv && source .venv/bin/activate
339
+ pip install -e .[dev]
340
+
341
+ export AGENTHIVE_URL=...
342
+ export AGENTHIVE_TOKEN=...
343
+ export AGENTHIVE_TEAM_ID=...
344
+
345
+ agenthive-mcp # stdio
346
+ TRANSPORT=http HTTP_PORT=8000 agenthive-mcp # HTTP/SSE
347
+ ```
348
+
349
+ Or via the Makefile:
350
+
351
+ ```bash
352
+ make dev # install with dev extras
353
+ make test # pytest
354
+ make lint # ruff check
355
+ make run # stdio
356
+ make run-http # HTTP/SSE on :8000
357
+ make docker # build the image locally
358
+ ```
359
+
360
+
361
+ ## Development
362
+
363
+ ```bash
364
+ make dev
365
+ make test
366
+ make lint
367
+ ```
368
+
369
+ The 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.
370
+
371
+ Adding a new tool:
372
+
373
+ 1. Add a `@mcp.tool()` function in `src/agenthive_mcp/server.py`, calling `_request()` from `client.py`. Only for a **member**-role AgentHive endpoint - see [Tool reference](#tool-reference).
374
+ 2. Add a matching route to `tests/fake_agenthive.py` if the endpoint isn't already covered.
375
+ 3. Add a test in `tests/test_tools.py` using the existing `stdio_client`/`ClientSession` pattern.
376
+
377
+ See [`AGENTS.md`](AGENTS.md) for deeper contribution guidance.
378
+
379
+
380
+ ## Publishing
381
+
382
+ Releases are fully automated via [semantic-release](https://semantic-release.gitbook.io/) - no manual tagging needed.
383
+
384
+ ### How it works
385
+
386
+ Every push to `main` runs the CI pipeline:
387
+
388
+ 1. **Test** — lint (`ruff`) + pytest across Python 3.10 / 3.11 / 3.12
389
+ 2. **Docker** — builds and pushes the image to GHCR
390
+ 3. **Release** — semantic-release analyses conventional commits, bumps the version, updates `CHANGELOG.md`, publishes to PyPI, and creates a GitHub Release
391
+
392
+ A release only happens when commits contain a `feat:`, `fix:`, or breaking-change - `chore:`, `docs:`, `ci:` commits don't trigger one.
393
+
394
+ ### Docker image tags
395
+
396
+ | Tag | When pushed |
397
+ |---|---|
398
+ | `latest` | Every merge to `main` |
399
+ | `sha-<short>` | Every merge to `main` |
400
+ | `1.2.3` / `1.2` | On a semantic-release version bump |
401
+
402
+ ### Required GitHub secrets
403
+
404
+ | Secret | Description |
405
+ |---|---|
406
+ | `POL_GH_TOKEN` | Personal access token with `repo` + `write:packages` scope |
407
+ | `PYPI_TOKEN` | PyPI API token for the `agenthive-mcp` project |
408
+
409
+ Add both at: **GitHub repo → Settings → Secrets and variables → Actions**.
410
+
411
+ ### Commit conventions
412
+
413
+ ```
414
+ feat: add new tool → minor version bump (0.x.0)
415
+ fix: correct response shape → patch bump (0.0.x)
416
+ feat!: breaking change → major bump (x.0.0)
417
+ chore/docs/ci/test → no release
418
+ ```
419
+
420
+
421
+ ## Security notes
422
+
423
+ - The container runs as a non-root user (`uid 10001`).
424
+ - `AGENTHIVE_TOKEN` is read from env vars only - never written to disk.
425
+ - 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.
426
+ - Admin-only calls (the review gate, user management, auto-approve rules) are deliberately **not** exposed as tools - see [Tool reference](#tool-reference).
427
+
428
+
429
+ ## License
430
+
431
+ MIT — see [LICENSE](LICENSE).