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_LOG_LEVEL Log level (DEBUG, INFO, WARNING, ERROR) INFO
CANON_LOG_JSON Output logs in JSON format false

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.1.0.tar.gz (36.4 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.1.0-py3-none-any.whl (34.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mcp_canon-0.1.0.tar.gz
  • Upload date:
  • Size: 36.4 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.1.0.tar.gz
Algorithm Hash digest
SHA256 aa945d8a30124c20d72aac27acf3df5ec5f8b5e2b373f73a8378984b395245ff
MD5 db4733aad6d5c6507ef07e400dc23725
BLAKE2b-256 927b3be849741db4b097b2ddccc22b66312bebef99a7fb2360ee66b810182bd5

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcp_canon-0.1.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.1.0-py3-none-any.whl.

File metadata

  • Download URL: mcp_canon-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 34.6 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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 55ddb7d78499199aaaa4a6efcf93e3b163a01832e1890d5587446a81fdfa3f93
MD5 a6ed35c31e718ad5a2f2aaafa65985a0
BLAKE2b-256 e7134c8bf543a8a4cd38a195884e0844468b0889b5868d1c56f08a95f80dcdd1

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcp_canon-0.1.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