mcp-docs-service 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/LICENSE +1 -1
  3. package/README.md +29 -57
  4. package/dist/handlers/docs.d.ts +17 -0
  5. package/dist/handlers/docs.js +280 -0
  6. package/dist/handlers/docs.js.map +1 -0
  7. package/dist/handlers/file.d.ts +32 -0
  8. package/dist/handlers/file.js +222 -0
  9. package/dist/handlers/file.js.map +1 -0
  10. package/dist/handlers/index.d.ts +1 -0
  11. package/dist/handlers/index.js +3 -0
  12. package/dist/handlers/index.js.map +1 -0
  13. package/dist/index.d.ts +2 -24
  14. package/dist/index.js +431 -49
  15. package/dist/index.js.map +1 -1
  16. package/dist/schemas/index.d.ts +1 -0
  17. package/dist/schemas/index.js +3 -0
  18. package/dist/schemas/index.js.map +1 -0
  19. package/dist/schemas/tools.d.ts +141 -0
  20. package/dist/schemas/tools.js +46 -0
  21. package/dist/schemas/tools.js.map +1 -0
  22. package/dist/types/docs.d.ts +49 -0
  23. package/dist/types/docs.js +2 -0
  24. package/dist/types/docs.js.map +1 -0
  25. package/dist/types/file.d.ts +21 -0
  26. package/dist/types/file.js +2 -0
  27. package/dist/types/file.js.map +1 -0
  28. package/dist/types/index.d.ts +34 -43
  29. package/dist/types/index.js +3 -5
  30. package/dist/types/index.js.map +1 -1
  31. package/dist/types/tools.d.ts +11 -0
  32. package/dist/types/tools.js +2 -0
  33. package/dist/types/tools.js.map +1 -0
  34. package/dist/utils/file.d.ts +24 -0
  35. package/dist/utils/file.js +94 -0
  36. package/dist/utils/file.js.map +1 -0
  37. package/dist/utils/index.d.ts +1 -60
  38. package/dist/utils/index.js +2 -151
  39. package/dist/utils/index.js.map +1 -1
  40. package/dist/utils/path.d.ts +16 -0
  41. package/dist/utils/path.js +39 -0
  42. package/dist/utils/path.js.map +1 -0
  43. package/package.json +20 -8
  44. package/dist/cli/bin.d.ts +0 -6
  45. package/dist/cli/bin.js +0 -49
  46. package/dist/cli/bin.js.map +0 -1
  47. package/dist/cli/index.d.ts +0 -16
  48. package/dist/cli/index.js +0 -108
  49. package/dist/cli/index.js.map +0 -1
  50. package/dist/cli/jsonrpc.d.ts +0 -29
  51. package/dist/cli/jsonrpc.js +0 -121
  52. package/dist/cli/jsonrpc.js.map +0 -1
  53. package/dist/core/docAnalyzer.d.ts +0 -25
  54. package/dist/core/docAnalyzer.js +0 -118
  55. package/dist/core/docAnalyzer.js.map +0 -1
  56. package/dist/core/docManager.d.ts +0 -48
  57. package/dist/core/docManager.js +0 -257
  58. package/dist/core/docManager.js.map +0 -1
  59. package/dist/core/docProcessor.d.ts +0 -20
  60. package/dist/core/docProcessor.js +0 -127
  61. package/dist/core/docProcessor.js.map +0 -1
  62. package/dist/core/mcpDocsServer.d.ts +0 -61
  63. package/dist/core/mcpDocsServer.js +0 -395
  64. package/dist/core/mcpDocsServer.js.map +0 -1
