Topos MCP server — structural code-quality tools (SIMPLE/COMPOSABLE/SECURE) for AI coding agents.
Project description
A structural quality gate for coding agents.
Topos measures complexity, coupling, and risky data flows, then gives your agent a concrete target—from SLOP to GOLD.
Install · What it checks · Under the hood · Docs · Issues
Why Topos
Coding agents produce working code quickly. The harder question is whether the result is still easy to understand, safe to change, and well-fitted to the rest of the repository. Quality is the new currency.
Topos computes that signal from program structure—not from an LLM review or a style opinion—and returns concrete failure locations and next actions. It is fast enough to sit inside the agent loop: measure, edit, verify, repeat.
Tests check behavior. Topos checks whether the implementation is built to keep changing.
Grounded in category theory, powered by a native-Rust engine.
Under the hood
Topos is a self-contained Rust CLI and MCP server. Analysis runs locally; your source code is not sent to an external model or hosted analysis service.
| Component | Role |
|---|---|
| tree-sitter | Parses six languages and powers the native AST, CFG, CPG, PDG, and UAST representations. |
| GitNexus | Supplies the repository dependency graph scored by COMPOSABLE (topos depgraph generate). Requires npm install -g gitnexus@1.6.8. |
| Sighthound | Embedded in the MCP server for supplementary security findings; native CPG probes remain the SECURE scoring source. |
| Graphify | Optional advisory orphan and fragile-edge detection via topos graphify / topos_refactor(target="graphify"); does not affect the medal. Requires pip install graphifyy. |
The result is one agent-facing contract over several structural lenses: one score to optimize, explicit evidence for each failure, and a verification loop that can tell a real improvement from cosmetic churn.
Install and Quick Start
VS Code MCP Extension
Open the Extensions view, search @mcp topos, select Topos, and choose Install. Or view here: Topos: GitHub's MCP Registry.
Then ask agent mode:
Use Topos to find this repository's worst structural problem, make one focused improvement, and verify the result.
See the agent setup guide for tool permissions and troubleshooting.
Other MCP clients [Claude Code]
Run the self-contained MCP server on demand—no persistent Topos or Python installation required:
claude mcp add --transport stdio topos -- uvx topos-mcp
Setup for Codex, Gemini CLI, Cursor, Windsurf, Antigravity, and manual JSON lives in the agent setup guide.
Standalone CLI
curl -fsSL https://docs.krv.ai/topos/install.sh | sh
Prefer Homebrew?
brew install krv-labs/tap/topos
On Homebrew 6+, that one-liner auto-taps and trusts only this formula. If you brew tap krv-labs/tap first, run brew trust --formula krv-labs/tap/topos before brew install topos.
Then run:
topos evaluate . -r
[!TIP] Want GOLD? Run
topos depgraph generateif your agent hasn't already (+ run again after big structural edits), then evaluate with the added CLI flag--gitnexus-dir .gitnexus.
Topos supports Python, Rust, JavaScript, TypeScript, C++, and Go. The CLI defaults to Python; use --language rust|go|javascript|typescript|cpp for another language. See Installation for platform support and alternative install paths.
More ways to use Topos
- OpenClaw / ClawHub:
openclaw skills install @Krv-Labs/topos - Hermes:
hermes skills tap add Krv-Labs/toposthenhermes skills install Krv-Labs/topos/topos - MCP Registry name:
io.github.Krv-Labs/topos - CLI reference: docs.krv.ai/topos/cli
What Topos checks
Every file gets three independent verdicts:
- SIMPLE — avoids unnecessary complexity using AST entropy and control-flow complexity.
- COMPOSABLE — stays decoupled from the repository using module-dependency structure and Martin instability.
- SECURE — avoids dangerous API reachability and taint paths in the code property graph.
Those verdicts roll up into one memorable quality medal without hiding which pillar failed:
| Medal | Criteria |
|---|---|
| 🥇 GOLD | Passes all 3 |
| 🥈 SILVER | Passes 2 of 3 |
| 🥉 BRONZE | Passes 1 of 3 |
| ❌ SLOP | Passes 0, or fails to parse |
Topos also returns ranked refactor guidance: failing metric locations, control-flow cycles, load-bearing dependency edges, process bottlenecks, and optional Graphify knowledge-graph findings. Advisory findings never silently change the scored medal.
How the medal system is derived
The three pillars are pairwise incomparable and form an eight-element evaluation lattice; GOLD is their intersection.
---
config:
layout: dagre
theme: neutral
---
graph BT
SLOP["❌ SLOP<br/>No Medal"]
SIMPLE["🥉 BRONZE<br/>Simple"]
COMPOSABLE["🥉 BRONZE<br/>Composable"]
SECURE["🥉 BRONZE<br/>Secure"]
SC["🥈 SILVER<br/>S ∧ C"]
SSc["🥈 SILVER<br/>S ∧ Sc"]
CSc["🥈 SILVER<br/>C ∧ Sc"]
IDEAL["🥇 GOLD<br/>Quality Code"]
SLOP --> SIMPLE
SLOP --> COMPOSABLE
SLOP --> SECURE
SIMPLE --> SC
SIMPLE --> SSc
COMPOSABLE --> SC
COMPOSABLE --> CSc
SECURE --> SSc
SECURE --> CSc
SC --> IDEAL
SSc --> IDEAL
CSc --> IDEAL
style SLOP fill:#f8d7da,stroke:#842029,color:#000
style SIMPLE fill:#cd7f32,stroke:#5c3a1e,color:#fff
style COMPOSABLE fill:#cd7f32,stroke:#5c3a1e,color:#fff
style SECURE fill:#cd7f32,stroke:#5c3a1e,color:#fff
style SC fill:#c0c0c0,stroke:#4a4a4a,color:#000
style SSc fill:#c0c0c0,stroke:#4a4a4a,color:#000
style CSc fill:#c0c0c0,stroke:#4a4a4a,color:#000
style IDEAL fill:#ffd700,stroke:#856404,color:#000
Distribution
Topos ships four ways:
- GitHub Releases — the
toposCLI binary (macOS/Linux), viainstall.shor a direct release download. - PyPI —
topos-mcp, a thinbin-wheel bundling the MCP server binary (pip install topos-mcp/uvx topos-mcp), zero Python runtime. - VS Code Marketplace — the Topos extension, bundling platform binaries.
- Docker — a container image for Glama and other MCP-registry hosting.
Crate layout and adapter details: docs.krv.ai/topos/architecture.
Contributing
Topos is used internally at Krv Labs to manage AI-agent code output. We welcome bugs, ideas, and contributions.
- Bug? Open an issue
- Idea? Start a discussion or open a PR
- Collaborate? team@krv.ai
Full documentation · Measures and metrics · Engineering notes
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
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 topos_mcp-0.4.1-py3-none-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: topos_mcp-0.4.1-py3-none-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 16.7 MB
- Tags: Python 3, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
85b8e1f204896e65417c1168eb0129add9d384012977f8792507639b625e0082
|
|
| MD5 |
f338e4776121dcd822e16e523cbac578
|
|
| BLAKE2b-256 |
2763831dee99b98052081b7a90bcc937f1cb04657cf7bdbb8147bfbfebffee9d
|
Provenance
The following attestation bundles were made for topos_mcp-0.4.1-py3-none-manylinux_2_34_x86_64.whl:
Publisher:
release.yml on Krv-Labs/topos
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
topos_mcp-0.4.1-py3-none-manylinux_2_34_x86_64.whl -
Subject digest:
85b8e1f204896e65417c1168eb0129add9d384012977f8792507639b625e0082 - Sigstore transparency entry: 2244348815
- Sigstore integration time:
-
Permalink:
Krv-Labs/topos@4b8ac2f6608afa6878c7341b1e045ccdd9e05250 -
Branch / Tag:
refs/tags/v0.4.1 - Owner: https://github.com/Krv-Labs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@4b8ac2f6608afa6878c7341b1e045ccdd9e05250 -
Trigger Event:
push
-
Statement type:
File details
Details for the file topos_mcp-0.4.1-py3-none-manylinux_2_34_aarch64.whl.
File metadata
- Download URL: topos_mcp-0.4.1-py3-none-manylinux_2_34_aarch64.whl
- Upload date:
- Size: 16.1 MB
- Tags: Python 3, manylinux: glibc 2.34+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8b6dcc52fafa085d8fafd840ac2aff97a1461600250b9991fd26d933fb5005db
|
|
| MD5 |
ad2870bdbaec1f019e0ea6388b09704d
|
|
| BLAKE2b-256 |
bcca929246b2120dee74a6b3967ea92a73154f43ef438df3f0e68a83a7fe9889
|
Provenance
The following attestation bundles were made for topos_mcp-0.4.1-py3-none-manylinux_2_34_aarch64.whl:
Publisher:
release.yml on Krv-Labs/topos
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
topos_mcp-0.4.1-py3-none-manylinux_2_34_aarch64.whl -
Subject digest:
8b6dcc52fafa085d8fafd840ac2aff97a1461600250b9991fd26d933fb5005db - Sigstore transparency entry: 2244348010
- Sigstore integration time:
-
Permalink:
Krv-Labs/topos@4b8ac2f6608afa6878c7341b1e045ccdd9e05250 -
Branch / Tag:
refs/tags/v0.4.1 - Owner: https://github.com/Krv-Labs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@4b8ac2f6608afa6878c7341b1e045ccdd9e05250 -
Trigger Event:
push
-
Statement type:
File details
Details for the file topos_mcp-0.4.1-py3-none-macosx_13_0_arm64.whl.
File metadata
- Download URL: topos_mcp-0.4.1-py3-none-macosx_13_0_arm64.whl
- Upload date:
- Size: 10.2 MB
- Tags: Python 3, macOS 13.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bb1897a4303fa23cc1c25eabf331f1b8a0ff4769f5d8b63ffd9300fd437645fa
|
|
| MD5 |
f90bd2c5478251581cb256f66b4c0244
|
|
| BLAKE2b-256 |
3f69855d061d9a593c1761f07afef971120c238084bc3b360bd8fe49c5aca963
|
Provenance
The following attestation bundles were made for topos_mcp-0.4.1-py3-none-macosx_13_0_arm64.whl:
Publisher:
release.yml on Krv-Labs/topos
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
topos_mcp-0.4.1-py3-none-macosx_13_0_arm64.whl -
Subject digest:
bb1897a4303fa23cc1c25eabf331f1b8a0ff4769f5d8b63ffd9300fd437645fa - Sigstore transparency entry: 2244347775
- Sigstore integration time:
-
Permalink:
Krv-Labs/topos@4b8ac2f6608afa6878c7341b1e045ccdd9e05250 -
Branch / Tag:
refs/tags/v0.4.1 - Owner: https://github.com/Krv-Labs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@4b8ac2f6608afa6878c7341b1e045ccdd9e05250 -
Trigger Event:
push
-
Statement type: