# CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
## What This Project Does
instruction-mcp is a minimal MCP (Model Context Protocol) server that serves markdown instructions as tools. It allows LLM applications to dynamically retrieve markdown content based on YAML configuration.
## Build and Development Commands
```bash
npm run build # Compile TypeScript to dist/
npm run dev # Watch mode for development
npm run validate # Validate instruction.yaml config
npm run list # List all configured tools
```
## CLI Usage
```bash
node dist/cli.js # Start server (default command)
node dist/cli.js validate -c config.yaml # Validate config
node dist/cli.js list -c config.yaml # List tools
```
## Architecture
The server has a simple pipeline:
1. **Config loading** (`config.ts`): Reads YAML config, validates with Zod schemas
2. **Tool building** (`tools.ts`): Converts config to MCP tool definitions, handles tool calls by reading markdown files
3. **MCP server** (`index.ts`): Exposes tools via stdio transport using `@modelcontextprotocol/sdk`
4. **CLI** (`cli.ts`): Commander-based CLI with `start`, `validate`, and `list` commands
## Configuration Format
Tools are defined in `instruction.yaml`:
```yaml
version: "1"
tools:
tool_name:
title: "Display Name"
description: "When to use this tool"
default: "key" # Optional
instructions:
key: "path/to/markdown.md"
```
Paths are relative to the config file location.