Skip to content

Commit 5570f35

Browse files
committed
Add markdown import documentation for CTX resources and prompts
1 parent f0c12a0 commit 5570f35

File tree

1 file changed

+103
-0
lines changed

1 file changed

+103
-0
lines changed

docs/getting-started/configuration.md

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,109 @@ The same configuration in JSON format:
282282
}
283283
```
284284

285+
### Markdown Imports
286+
287+
The markdown import type allows importing directories containing markdown files with YAML frontmatter metadata,
288+
automatically converting them into CTX prompts, documents, and resources.
289+
290+
| Parameter | Description | Required | Default |
291+
|-----------|---------------------------------------------|----------|---------|
292+
| `type` | Import type (must be "local") | No | - |
293+
| `path` | Path to directory containing markdown files | Yes | - |
294+
| `format` | Format type ("md") | Yes | - |
295+
296+
When you specify `format: md`, the system will:
297+
298+
1. **Recursively scan** the specified directory and all subdirectories for `.md` and `.markdown` files
299+
2. **Parse YAML frontmatter** from each file to extract metadata
300+
3. **Auto-detect resource types** based on metadata (`type: prompt` or default to resource)
301+
4. **Register each file** as an individual CTX resource accessible via MCP
302+
5. **Extract titles** from first `#` header if no title is provided in frontmatter
303+
304+
#### Basic Markdown Import
305+
306+
```yaml
307+
import:
308+
- path: ./docs
309+
format: md
310+
```
311+
312+
#### Markdown Import with Path Prefix
313+
314+
```yaml
315+
import:
316+
- path: ./prompts
317+
format: md
318+
pathPrefix: /team-prompts
319+
```
320+
321+
#### Markdown File Formats
322+
323+
**With YAML Frontmatter:**
324+
325+
```markdown
326+
---
327+
type: prompt
328+
title: "Code Review Helper"
329+
description: "Assists with code review tasks"
330+
tags: ["code-review", "development"]
331+
schema:
332+
properties:
333+
language:
334+
type: string
335+
description: "Programming language"
336+
---
337+
338+
# Code Review Assistant
339+
340+
I'll help you review {{language}} code effectively.
341+
```
342+
343+
**Without Frontmatter (Auto Title Extraction):**
344+
345+
```markdown
346+
# Database Best Practices
347+
348+
This document outlines database design guidelines...
349+
```
350+
351+
#### Title/Description Priority
352+
353+
The system uses this hierarchy for determining titles and descriptions:
354+
355+
1. `description` field in frontmatter (highest priority)
356+
2. `title` field in frontmatter
357+
3. First `#` header in content (auto-extracted)
358+
4. Generated from filename (lowest priority)
359+
360+
#### Supported Frontmatter Fields
361+
362+
**For Prompts (`type: prompt`):**
363+
364+
- `id`: Unique identifier (auto-generated from filename if not provided)
365+
- `title`/`description`: Human readable description
366+
- `tags`: Array or comma-separated string of tags
367+
- `role`: Message role (user/assistant)
368+
- `schema`: JSON schema for prompt arguments
369+
- `messages`: Array of message objects
370+
- `extend`: Template inheritance configuration
371+
372+
#### Example Directory Structure
373+
374+
```
375+
prompts/
376+
├── python-helper.md # With full frontmatter
377+
├── code-review-checklist.md # No frontmatter, auto title
378+
└── debugging/
379+
└── error-analysis.md # Nested directory
380+
```
381+
382+
This import type is particularly useful for:
383+
384+
- **AI Coding Tools Integration**: Making documentation discoverable to Claude Code, Cursor, and other AI assistants
385+
- **Team Knowledge Bases**: Converting documentation directories into structured resources
386+
- **Prompt Libraries**: Managing collections of prompts in familiar markdown format
387+
285388
### Circular Import Detection
286389
287390
The system automatically detects and prevents circular imports. If a circular import is detected, an error will be

0 commit comments

Comments
 (0)