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.1.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.1-py3-none-any.whl (34.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mcp_canon-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 765c9f2818aad4f3158c0be91e6e974a1bcb6fdc81ce1182366498b0e7c90e6e
MD5 6fd0cdd554d6bb615e9403fe2097df33
BLAKE2b-256 5a4bb996708739f07e841b6e52f18c7d56f7ee5d79fd0f837251f67018587f2f

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: mcp_canon-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 34.7 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 27be000af15c8f7a3820b4793c739c5456cb281098a32f245f1ce3dba3e40c5d
MD5 be35898f1963745ec1fd4ee68db4f1cd
BLAKE2b-256 fe542de1b40cf4736cff3add7fa52c9cb27f25f6972ca61f0a909dd5897f272d

See more details on using hashes here.

Provenance

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