package/CHANGELOG.md ADDED
@@ -0,0 +1,43 @@
1
+ # Changelog
2
+
3
+ All notable changes to the MCP Docs Service will be documented in this file.
4
+
5
+ ## [0.2.1] - 2023-03-12
6
+
7
+ ### Added
8
+
9
+ - Additional documentation improvements
10
+ - Enhanced knowledge base generation capabilities
11
+
12
+ ## [0.2.0] - 2023-03-12
13
+
14
+ ### Added
15
+
16
+ - New `get_docs_knowledge_base` tool for creating comprehensive knowledge bases for LLM context
17
+ - Knowledge base generation example in `docs/examples/knowledge-base-generator.md`
18
+ - Support for document summaries in knowledge base
19
+ - Organization of documents by categories and tags in knowledge base
20
+ - Updated documentation to reflect new features
21
+
22
+ ### Changed
23
+
24
+ - Improved documentation structure and organization
25
+ - Updated roadmap to include knowledge base features
26
+ - Enhanced basic usage tutorial with knowledge base examples
27
+ - Removed unnecessary file operation tools in favor of document-specific tools
28
+
29
+ ### Fixed
30
+
31
+ - TypeScript type errors in knowledge base implementation
32
+ - Various documentation improvements and corrections
33
+
34
+ ## [0.1.1] - 2023-03-11
35
+
36
+ ### Added
37
+
38
+ - Initial release of MCP Docs Service
39
+ - Basic documentation management functionality
40
+ - Support for reading, writing, editing, and deleting markdown files with frontmatter
41
+ - Search functionality for documentation
42
+ - Navigation generation
43
+ - Documentation structure analysis
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2023 Your Name
3
+ Copyright (c) 2023 Aleks Petrov
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -7,9 +7,25 @@ The MCP Documentation Service is a custom implementation of the Model Context Pr
7
7
  - **Document Management**: Create, read, update, and delete markdown documentation files
8
8
  - **Metadata Management**: Work with document frontmatter (YAML metadata)
9
9
  - **Search**: Search through documentation using keywords and filters
10
+ - **Knowledge Base Generation**: Create comprehensive knowledge bases for LLM context
11
+ - **Structure Analysis**: Analyze documentation structure and relationships
12
+ - **Navigation Generation**: Generate navigation structures for documentation
13
+ - **Tag Management**: Organize documentation by tags and categories
10
14
  - **Analytics**: Analyze documentation health and get suggestions for improvement
11
15
  - **Custom Directory Support**: Specify a custom docs directory and create it if it doesn't exist
12
- - **JSON-RPC 2.0 Support**: Native support for the JSON-RPC 2.0 protocol used by Cursor and other MCP clients
16
+
17
+ ## Documentation
18
+
19
+ Comprehensive documentation is available in the `docs` directory:
20
+
21
+ - [Getting Started Guide](docs/guides/getting-started.md) - Introduction to the MCP Docs Manager
22
+ - [API Overview](docs/api/overview.md) - Overview of the API and available tools
23
+ - [Tools Reference](docs/api/tools-reference.md) - Complete reference of all available tools
24
+ - [Basic Usage Tutorial](docs/tutorials/basic-usage.md) - Tutorial for basic usage
25
+ - [Examples](docs/examples/) - Code examples for common tasks
26
+ - [Navigation Generator](docs/examples/navigation-generator.md) - Example of how to generate navigation for documentation
27
+ - [Knowledge Base Generator](docs/examples/knowledge-base-generator.md) - Example of how to generate a knowledge base for LLM context
28
+ - [Roadmap](docs/roadmap.md) - Development roadmap and planned features
13
29
 
14
30
  ## Installation
15
31
 
