tenetstenets

MCP server for context that feeds your prompts

100% local NLP-powered code ranking for AI coding assistants

pip install tenets[mcp]

BM25 + TF-IDF + import graphs find the right files automatically.
Native MCP for Cursor, Claude Desktop, Windsurf.
Your code never leaves your machine.

Setup MCPQuick StartCLI DocsSee Examples

Quick Setup

One install, one config — context that feeds your prompts

1Install: pip install tenets[mcp]

2Add to ~/.cursor/mcp.json:

{
  "mcpServers": {
    "tenets": {
      "command": "tenets-mcp"
    }
  }
}

1Install: pip install tenets[mcp]

2Add to claude_desktop_config.json:

{
  "mcpServers": {
    "tenets": {
      "command": "tenets-mcp"
    }
  }
}

Config location → macOS: ~/Library/Application Support/Claude/ · Windows: %APPDATA%\Claude\

1Install: pip install tenets[mcp]

2Settings → Extensions → MCP, add:

{
  "mcpServers": {
    "tenets": {
      "command": "tenets-mcp"
    }
  }
}

✓ Restart your IDE — tenets tools are now available

🔌 Native MCP Integration

Model Context Protocol is Anthropic's open standard for AI tool connectivity. Tenets is a local MCP server — your AI assistant calls it directly to get intelligent code context.

🧠 NLP-Powered Ranking

Other MCP servers give raw file access. Tenets uses NLP analysis — BM25, TF-IDF, keyword extraction, import graphs — to find and rank the most relevant code for any task.

🔒 100% Local Processing

Everything runs on your machine. No cloud APIs, no data leaving your computer, no API keys for core features. Your codebase stays completely private.

See It In Action

$ tenets distill "add mistral api to summarizer" --format html

Context building - Analyzing files

Analyzing and ranking relevant files

Context building - Building context

Building optimized context with summaries

$ tenets rank "fix summarizing truncation bug" --tree

Ranking the most relevant files

Ranking files by relevance using multi-factor scoring

$ tenets examine . --complexity --hotspots --ownership

Code analysis

Comprehensive code analysis with metrics

$ tenets examine . --show-details --hotspots --format html

Quality metrics

Code quality metrics and improvement suggestions

$ tenets session create payment-integration
$ tenets tenet add "Always validate user input" --priority critical --category security
$ tenets tenet add "Use type hints in Python" --priority high --category style
$ tenets instill --session payment-integration
$ tenets system-instruction set "Prefer small, safe diffs and add tests" --enable
$ tenets distill "add OAuth2 refresh tokens" --session payment-integration --remove-comments --condense

Sessions - Creating session

Creating a session and adding tenets

Sessions - Managing tenets

Managing and instilling guiding principles

Sessions - Building context

Building context with session-aware tenets

$ tenets momentum --team --since "last month" --detailed

Velocity

Team velocity metrics and trends

$ tenets viz deps --format html --output interactive.html

Visualization

D3.js interactive dependency graph visualization

Core Features

Intelligent Context Building

Multi-factor ranking algorithm that goes beyond keyword matching. Analyzes code structure, import relationships, Git history, and semantic meaning to surface exactly the files you need for any development task.

  • Multi-Factor Ranking: Keywords, structure, imports, path relevance, and Git signals
  • Optional ML: Semantic embeddings and transformers when tenets[ml] is installed
  • Summarization: Rules-based and ML summarizers built-in; LLMs only if API keys enabled
  • Token Optimization: Budget-aware packing and model-specific token counting
  • Lightweight Extras: Extras-based dependency architecture keeps core lean

Code Quality Metrics & Evaluation

Comprehensive evaluation system that assesses code quality, identifies hotspots, tracks technical debt, and provides actionable insights. Use tenets not just for prompting but for continuous code quality monitoring and improvement.

  • Complexity Analysis: Cyclomatic, cognitive, and Halstead metrics
  • Quality Evaluation: Maintainability index and code health scoring
  • Technical Debt Tracking: Identify and prioritize refactoring needs
  • Test Coverage Analysis: Find untested code paths and improve reliability
  • Code Pattern Detection: Identify anti-patterns and best practices

Stateful Prompting & Tenets

Build complex features iteratively with persistent sessions. Define guiding principles (tenets) that shape how AI understands your codebase. Perfect for ongoing conversations with AI assistants and maintaining context across multiple prompts.

  • Persistent Context: Maintain state across multiple CLI invocations
  • Guiding Tenets: Define principles that guide AI interactions
  • Incremental Building: Add context without starting over each time
  • Session Branching: Explore alternatives without losing work
  • SQLite Storage: Reliable local session persistence and history

Development Intelligence & Insights

Track velocity, identify bottlenecks, and understand team patterns. Visualize your architecture, monitor code evolution, and make data-driven decisions about refactoring, technical debt, and resource allocation.

  • Velocity Tracking: Monitor team and individual productivity metrics
  • Hotspot Analysis: Find frequently changing and problematic areas
  • Dependency Visualization: Understand architecture and coupling
  • Contributor Analytics: Track code ownership and expertise
  • Trend Analysis: Monitor quality and velocity changes over time

How the NLP Pipeline Works

1

Input

Natural language prompt
or specific query

2

Scan

Parallel file discovery
respecting .gitignore

3

Analyze

Language analyzers & AST
structure and metrics

4

Rank

Multi-factor scoring
keywords, structure, git

5

ML (Optional)

Embeddings & semantic
similarity when enabled

6

Tenets Injection

Inject guiding principles
maintain consistency

7

Summarize & Output

Token budgeting & summaries
LLMs optional via API keys

Installation Options

Recommended

Local MCP Server

pip install tenets[mcp]

Context that feeds your prompts

Core Only

pip install tenets

CLI + Python library (no MCP)

Everything

pip install tenets[all]

MCP + ML + visualization

Docker

# Official Docker commands are coming soon

Official Docker image and compose examples coming soon

View Installation Guide View on GitHub