About ucn
UCN is an AST-based code intelligence server and CLI for developers and AI agents, providing source-linked answers with explicit uncertainty and coverage accounting.
Key features
- 01AST-based analysis across multiple languages
- 02Symbol and call-graph navigation
- 03Impact, test, and refactor previews
- 04Counted matches with uncertainty labels
- 05CLI, agent skill, and MCP access
Use cases
- 01Find callers and trace paths through a codebase
- 02Assess a symbol or staged diff's impact
- 03Locate statically linked tests before a change
- 04Review rename and signature-change plans
MCP support
The MCP server exposes UCN's code-navigation and analysis commands to MCP clients. It uses a persistent process for repeated queries.
Configuration
Local server config is the same for every client. Copy it into your client’s MCP config file.
Tools
1Saved tool list · updated 2w ago
| Parameter | Type | Required | Description |
|---|---|---|---|
| in | string | No | Only search in this directory path (e.g. "src/core") |
| to | enum | No | trace with direction=callers: continue toward entry points.entrypoints |
| all | boolean | No | Lift formatter and result caps where supported. |
| git | boolean | No | show summary: attach last-modified, author, and recent-change metadata. |
| hot | boolean | No | repo stats: include the top N most-called functions. |
| raw | boolean | No | source: code text without a header or line-number gutter, including full large classes. Notes follow as "# " lines; MCP transport budgets still apply. |
| top | integer | No | Max results to show (default: 10). Must be a positive integer. |
| base | string | No | Git ref (default: HEAD). impact/check without a symbol: diff against it; check with a symbol: compare the declaration with its version there. E.g. "HEAD~3", "main", a commit SHA |
| deep | boolean | No | repo: include health and sample the ordinal resolution-evidence profile, not accuracy. |
| file | string | No | File target for source/deps/api or a symbol-disambiguation filter. |
| line | integer | No | Definition line pin. Resolves the symbol defined at this exact line (the middle component of a file:line:name handle). Disambiguates same-file same-name definitions. |
| name | string | No | Symbol name or stable path:line:name handle. Used by show/find/usages/source/trace/impact/tests/check/plan. |
| term | string | No | Literal search term by default. Set regex=true only for regular-expression syntax. |
| type | string | No | Symbol type filter for structural search: function, class, call, method, type, state, field, constant, macro. Triggers index-based search. |
| depth | integer | No | Max depth (default: 3 for trace, 2 for deps); expands all children. Non-negative integer. |
| exact | boolean | No | Exact name match only (no substring matching) |
| limit | integer | No | Max results to return (default: 500; structural search: 50; usages and lines: uncapped). Caps find, usages, search, deadcode, api, and repo files. find text shows the top 5 in detail and counts the rest; limit raises both. Must be a positive integer. |
| lines | boolean | No | find/usages/search/show/impact: path:line:text listings without default row caps; explicit top/limit still apply. show accepts callers/callees sections, default callers. Tier tags follow a tab; accounting and notes follow as "# " lines. MCP transport budgets still apply and preserve accounting. |
| param | string | No | Filter by parameter name or type (structural search). E.g. "Request", "ctx". |
| range | string | No | source line range, e.g. "10-20" or "15"; requires file. |
| regex | boolean | No | Treat search term as a regular expression (default: false/literal). Ordinary patterns run in an RE2-compatible linear-time engine; unsafe nested repetition is rejected. |
| stack | string | No | The stack trace text to parse (stacktrace command) |
| bridge | boolean | No | Match server routes to client requests (endpoints command). |
| cycles | boolean | No | deps: report circular imports instead of a file graph. |
| method | string | No | Filter by HTTP method (e.g. "GET", "POST") for endpoints. |
| prefix | string | No | Filter routes/requests by path prefix (endpoints command). |
| staged | boolean | No | impact/check without a symbol: analyze staged changes. |
| unused | boolean | No | Only symbols with zero callers (structural search). |
| command | enum | Yes | UCN task command. One of: show, find, usages, search, source, trace, impact, tests, check, plan, repo, deps, api, entrypoints, endpoints, deadcode, audit_async, stacktrace.show | find | usages | search | source | trace | impact | tests | check | plan | repo | deps | api | entrypoints | endpoints | deadcode | audit_async | stacktrace |
| compact | boolean | No | Compact output defaults to true for show/impact and false for usages; set the opposite value to change that command's presentation. |
| context | integer | No | Lines of context around each match. Non-negative integer. |
| diverse | boolean | No | show example: return representatives from distinct argument shapes. |
| exclude | string | No | Comma-separated patterns to exclude (e.g. "test,mock,vendor") |
| returns | string | No | Filter by return type (structural search). E.g. "Promise", "error". |
| detailed | boolean | No | repo files: show symbols per file; deps: include import declarations and importers. |
| exported | boolean | No | Only exported/public symbols (structural search). |
| receiver | string | No | Filter calls by receiver (structural search, type=call). E.g. "db", "http". |
| sections | string | No | Comma-separated projection. show: summary,callers,callees,source,dependencies,tests,types,example,related. repo: summary,files,stats,health. |
| add_param | string | No | Parameter name to add (plan command) |
| code_only | boolean | No | Exclude matches in comments and strings |
| decorator | string | No | Filter by decorator/annotation (structural search). E.g. "Route", "Test". |
| direction | enum | No | trace: callees/callers. deps: imports/importers/both.callees | callers | imports | importers | both |
| framework | string | No | Filter entrypoints by framework (e.g. "express", "spring", "flask"). Comma-separated for multiple. |
| functions | boolean | No | repo stats: include per-function line counts sorted by size. |
| max_chars | integer | No | Max output characters, not UTF-8 bytes, including notes and preserved metadata. Broad sweep commands (repo, entrypoints, endpoints, deadcode, deps, check, audit_async) default to 3K; all other commands default to 10K. Maximum: 100K. all=true lifts formatter caps but keeps the 100K transport ceiling. |
| max_files | integer | No | Max files to index (default: 10000). Use for very large codebases. Must be a positive integer. |
| max_lines | integer | No | source: maximum lines per declaration; raw mode discloses any truncation. |
| rename_to | string | No | New name for the function, method, or type (plan command) |
| top_level | boolean | No | repo files: show only top-level functions. |
| unmatched | boolean | No | Only show unmatched routes/requests (endpoints command). |
| calls_only | boolean | No | tests: retain direct calls and test-case matches only. |
| class_name | string | No | Class name to scope method analysis (e.g. "MarketDataFetcher" for close) |
| with_types | boolean | No | show: include related type definitions. |
| client_only | boolean | No | Only list client requests (endpoints command). |
| project_dir | string | Yes | Non-empty absolute path, or a path relative to the MCP server process working directory, identifying the project to analyze. |
| server_only | boolean | No | Only list server routes (endpoints command). |
| with_source | boolean | No | Attach exact source to find results. |
| remove_param | string | No | Parameter name to remove (plan command) |
| default_value | string | No | Default value for added parameter (plan command) |
| exclude_tests | boolean | No | Exclude test files: the default for entrypoints (include_tests=true lists them); usages and endpoints list test files unless exclude_tests=true. |
| include_tests | boolean | No | Include test files in results (excluded by default) |
| case_sensitive | boolean | No | Case-sensitive search (default: false, case-insensitive) |
| hide_uncertain | boolean | No | Hide uncertain (interpolated-path) bridges (endpoints command). |
| min_confidence | number | No | Minimum ordinal evidence weight (legacy name; not a probability) for caller/callee edges |
| follow_symlinks | boolean | No | Follow symlinks during file discovery (default: true) |
| include_bundled | boolean | No | Index *.min.js and *.bundle.js files (default: false). Source maps remain disclosed but unindexed. Bypasses the shared cache. |
| include_methods | boolean | No | Include method callees where receiver evidence permits. Caller-bearing views always tier method sites. |
| show_confidence | boolean | No | show: resolution-evidence labels default to visible; set false to hide them. Numeric weights are ordinal, not probabilities. |
| include_exported | boolean | No | Include exported symbols in deadcode results |
| unreachable_only | boolean | No | show/impact: retain only relationships unreachable from detected entry points. |
| expand_unverified | boolean | No | trace callers: follow unverified edges; downstream nodes remain marked possible, never confirmed. |
| include_decorated | boolean | No | Include decorated/annotated symbols in deadcode results |
Details
From the project READMEUCN - Universal Code Navigator
Auditable answers, with every match counted, unsure ones marked and blind spots named.
If you work with AI Agents, add UCN as a Skill or MCP tool. One tool gives the agent compact, source-linked answers to caller, impact, and test questions, with uncertainty labeled instead of guessed. The answer depends on the indexed source, not on who asks: a person at a terminal and an agent over MCP receive the same records for the same question.
Conceptual overview · Still image
Use the CLI directly, install the agent skill, or connect through MCP. One engine supplies all three:
Terminal AI Agents Agent Skills
│ │ │
CLI MCP Skill
└────────────────────┼────────────────────┘
│
┌──────┴──────┐
│ UCN Engine │
│ commands │
│ tree-sitter │
└─────────────┘
UCN uses tree-sitter abstract syntax trees (ASTs) for static code analysis, without compiling the project or starting a language server. The CLI runs on demand and reuses an incremental index; MCP keeps a process available for repeated queries. No project configuration is required, and the cache lives outside the repository.
Supports JavaScript, TypeScript, JSX/TSX, Python, Go, Rust, Java, C, C++, C#, and HTML inline scripts.
Install
npm install -g ucn # Node.js 20+
In the shell
From a project directory:
ucn repo
ucn show handleRequest --lines
ucn source handleRequest --raw
ucn impact --staged --lines
ucn check --staged
repo maps the project. show --lines locates callers, source --raw
retrieves the implementation, and impact and check inspect a staged change.
When a name is ambiguous, find returns a file:line:name handle that
subsequent commands accept.
--lines returns path:line:text records; --raw returns source code.
Both fit an agent's existing scripts without parsing a human-readable report.
Text search remains useful for comments, configuration, strings, and code
outside the supported languages. usages provides the literal-name inventory
when the task needs every occurrence, including those that are not calls.
Code navigation and change analysis
show gathers a symbol's signature, source, callers, callees, and related
context. Select the sections you need or set an output budget to keep the
answer focused. trace follows the call graph across files, down into callees
or up through callers toward entry points. Unverified relationships remain
visible, and the tree's accounting reports where exploration stopped.
impact connects a symbol or Git diff to its callers. tests follows indexed
call and reference paths to identify statically linked tests, including links
several hops away. plan previews a rename or signature change with source
locations and review items; it does not edit files. Together these commands
support code exploration, refactoring, and change review from a terminal or
an AI agent.
What an answer establishes
For caller answers, UCN checks bindings, imports, receiver types, and ownership to distinguish calls to the selected definition from other uses of its name. Calls without enough evidence stay visible as unverified, with a reason. A matching method name alone does not establish which implementation runs; receiver and ownership evidence determine how the candidate is classified.
In ripgrep at 82313cf9,
the selected file_name helper has four confirmed call sites and one unverified
candidate. This animation accounts for all 29 matching lines, alongside import
relationships and same-name definitions drawn from UCN's output.
Captured findings · Still image · Data
The ACCOUNT line reconciles the observed name occurrences: confirmed calls, unverified candidates, non-call occurrences, and matches attributed to another target. Each occurrence is counted in exactly one category, so the totals can be checked line by line rather than taken on trust. CONTRACT describes the scope of that accounting. Warnings identify source the index could not cover. These details survive text truncation for an agent's output budget; a budget too small to hold them withholds the answer and names the budget that would.
An empty result therefore means something specific about the inspected code.
It cannot establish that reflection, generated code, runtime registration, or
external consumers never reach a symbol. deadcode supplies candidates to
investigate; deletion still needs corroboration. A refactor preview still
needs the compiler and tests.
Accuracy and validation
Release gates compare UCN's answers with independent compilers and language servers on a ten-repository board of pinned production codebases. The local October 4, 2026 evaluation recorded these sampled caller results:
| Repository | Pinned commit | Oracle | Symbols sampled | Confirmed precision | In-scope recall |
|---|---|---|---|---|---|
| preact-signals | e0ce9fdf | ts-morph | 27 | 100% | 100% |
| httpx | b5addb64 | Pyright | 50 | 100% | 100% |
| cobra | ad460ea8 | gopls | 50 | 100% | 100% |
| viper | 528f7416 | gopls | 50 | 100% | 100% |
| ripgrep | 82313cf9 | rust-analyzer | 41 | 100% | 100% |
| clap | d3e59a9a | rust-analyzer | 50 | 100% | 100% |
| javapoet | b9017a95 | JDT LS | 50 | 100% | 100% |
| newtonsoft-json | 4f73e743 | Roslyn | 50 | 100% | 100% |
| cjson | c859b25d | clangd | 50 | 100% | 100% |
| fmt | e424e3f2 | clangd | 50 | 100% | 100% |
That evaluation reported zero missing in-scope oracle edges in both caller and callee answers, and 8,000 cross-command comparisons with zero disagreements. The default dead-code audit found zero false-dead results among 9 scored claims; 4 additional claims could not be pinned by the oracle and were unscored. All ten repositories passed the performance budgets, with steady-state query p95 from 4.7 to 101.1 ms. Those timings exclude process startup and indexing; cold builds and cache loading are measured separately.
The samples are deterministic and stratified by reference activity. Confirmed precision applies to scored claims; recall counts in-scope oracle edges found in either the confirmed or unverified band. Unverified candidates, oracle abstentions, and unscored findings remain separate. These measurements do not establish complete runtime knowledge or identical performance on every machine.
The scheduled board covers 25 pinned repositories: the ten above plus zod, express, hono, zustand, fastify, rich, click, attrs, grpc-go, chi, cursive, itertools, rayon, gson, and jsoup. A rotating fresh-repository arm checks codebases outside that pinned board.
The repository manifest records the full commits. The Publish workflow gates releases, and the Eval workflow runs the checks on schedule and on demand. Their run pages provide CI results and evaluation artifacts. Reproduce the checks locally with the oracle dependencies installed:
npm run verify
npm run trust:gate
Commands
| Task | Command |
|---|---|
| Repository orientation and health | repo [--sections=summary,files,stats,health] [--deep] |
| Symbol summary and relationships | show <symbol> [--sections=...] |
| Definition lookup | find <name> [--type=type] [--with-source] |
| Complete literal-name inventory | usages <name> |
| Literal, regex, or structural search | search [term] [--regex] [structural flags] |
| Exact source extraction | source <symbol|file:range> |
| Call trees: down, up, or to entry points | trace <symbol> [--direction=...] [--to=entrypoints] |
| Symbol or Git-diff impact | impact [symbol] [--staged] |
| Direct or transitively linked tests | tests <symbol> [--depth=N] |
| Signature or pre-commit validation | check [symbol] [--staged] |
| Refactor preview | plan <symbol> --rename-to=... |
| Imports, importers, and cycles | deps [file] [--direction=...] [--cycles] |
| Project or file public API | api [file] |
| Runtime and framework roots | entrypoints |
| Server/client HTTP surface | endpoints [--bridge] |
| Conservative dead-code candidates | deadcode |
| Likely missing awaits | audit-async |
| Stack-trace frame resolution | stacktrace <text> |
deps --cycles groups circular dependencies and distinguishes eager imports
from deferred or type-only edges. Enumeration limits are disclosed. repo
reports source coverage as well as project structure; its HOT ranking counts
confirmed production callers exactly (a refinement budget only binds on very
large repositories, and is disclosed), and repo --sections=stats --hot ranks
by all callers.
endpoints --bridge matches server routes and client requests recognized by
its framework extractors. plan handles code relationships
such as imports, overrides, and interface or trait methods when ownership is
resolved; ambiguous relationships remain review items.
Run ucn --help for flags, or use the
command reference.
Shell output
Records and code go to stdout; accounting and notes go to stderr. Unverified
records carry a tab-separated reason. An empty listing exits 1, an error
exits 2, and a successful listing exits 0. --lines supports find, show,
usages, search, and impact; show --lines lists callers by default.
Use --json when the script needs structured fields or a tree result.
Listings are deterministic for a given source tree: a fresh build, a cache
load, and an incremental rebuild return the same records in the same order.
Listings have no default row cap. Explicit limits disclose what they omit,
and a shell-mode character budget fails before writing partial output.
source --raw extracts complete functions and classes unless an explicit
line limit is requested; any resulting truncation is reported on stderr.
Ordinary text-mode command errors also exit 2. JSON keeps exit 0 for successful
empty results and exit 1 for command errors (meta.ok: false plus error).
An exception inside UCN is reported as Internal error: ... (JSON adds
meta.internalError: true), never as an answer about the code.
Target-less check exits 1 when TRUST is BLOCKED, 0 for other completed
checks, and 2 if it could not run.
Outside --lines, find, text search, deadcode, api, and
repo --sections=files default to a maximum of 500 results. find text shows
the top 5 in detail and counts the rest (JSON returns up to 500); --limit=N
raises both. Use --limit=N to request more; usages lists every site,
test files included, unless a limit or --exclude-tests is given. Broad find queries select candidates by approximate usage
totals before calculating definition-pinned caller activity, and disclose
that selection when limited.
Files named *.min.js, *.bundle.js, and *.map are reported as skipped
sources and make completeness partial. --include-bundled (MCP
include_bundled=true) indexes the JavaScript bundles while respecting user
exclusions; it bypasses the shared cache. Source maps remain disclosed but
unindexed.
AI setup
One tool, 18 commands, compact source-linked answers that keep their trust metadata even when truncated.
MCP
# Claude Code
claude mcp add ucn -- npx -y ucn --mcp
# OpenAI Codex CLI
codex mcp add ucn -- npx -y ucn --mcp
# VS Code Copilot
code --add-mcp '{"name":"ucn","command":"npx","args":["-y","ucn","--mcp"]}'
Manual MCP configuration
{
"mcpServers": {
"ucn": {
"command": "npx",
"args": ["-y", "ucn", "--mcp"]
}
}
}
VS Code uses .vscode/mcp.json:
{
"servers": {
"ucn": {
"type": "stdio",
"command": "npx",
"args": ["-y", "ucn", "--mcp"]
}
}
}
Agent Skill (no server needed)
macOS / Linux:
# Claude Code
mkdir -p ~/.claude/skills
cp -r "$(npm root -g)/ucn/.claude/skills/ucn" ~/.claude/skills/
# OpenAI Codex CLI
mkdir -p ~/.agents/skills
cp -r "$(npm root -g)/ucn/.claude/skills/ucn" ~/.agents/skills/
Windows PowerShell:
$npmRoot = npm root -g
New-Item -ItemType Directory -Force "$env:USERPROFILE\.claude\skills"
Copy-Item -Recurse "$npmRoot\ucn\.claude\skills\ucn" "$env:USERPROFILE\.claude\skills\"
New-Item -ItemType Directory -Force "$env:USERPROFILE\.agents\skills"
Copy-Item -Recurse "$npmRoot\ucn\.claude\skills\ucn" "$env:USERPROFILE\.agents\skills\"
The skill teaches an agent how to orient, pin symbols, choose the smallest useful command, interpret the evidence tiers, and recover from incomplete answers. It's guidance over the same engine, not a second implementation.
Scope
UCN analyzes indexed source in one project. It does not execute the program
or index installed dependencies such as node_modules and site-packages.
repo --sections=health --deep reports source coverage and known analysis
limits.
C and C++ can use compile_commands.json for include paths and header context,
but UCN does not run the preprocessor or reproduce a compiler's build-specific
view. C# source generators and external assemblies are also outside the
index. HTML has regression coverage but no compiler/LSP repository oracle.
The CLI, MCP, and skill share the same resolution rules and evidence. Changing the transport does not change what the engine knows about the code.
MIT
Comments
New to MCP?
From what the protocol is to installing your first server, these answers cover most first questions.
An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.