@@ -178,13 +194,9 @@ async function example() {
178
194
  example();
179
195
  ```
180
196
 
181
- ## Query Formats
197
+ ## Query Format
182
198
 
183
- The service supports two query formats:
184
-
185
- ### SQL-like Format
186
-
187
- The traditional SQL-like query format:
199
+ The service uses a SQL-like query format to execute commands:
188
200
 
189
201
  ```
190
202
  command_name(param1="value1", param2="value2")
@@ -196,60 +208,20 @@ For example:
196
208
  get_document(path="architecture/overview.md")
197
209
  ```
198
210
 
199
- ### JSON-RPC 2.0 Format
200
-
201
- As of version 0.2.0, the service also supports the JSON-RPC 2.0 format used by Cursor and other MCP clients:
202
-
203
- ```json
204
- {
205
- "jsonrpc": "2.0",
206
- "method": "get_document",
207
- "params": {
208
- "path": "architecture/overview.md"
209
- },
210
- "id": 1
211
- }
212
- ```
213
-
214
- The service automatically detects the format of the input and processes it accordingly.
215
-
216
211
  ## Available Commands
217
212
 
218
- ### Document Operations
219
-
220
- - **list_files(directory="")**: List all markdown files (optionally in a specific directory)
221
- - **list_directories(directory="")**: List all directories (optionally in a specific directory)
222
- - **get_document(path="path/to/doc.md")**: Get a document's content and metadata
223
- - **create_document(path="path/to/doc.md", content="content", metadata={...})**: Create a new document
224
- - **update_document(path="path/to/doc.md", content="updated content", metadata={...})**: Update an existing document
225
- - **delete_document(path="path/to/doc.md")**: Delete a document
213
+ ### Documentation Tools
226
214
 
227
- ### Search & Analysis
228
-
229
- - **search_documents(query="search term", directory="", tags=["tag1"], status="published")**: Search documents
230
- - **analyze_docs(directory="")**: Analyze documentation health
231
- - **get_health_score()**: Get overall documentation health score
232
- - **get_suggestions()**: Get suggestions for improving documentation
215
+ - **read_document(path="path/to/doc.md")**: Read a markdown document and extract its content and metadata
216
+ - **list_documents(basePath="")**: List all markdown documents in a directory
217
+ - **get_structure(basePath="")**: Get the structure of the documentation directory
218
+ - **get_navigation(basePath="")**: Get the navigation structure for the documentation
219
+ - **get_docs_knowledge_base(basePath="", includeSummaries=true, maxSummaryLength=500)**: Create a comprehensive knowledge base of documentation for LLM context
220
+ - **write_document(path="path/to/doc.md", content="content", metadata={...})**: Write content to a markdown document with frontmatter
221
+ - **edit_document(path="path/to/doc.md", edits=[{oldText: "...", newText: "..."}])**: Apply edits to a markdown document while preserving frontmatter
222
+ - **delete_document(path="path/to/doc.md")**: Delete a markdown document
223
+ - **search_documents(basePath="", query="search term", tags=["tag1"], status="published")**: Search for markdown documents matching criteria
233
224
 
234
225
  ## License
235
226
 
236
227
  MIT
237
-
238
- Just published MCP Dcumentation Service 🔥
239
- Open source, vibe coding only.A tool that lets AI assistants interact with your documentation through the Model Context Protocol.It enables AI tools like Claude and Cursor to read, create, update, and analyze your markdown docs with a simple query interface.Key features:
240
- ✅ Document CRUD operations with frontmatter support
241
- ✅ Documentation search and health analytics
242
- ✅ Custom directory handlingtest it: `npx mcp-docs-service`
243
-
244
- Why document your project when working with AI assistants like Claude in Cursor?Good documentation gives AI context about your project's architecture, decisions, and conventions. This means:• More accurate code suggestions
245
- • Better understanding of your codebase
246
- • Fewer misunderstandings and errors
247
- • Consistent implementation of patternsDocumentation is the map that helps AI navigate your code landscape.
248
-
249
- Use with Cursor IDE:1. Set up mcp-docs-service in your .cursor/mcp.json 2. Ask Cursor: "Analyze our documentation health" 3. Cursor uses MCP to scan your docs and report issues 4. Ask: "Create a guide for our authentication system" 5. Cursor generates a well-structured doc based on your codeThe AI can now read and write to your docs directory, keeping documentation in sync with code changes 💥
250
-
251
- With Claude Desktop:1. Configure mcp-docs-service in claude_desktop_config.json 2. Ask: "What's our approach to error handling?" 3. Claude searches your docs and explains your patterns 4. Say: "Our validation changed, update the API docs" 5. Claude updates the relevant markdown filesClaude becomes your documentation assistant, maintaining docs without switching contexts or tools.
252
-
253
- Real example from my workflow:"Claude, analyze our docs and identify gaps in our API documentation"Claude found 7 endpoints missing docs, created templates for each, and suggested improvements to our existing docs.This took 2 minutes instead of hours of manual review!Documentation becomes a living part of your codebase, not an afterthought.
254
-
255
- Getting started is simple:1. npm install -g mcp-docs-service 2. Add to your AI tool config 3. Start asking questions about your docsFull setup guide: npmjs.com/packa…This is just v0.1.1 - I'd love feedback on how you're using it and what features would help your documentation workflow.
@@ -0,0 +1,17 @@
1
+ import { ToolResponse } from "../types/tools.js";
2
+ /**
3
+ * Reads a markdown document and extracts its content and metadata
4
+ */
5
+ export declare function readDocument(docPath: string, allowedDirectories: string[]): Promise<ToolResponse>;
6
+ /**
7
+ * Lists all markdown documents in a directory
8
+ */
9
+ export declare function listDocuments(basePath: string, allowedDirectories: string[]): Promise<ToolResponse>;
10
+ /**
11
+ * Gets the structure of the documentation directory
12
+ */
13
+ export declare function getStructure(basePath: string, allowedDirectories: string[]): Promise<ToolResponse>;
14
+ /**
15
+ * Gets the navigation structure for the documentation
16
+ */
17
+ export declare function getNavigation(basePath: string, allowedDirectories: string[]): Promise<ToolResponse>;
@@ -0,0 +1,280 @@
1
+ import fs from "fs/promises";
2
+ import path from "path";
3
+ import { validatePath } from "../utils/path.js";
4
+ import matter from "gray-matter";
5
+ /**
6
+ * Reads a markdown document and extracts its content and metadata
7
+ */
8
+ export async function readDocument(docPath, allowedDirectories) {
9
+ try {
10
+ const normalizedPath = await validatePath(docPath, allowedDirectories);
11
+ // Read the file
12
+ const content = await fs.readFile(normalizedPath, "utf-8");
13
+ // Parse frontmatter
14
+ const { data: metadata, content: markdownContent } = matter(content);
15
+ return {
16
+ content: [{ type: "text", text: "Document read successfully" }],
17
+ metadata: {
18
+ path: docPath,
19
+ content: markdownContent,
20
+ metadata,
21
+ },
22
+ };
23
+ }
24
+ catch (error) {
25
+ return {
26
+ content: [
27
+ { type: "text", text: `Error reading document: ${error.message}` },
28
+ ],
29
+ isError: true,
30
+ };
31
+ }
32
+ }
33
+ /**
34
+ * Lists all markdown documents in a directory
35
+ */
36
+ export async function listDocuments(basePath, allowedDirectories) {
37
+ try {
38
+ const normalizedBasePath = basePath
39
+ ? await validatePath(basePath, allowedDirectories)
40
+ : allowedDirectories[0];
41
+ const documents = [];
42
+ async function processDirectory(dirPath) {
43
+ const entries = await fs.readdir(dirPath, { withFileTypes: true });
44
+ for (const entry of entries) {
45
+ const entryPath = path.join(dirPath, entry.name);
46
+ if (entry.isDirectory()) {
47
+ await processDirectory(entryPath);
48
+ }
49
+ else if (entry.name.endsWith(".md")) {
50
+ try {
51
+ const content = await fs.readFile(entryPath, "utf-8");
52
+ const { data: metadata } = matter(content);
53
+ documents.push({
54
+ path: entryPath,
55
+ name: entry.name,
56
+ metadata: metadata,
57
+ });
58
+ }
59
+ catch (error) {
60
+ console.error(`Error processing ${entryPath}: ${error.message}`);
61
+ }
62
+ }
63
+ }
64
+ }
65
+ await processDirectory(normalizedBasePath);
66
+ return {
67
+ content: [{ type: "text", text: `Found ${documents.length} documents` }],
68
+ metadata: {
69
+ documents,
70
+ },
71
+ };
72
+ }
73
+ catch (error) {
74
+ return {
75
+ content: [
76
+ { type: "text", text: `Error listing documents: ${error.message}` },
77
+ ],
78
+ isError: true,
79
+ };
80
+ }
81
+ }
82
+ /**
83
+ * Gets the structure of the documentation directory
84
+ */
85
+ export async function getStructure(basePath, allowedDirectories) {
86
+ try {
87
+ const normalizedBasePath = basePath
88
+ ? await validatePath(basePath, allowedDirectories)
89
+ : allowedDirectories[0];
90
+ async function buildStructure(dirPath, relativePath = "") {
91
+ try {
92
+ const entries = await fs.readdir(dirPath, { withFileTypes: true });
93
+ const children = [];
94
+ let metadata;
95
+ // Check if there's an index.md file to get directory metadata
96
+ const indexPath = path.join(dirPath, "index.md");
97
+ try {
98
+ const indexStat = await fs.stat(indexPath);
99
+ if (indexStat.isFile()) {
100
+ const content = await fs.readFile(indexPath, "utf-8");
101
+ const { data } = matter(content);
102
+ metadata = data;
103
+ }
104
+ }
105
+ catch (error) {
106
+ // No index.md file, that's fine
107
+ }
108
+ // Process all entries
109
+ for (const entry of entries) {
110
+ const entryPath = path.join(dirPath, entry.name);
111
+ const entryRelativePath = path.join(relativePath, entry.name);
112
+ if (entry.isDirectory()) {
113
+ const subDir = await buildStructure(entryPath, entryRelativePath);
114
+ children.push(subDir);
115
+ }
116
+ else if (entry.name.endsWith(".md") && entry.name !== "index.md") {
117
+ try {
118
+ const content = await fs.readFile(entryPath, "utf-8");
119
+ const { data } = matter(content);
120
+ children.push({
121
+ name: entry.name,
122
+ path: entryRelativePath,
123
+ type: "file",
124
+ metadata: data,
125
+ children: [],
126
+ });
127
+ }
128
+ catch (error) {
129
+ children.push({
130
+ name: entry.name,
131
+ path: entryRelativePath,
132
+ type: "file",
133
+ error: error.message,
134
+ children: [],
135
+ });
136
+ }
137
+ }
138
+ }
139
+ // Sort children by order metadata if available, then by name
140
+ children.sort((a, b) => {
141
+ const orderA = a.metadata?.order ?? Infinity;
142
+ const orderB = b.metadata?.order ?? Infinity;
143
+ if (orderA !== orderB) {
144
+ return orderA - orderB;
145
+ }
146
+ return a.name.localeCompare(b.name);
147
+ });
148
+ return {
149
+ name: path.basename(dirPath),
150
+ path: relativePath,
151
+ type: "directory",
152
+ metadata,
153
+ children,
154
+ };
155
+ }
156
+ catch (error) {
157
+ return {
158
+ name: path.basename(dirPath),
159
+ path: relativePath,
160
+ type: "directory",
161
+ error: error.message,
162
+ children: [],
163
+ };
164
+ }
165
+ }
166
+ const structure = await buildStructure(normalizedBasePath);
167
+ return {
168
+ content: [
169
+ {
170
+ type: "text",
171
+ text: "Documentation structure retrieved successfully",
172
+ },
173
+ ],
174
+ metadata: {
175
+ structure,
176
+ },
177
+ };
178
+ }
179
+ catch (error) {
180
+ return {
181
+ content: [
182
+ { type: "text", text: `Error getting structure: ${error.message}` },
183
+ ],
184
+ isError: true,
185
+ };
186
+ }
187
+ }
188
+ /**
189
+ * Gets the navigation structure for the documentation
190
+ */
191
+ export async function getNavigation(basePath, allowedDirectories) {
192
+ try {
193
+ // First get the structure
194
+ const structureResponse = await getStructure(basePath, allowedDirectories);
195
+ if (structureResponse.isError) {
196
+ return structureResponse;
197
+ }
198
+ const structure = structureResponse.metadata?.structure;
199
+ // Build navigation from structure
200
+ function buildNavigation(structure) {
201
+ const sections = [];
202
+ function processNode(node, parentPath = []) {
203
+ // Skip nodes with errors
204
+ if (node.error) {
205
+ return;
206
+ }
207
+ if (node.type === "directory") {
208
+ // Create a section for this directory
209
+ const section = {
210
+ title: node.metadata?.title || node.name,
211
+ path: node.path ? `/${node.path}` : null,
212
+ items: [],
213
+ order: node.metadata?.order ?? Infinity,
214
+ };
215
+ // Process children
216
+ for (const child of node.children) {
217
+ if (child.type === "file") {
218
+ // Add file as an item
219
+ section.items.push({
220
+ title: child.metadata?.title || child.name.replace(/\.md$/, ""),
221
+ path: `/${child.path}`,
222
+ order: child.metadata?.order ?? Infinity,
223
+ });
224
+ }
225
+ else if (child.type === "directory") {
226
+ // Process subdirectory
227
+ const childSections = processNode(child, [
228
+ ...parentPath,
229
+ node.name,
230
+ ]);
231
+ if (childSections) {
232
+ sections.push(...childSections);
233
+ }
234
+ }
235
+ }
236
+ // Sort items by order
237
+ section.items.sort((a, b) => {
238
+ if (a.order !== b.order) {
239
+ return a.order - b.order;
240
+ }
241
+ return a.title.localeCompare(b.title);
242
+ });
243
+ // Only add section if it has items
244
+ if (section.items.length > 0) {
245
+ sections.push(section);
246
+ }
247
+ return sections;
248
+ }
249
+ return null;
250
+ }
251
+ processNode(structure);
252
+ // Sort sections by order
253
+ sections.sort((a, b) => {
254
+ if (a.order !== b.order) {
255
+ return a.order - b.order;
256
+ }
257
+ return a.title.localeCompare(b.title);
258
+ });
259
+ return sections;
260
+ }
261
+ const navigation = buildNavigation(structure);
262
+ return {
263
+ content: [
264
+ { type: "text", text: "Navigation structure retrieved successfully" },
265
+ ],
266
+ metadata: {
267
+ navigation,
268
+ },
269
+ };
270
+ }
271
+ catch (error) {
272
+ return {
273
+ content: [
274
+ { type: "text", text: `Error getting navigation: ${error.message}` },
275
+ ],
276
+ isError: true,
277
+ };
278
+ }
279
+ }
280
+ //# sourceMappingURL=docs.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;gBACrB,IAAI,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,KAAK,EAAE,CAAC;oBACxB,OAAO,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC;gBAC3B,CAAC;gBACD,OAAO,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;YACxC,CAAC,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC;QAClB,CAAC;QAED,MAAM,UAAU,GAAG,eAAe,CAAC,SAAS,CAAC,CAAC;QAE9C,OAAO;YACL,OAAO,EAAE;gBACP,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,6CAA6C,EAAE;aACtE;YACD,QAAQ,EAAE;gBACR,UAAU;aACX;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,OAAO;YACL,OAAO,EAAE;gBACP,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,6BAA6B,KAAK,CAAC,OAAO,EAAE,EAAE;aACrE;YACD,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,32 @@
1
+ import { ToolResponse } from "../types/tools.js";
2
+ /**
3
+ * Reads a file and returns its content
4
+ */
5
+ export declare function readFile(filePath: string, allowedDirectories: string[]): Promise<ToolResponse>;
6
+ /**
7
+ * Writes content to a file
8
+ */
9
+ export declare function writeFile(filePath: string, content: string, allowedDirectories: string[]): Promise<ToolResponse>;
10
+ /**
11
+ * Lists files in a directory
12
+ */
13
+ export declare function listFiles(dirPath: string, allowedDirectories: string[]): Promise<ToolResponse>;
14
+ /**
15
+ * Gets information about a file
16
+ */
17
+ export declare function getFileInfo(filePath: string, allowedDirectories: string[]): Promise<ToolResponse>;
18
+ /**
19
+ * Searches for files matching a pattern
20
+ */
21
+ export declare function searchForFiles(rootPath: string, pattern: string, excludePatterns: string[] | undefined, allowedDirectories: string[]): Promise<ToolResponse>;
22
+ /**
23
+ * Applies edits to a file
24
+ */
25
+ export declare function editFile(filePath: string, edits: Array<{
26
+ oldText: string;
27
+ newText: string;
28
+ }>, allowedDirectories: string[]): Promise<ToolResponse>;
29
+ /**
30
+ * Gets the directory structure as a tree
31
+ */
32
+ export declare function getDirectoryTree(dirPath: string, allowedDirectories: string[]): Promise<ToolResponse>;