Skip to main content

mcp-canon

MCP server providing architectural patterns and best practices to LLM agents via RAG.

Installation

Standard (with bundled guides)

pip install mcp-canon

Includes pre-populated database with best practices for Python, Docker, Kubernetes, etc.

With indexing support

pip install "mcp-canon[indexing]"

Required for creating your own knowledge base from Markdown files.

With HTTP server support

pip install "mcp-canon[http]"

Development (all dependencies)

pip install "mcp-canon[dev]"

Quick Start

Option 1: Using bundled guides (zero configuration)

Just install and configure your MCP client — the bundled database works immediately.

{
  "mcpServers": {
    "canon": {
      "command": "uvx",
      "args": ["mcp-canon"]
    }
  }
}

Option 2: Create and index your own guides

Complete workflow from installation to running with custom guides.

Step 1: Install with indexing support

pip install "mcp-canon[indexing]"

Step 2: Create library structure

my-library/
├── python/
│   └── fastapi-guide/
│       ├── INDEX.md      # Required: metadata
│       └── GUIDE.md      # Content
└── docker/
    └── best-practices/
        └── INDEX.md      # Can reference external URL

Step 3: Create INDEX.md with frontmatter

mkdir -p my-library/python/fastapi-guide

Create my-library/python/fastapi-guide/INDEX.md:

---
name: fastapi-guide
description: "Production-ready FastAPI patterns and best practices"
metadata:
  tags:
    - python
    - fastapi
    - api
    - production
  type: local
---

Step 4: Add guide content

Create my-library/python/fastapi-guide/GUIDE.md:

# FastAPI Production Guide

## Project Structure
...

## Error Handling
...

Step 5: Index your library

# Index to custom location
canon index --library ./my-library --output /path/to/my-db

# Validate frontmatter before indexing (optional)
canon validate --library ./my-library

Step 6: Configure MCP client

Local mcp

{
  "mcpServers": {
    "canon": {
      "command": "uvx",
      "args": ["mcp-canon"],
      "env": {
        "CANON_DB_PATH": "/path/to/my-db"
      }
    }
  }
}

Option 3: Running as HTTP server

For remote access or multi-client scenarios, run Canon as an HTTP server.

Step 1: Install with HTTP support

pip install "mcp-canon[http]"

Step 2: Start the server

# Default port 8080
canon serve

# Custom port and host
canon serve --port 3000 --host 0.0.0.0

# With custom database
CANON_DB_PATH=/path/to/db canon serve --port 8080

Step 3: Configure MCP client

{
  "mcpServers": {
    "canon": {
      "url": "http://localhost:8080/mcp"
    }
  }
}

Step 4: Verify connection

# Health check
curl http://localhost:8080/health

MCP Client Configuration

Configuration examples for popular MCP clients. Replace CANON_DB_PATH with your database path if using a custom database.

Claude Desktop

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json

{
  "mcpServers": {
    "canon": {
      "command": "uvx",
      "args": ["mcp-canon"]
    }
  }
}

With custom database:

{
  "mcpServers": {
    "canon": {
      "command": "uvx",
      "args": ["mcp-canon"],
      "env": {
        "CANON_DB_PATH": "/path/to/your/db"
      }
    }
  }
}

Cursor

Settings: Cursor Settings > Features > MCP Servers > Add new MCP server

{
  "mcpServers": {
    "canon": {
      "command": "uvx",
      "args": ["mcp-canon"]
    }
  }
}

VS Code (GitHub Copilot)

File: .vscode/mcp.json (project) or user settings

{
  "mcpServers": {
    "canon": {
      "command": "uvx",
      "args": ["mcp-canon"]
    }
  }
}

Windsurf

File: ~/.codeium/windsurf/mcp_config.json

{
  "mcpServers": {
    "canon": {
      "command": "uvx",
      "args": ["mcp-canon"]
    }
  }
}

JetBrains AI Assistant

Settings: Settings > Tools > AI Assistant > Model Context Protocol (MCP) > + Add

{
  "mcpServers": {
    "canon": {
      "command": "uvx",
      "args": ["mcp-canon"]
    }
  }
}

Gemini CLI

File: ~/.gemini/settings.json

{
  "mcpServers": {
    "canon": {
      "command": "uvx",
      "args": ["mcp-canon"]
    }
  }
}

Claude Code CLI

claude mcp add canon -- uvx mcp-canon

