min-kb-mcp copilot-instructions.md

min-kb-mcp copilot-instructions.md is an instructions file for GitHub Copilot from cmwen/min-kb-mcp. It costs 937 tokens per session, scanned A, original, MIT.

Repository instructions for an MCP server that manages a file-based knowledge base, meaning a collection of Markdown notes, with a SQLite search index.

In plain words
What is it for?
Use them when working on the command-line interface, MCP connections, Markdown article files, database indexing, search, or configuration.
Why use it?
They explain the project structure and rules an AI coding agent should follow when changing the server.

Instructions file for GitHub Copilot

Written for GitHub Copilot: a Copilot instructions file.

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add instructions/cmwen/min-kb-mcp/copilot-instructions
Clone the repo
git clone --depth 1 https://github.com/cmwen/min-kb-mcp

Made for: GitHub Copilot.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for min-kb-mcp copilot-instructions.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/cmwen/min-kb-mcp/copilot-instructions.svg)](https://agentmods.dev/instructions/cmwen/min-kb-mcp/copilot-instructions)
Your own site
<a href="https://agentmods.dev/instructions/cmwen/min-kb-mcp/copilot-instructions"><img src="https://agentmods.dev/badge/instructions/cmwen/min-kb-mcp/copilot-instructions.svg" alt="Measured on agentmods" height="20"></a>
Per session 937 This file is loaded in full into every session.
When invoked 937 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00937 $0.00937
Opus 5 $0.00468 $0.00468
Sonnet 5 $0.00187 $0.00187
Haiku 4.5 $0.00094 $0.00094

Measured 5d ago against content hash 0ecc7debf796, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

min-kb-mcp copilot-instructions.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.github/copilot-instructions.md · 48 lines

How it starts

The opening of the file, as written. The whole thing — 48 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Copilot instructions for this repo

Purpose: This is an LLM-first MCP server that manages a file-based knowledge base with a SQLite (WASM via sql.js) index. The CLI starts the server; MCP tools read/write Markdown files and keep the index in sync.

Key modules (read these first)

  • src/cli.ts: Commander CLI entry. start --kb is required. Transport is stdio (default) or HTTP when MCP_TRANSPORT=http. CLI can accept --port; MCP_PORT overrides too.
  • src/server.ts: MCPServer wiring (stdio or Streamable HTTP transport), Express-based /mcp endpoint for HTTP, tool and resource registration. Uses zod schemas for tool inputs. Maintains session via mcp-session-id header for HTTP.
  • src/core/config.ts: Resolves KB paths with appdata-path. KB root: /min-kb-mcp/ with .sqlite and articles/; ensures directories exist.
  • src/core/file-manager.ts: Creates/reads/updates/deletes Markdown files under articles/. IDs are uuid v4; filenames are .md. Throws FileOperationError.
  • src/db/database.ts: sql.js (WASM) database. Tables: articles(id, filePath, title, keywords) and articles_content(id, content). Tries FTS5 (porter tokenizer, fallback variants) then falls back to LIKE search when FTS5 is unavailable. Throws DatabaseError.

Data flow & responsibilities

  • create/update/delete: FileManager writes files; DatabaseService indexArticle/deindexArticle keeps tables+FTS in sync then persists DB to disk.
  • search: Prefer FTS5 with bm25(...) ordering; fallback returns rank=0 and simple LIKE matches.
  • resources: Articles exposed via article://{id}; resource handler reads the Markdown file from articles/.

Tool implementation pattern (follow this shape)

  • Define input schema with zod and register via server.registerTool.
  • Perform file op(s) via FileManager, then index via DatabaseService.
  • Return MCP content: include a minimal text message and a resource entry like { type: 'resource', uri: 'article://', resource: { text, uri, mimeType: 'text/markdown' } }.
  • On failure, return { content: [{ type: 'text', text: msg }], isError: true } (see createArticle/updateArticle/deleteArticle). Keep responses short.

HTTP transport specifics

  • Express routes: POST /mcp handles requests; GET/DELETE /mcp handle session notifications/termination. Multiple sessions tracked by sessionId; client supplies mcp-session-id header.
  • CORS is permissive for dev (origin: '*'). Lock down in production.

Developer workflows

  • Install: pnpm i
  • Lint/format: pnpm run lint, pnpm run format (Biome)
  • Build: pnpm run build (tsc to dist/). Tests are excluded from build (see tsconfig exclude).
  • Tests: pnpm test (Vitest; src/**/*.spec.ts). Example: src/db/database.spec.ts bootstraps the DB by indexing once to await async init.
  • Run (stdio MCP): pnpm start -- --kb my-kb
  • Run (HTTP dev): MCP_TRANSPORT=http MCP_PORT=9876 pnpm run dev, then connect MCP Inspector to http://localhost:9876/mcp

Conventions & gotchas

  • TypeScript strict mode; Node ≥22. Errors use FileOperationError/DatabaseError. Avoid leaking low-level errors in tool responses; use isError with succinct text.
  • IDs are UUIDs; filenames are .md; title is derived from first H1 if not provided (DatabaseService.extractTitle).
  • sql.js FTS5 support may be absent in some WASM builds; code transparently falls back to LIKE. Ranking may be 0 and order less meaningful in fallback.
  • Publishing targets GitHub Packages (publishConfig.registry). prepublishOnly runs build; CLI bin is dist/cli.js.

Add new features by mirroring existing patterns

  • New tool: add zod schema, use FileManager/DatabaseService, return a resource when appropriate, and register in server.registerTools().
  • New resource: extend registerResources() with a ResourceTemplate and read via FileManager.

Reference examples

  • createArticle/searchArticles/updateArticle/deleteArticle in src/server.ts show the canonical tool structure and error handling.
  • DatabaseService.indexArticle/search/listArticles in src/db/database.ts show schema, FTS/LIKE dual-path search, and persistence.

Read the full file on GitHub · 48 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 48 lines · 937 tokens per session scan A 0ecc7debf796

Subscribe to this mod's changes

min-kb-mcp copilot-instructions.md is an instructions file published in the GitHub repository cmwen/min-kb-mcp (3 stars, last pushed 28d ago), licensed MIT. It adds 937 tokens to every session, about $0.0047 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.