DM

darko-mesaros/grimoire-mcp

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

10 stars 3 forks 质量 64 趋势 26

A Model Context Protocol server for managing software development patterns - your personal grimoire of reusable code knowledge

概览

As I am leveling up my development skills, I always needed a way to quickly store some best practices I ended up implementing in projects. What if my coding assistant could just save it to some ... ✨ pattern library ✨. Well now it can! Oh, and it can read code patterns too! 🥳 So, the Grimoire-MCP is a Model Context Protocol (MCP) server for managing software development patterns stored as markdown files with YAML frontmatter. Oh, and it's all on your filesystem! The server the PATTERNS_DIR environment variable to be set ideally via your MCP config, or in the shell: The server will fail to start if this variable is not set or if the directory doesn't exist. The LLM will create patterns on your behalf, but you are more than welcome to store them yourself as well.

README

以下为原文 README 节选,完整内容请查看原文。

Grimoire-MCP - Development Pattern Library

As I am leveling up my development skills, I always needed a way to quickly store some best practices I ended up implementing in projects. What if my coding assistant could just save it to some … ✨ pattern library ✨. Well now it can! Oh, and it can read code patterns too! 🥳

So, the Grimoire-MCP is a Model Context Protocol (MCP) server for managing software development patterns stored as markdown files with YAML frontmatter. Oh, and it’s all on your filesystem!

Setup

Required Environment Variable

The server requires the PATTERNS_DIR environment variable to be set ideally via your MCP config, or in the shell:

export PATTERNS_DIR="/path/to/your/patterns"

The server will fail to start if this variable is not set or if the directory doesn’t exist.

Pattern File Format

The LLM will create patterns on your behalf, but you are more than welcome to store them yourself as well.

Patterns are stored as markdown files with YAML frontmatter:

---
pattern: example-pattern
category: rust
framework: axum
projects: [project1, project2] # These are the names of the projects this pattern was involved in.
tags: [web, api, error-handling]
---

Your pattern content goes here...

Usage

Available Tools

  • list_patterns - List all available patterns
  • search_patterns - Search by query, category, framework, or tag
  • get_pattern - Get specific pattern by name
  • create_pattern - Create new pattern with metadata and content

Pattern Browser TUI

The project includes a terminal-based pattern browser (browse) as a separate binary target. It lets you browse, search, and read your patterns directly in the terminal without needing an MCP client.

Running the Browser

PATTERNS_DIR="/path/to/your/patterns" cargo run --bin browse

Or build and run the release binary:

cargo build --release
PATTERNS_DIR="/path/to/your/patterns" ./target/release/browse

Keyboard Controls

Key Action
j / ↓ Navigate down
k / ↑ Navigate up
/ Search / filter patterns
Esc Cancel search
Enter Apply search filter
PgUp / PgDn Scroll pattern content
q Quit

Building

cargo build --release

This produces two binaries:

  • ./target/release/grimoire-mcp — the MCP server
  • ./target/release/browse — the TUI pattern browser

MCP Client Configuration

Kiro CLI

Add to your MCP configuration:

{
  "mcpServers": {
    "pattern-library": {
      "command": "/path/to/grimoire-mcp/target/release/grimoire-mcp",
      "env": {
        "PATTERNS_DIR": "/path/to/your/patterns"
      }
    }
  }
}

Cursor IDE

Add to your Cursor settings:

{
  "mcp": {
    "servers": {
      "pattern-library": {
        "command": "/path/to/grimoire-mcp/target/release/grimoire-mcp",
        "env": {
          "PATTERNS_DIR": "/path/to/your/patterns"
        }
在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "pattern-library": { "command": "/path/to/grimoire-mcp/target/release/grimoire-mcp", "env": { "PATTERNS_DIR": "/path/to/your/patterns" } } } }