scry
This server is a read-only SQL + full-text search interface over a marker-indexed knowledge graph (scry), backed by SQLite, with tools for discovering docs, anchors, binds, and file contents.
Query the knowledge graph with SQL (
scry_sql): run read-only SELECT/CTE queries against tables likescry__doc,scry__doc_tag,scry__anchor,scry__bind,scry__rel,scry__file, and FTS5 virtual tables. Supports JSON1 queries onextras.Full-text search file bodies (
scry_grep): FTS5 search across all indexed files with optional filtering by doc kind, status, path glob, and limit; returns snippets with highlighted matches and BM25 scores.Mint new marker IDs (
scry_mint,scry_mint_with_check): generate collision-free IDs for@scry.entry,@scry.anchor, or@scry.bindmarkers, with per-field schema instructions and tier-1/tier-2 collision warnings (the_with_checkvariant is preferred).Rebuild the index from disk (
scry_surface): re-scan project files, parse markers, upsert to DB; supportsforce(hard-delete missing files) and scopedpathre-indexing (single file or directory).Reset the index to disk-only state (
scry_sink): atomically truncate all scry index tables, preserving schema; optionally follow withscry_surfacefor a reset+reindex; requires user confirmation.Create a clean PR branch (
scry_scrub): strip all@scry.*markers from tracked files (excludingagent/**andAGENT.mdby default) to produce a{branch}--cleanbranch with unstaged changes.Run validation/transformation scripts (
scry_script): list or execute bundled/project-local scripts that have read-write DB access.Check database health (
scry_db_health): probe for corruption vs. transient WAL lock contention; reports status (ok/locked/corrupt), integrity check result, doc count, and fresh-DB detection — designed for substrate auto-restore loops.
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., "@scry list all active design entries"
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.
scry
Scry Marker Specification - This project implements a formal, generic scry marker contract defined here
See scryspec.com for an overview.
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.
Install
uv pip install scry-mcp
# or:
pip install scry-mcpThe 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.
Related MCP server: Context Bunker MCP
Quickstart
# In your project root:
scry init # scaffolds agent/ + driver dirs, updates .gitignoreThen 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 |
| Run the MCP server (default). |
| Create |
| One-shot batch reindex without booting the server. |
| Print the package version. |
The server walks up from cwd until it finds a .scry/ directory; that
becomes the project root (falling back to cwd when none is found). The
cache lives at .scry/data/project.db and is gitignored.
Marker mode
marker_mode in .scry/config.toml controls how markers are handled:
Mode | Behavior |
| Markers live embedded in source files. |
| Markers live in |
| No markers read or written. Only |
Markers
Scry recognizes three marker kinds per scry-spec v1.2.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?
extras:
owner: auth-team
jira: AUTH-1247
reviewed_at: 2026-05-19
@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#UT1Block 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.
extras field (scry-spec v1.2.0, FR4.B)
@scry.entry accepts an optional extras field: a single-depth map of
arbitrary string keys to scalar values (string | number | boolean | null).
Use it to attach structured metadata that isn't part of the core schema —
ownership, ticket IDs, cost ledgers, review timestamps, anything you want
to query later.
Constraints:
Single depth only — values must be scalars; nested maps and lists are diagnostic violations.
Serialized size ≤ 4 KB (the spec's SHOULD-level cap).
Oversize payloads MUST round-trip intact — the cap is a diagnostic, not a truncation gate. Empty
extras: {}emits a SHOULD-level warning.
Indexed and queryable as of v0.17.0. The extras field is serialized to
compact JSON-text in the scry__doc.extras column (NULL when absent),
and exposed to scry_sql via SQLite JSON1. A doc with
extras:
cost_usd: 12.5
tier: gold
active: trueanswers queries like:
SELECT id,
json_extract(extras, '$.cost_usd') AS cost,
json_extract(extras, '$.tier') AS tier
FROM scry__doc
WHERE kind = 'deliverable'
AND json_extract(extras, '$.active') = 1
ORDER BY cost DESC;Round-trip is byte-equivalent for the YAML scalar map: integers, floats,
strings, booleans, and null are preserved.
@scry.entry kind values (v1.2.0 baseline)
kind | use for |
| architecture and design docs |
| canonical recipes, established patterns |
| requirements and specifications |
| post-mortems, "I tried X and it failed because Y" |
| service quirks, undocumented behaviors |
| discrete work items |
| phase markers, exit criteria |
| objective satisfied by a deliverable set via the |
| wake/session reports |
| security or integrity audits |
| research notes |
| implementation-specific docs |
MCP tools
Tool | Purpose |
| Read-only SQL gateway. Rejects mutator keywords. Returns |
| Full-text search over indexed file bodies ( |
| Generate a collision-free ID and the marker schema. |
| Preferred minter — same as |
| Batch reindex from disk. |
| Lower the index back to disk-only state — truncates all index tables atomically (schema preserved, disk markers untouched). Requires user confirmation; |
| Create a |
| Discover and run validation scripts from |
| Probe the project DB and report |
Database schema
Marker-backed core tables:
Table | Holds |
| One row per |
| Tags as a join table — |
| Seeded questions per doc — |
| One row per |
| Seeded questions per anchor — |
| One row per |
| Typed edges between docs — |
| Universal file-body index — |
| Lint-style warnings emitted by the parser/indexer — id, kind, marker_kind, marker_id, file_path, message, detected_at. |
| Schema migration ledger. |
FTS5 virtual tables (trigger-maintained, queryable via FTS MATCH):
FTS table | Searches |
| Doc summary, rationale, applies, current_path. |
| Tag strings. |
| Doc seeded questions. |
| Anchor descriptions. |
| Bind source_local_id, target_id, comment. |
| Full file bodies. Prefer the |
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
.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]"
pytest159 tests cover the parser, SQL gateway, mint, surface, watcher
plumbing, script discovery, relationship cycle detection, FR4.B extras
indexing + JSON1 queryability, schema-migration backfill, and
concurrent-connection retry behavior.
License
MIT — see LICENSE.
Available Tools
9 toolsscry_db_healthA
Probe the scry project database and report health.
Designed for substrate code (e.g. reflection's wake.py auto-restore
loop) that needs to distinguish actual corruption from transient WAL
write-lock contention. The same scry-mcp connection primitives are
used as for every other tool — long busy_timeout, WAL journal mode,
retry semantics — so a healthy-but-busy DB will not be reported as
corrupt.
Returns JSON with these fields:
status "ok" | "corrupt" | "locked"
integrity result of PRAGMA integrity_check (string), or null
when the probe could not run (e.g. status=locked)
doc_count integer row count of scry__doc, or null when the
table does not exist yet (fresh / unmigrated DB)
doc_count_error populated when doc_count is null and the count
query failed for a known-benign reason (table
missing); null otherwise
db_path absolute path to the project.db file probed
error string explanation when status != "ok"; null otherwise
Status semantics for substrate decisions:
status="ok" DB is healthy. Do not quarantine.
status="locked" DB is healthy but contended. Do NOT quarantine;
retry the probe on the next wake. Substrate code
that conflates this with corruption causes the
Group-C cascade described in the May 2026
diagnostic.
status="corrupt" DB failed PRAGMA integrity_check or could not
be opened as a SQLite database at all. Safe to
initiate auto-restore.
A status="ok" with doc_count=null and doc_count_error="no such
table: scry__doc" is a fresh-and-unmigrated DB. Substrate should
run migrations (or call scry_surface) rather than quarantine.
Inputs: no named parameters. Returns: result
scry_grepA
Full-text search over all indexed file bodies (scry__file_fts).
Complements scry_sql: use this when you want broad full-text search across file content, not just curated marker fields.
Returns one hit per file (highest BM25-ranked match).
Args: query: FTS5 query string — plain words, phrases ("foo bar"), boolean (foo AND bar, foo OR bar, NOT foo). Accepts standard FTS5 syntax. kind: Optional: filter to files whose associated doc has this kind (e.g. 'design', 'lesson', 'pattern'). Files without a doc marker are excluded when this filter is set. status: Optional: filter by doc status (e.g. 'active', 'draft'). Files without a doc marker are excluded when set. path_glob: Optional: GLOB pattern on file path, e.g. 'agent/design/' or '.py'. Applied before FTS. limit: Max number of results to return (default 20).
Returns JSON: { "hits": [ { "path": "agent/design/...", "doc_id": "design.foo~abcd1234" | null, "snippet": "...text with matches highlighted...", "score": 12.4, "match_count": 3 } ], "total_matches": 47, "query": "...", "filters_applied": { "kind": null, "status": null, "path_glob": null } }
Tips:
Combine with scry_sql: get doc IDs from scry_grep, then JOIN to scry__doc_tag or scry__doc for richer metadata.
Use path_glob to scope to a subtree: 'agent/design/*'
scry__file is populated during scry_surface; call that first if results are empty on a fresh DB.
Inputs: query (required), kind, limit, status, +1 more. Returns: result
scry_mintA
REQUIRED before writing any @scry.* marker. Generates a collision-free ID and returns the marker schema with per-field instructions. Follow the returned instructions exactly when filling fields.
Also performs collision detection and returns warnings alongside the ID:
tier1_collisions — markers with the SAME prefix already in the DB. If any tier-1 hit is the same logical concept, ABANDON the new ID and reference the existing marker instead — stranded IDs pollute scry.
tier2_neighbors — markers in the same kind+first-segment family (informational; may reveal related prior work to link against).
Args: kind: "entry", "anchor", or "bind" prefix: Human-readable prefix. entry: MUST contain a dot (e.g. "design.auth-flow", "task.fix-bug") anchor/bind: MUST NOT contain dots (e.g. "auth-check", "validate-jwt")
Returns JSON with: id, schema (marker_open/close + per-field instructions), and optionally tier1_collisions + tier2_neighbors when they exist.
Field quality matters (FR4.A authoring guidance): summary — prose sentences + 'Also:' keyword cluster at the end. "JWT auth middleware, validates bearer tokens. Also: JWT, bearer-token, auth-guard, refresh-flow" tags — carry both classifier and bare-keyword forms. ["topic:auth", "auth", "scope:runtime", "runtime"] rationale — Why this artifact exists: the problem it solves or the role it fills. Not why you would search for it, not a findability claim, not its importance. Lesson: "prevents re-introducing the auth bypass fixed in PR 412". Design: "centralizes token checks so endpoints do not each re-implement them". Track wake: "owns the reflect-mcp build-to-PyPI path". Bad: "invisible to scry without this", "this is important". applies — verb-shaped triggers (actions, not topics). "modifying auth, adding protected endpoints" not "when working on auth" seeded_questions — include both full questions AND fragment queries. ["What is the JWT refresh flow?", "JWT refresh token implementation"]
Inputs: kind (required), prefix (required). Returns: result
scry_mint_with_checkA
PREFERRED over raw scry_mint. Generates a collision-free scry marker ID (same as scry_mint) and augments the response with existing-marker warnings:
Tier 1 — exact-prefix collision: markers with the same prefix already in scry__doc. If any tier-1 hit is the same logical concept, ABANDON the new ID and reference the existing marker instead — stranded IDs pollute scry.
Tier 2 — family-slug neighbors: related markers in the same slug family (informational; may reveal related prior work to link against).
Args: kind: 'entry', 'anchor', or 'bind' prefix: Human-readable prefix. entry MUST contain a dot (e.g. 'design.auth-flow', 'task.fix-bug'). anchor/bind must NOT contain dots (e.g. 'auth-check', 'validate-jwt').
Returns: id, marker schema (same as scry_mint), plus tier-1/tier-2 collision info.
Inputs: kind (required), prefix (required). Returns: result
scry_scriptA
Run validation or transformation scripts with DB access.
Actions: list — discover available scripts (bundled + project-local) run — execute a named script
Args: action: "list" or "run" script: script name (required for action="run") params: arbitrary params passed to the script (optional)
Scripts have read-write DB access. They return structured JSON.
Inputs: action (required), params, script. Returns: result
scry_scrubA
Create a clean PR branch with all @scry.* markers stripped.
By default, files inside agent/** and any AGENT.md are excluded from scrubbing — their markers are left intact. Only tracked files outside the agent workspace are cleaned. This matches the common workflow: agent/ is gitignored (or excluded via .git/info/exclude), so only the tracked source files need clean markers for PR submission.
Set include_agent=true to restore the prior behavior: scrub everything and remove the agent/ directory entirely.
Creates {branch}--clean from current HEAD. Does not stage or commit — leaves unstaged changes for the user.
Fails if on main/master or if working tree is dirty.
Inputs: include_agent. Returns: result
scry_sinkA
Lower the index back to disk-only state. The DB forgets; the disk remembers.
Truncates all scry index tables (scry__doc, scry__anchor, scry__bind, scry__rel, scry__file, scry__warning, and join tables) in a single atomic transaction. Schema is preserved; FTS tables update via existing triggers. Disk markers are never modified.
Requires protocol-level user confirmation via MCP elicitation before executing — the operation will not proceed if the confirmation is declined, cancelled, or unavailable.
Args: then_surface: If True, immediately runs scry_surface after the sink to rebuild the index from disk markers in a single call. Equivalent to "reset + reindex."
Returns JSON with pre-deletion counts and operation result.
Inputs: then_surface. Returns: result
scry_sqlA
Execute a read-only SQL query against the scry project database. Use this to discover project state, search docs, check coverage, inspect anchors.
Supports SELECT and WITH (CTE) queries only. All mutator keywords (INSERT, UPDATE, DELETE, DROP, etc.) are blocked.
Key tables: scry__doc — knowledge graph entries (@scry.entry markers) columns: id, kind, status, weight, summary, rationale, applies, current_path, ephemeral, missing_since, content_hash, extras (JSON1; NULL when absent), created_at, updated_at extras: single-depth scalar map per scry-spec FR4.B (v1.1.0+). Query with JSON1, e.g. SELECT id, json_extract(extras, '$.cost_usd') AS cost FROM scry__doc WHERE kind = 'deliverable' ORDER BY cost DESC scry__doc_tag — tags as a join table: doc_id, tag scry__doc_seeded_question — seeded questions: doc_id, ordinal, question scry__anchor — named code location bookmarks: id, doc_id, description, content_hash, created_at, updated_at scry__anchor_seeded_question — anchor seeded questions: anchor_id, ordinal, question scry__bind — binding markers (@scry.bind): id, source_doc_id, source_local_id, target_id, target_fragment, comment, content_hash, created_at, updated_at scry__rel — typed edges between docs: from_id, to_id, predicate (depends_on|implements|supersedes|satisfies), fragment scry__file — universal file body index: path, doc_id, body, content_hash, last_modified scry__bind_fts — full-text search over bindings (source_local_id, target_id, comment) scry__warning — lint-style warnings: id, kind, marker_kind, marker_id, file_path, message, detected_at (kinds: misplaced_doc, depends_on_cycle) scry__doc_fts — full-text search over docs (id, summary, rationale, applies, current_path) scry__doc_tag_fts — full-text search over tags (tag, doc_id UNINDEXED) scry__doc_seeded_question_fts — full-text search over seeded questions (question, doc_id UNINDEXED) scry__anchor_fts — full-text search over anchors (id, description) scry__file_fts — full-text search over file bodies (path, body); prefer scry_grep tool
Returns JSON: {"results": [...], "row_count": N}
Inputs: query (required). Returns: result
scry_surfaceA
Rebuild the DB from disk markers. Use after git pull, bulk file moves, or if query results seem stale. The file watcher handles live indexing — only call this for full re-scans.
Walks all project files, parses @scry.* markers, upserts to DB. Idempotent. Uses content-hash dedup.
Args: force: If true, hard-deletes records whose files no longer exist. If false (default), sets missing_since and warns. path: Optional scope, relative to project root. None (default) — full corpus walk. Current behavior, unchanged. — re-index exactly that one file. — re-index every file under that directory, recursively. If path does not exist on disk, returns a clear error. Scoped reconciliation: flagged_missing, misplaced_doc warnings, and force-deletes are all scoped to the path — docs outside the scope are never flagged as missing.
Returns JSON with counts per marker type, any warnings, and a scope field echoing the path argument (null for a full walk).
Inputs: path, force. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 9 tools
The tools are mostly distinct, but scry_mint and scry_mint_with_check have overlapping functionality—both generate IDs and report collisions, with the latter described as 'preferred'. This could confuse an agent about which to use. Other tools like scry_grep and scry_sql are complementary and well-differentiated.
All tools consistently use the 'scry_' prefix, and most follow a verb or verb_noun pattern (e.g., scry_grep, scry_scrub). However, scry_mint_with_check breaks the pattern with a prepositional suffix, and scry_db_health is a noun_noun form. Overall, naming is readable and predictable with minor inconsistencies.
With 9 tools, the server provides a well-scoped interface for managing scry markers and the database. Each tool serves a clear purpose without unnecessary overlap or excessive granularity. The count is appropriate for the domain.
The tool surface covers core workflows: marker creation (scry_mint, scry_mint_with_check), search (scry_grep, scry_sql), database rebuild (scry_surface), reset (scry_sink), cleanup (scry_scrub), health checks (scry_db_health), and scripting (scry_script). Minor gaps exist, such as no dedicated tool for updating or deleting markers directly, but these are manageable via scry_sql and file operations.
Maintenance
Related MCP Connectors
Nifty's MCP server — exposes tasks, projects, messages, and files as tools for AI agents.
Agent-native MCP server over the public saagarpatel.dev corpus. Read-only, stateless.
Shared memory MCP server for Claude Code, Codex, Gemini CLI and Cursor. Cited, editable.
Hosted MCP server and Agent Skills for specs, engineering threads, and project memory.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceLocal MCP server for indexing personal knowledge into SQLite with hybrid search, chunk-level citations, memory tools, and agent orchestration.4MIT
- AlicenseNot gradedqualityDmaintenanceAn MCP server that indexes your codebase using tree-sitter AST parsing and gives AI tools instant access to structural intelligence like dependency graphs, call trees, and dead code detection from a local SQLite database.MIT
- AlicenseNot gradedqualityDmaintenanceLocal MCP server for persistent, searchable agent memory using SQLite FTS5, replacing flat MEMORY.md files with efficient full-text search and workspace context caching.GPL 3.0
- AlicenseNot gradedqualityDmaintenanceA local MCP server that parses codebases into semantic chunks, indexes them in SQLite with vector embeddings, and exposes MCP tools for LLM agents to query.MIT