Roo Code / Kilo Code

File: .roo/mcp.json or .kilocode/mcp.json

{
  "mcpServers": {
    "canon": {
      "command": "uvx",
      "args": ["mcp-canon"]
    }
  }
}

Augment Code

File: VS Code settings under augment.advanced

{
  "augment.advanced": {
    "mcpServers": [
      {
        "name": "canon",
        "command": "uvx",
        "args": ["mcp-canon"]
      }
    ]
  }
}

Warp

Settings: Settings > AI > Manage MCP servers > + Add

{
  "canon": {
    "command": "uvx",
    "args": ["mcp-canon"],
    "env": {},
    "start_on_launch": true
  }
}

OpenAI Codex CLI

File: ~/.codex/config.toml

[mcp_servers.canon]
command = "uvx"
args = ["mcp-canon"]

HTTP Server Connection

For clients supporting remote MCP servers (after running canon serve):

{
  "mcpServers": {
    "canon": {
      "url": "http://localhost:8080/mcp"
    }
  }
}

Using pip instead of uvx

If you installed via pip instead of uvx:

{
  "mcpServers": {
    "canon": {
      "command": "python",
      "args": ["-m", "mcp_canon"]
    }
  }
}

Environment Variables

Variable Description Default
CANON_DB_PATH Path to custom database Bundled DB
CANON_EMBEDDING_MODEL Fastembed model name (supported models) nomic-ai/nomic-embed-text-v1.5-Q
CANON_EMBEDDING_DIM Embedding vector dimensions (must match model) 768
CANON_FASTEMBED_THREADS ONNX runtime threads for FastEmbed (lower = less RAM, slower) auto
CANON_FASTEMBED_BATCH_SIZE Embedding batch size during indexing (lower = less RAM, slower) 256
CANON_FASTEMBED_PARALLEL FastEmbed data-parallel workers (>1 increases RAM usage) disabled
CANON_LOG_LEVEL Log level (DEBUG, INFO, WARNING, ERROR) INFO
CANON_LOG_JSON Output logs in JSON format false

Note: Changing CANON_EMBEDDING_MODEL or CANON_EMBEDDING_DIM requires a full reindex: canon index --library ./library


Documentation

Document Description
Writing Guides How to write guides that index well — frontmatter schema, content structure best practices, and search optimization

MCP Tools

Tool Description
search_best_practices Semantic search for best practices (within a guide if guide_id is provided)
search_suitable_guides Find guides matching a task description
read_full_guide Get complete guide content

CLI Commands

# Indexing
canon index --library ./library           # Index guides (creates new DB)
canon index --library ./lib --append      # Add to existing database
canon validate --library ./library        # Validate frontmatter

# Server
canon serve --port 8080                   # Start HTTP server (requires [http])

# Info
canon list                                # List indexed guides
canon info                                # Show database info

Frontmatter Schema

Required fields in INDEX.md:

---
name: guide-name              # Must match folder name
description: "Guide description for semantic search"
metadata:
  tags:                       # From controlled vocabulary
    - python
    - fastapi
  type: local                 # "local" for GUIDE.md, "link" for URL
  url: https://...            # Required if type: link
---

License

MIT

Release files for mcp-canon 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mcp-canon 0.2.0
File Size Uploaded
mcp_canon-0.2.0.tar.gz 39.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mcp-canon 0.2.0
File Interpreter ABI Platform
mcp_canon-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 74.9 kB

Release files / mcp_canon-0.2.0.tar.gz

Download URL mcp_canon-0.2.0.tar.gz
Size 39.0 kB
Tags Source
SHA-256 checksum
How to use checksums
d13de0fc0d282f5ef032637b76be54f732865143a1ab3bfd5a67cb22d5626024
BLAKE2b-256 checksum
How to use checksums
cd44e8391d327a6203b263774f52a3222c30b2c685dfb3aed165e8365320da86
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 11, 2026.

Transparency log

Release files / mcp_canon-0.2.0-py3-none-any.whl

Download URL mcp_canon-0.2.0-py3-none-any.whl
Size 35.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c877d5fa66c6d5e2f6a749d849b7f7efa60dcd08dea2908cb55544a61b00ee9a
BLAKE2b-256 checksum
How to use checksums
555a1dff648a00e9e3527484fe241c0879f6ca325e8111f6263911655a9a8244
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 11, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page