Codevira MCP
Codevira
One memory layer for every AI coding tool you use. Switch between Claude Code, Cursor, Windsurf, and Antigravity without losing context, decisions, or progress.
Built for solo developers working on local projects with AI agents. Codevira gives every AI tool you use access to the same persistent project memory — so you stop re-explaining your codebase every session, stop losing carefully-made decisions, and stop burning tokens on re-discovery.
Works with: Claude Code · Claude Desktop · Cursor · Windsurf · Google Antigravity · any MCP-compatible AI tool
The Problem (Four Pains Codevira Solves)
If you code with AI agents on a project longer than a week, you've felt all of these:
1. Re-explaining your codebase every session
Every new chat starts from zero. The AI doesn't know your architecture, your conventions, your "we don't do it that way" decisions. You waste the first 10 minutes (and thousands of tokens) catching it up — only to do it again tomorrow.
2. AI undoing your careful decisions
Last week you debugged a tricky retry policy for 3 hours. Today's AI session refactors it to a simpler version because it has no idea why the complexity exists. Now it's broken again.
3. Cross-tool amnesia
You started planning in Claude Code. Switched to Cursor for autocomplete. Opened Antigravity to run tests. Three different agents, three different blind copies of your project state. Nothing carries over.
4. Token budget burned on re-discovery
Your AI agent reads the same 12 files every session before doing any actual work. You're paying API costs for the same lookups, over and over.
Codevira is a persistent memory layer that fixes all four — for every AI tool, on every project, on your local machine.
Related MCP server: Tages
How It Works
Codevira is a Model Context Protocol server that runs locally and gives any AI tool a structured, queryable memory of your codebase:
Capability | What it means for you |
Zero-config setup |
|
Cross-tool continuity | One |
Decision protection |
|
Context graph | Every source file has a node: role, rules, dependencies, stability, blast radius. AI calls |
Function-level call graph |
|
Semantic code search | Natural-language search across your codebase ( |
Roadmap + changesets | Multi-file work tracked atomically; sessions resume cleanly after interruption |
Adaptive learning | Tracks which past decisions panned out — gives confidence scores and surfaces patterns |
Cross-project memory | Learned preferences sync across all your local projects via |
Auto-init on first call | No |
Token-efficient by design
Codevira is built around the principle that AI agent context windows are precious. Tools return summaries by default with opt-in full data:
get_node(path)— ~100 tokens by default (counts + flags). Passfull=truefor the entire rules array.get_impact(path)— 10 affected files. Passsummary_only=truefor just counts (~80 tokens) before deciding to dig deeper.search_codebase(query)— file/symbol pointers only. Passinclude_content=trueto inline source.search_decisions(query)— 5 truncated matches. Passfull=truefor verbatim text.
The agent always asks for what it needs, in the size it needs.
Quick Start
1. Install
# Recommended: global install via pipx (isolated, works everywhere)
pipx install codevira
# Alternative: pip install
pip install codeviraInstalls the full toolkit (23 AI-facing MCP tools + 12 admin/CLI tools) out of the box. Semantic search downloads a ~90MB embedding model on first use.
2. Register with your AI tools
codevira registerThis one-time global command injects Codevira's MCP config into all detected AI tools — Claude Code, Cursor, Windsurf, Claude Desktop, and Google Antigravity. Run it from anywhere; no project directory needed.
3. Start using
Open any project in your AI tool. On the first MCP tool call, Codevira auto-initializes:
Detects language, source directories, and file extensions from project markers
Creates the context graph and roadmap
Installs a
post-commitgit hook for automatic reindexing
No explicit codevira init needed — everything happens on demand.
Note:
codevira initis still available for explicit per-project setup with custom settings.
4. Verify
Ask your AI agent to call get_roadmap() — it should return your current phase and next action.
Note: Restart your AI tool after running
codevira registerto pick up the new MCP config.
Customizing what's indexed
Codevira tries to auto-detect your project's source layout, but monorepo or non-standard layouts sometimes slip through — you'll notice when codevira index --full reports 0 chunks indexed and prints a hint pointing you here.
cd your-project
codevira configureScans your project (gitignore-aware), shows discovered directories and extensions with file counts, and lets you pick which to watch via a numbered-list prompt. It writes your choices back to .codevira/config.yaml and offers to rebuild the index.
Non-interactive (useful in scripts or CI):
codevira configure --dirs src,packages,apps --extensions .py,.ts,.tsx --no-reindexAfter changing watched directories, restart your AI tool — running watchers snapshot the dir set at boot.
Manual config (only if auto-inject didn't detect your tool)
Codevira supports two transports. Use the right one for your client:
Client | Transport | Config file |
Claude Desktop (app) | stdio |
|
Claude Code (CLI) | stdio or HTTP |
|
Cursor | stdio |
|
Windsurf | stdio |
|
Google Antigravity | stdio |
|
Stdio transport — Claude Desktop, Cursor, Windsurf (.claude/settings.json / .cursor/mcp.json / .windsurf/mcp.json):
{
"mcpServers": {
"codevira": {
"command": "codevira",
"args": [],
"cwd": "/path/to/your-project"
}
}
}Claude Desktop (~/Library/Application Support/Claude/claude_desktop_config.json):
{
"mcpServers": {
"codevira": {
"command": "/path/to/codevira",
"args": ["--project-dir", "/path/to/your-project"]
}
}
}Tip: find the full binary path with
which codevira
HTTP/HTTPS transport — Preview in v1.7, single-project only. The HTTP server binds to one project at startup and cannot switch contexts per request. Multi-project HTTPS is planned for v1.8. For multi-project work today, use stdio via codevira register (above).
First start the HTTP server in a terminal:
codevira serve --port 7007 --project-dir /path/to/your-project
# For HTTPS (required by some clients):
codevira serve --https --port 7443 --project-dir /path/to/your-projectThen register the URL:
{
"mcpServers": {
"codevira": {
"url": "https://localhost:7443/mcp"
}
}
}HTTPS note: Claude Code uses Node.js, which requires a trusted CA for HTTPS. Run once to trust the mkcert CA:
brew install mkcert && mkcert -install launchctl setenv NODE_EXTRA_CA_CERTS "$(mkcert -CAROOT)/rootCA.pem" echo 'export NODE_EXTRA_CA_CERTS="$(mkcert -CAROOT)/rootCA.pem"' >> ~/.zshrcThen restart Claude Code.
Auto-start on login (macOS):
codevira serve --install-service # start server automatically on login
codevira serve --uninstall-service # remove auto-startGoogle Antigravity (~/.gemini/antigravity/mcp_config.json):
{
"mcpServers": {
"codevira": {
"$typeName": "exa.cascade_plugins_pb.CascadePluginCommandTemplate",
"command": "codevira",
"args": []
}
}
}Codevira data layout (v1.6)
~/.codevira/ <- global Codevira home
├── global.db <- cross-project intelligence
├── projects/
│ └── <project-key>/ <- per-project data (keyed by path)
│ ├── config.yaml
│ ├── metadata.json
│ ├── graph/
│ │ ├── graph.db
│ │ └── changesets/
│ ├── codeindex/ <- semantic search (optional)
│ └── logs/
└── certs/ <- HTTPS certs (if using --https)Legacy
.codevira/directories inside project repos are auto-migrated to centralized storage on first server start.
Configuration
Each project has a config.yaml at ~/.codevira/projects/<project-key>/config.yaml. It's auto-generated on first use with sensible defaults, but you can edit it to customize what Codevira indexes:
project:
name: my-project
language: python
collection_name: my_project
# Which directories to scan for source files
watched_dirs:
- src
- tests
- scripts
# Which file extensions count as "source" for indexing + change detection
file_extensions:
- .py
- .ts
- .tsx
# Directories to skip even if inside watched_dirs
skip_dirs:
- node_modules
- .venv
- __pycache__
- dist
- build
logs:
# 0 = keep sessions/decisions forever (default).
# Only set > 0 if you have privacy reasons to time-bound history.
retention_days: 0Common gotchas:
file_extensionsmust be a proper YAML list — each extension on its own line. This is wrong:file_extensions: - .py, .md, .html # ❌ one item containing commas, not three extensionsThis is correct:
file_extensions: - .py - .md - .htmlOr inline:
file_extensions: [.py, .md, .html]file_extensionsis intended for source code (Python, TypeScript, Go, Rust, etc.). Codevira uses tree-sitter AST parsing — putting.mdor.htmlhere may produce malformed graph nodes since tree-sitter parsers for those languages are different.Files are only scanned if they live inside
watched_dirs. Adding an extension alone isn't enough — make sure the directory is listed too.
After editing the config, run codevira index --full to rebuild the graph from scratch, or codevira index for incremental changes.
Uninstall / Reset
codevira clean # remove global data + IDE configs + launchd service
codevira clean --all # also remove per-project artifacts
codevira clean --dry-run # preview what would be removedHow It Works
Setup Flow
flowchart LR
A["pipx install codevira"] --> B["codevira register"]
B --> C["Open project in\nClaude Code / Cursor /\nWindsurf / Antigravity"]
C --> D["First MCP tool call\ntriggers auto-init"]
D --> E["✓ Config written\n✓ Graph built\n✓ Roadmap created\n✓ Ready"]Agent Session Lifecycle
flowchart TB
Start([Start Session])
subgraph "Orientation (single call)"
A["get_session_context()\nroadmap + changesets +\ndecisions + global intelligence"]
end
subgraph "Work"
B[get_node / get_impact\nbefore touching files]
C[Plan + Implement + Test]
D[refresh_index\nafter changes]
end
subgraph "Session End"
E[update_node — record changes]
F[write_session_log — decisions]
G[update_next_action — handoff]
end
Start --> A
A --> B
B --> C
C --> D
D --> E
E --> F
F --> GArchitecture
flowchart TB
A[Source Code\n15+ languages]
subgraph "Indexing Pipeline"
B[Tree-sitter AST Parser]
C[Function / Class / Call Extraction]
D[Background File Watcher\nauto-reindex on save]
end
subgraph "Centralized Storage — ~/.codevira/"
E[(Context Graph + Call Graph\nSQLite DB)]
F[(Semantic Index\nChromaDB — optional)]
G[(Global Memory\ncross-project intelligence)]
H[(Session Logs + Decisions\nsearchable history)]
end
subgraph "Adaptive Learning"
I[Outcome Tracking]
J[Rule Inference]
K[Preference Learning]
end
subgraph "MCP Server"
L[36 Tools + 5 Prompts\nstdio or HTTP transport]
end
M[AI Coding Agent\nClaude Code · Cursor · Windsurf · Antigravity]
A --> B
B --> C
C --> E
C --> F
D --> B
E --> L
F --> L
G --> L
H --> L
I --> G
J --> G
K --> G
E --> I
L --> MSession Protocol
Every agent session follows a simple protocol. Set it up once in your agent's system prompt — then your agents handle the rest.
Session start (mandatory):
list_open_changesets() -> resume any unfinished work first
get_roadmap() -> current phase, next action
search_decisions("topic") -> check what's already been decided
get_node("src/service.py") -> read rules before touching a file
get_impact("src/service.py") -> check blast radiusSession end (mandatory):
complete_changeset(id, decisions=[...])
update_node(file_path, changes)
update_next_action("what the next agent should do")
write_session_log(...)This loop keeps every session fast, focused, and resumable.
MCP Tools + 5 Prompts
23 tools exposed to AI agents (token-optimized, summary-first). The remaining 12 tools are admin/dashboard tools that work via dispatch but aren't advertised in list_tools() — humans access them via the CLI or via specific MCP prompts. Tools marked (admin) below.
Graph Tools
Tool | Description |
| Summary by default (counts + flags); |
| Blast radius — |
| Append rules, connections, key_functions |
| Function-level: callers, callees, tests, dependents, symbols |
| Bulk node listing — agents should use targeted queries instead |
| Register a new file (auto-generated by refresh_graph) |
| Auto-generate stubs (background/automatic) |
| Background reindex (fire-and-forget) |
| Mermaid/DOT export — large dump |
| PR review — use |
| Risk scoring — use |
| Complexity dashboard |
Roadmap Tools
Tool | Description |
| Current phase, next action, open changesets |
| Full details of any phase by number |
| Set what the next agent should do |
| Mark phase in_progress / blocked |
| Queue new upcoming work |
| Mark done, auto-advance to next |
| Move a phase to the deferred list |
| Full history with all decisions inline |
Changeset Tools
Tool | Description |
| All in-progress changesets |
| Open a multi-file changeset |
| Close and record decisions |
| Mid-session checkpoint |
Search Tools
Tool | Description |
| Semantic search — pointers only by default |
| Past decisions (default 5, truncated context) |
| Recent decisions touching a file (default 5) |
| Write structured session record |
Adaptive Learning Tools
Tool | Description |
| THE main "catch me up" call — start every session here (~800 tokens) |
| Outcome-based reliability scores |
| Already in get_session_context |
| Already in get_session_context |
| Dashboard metric — use |
Code Reader Tools
Tool | Description |
| All public symbols, signatures, line numbers (Python, TypeScript, Go, Rust) |
| Full source of one function or class |
Playbook Tool
Tool | Description |
| Curated rules for: |
MCP Workflow Prompts (v1.5)
Prompt | Description |
| Staged diff + blast radius + risk score |
| Symptom -> affected files -> call chain -> hypothesis |
| Full project context catch-up for new sessions |
| Test coverage gaps + high-risk functions before commit |
| Module map + hotspots + dependency summary |
Language Support
Feature | Python | TypeScript | Go | Rust | 12+ Others |
Context graph + blast radius | Y | Y | Y | Y | Y |
Semantic code search | Y | Y | Y | Y | Y |
Function-level call graph | Y | Y | Y | Y | |
| Y | Y | Y | Y | |
AST-based chunking | Y | Y | Y | Y | |
Auto-generated graph stubs | Y | Y | Y | Y | |
Roadmap + changesets | Y | Y | Y | Y | Y |
Session logs + decision search | Y | Y | Y | Y | Y |
Supported languages: Python, TypeScript, JavaScript, Go, Rust, Java, Kotlin, C#, Ruby, PHP, C, C++, Swift, Solidity, Vue.
Requirements
Python 3.10+
~500MB install (includes ChromaDB + sentence-transformers for semantic search)
~90MB model download on first
search_codebase()call
pip install codevira includes the full toolkit out of the box — graph, roadmap, changesets, code reader, learning, call graph, and semantic search.
Minimal install (no semantic search)
If you want to skip the ML stack and use only graph-based tools (semantic search disabled), install without the search deps:
pip install codevira --no-deps
pip install pyyaml mcp watchdog tree-sitter tree-sitter-language-pack rich uvicorn starlette pathspecThe search_codebase tool will be hidden from your AI agent; all other tools work normally.
Background
Want to understand the full story behind why this was built, the design decisions, what didn't work, and how it compares to other tools in the ecosystem?
Read the full write-up: How We Cut AI Coding Agent Token Usage by 92%
Contributing
Contributions are welcome. Read CONTRIBUTING.md for the full guide.
Reporting a bug? Open a bug report Requesting a feature? Open a feature request Found a security issue? Read SECURITY.md — please don't use public issues for vulnerabilities.
Testing a release candidate locally? See docs/local-pypi-https.md for setting up a Docker-based HTTPS PyPI registry that mirrors the real PyPI install flow without touching public PyPI.
FAQ
Common questions about setup, usage, architecture, and troubleshooting — see FAQ.md.
Roadmap
See what's built, what's next, and the long-term vision — see ROADMAP.md.
Star History
If Codevira saves you tokens or sanity, a star helps other developers find it. Tracking growth keeps me focused on what's working.
License
MIT — free to use, modify, and distribute.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- FlicenseNot gradedqualityNot gradedmaintenanceAn MCP server that provides persistent project context, workflow management, and knowledge capture for AI coding agents. It enables agents to maintain structured memory across sessions by tracking project profiles, conventions, skills, and technical debt.7
- AlicenseNot gradedqualityAmaintenanceEnables AI coding agents to maintain persistent, cross-session memory of codebase architecture, naming conventions, and decisions through MCP tools. Eliminates repetitive project re-explanation by automatically injecting stored context into every session with local-first SQLite storage and optional team sharing capabilities.4MIT
- AlicenseNot gradedqualityDmaintenanceAn MCP server that provides persistent, cross-session memory and team knowledge sharing for AI development workflows. It enables project DNA scanning, semantic search, context budgeting, and git-aware indexing to prevent AI context loss between sessions.17MIT
- AlicenseBqualityBmaintenanceMCP server providing persistent engineering memory and spec-driven development workflows for AI coding agents, preserving learnings across sessions.41Business Source 1.1
Related MCP Connectors
Persistent memory and cross-session learning for AI coding assistants (hosted remote MCP).
One shared brain for your AI coding agents: team memory, agent Q&A, tasks, and file claims.
Your memory, everywhere AI goes. Build knowledge once, access it via MCP anywhere.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/sachinshelke/codevira'
If you have feedback or need assistance with the MCP directory API, please join our Discord server