CypherWolf MCP server — Neo4j Cypher query revision from a curated corpus, for @neo4j.com users.
Project description
cypherwolf-mcp
CypherWolf revises Neo4j Cypher queries against a curated corpus of Neo4j engineering precedent, returning corpus-grounded rewrite options plus the index/constraint validation gates to confirm before applying a rewrite.
It ships as a single-tool MCP server (revise_query) that runs locally over
stdio and proxies to the CypherWolf HTTPS service. Access is restricted to
@neo4j.com users. The package holds no API key, no shared secret,
and no Aura credentials — all access control is enforced server-side via an
email gate plus a 30-day session token.
Install
pip install cypherwolf-mcp
Requires Python 3.10+. Dependencies are just mcp and httpx — no database
driver, no cloud SDKs.
Sign in (first run)
Before the MCP server can revise queries, sign in once in a normal terminal with your Neo4j email:
cypherwolf-mcp auth
You will see the following disclosure, then be prompted for your email and a 6-digit code sent to it:
This will email a 6-digit code to verify your @neo4j.com address. Your queries and the rewrites are saved to a Neo4j-internal folder under your email for internal use only.
The resulting session token is cached at ~/.cypherwolf/credentials.json
(mode 0600) and is valid for 30 days. After it expires — or if the token is
revoked — the tool will ask you to run cypherwolf-mcp auth again.
Configure your MCP client
Point your MCP client at the cypherwolf-mcp console script (installed on your
PATH by pip).
Cursor (~/.cursor/mcp.json)
{
"mcpServers": {
"cypherwolf": {
"command": "cypherwolf-mcp"
}
}
}
Claude Code (settings.json)
{
"mcpServers": {
"cypherwolf": {
"command": "cypherwolf-mcp"
}
}
}
Restart the client after editing the config. The cypherwolf server exposes a
single tool, revise_query.
Coworker testing checklist
After the PyPI upload is live, use these steps for Neo4j coworker testing while the source repo remains private:
-
Install or upgrade the package:
python -m pip install --upgrade cypherwolf-mcp
-
Sign in once:
cypherwolf-mcp authUse your
@neo4j.comemail, then paste the 6-digit code emailed to you. The package stores a 30-day session token at~/.cypherwolf/credentials.jsonwith file mode0600. -
Add the MCP server to Cursor:
{ "mcpServers": { "cypherwolf": { "command": "cypherwolf-mcp" } } }
-
Restart Cursor and confirm a
cypherwolfMCP server with one tool,revise_query, is available.For Claude Code, use the
settings.jsonsnippet in Configure your MCP client. -
Ask Cursor to call
revise_querywith a Cypher query and optional schema context. The shim is already pointed at the deployed service:https://cypherwolf-shim-ez6emjisaa-uc.a.run.app.
Expected auth behavior:
- Non-
@neo4j.comemails are rejected. - Expired or revoked sessions return an auth-required response telling you to
rerun
cypherwolf-mcp auth. - Queries and rewrites are logged to Neo4j-internal storage keyed by your email, as disclosed during sign-in.
The revise_query tool
| Arg | Required | Description |
|---|---|---|
query |
yes | The Cypher query to revise. |
context |
no | Schema or context details (labels, indexes, cardinalities). |
neo4j_version |
no | Target Neo4j version, e.g. "5.26". |
mode |
no | Optional tuning mode, e.g. "verbose". |
Response (structured JSON):
{
"option_a": "MATCH (u:User {id: $id}) RETURN u",
"option_b": "…optional second rewrite…",
"validation_gates": ["Equality predicate on :User(id) — confirm CREATE INDEX …"],
"why": ["Corpus precedent (Slack, Fauth): …"],
"top_n": ["[0.91] Slack — Fauth: supernode pagination"],
"no_rewrite_reason": null
}
- Corpus-gap is a success. When the corpus has no relevant precedent,
option_aisnullandno_rewrite_reasonexplains why ("corpus-gap"). CypherWolf never bluffs a rewrite. - On an auth / rate-limit / upstream error the tool returns a structured payload
with an
errorfield and a matchingno_rewrite_reason("auth-required","rate-limited","upstream-unavailable") rather than throwing.
Configuration
| Environment variable | Default | Purpose |
|---|---|---|
CYPHERWOLF_SHIM_URL |
https://cypherwolf-shim-ez6emjisaa-uc.a.run.app |
CypherWolf service base URL. |
CYPHERWOLF_SESSION_TOKEN |
(unset) | Supply a session token directly, bypassing the on-disk cache (CI / scripted use). |
Credentials cache: ~/.cypherwolf/credentials.json (mode 0600), holding
{email, session_token, issued_at}.
Privacy
Your submitted queries and the returned rewrites are logged server-side to a Neo4j-internal storage location, keyed by your email, for internal use only. See the sign-in disclosure above.
Publishing
The package is prepared for public PyPI as cypherwolf-mcp. The source repo can
stay private during the Neo4j-only coworker-testing phase because the wheel ships
no secrets and all access control is enforced by the hosted shim's @neo4j.com
email-code gate.
Current publish status: distribution artifacts build and pass twine check, but
the first production PyPI upload is blocked until an account-scoped pypi.org
API token is available. A project-scoped token cannot create the first release
because the cypherwolf-mcp project does not exist on PyPI yet.
Build the artifacts
cd mcp
python -m build # produces dist/cypherwolf_mcp-<version>-py3-none-any.whl + .tar.gz
Verify a clean install in a throwaway venv:
python -m venv /tmp/cw && /tmp/cw/bin/pip install dist/cypherwolf_mcp-*.whl
/tmp/cw/bin/cypherwolf-mcp --help
/tmp/cw/bin/pip freeze | grep -iE 'google|neo4j' # must be empty
First production publish — one-shot account token
Use an account-scoped PyPI API token exactly once to create the production
cypherwolf-mcp project. Build from a committed tree, publish, verify the public
install, then remove the account token from the release path.
cd mcp
rm -rf dist build *.egg-info
python -m build
python -m twine check dist/*
python -m twine upload dist/*
After upload, verify in a clean environment:
python -m venv /tmp/cw-pypi
/tmp/cw-pypi/bin/pip install cypherwolf-mcp
/tmp/cw-pypi/bin/cypherwolf-mcp --help
/tmp/cw-pypi/bin/pip freeze | grep -iE 'google|neo4j' # must be empty
Ongoing publish path — PyPI Trusted Publishing via GitHub Actions
Trusted Publishing (OIDC) is preferred over a long-lived API token: no secret to store or rotate.
- On PyPI, add a Trusted Publisher for the
neo-gerlt/cypherwolfrepo, workflow.github/workflows/publish-mcp.yml, and environmentpypi. - Cut a GitHub Release, or run the workflow manually if PyPI's Trusted
Publisher settings allow it. The workflow builds
mcp/, runstwine check, and publishes with OIDC. - Retire the account-scoped token after Trusted Publishing is confirmed.
Alternative — manual publish after the project exists
cd mcp
python -m build
python -m twine upload dist/* # with a project-scoped token
Release checklist
-
Bump
versioninpyproject.tomlandcypherwolf/__init__.pyfor each release. -
Build from
repos/cypherwolf/mcp/and publish with Trusted Publishing or a scoped PyPI token. Do not commit any token to the repo. -
Verify a fresh install in a clean virtual environment:
python -m venv /tmp/cw && /tmp/cw/bin/pip install cypherwolf-mcp /tmp/cw/bin/cypherwolf-mcp --help /tmp/cw/bin/pip freeze | grep -iE 'google|neo4j' # must be empty
-
Repo split to
neo-gerlt/cypherwolf-mcpremains deferred (follow-on #10) and is not required to publish — apyproject.tomlrooted atmcp/ships the wheel from the monorepo today.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cypherwolf_mcp-0.1.0.tar.gz.
File metadata
- Download URL: cypherwolf_mcp-0.1.0.tar.gz
- Upload date:
- Size: 30.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3e4010ff63a956a2fdda23a0111e92b757a74ee7baf8c688dac3745429351ff6
|
|
| MD5 |
4ff242d960ac05721f5841d2ecc663bd
|
|
| BLAKE2b-256 |
80be869fd639db9373fa995575439564f71bac7dfbfafc0dd5b3900290376cfb
|
File details
Details for the file cypherwolf_mcp-0.1.0-py3-none-any.whl.
File metadata
- Download URL: cypherwolf_mcp-0.1.0-py3-none-any.whl
- Upload date:
- Size: 21.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
91f96e54ca54605130b728a8aceb19d2a3ac91e556c5fc79a431f49e31be5872
|
|
| MD5 |
de9f7f6ff0bc2cab7b8bda107c8263f4
|
|
| BLAKE2b-256 |
ac9e19636cb1db2108d578bc8129a604ad9026a05d59dc5999cca212f151e258
|