Metadata-Version: 2.4
Name: knowledge-cache
Version: 0.1.0
Summary: MCP server that caches technical knowledge in SQLite + FTS5
License-Expression: MIT
License-File: LICENSE
Keywords: cache,fts5,knowledge,mcp,sqlite
Classifier: Development Status :: 3 - Alpha
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Database
Requires-Python: >=3.12
Requires-Dist: mcp<2,>=1.28.1
Description-Content-Type: text/markdown

# knowledge-cache

MCP server for caching technical documentation, API references, and code patterns in SQLite + FTS5. Reduces repeated web lookups by storing knowledge locally with tag-based categorization and full-text search.

## How it works

```
Agent -> knowledge_find("navmesh setdestination", ["unity"])
            ├── hit → returns cached content (avoids web fetch)
            └── miss → fetch via context7 → knowledge_store(content, tags, url)
```

## Tools

| Tool | Args | Description |
|------|------|-------------|
| `knowledge_find` | `query: str`, `tags?: str[]`, `limit?: int` | FTS5 full-text search with optional tag filter |
| `knowledge_store` | `content: str`, `tags: str[]`, `source_url?: str` | Store and index a knowledge entry |
| `knowledge_stats` | — | Cache statistics: total entries, top tags, date range |
| `knowledge_forget` | `id: int` | Remove a stale entry |

## Storage

SQLite with FTS5 for full-text search. Schema:

- `knowledge` — entries with content, source URL, timestamps
- `knowledge_fts` — FTS5 virtual table (porter stemmer, prefix matching)
- `knowledge_tags` — category tags per entry (NOCASE, multi-tag filter)

Default database path: `./.knowledge/knowledge.db` (configurable via `--db-path`).

## Setup

### Install

```bash
cd knowledge-cache
uv add mcp
```

### MCP config (per project `.mcp.json`)

```json
{
  "mcpServers": {
    "knowledge-cache": {
      "command": "uv",
      "args": [
        "run",
        "--directory", "/path/to/knowledge-cache",
        "server.py",
        "--db-path", "/path/to/project/.knowledge/knowledge.db"
      ]
    }
  }
}
```

## Dependencies

Zero (stdlib: `sqlite3`, `os`, `argparse`). Requires `mcp` package for the MCP server transport. FTS5 is built into Python's SQLite on Windows.
