Skip to main content

Marker-indexed SQL cache MCP server

Project description

scry

Marker-indexed SQL cache MCP server. Scry indexes in-file @scry.* markers into a SQLite database that agents query via read-only SQL, providing structured project knowledge without LLM reasoning.

PyPI Python

Install

uv pip install scry-mcp
# or:
pip install scry-mcp

The PyPI distribution is scry-mcp (the bare name scry was already taken on PyPI). The import name and the installed console command are both scry.

Quickstart

# In your project root:
scry init                # scaffolds agent/ + driver dirs, updates .gitignore

Then add it to your MCP client config:

{
  "mcpServers": {
    "scry": {
      "command": "scry"
    }
  }
}

The MCP client inherits cwd from wherever it's launched, and scry walks up from there looking for an agent/ directory — so the same config works for any project. Bare scry (no subcommand) starts the MCP server over stdio — that's what Claude calls. Other subcommands:

Command Purpose
scry Run the MCP server (default).
scry init [path] Create agent/ + agent/drivers/@local/scry/{data,runtime,scripts}/ and a local .gitignore inside the driver dir. Idempotent — safe to run inside an ACP project.
scry surface [--force] One-shot batch reindex without booting the server.
scry version Print the package version.

The server walks up from cwd until it finds an agent/ directory; that becomes the project root. The cache lives at agent/drivers/@<namespace>/scry/data/project.db and is gitignored.

Markers

Scry recognizes three marker kinds per scry-spec v1.0: @scry.entry and @scry.anchor are block markers with a YAML body between open/close tokens; @scry.bind is a line or block marker declaring cross-references.

<!-- @scry.entry
id: design.auth-flow~a1b2c3d4
kind: design
summary: >
  JWT auth middleware, token validation, refresh flow
status: active
weight: 0.85
tags: ["scope:auth", "topic:security"]
rationale: >
  Missing this causes auth bypass bugs
applies: modifying auth, adding protected endpoints
seeded_questions:
  - How does token refresh work?
@scry.entry.end -->

<!-- @scry.anchor auth-check~f1e2d3c4
description: JWT validation point for protected routes
@scry.anchor.end -->
# @scry.bind validate-jwt~a1b2c3d4 spec.auth~xyz89012#FR3
# @scry.bind jwt-expiry~b2c3d4e5 spec.auth~xyz89012#UT1

Block markers can be embedded in any host-language comment style (HTML, Python, JS, JSDoc, Rust, bare YAML). Comment prefixes are inferred from the YAML body — there is no per-language config.

@scry.entry kind values (v1.0 baseline)

kind use for
design architecture and design docs
pattern canonical recipes, established patterns
spec requirements and specifications
lesson post-mortems, "I tried X and it failed because Y"
internal service quirks, undocumented behaviors
task discrete work items
milestone phase markers, exit criteria
report wake/session reports
audit security or integrity audits
research research notes
code implementation-specific docs

MCP tools

Tool Purpose
scry_sql(query) Read-only SQL gateway. Rejects mutator keywords. Returns {results, row_count} JSON.
scry_mint(kind, prefix) Generate a collision-free ID and the marker schema.
scry_mint_with_check(kind, prefix) Preferred minter — same as scry_mint plus tier-1/tier-2 collision warnings.
scry_surface(force=false) Batch reindex from disk. force=true hard-deletes records whose source file no longer exists.
scry_scrub() Create a <branch>--clean git branch with all @scry.* markers stripped and agent/ removed.
scry_script(action, script?, params?) Discover and run validation scripts from src/scry/scripts/ and agent/drivers/@<ns>/scry/scripts/.

Database schema

Core tables: scry__doc, scry__anchor, scry__bind (marker-backed); scry__doc_fts, scry__anchor_fts, scry__bind_fts (FTS5, trigger-maintained); doc_relationship (depends_on edges with cycle detection); scry__warning; migration. The cache is fully reconstructable from disk via scry_surface.

The DB is gitignored; after git pull, agents call scry_surface to rebuild.

Watcher

A daemon thread runs alongside the MCP server, watching the project tree with a 150 ms debounce window. A lock file at agent/drivers/@<ns>/scry/runtime/lock performs PID-based primary election so multiple sessions don't race writes. The primary instance runs a cold scan on startup; secondaries observe and wait.

On file deletion: docs are soft-deleted (missing_since set); anchors and binds are hard-deleted.

Tests

uv pip install -e ".[dev]"
pytest

98 tests cover the parser, SQL gateway, mint, surface, watcher plumbing, script discovery, and relationship cycle detection.

License

MIT — see LICENSE.

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

scry_mcp-0.15.6.tar.gz (57.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

scry_mcp-0.15.6-py3-none-any.whl (48.6 kB view details)

Uploaded Python 3

File details

Details for the file scry_mcp-0.15.6.tar.gz.

File metadata

  • Download URL: scry_mcp-0.15.6.tar.gz
  • Upload date:
  • Size: 57.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for scry_mcp-0.15.6.tar.gz
Algorithm Hash digest
SHA256 b85c5982896b7f837fa38eeb0901088310184228ff202b0333c7dd89e7165eba
MD5 181adc1974a21c7c43f4390d6c96dc64
BLAKE2b-256 9f66b6545744b09fed66ebca4588e3d3d7803d70029817300c015aca4bdf068d

See more details on using hashes here.

File details

Details for the file scry_mcp-0.15.6-py3-none-any.whl.

File metadata

  • Download URL: scry_mcp-0.15.6-py3-none-any.whl
  • Upload date:
  • Size: 48.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for scry_mcp-0.15.6-py3-none-any.whl
Algorithm Hash digest
SHA256 4e472827a697f134237545fb70f87e7ad02559090bc9fe06f14546d2b71fa048
MD5 d3b5dd5c687ccea7b3dda44fd37b4b23
BLAKE2b-256 9f242ffc408a6a6f80d94b235f15476d5668a81cbab5b590f772dcaa714803a9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page