Skip to main content

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

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcp_canon-0.2.0.tar.gz (39.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mcp_canon-0.2.0-py3-none-any.whl (35.8 kB view details)

Uploaded Python 3

File details

Details for the file mcp_canon-0.2.0.tar.gz.

File metadata

  • Download URL: mcp_canon-0.2.0.tar.gz
  • Upload date:
  • Size: 39.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mcp_canon-0.2.0.tar.gz
Algorithm Hash digest
SHA256 d13de0fc0d282f5ef032637b76be54f732865143a1ab3bfd5a67cb22d5626024
MD5 ff319631c0ea8f2a9340c51be33f6399
BLAKE2b-256 cd44e8391d327a6203b263774f52a3222c30b2c685dfb3aed165e8365320da86

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcp_canon-0.2.0.tar.gz:

Publisher: publish.yml on tripcher/canon

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mcp_canon-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: mcp_canon-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 35.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mcp_canon-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c877d5fa66c6d5e2f6a749d849b7f7efa60dcd08dea2908cb55544a61b00ee9a
MD5 8d172c9ef80d64d2519d8ddd0bf9d890
BLAKE2b-256 555a1dff648a00e9e3527484fe241c0879f6ca325e8111f6263911655a9a8244

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcp_canon-0.2.0-py3-none-any.whl:

Publisher: publish.yml on tripcher/canon

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page