Tenets
Offline MCP server that ranks & summarizes code using BM25, TF-IDF, embeddings & git signals; integrates with Cursor, Claude Desktop and Windsurf; privacy preserving.
tenets
MCP server for context that feeds your prompts.
Intelligent code context aggregation + automatic guiding principles injection—100% local.
Coverage note: Measures core modules (distiller, ranking, MCP, CLI, models). Optional features (viz, language analyzers) are excluded.
tenets is an MCP server for AI coding assistants. It solves two critical problems:
-
Intelligent Code Context — Finds, ranks, and aggregates the most relevant code using NLP (BM25, TF-IDF, import centrality, git signals). No more manual file hunting.
-
Automatic Guiding Principles — Injects your tenets (coding standards, architecture rules, security requirements) into every prompt automatically. Prevents context drift in long conversations.
Integrates natively with Cursor, Claude Desktop, Windsurf, VS Code via Model Context Protocol. Also ships a CLI and Python library. 100% local processing — no API costs, no data leaving your machine.
What is tenets?
- Finds all relevant files automatically using NLP analysis
- Ranks them by importance using BM25, TF-IDF, ML embeddings, and git signals
- Aggregates them within your token budget with intelligent summarizing
- Injects guiding principles (tenets) automatically into every prompt for consistency
- Integrates natively with AI assistants via Model Context Protocol (MCP)
- Pins critical files per session for guaranteed inclusion
- Transforms content on demand (strip comments, condense whitespace, or force full raw context)
MCP-first Quickstart (recommended)
- Install + start MCP server
pip install tenets[mcp] tenets-mcp - Claude Code (CLI / VS Code extension)
Or manually add toclaude mcp add tenets -s user -- tenets-mcp~/.claude.json:{ "mcpServers": { "tenets": { "type": "stdio", "command": "tenets-mcp", "args": [] } } } - Claude Desktop (macOS app -
~/Library/Application Support/Claude/claude_desktop_config.json){ "mcpServers": { "tenets": { "command": "tenets-mcp" } } } - Cursor (
~/.cursor/mcp.json){ "mcpServers": { "tenets": { "command": "tenets-mcp" } } } - Windsurf (
~/.windsurf/mcp.json){ "tenets": { "command": "tenets-mcp" } } - VS Code Extension (alternative for VS Code users)
- Install from VS Code Marketplace ⭐
- Or search "Tenets MCP Server" in VS Code Extensions
- Extension auto-starts the server and provides status indicator + commands
- Docs (full tool list & transports): https://tenets.dev/MCP/
Installation (CLI/Python)
# Using pipx (recommended for CLI tools)
pipx install tenets[mcp] # MCP server + CLI (recommended)
pipx install tenets # CLI only (no MCP server)
# Or using pip
pip install tenets[mcp] # Adds MCP server dependencies (REQUIRED for MCP)
pip install tenets # CLI + Python, BM25/TF-IDF ranking (no MCP)
pip install tenets[light] # RAKE/YAKE keyword extraction
pip install tenets[viz] # Visualization features
pip install tenets[ml] # ML embeddings / reranker (2GB+)
pip install tenets[all] # Everything
Important: The [mcp] extra is required for MCP server functionality. Without it:
- The
tenets-mcpexecutable exists but will fail when you try to run it - Missing dependencies:
mcp,sse-starlette,uvicorn(15 additional packages) - You'll get a clear error:
ImportError: MCP dependencies not installed
MCP Tool Surface (AI assistants)
- Start the MCP server
pip install tenets[mcp] tenets-mcp - Cursor (
~/.cursor/mcp.json){ "mcpServers": { "tenets": { "command": "tenets-mcp" } } } - Claude Desktop (
~/Library/Application Support/Claude/claude_desktop_config.json){ "mcpServers": { "tenets": { "command": "tenets-mcp" } } } - Tools exposed:
distill,rank,examine,session_*,tenet_*, plussearch_tools+get_tool_schemafor on-demand discovery. - Docs: see
docs/MCP.mdfor full endpoint/tool list, SSE/HTTP details, and IDE notes.
MCP Server (AI assistant integration)
Once you start tenets-mcp and drop one of the configs above into your IDE, ask your AI:
- “Use tenets to find the auth code” (calls
distill) - “Pin src/auth to session auth-feature” (calls
session_pin_folder) - “Rank files for the payment bug” (calls
rank_files)
See MCP docs for transports (stdio/SSE/HTTP), tool schemas, and full examples.
Quick Start
Three Ranking Modes
Tenets offers three modes that balance speed vs. accuracy for both distill and rank commands:
| Mode | Speed | Accuracy | Use Case | What It Does |
|---|---|---|---|---|
| fast | Fastest | Good | Quick exploration | Keyword & path matching, basic relevance |
| balanced | 1.5x slower | Better | Most use cases (default) | BM25 scoring, keyword extraction, structure analysis |
| thorough | 4x slower | Best | Complex refactoring | ML semantic similarity, pattern detection, dependency graphs |
Core Commands
distill - Build Context with Content
# Basic usage - finds and aggregates relevant files
tenets distill "implement OAuth2" # Searches current directory by default
# Search specific directory
tenets distill "implement OAuth2" ./src
# Copy to clipboard (great for AI chats)
tenets distill "fix payment bug" --copy
# Generate interactive HTML report
tenets distill "analyze auth flow" --format html -o report.html
# Speed/accuracy trade-offs
tenets distill "debug issue" --mode fast # <5s, keyword matching
tenets distill "refactor API" --mode thorough # Semantic analysis
# ML-enhanced ranking (requires pip install tenets[ml])
tenets distill "fix auth bug" --ml # Semantic embeddings
tenets distill "optimize queries" --ml --reranker # Neural reranking (best accuracy)
# Transform content to save tokens
tenets distill "review code" --remove-comments --condense
# Adjust timeout (default 120s; set 0 to disable)
tenets distill "implement OAuth2" --timeout 180
rank - Preview Files Without Content
# See what files would be included (much faster than distill!)
tenets rank "implement payments" --top 20 # Searches current directory by default
# Understand WHY files are ranked
tenets rank "fix auth" --factors
# Tree view for structure understanding
tenets rank "add caching" --tree --scores
# ML-enhanced ranking for better accuracy
tenets rank "fix authentication" --ml # Uses semantic embeddings
tenets rank "database optimization" --ml --reranker # Cross-encoder reranking
# Export for automation
tenets rank "database migration" --format json | jq '.files[].path'
# Search specific directory
tenets rank "payment refactoring" ./src --top 10
Sessions & Guiding Principles (Tenets)
The killer feature: define guiding principles once, and they're automatically injected into every prompt.
# Create a working session
tenets session create payment-feature
# Add guiding principles (tenets) — these auto-inject into all prompts
tenets tenet add "Always validate user inputs before database operations" --priority critical
tenets tenet add "Use Decimal for monetary calculations, never float" --priority high
tenets tenet add "Log all payment state transitions" --priority medium
# Pin critical files (guaranteed inclusion in context)
tenets session pin-file payment-feature src/core/payment.py
# Instill tenets to the session
tenets instill --session payment-feature
# Now every distill automatically includes your tenets + pinned files
tenets distill "add refund flow" --session payment-feature
# Output includes: relevant code + your 3 guiding principles
Why this matters: In long AI conversations, context drifts. The AI forgets your coding standards. Tenets solve this by re-injecting your rules every time.
Other Commands
# Visualize architecture
tenets viz deps --output architecture.svg # Dependency graph
tenets viz deps --format html -o deps.html # Interactive HTML
# Track development patterns
tenets chronicle --since "last week" # Git activity
tenets momentum --team # Sprint velocity
# Analyze codebase
tenets examine . --complexity --threshold 10 # Find complex code
Configuration
Create .tenets.yml in your project:
ranking:
algorithm: balanced # fast | balanced | thorough
threshold: 0.1
use_git: true # Use git signals for relevance
context:
max_tokens: 100000
output:
format: markdown
copy_on_distill: true # Auto-copy to clipboard
ignore:
- vendor/
- '*.generated.*'
How It Works
Code analysis intelligence
tenets employs a multi-layered approach optimized specifically for code understanding (but its core functionality could be applied to any field of document matching). It tokenizes camelCase and snake_case identifiers intelligently. Test files are excluded by default unless specifically mentioned in some way. Language-specific AST parsing for 15+ languages is included.
Multi-ranking NLP
Deterministic algorithms in balanced work reliably and quickly meant to be used by default. BM25 scoring prevents biasing of files which may use redundant patterns (test files with which might have "response" referenced over and over won't necessarily dominate searches for "response").
The default ranking factors consist of: BM25 scoring (25% - statistical relevance preventing repetition bias), keyword matching (20% - direct substring matching), path relevance (15%), TF-IDF similarity (10%), import centrality (10%), git signals (10% - recency 5%, frequency 5%), complexity relevance (5%), and type relevance (5%).
Smart Summarization
When files exceed token budgets, tenets intelligently preserves:
- Function/class signatures
- Import statements
- Complex logic blocks
- Documentation and comments
- Recent changes
ML / deep learning embeddings
Semantic understand can be had with ML features: pip install tenets[ml]. Enable with --ml --reranker flags or set use_ml: true and use_reranker: true in config.
In thorough mode, sentence-transformer embeddings are enabled, and understand that authenticate() and login() are conceptually related for example, and that payment even has some crossover in relevancy (since these are typically associated together).
Optional cross-encoder neural re-ranking in this mode jointly evaluates query-document pairs with self-attention for superior accuracy.
A cross-encoder, for example, will correctly rank "DEPRECATED: We no longer implement oauth2" lower than implement_authorization_flow() for query "implement oauth2", understanding the negative context despite keyword matches.
Since cross-encoders process document-query pairs together (O(n²) complexity), they're much slower than bi-encoders and only used for re-ranking top K results.
Documentation
- Full Documentation - Complete guide and API reference
- CLI Reference - All commands and options
- Configuration Guide - Detailed configuration options
- Architecture Overview - How tenets works internally
Output Formats
# Markdown (default, optimized for AI)
tenets distill "implement OAuth2" --format markdown
# Interactive HTML with search, charts, copy buttons
tenets distill "review API" --format html -o report.html
# JSON for programmatic use
tenets distill "analyze" --format json | jq '.files[0]'
# XML optimized for Claude
tenets distill "debug issue" --format xml
Python API
from tenets import Tenets
# Initialize
tenets = Tenets()
# Basic usage
result = tenets.distill("implement user authentication")
print(f"Generated {result.token_count} tokens")
# Rank files without content
from tenets.core.ranking import RelevanceRanker
ranker = RelevanceRanker(algorithm="balanced")
ranked_files = ranker.rank(files, prompt_context, threshold=0.1)
for file in ranked_files[:10]:
print(f"{file.path}: {file.relevance_score:.3f}")
Supported Languages
Specialized analyzers for Python, JavaScript/TypeScript, Go, Java, C/C++, Ruby, PHP, Rust, and more. Configuration and documentation files are analyzed with smart heuristics for YAML, TOML, JSON, Markdown, etc.
Contributing
See CONTRIBUTING.md for guidelines.
License
MIT License - see LICENSE for details.
Documentation · MCP Guide · Privacy · Terms
関連サーバー
Alpha Vantage MCP Server
スポンサーAccess financial market data: realtime & historical stock, ETF, options, forex, crypto, commodities, fundamentals, technical indicators, & more
FAL FLUX.1 Kontext [Max]
A frontier image generation and editing model with advanced text rendering and contextual understanding, powered by the FAL AI API.
MCP Repo Search Server
MCP server that gives LLMs structural code intelligence across multiple repos
Quantum Computation
Perform quantum computations using OpenAI and IBM Quantum APIs.
MalwareAnalyzerMCP
Execute terminal commands for malware analysis. Requires Node.js 18 or higher.
MCP Agent Trace Inspector
Step-by-step observability for MCP agent workflows — trace, inspect, and debug multi-step agent executions
GhostMCP
Injectable MCP server for AI-driven reverse engineering inside processes
Petclinic
Interacts with the Swagger Petstore API using Petclinic v3 APIs, exposing tools for OpenAI models.
A2ABench
Agent-native developer Q&A API with MCP + A2A endpoints for citations, job pickup, and answer submission.
BCMS MCP
Give me a one - two sentence description of the BCMS MCP # MCP The BCMS Model Context Protocol (MCP) integration enables AI assistants like Claude, Cursor, and other MCP-compatible tools to interact directly with your BCMS content. This allows you to create, read, and update content entries, manage media files, and explore your content structure—all through natural language conversations with AI. ## What is MCP? The [Model Context Protocol (MCP)](https://modelcontextprotocol.io/) is an open standard developed by Anthropic that allows AI applications to securely connect to external data sources and tools. With BCMS MCP support, you can leverage AI assistants to: - Query and explore your content structure - Create new content entries with AI-generated content - Update existing entries - Manage your media library - Get intelligent suggestions based on your content model --- ## Getting Started ### Prerequisites 1. A BCMS account with an active instance 2. An MCP key with appropriate permissions 3. An MCP-compatible client (Claude Desktop, Cursor, or any MCP client) ### Step 1: Create an MCP Key 1. Navigate to your BCMS dashboard 2. Go to Settings → MCP 3. Click Create MCP Key 4. Configure the permissions for templates you want the AI to access:GET: Read entries 5. POST: Create entries 6. PUT: Update entries 7. DELETE: Delete entries Note: Right now, MCP only supports creating, reading and updating content. ### Step 2: Configure Your MCP Client You can find full instructions for integrating BCMS with your AI tools right inside BCMS, on the MCP page. But in general, installing BCMS MCP works in a standard way: ``` { "mcpServers": { "bcms": { "url": "https://app.thebcms.com/api/v3/mcp?mcpKey=YOUR_MCP_KEY" } } } ``` ## Available Tools Once connected, your AI assistant will have access to the following tools based on your MCP key permissions: ### Content Discovery #### list_templates_and_entries Lists all templates and their entries that you have access to. This is typically the first tool to call when exploring your BCMS content. Returns: - Template IDs, names, and slugs - Entry IDs with titles and slugs for each language Example prompt: "Show me all the templates and entries in my BCMS" --- ### Entry Management #### list_entries_for_{templateId} Retrieves all entries for a specific template with full content data. A separate tool is generated for each template you have access to. Returns: - Complete entry data including all meta fields - Content in all configured languages - Entry statuses Example prompt: "List all blog posts from my Blog template" --- #### create_entry_for_{templateId} Creates a new entry for a specific template. The input schema is dynamically generated based on your template's field structure. Input: - statuses: Array of status assignments per language - meta: Array of metadata for each language (title, slug, custom fields) - content: Array of content nodes for each language Example prompt: "Create a new blog post titled 'Getting Started with BCMS' with a brief introduction paragraph" --- #### update_entry_for_{templateId} Updates an existing entry for a specific language. Input: - entryId: The ID of the entry to update - lng: Language code (e.g., "en") - status: Optional status ID - meta: Updated metadata - content: Updated content nodes Example prompt: "Update the introduction paragraph of my 'Getting Started' blog post" --- ### Media Management #### list_all_media Lists all media files in your media library. Returns: - Media IDs, names, and types - File metadata (size, dimensions for images) - Parent directory information Example prompt: "Show me all images in my media library" --- #### list_media_dirs Lists the directory structure of your media library. Returns: - Hierarchical directory structure - Directory IDs and names Example prompt: "Show me the folder structure of my media library" --- #### create-media-directory Creates a new directory in your media library. Input: - name: Name of the directory - parentId: Optional parent directory ID (root if not specified) Example prompt: "Create a new folder called 'Blog Images' in my media library" --- #### request-upload-media-url Returns a URL you use to upload a file (for example via POST with multipart form data), which avoids pushing large binaries through the MCP tool payload. You still need a valid file name and MIME type when uploading, as described in the tool response. Availability: Only when the MCP key has Can mutate media enabled. Example prompt: “Give me an upload URL for a new hero image, then tell me how to upload it.” Input: - fileName: Name of the file with extension - fileData: Base64-encoded file data (with data URI prefix) - parentId: Optional parent directory ID Example prompt: "Upload this image to my Blog Images folder" --- ### Linking Tools #### get_entry_pointer_link Generates an internal BCMS link to an entry for use in content. Input: - entryId: The ID of the entry to link to Returns: - Internal link format: entry:{entryId}@*_{templateId}:entry Example prompt: "Get me the internal link for the 'About Us' page entry" --- #### get_media_pointer_link Generates an internal BCMS link to a media item for use in content. Input: - mediaId: The ID of the media item Returns: - Internal link format: media:{mediaId}@*_@*_:entry Example prompt: "Get the link for the hero image so I can use it in my blog post" --- ## Content Structure ### Entry Content Nodes When creating or updating entries, content is structured as an array of nodes. Supported node types include: Type Description paragraph Standard text paragraph heading Heading (h1-h6) bulletList Unordered list orderedList Numbered list listItem List item codeBlock Code block with syntax highlighting blockquote Quote block image Image node widget Custom widget with props ### Example Content Structure ``` { "content": [ { "lng": "en", "nodes": [ { "type": "heading", "attrs": { "level": 1 }, "content": [ { "type": "text", "text": "Welcome to BCMS" } ] }, { "type": "paragraph", "content": [ { "type": "text", "text": "This is your first paragraph." } ] } ] } ] } ``` ## Security & Permissions ### MCP Key Scopes Your MCP key controls what the AI can access: - Template Access: Only templates explicitly granted in the MCP key are visible - Operation Permissions: Each template can have independent GET/POST/PUT/DELETE permissions - Media Access: Media operations are controlled separately ### Best Practices 1. Principle of Least Privilege: Only grant the permissions needed for your use case 2. Separate Keys: Create different MCP keys for different purposes or team members 3. Regular Rotation: Periodically rotate your MCP keys ## Use Cases ### Content Creation Workflows Blog Post Creation "Create a new blog post about the benefits of headless CMS. Include an introduction, three main benefits with explanations, and a conclusion. Use the Blog template." Product Updates "Update the price field for all products in the Electronics category to apply a 10% discount" ### Content Exploration Content Audit "List all blog posts that don't have a featured image set" Translation Status "Show me which entries are missing German translations" ### Media Organization Library Cleanup "Show me all unused images in the media library" Folder Setup "Create folder structure for: Products > Categories > Electronics, Clothing, Home" ## Troubleshooting ### Common Issues #### "MCP key not found" - Verify your MCP key format: keyId.keySecret.instanceId - Ensure the MCP key hasn't been deleted or deactivated - Check that you're using the correct instance #### "MCP key does not have access to template" - Review your MCP key permissions in the dashboard - Ensure the required operation (GET/POST/PUT/DELETE) is enabled for the template #### Session Expired - MCP sessions may timeout after periods of inactivity - Simply start a new conversation to establish a fresh session ### Getting Help - Documentation: [thebcms.com/docs](https://thebcms.com/docs) - Support: [[email protected]](mailto:[email protected]) - Community: [Join BCMS Discord](https://discord.com/invite/SYBY89ccaR) for community support ## Technical Reference ### Endpoint POST https://app.thebcms.com/api/v3/mcp?mcpKey={MCP_KEY} ### Transport BCMS MCP uses the Streamable HTTP transport with session management. Sessions are maintained via the mcp-session-id header. ### Response Format All tools return structured JSON responses conforming to the MCP specification with: - content: Array of content blocks - structuredContent: Typed response data ## Rate Limits MCP requests are subject to the same rate limits as API requests: - Requests are tracked per MCP key - Contact support if you need higher limits for production workloads
mcp-analytics
MCP-native Web analytics. Install one JS snippet, add the connector to Claude/Cursor/ChatGPT, then ask questions about your traffic directly in chat. No dashboard. No charts. Just answers. EU-hosted, GDPR-ready. Free up to 100k hits/month.