Skip to content

Commit 35815ae

Browse files
committed
docs: update README with comprehensive programmatic access methods
- Add "Multiple Access Methods" section highlighting CLI, REST API, MCP, and programmatic usage - Include detailed installation instructions for npx and global usage - Add REST API endpoint documentation with curl examples - Include MCP server configuration for Claude Desktop integration - Add TypeScript programmatic API examples with all access patterns
1 parent 5a259dc commit 35815ae

File tree

1 file changed

+117
-3
lines changed

1 file changed

+117
-3
lines changed

README.md

Lines changed: 117 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,24 +54,40 @@ npx markmv --help
5454
- Dry-run mode for safe testing
5555
- Detailed operation reporting
5656

57+
### 🌐 **Multiple Access Methods**
58+
- **CLI Tool**: Direct command-line interface with JSON output
59+
- **REST API**: Lightweight HTTP server using native Node.js
60+
- **MCP Server**: Model Context Protocol for AI agent integration
61+
- **Programmatic API**: TypeScript library for Node.js applications
62+
5763
## 📦 Installation
5864

5965
### Direct Usage with npx (Recommended)
6066
```bash
67+
# CLI Tool
6168
npx markmv --help
6269
npx markmv move old-doc.md new-doc.md
70+
71+
# REST API Server
72+
npx markmv-api
73+
74+
# MCP Server
75+
npx markmv-mcp
6376
```
6477

6578
### Global Installation
6679
```bash
6780
npm install -g markmv
68-
markmv --help
81+
82+
# All tools available globally
83+
markmv --help # CLI tool
84+
markmv-api # REST API server
85+
markmv-mcp # MCP server
6986
```
7087

71-
### Local Installation
88+
### Library Installation
7289
```bash
7390
npm install markmv
74-
npx markmv --help
7591
```
7692

7793
### Requirements
@@ -236,6 +252,104 @@ npx markmv index --dry-run --verbose
236252
- **branch**: Index in directories with subdirectories
237253
- **existing**: Only update existing index files
238254

255+
## 🌐 Access Methods
256+
257+
markmv provides multiple ways to access its functionality:
258+
259+
### 1. CLI Tool (Command Line Interface)
260+
261+
The primary command-line interface with JSON output support:
262+
263+
```bash
264+
# Basic usage
265+
npx markmv move old.md new.md
266+
267+
# With JSON output for scripting
268+
npx markmv move old.md new.md --json
269+
270+
# Dry run with detailed output
271+
npx markmv split large.md --strategy headers --dry-run --verbose --json
272+
```
273+
274+
### 2. REST API Server
275+
276+
Lightweight HTTP API using native Node.js (zero external dependencies):
277+
278+
```bash
279+
# Start API server (default port 3000)
280+
npx markmv-api
281+
282+
# Custom port
283+
PORT=8080 npx markmv-api
284+
```
285+
286+
**Available Endpoints:**
287+
- `GET /health` - Health check
288+
- `POST /api/move` - Move single file
289+
- `POST /api/move-batch` - Move multiple files
290+
- `POST /api/validate` - Validate operation results
291+
292+
**Example API Usage:**
293+
```bash
294+
# Move a file
295+
curl -X POST http://localhost:3000/api/move \
296+
-H "Content-Type: application/json" \
297+
-d '{"source": "old.md", "destination": "new.md", "options": {"dryRun": true}}'
298+
299+
# Health check
300+
curl http://localhost:3000/health
301+
```
302+
303+
### 3. MCP Server (Model Context Protocol)
304+
305+
For AI agent integration with Claude and other MCP-compatible systems:
306+
307+
```bash
308+
# Start MCP server
309+
npx markmv-mcp
310+
```
311+
312+
**MCP Configuration for Claude Desktop:**
313+
```json
314+
{
315+
"mcpServers": {
316+
"markmv": {
317+
"command": "npx",
318+
"args": ["markmv-mcp"]
319+
}
320+
}
321+
}
322+
```
323+
324+
**Available MCP Tools:**
325+
- `move_file` - Move markdown file with link updates
326+
- `move_files` - Move multiple files with link updates
327+
- `validate_operation` - Validate operation results
328+
329+
### 4. Programmatic API
330+
331+
TypeScript/JavaScript library for Node.js applications:
332+
333+
```typescript
334+
import { FileOperations, moveFile, createMarkMv } from 'markmv';
335+
336+
// Simple usage
337+
const result = await moveFile('old.md', 'new.md');
338+
339+
// Advanced usage
340+
const fileOps = new FileOperations();
341+
const result = await fileOps.moveFile('docs/api.md', 'reference/', {
342+
dryRun: true,
343+
verbose: true
344+
});
345+
346+
// Factory pattern
347+
const markmv = createMarkMv();
348+
const result = await markmv.moveFiles([
349+
{ source: 'docs/*.md', destination: 'archive/' }
350+
]);
351+
```
352+
239353
## ⚙️ Configuration
240354

241355
Configuration options can be passed via command line flags. See each command's `--help` for available options.

0 commit comments

Comments
 (0)