Skip to main content
Glama
Markdown Knowledge MCP

Markdown Knowledge MCP

README.md
# Markdown Knowledge MCP

Search a local folder of Markdown notes from an MCP client. The server indexes headings and text with SQLite FTS5, ranks matching sections with BM25, and returns source paths and line ranges so you can check the excerpts yourself.

It is a retrieval tool, not a chatbot: it does not generate answers, decide which source is correct, or call an AI service. If sources disagree, compare the cited sections. If nothing matches, the server reports that instead of inventing an answer.

## Try it

You need [uv](https://docs.astral.sh/uv/), Python 3.10 or newer with SQLite FTS5, and macOS or Linux (including WSL). Clone the repository and run:

```sh
git clone https://github.com/Videhisawesome/markdown-knowledge-mcp.git
cd markdown-knowledge-mcp
uv sync --locked
uv run markdown-knowledge-mcp --root "$PWD/examples/knowledge"
```

The server speaks MCP over stdio. It waits for a client and does not open a network port. The example folder contains fictional documentation; replace it with a dedicated folder of Markdown files you are allowed to share with your client.

### Connect an MCP client

For a client that uses a JSON `mcpServers` configuration, set the uv path, checkout path, and Markdown folder to real absolute paths: use `command -v uv` to find uv.

```json
{
  "mcpServers": {
    "markdown-knowledge": {
      "command": "/absolute/path/to/uv",
      "args": [
        "--directory", "/absolute/path/to/markdown-knowledge-mcp",
        "run", "markdown-knowledge-mcp",
        "--root", "/absolute/path/to/notes"
      ]
    }
  }
}
```

Use the equivalent stdio setup in clients with a different configuration format.

## Tools

| Tool | What it does |
| --- | --- |
| `search_knowledge(query, limit=5)` | Returns ranked matching excerpts with section IDs and citations. |
| `read_section(section_id, offset=0, max_chars=8000)` | Reads a matching section with its relative path and line range. Use `next_offset` to read longer sections. |
| `refresh_index()` | Rebuilds the index after you add, move, or edit notes. |

## Mark a documentation gap

If a section is deliberately unwritten, make `<!-- knowledge-gap -->` the entire body under its heading. A matching gap is labeled `documented_gap` and returns the citation but no excerpt. An ordinary no-match is labeled `no_matches`. If another document has written material on the same topic, inspect that source separately.

## Privacy and limits

- The server reads the Markdown folder you configure. Use a narrow folder, not your home directory.
- The search index is in memory. The server does not modify source files or send requests over the network. An MCP client or its model provider may receive text returned by the tools. Only point the server at content permitted by that client's data policies.
- Treat document text as untrusted. An excerpt is evidence, not an instruction for a client to follow.
- The index reads UTF-8 `.md` and `.markdown` files, skips hidden files and symlinks, and caps scans at 1 MiB per file and 16 MiB overall. Refresh reports when scan limits were reached.
- Search is lexical, not semantic. Wording matters; try a narrower or alternate term when a search misses. Results are not proof that a fact is true, current, or the only relevant answer.

## Development

```sh
uv run python -m unittest discover -s tests -v
```

MIT licensed. See [LICENSE](LICENSE).

TDQS

A3.7/5.0

Scored across 3 tools

Disambiguation5/5

The three tools have clearly distinct purposes: search_knowledge discovers excerpts, read_section retrieves a specific indexed section, and refresh_index rebuilds the in-memory index. There is little risk of misselection because each targets a different stage of the retrieval workflow.

Naming Consistency5/5

All tool names follow a consistent snake_case verb_noun pattern: search_knowledge, read_section, refresh_index. The convention is predictable and readable throughout.

Tool Count5/5

For a focused Markdown knowledge retrieval server, three tools are well-scoped and each earns its place. The surface is intentionally small rather than thin, since search, read, and refresh cover the core workflow.

Completeness4/5

The tools cover discovery, section reading, and index refresh, which is most of the read-only knowledge lifecycle. However, there is no explicit list/browse operation or a clearly stated way to resolve a section ID from search results before read_section is used.

Maintenance

ActivityMaintained
ResponsivenessNo recent community issues