@docsyncdev/mcp-server 1.0.1 → 1.1.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.
- package/README.md +73 -17
- package/dist/index.d.ts +33 -5
- package/dist/index.js +66 -50
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# @
|
|
1
|
+
# @docsyncdev/mcp-server
|
|
2
2
|
|
|
3
3
|
MCP (Model Context Protocol) server for DocSync - enables AI coding assistants like Claude Code and Cursor to search and interact with your documentation.
|
|
4
4
|
|
|
@@ -8,6 +8,7 @@ MCP (Model Context Protocol) server for DocSync - enables AI coding assistants l
|
|
|
8
8
|
- **Semantic Search**: Search your documentation using natural language queries
|
|
9
9
|
- **Documentation Browser**: List and browse docs by level (module, topic, unit)
|
|
10
10
|
- **Full Document Retrieval**: Get complete document content by ID
|
|
11
|
+
- **Compact Mode**: Condensed output for quick lookups (reduces token usage ~30%)
|
|
11
12
|
- **Caching**: Built-in LRU cache reduces API calls and improves latency
|
|
12
13
|
- **Rate Limiting**: Server-side rate limiting prevents abuse
|
|
13
14
|
|
|
@@ -36,7 +37,7 @@ Add to your `claude_desktop_config.json` or `.claude/settings.json`:
|
|
|
36
37
|
"mcpServers": {
|
|
37
38
|
"docsync": {
|
|
38
39
|
"command": "npx",
|
|
39
|
-
"args": ["@
|
|
40
|
+
"args": ["-y", "@docsyncdev/mcp-server"],
|
|
40
41
|
"env": {
|
|
41
42
|
"DOCSYNC_API_KEY": "ds_your_api_key_here",
|
|
42
43
|
"DOCSYNC_PROJECT_ID": "your-project-uuid"
|
|
@@ -55,7 +56,7 @@ Add to your Cursor MCP configuration:
|
|
|
55
56
|
"mcpServers": {
|
|
56
57
|
"docsync": {
|
|
57
58
|
"command": "npx",
|
|
58
|
-
"args": ["@
|
|
59
|
+
"args": ["-y", "@docsyncdev/mcp-server"],
|
|
59
60
|
"env": {
|
|
60
61
|
"DOCSYNC_API_KEY": "ds_your_api_key_here",
|
|
61
62
|
"DOCSYNC_PROJECT_ID": "your-project-uuid"
|
|
@@ -75,6 +76,7 @@ Search documentation semantically. Returns relevant chunks matching your query.
|
|
|
75
76
|
|
|
76
77
|
- `query` (string, required): Natural language search query
|
|
77
78
|
- `limit` (number, optional): Maximum results (default 10, max 50)
|
|
79
|
+
- `compact` (boolean, optional): Return condensed output with just paths and scores (default: false)
|
|
78
80
|
|
|
79
81
|
**Example:**
|
|
80
82
|
|
|
@@ -82,22 +84,34 @@ Search documentation semantically. Returns relevant chunks matching your query.
|
|
|
82
84
|
How does authentication work in this project?
|
|
83
85
|
```
|
|
84
86
|
|
|
87
|
+
**Compact mode example:**
|
|
88
|
+
|
|
89
|
+
```
|
|
90
|
+
search_docs({ query: "authentication", compact: true })
|
|
91
|
+
|
|
92
|
+
→ **5 results for "authentication"**
|
|
93
|
+
- docs/topics/auth.md (95%)
|
|
94
|
+
- docs/modules/security.md (82%)
|
|
95
|
+
- ...
|
|
96
|
+
```
|
|
97
|
+
|
|
85
98
|
### get_docs_for_file ⭐
|
|
86
99
|
|
|
87
|
-
**The killer feature.** Get documentation relevant to a source code file, with full
|
|
100
|
+
**The killer feature.** Get documentation relevant to a source code file, with full context.
|
|
88
101
|
|
|
89
102
|
When you're working on `src/auth/jwt.ts`, this returns:
|
|
90
103
|
|
|
91
|
-
-
|
|
92
|
-
-
|
|
93
|
-
-
|
|
104
|
+
- Unit doc (JWT implementation details) - **full content**
|
|
105
|
+
- Module doc (Security architecture) - **full content**
|
|
106
|
+
- Related topics based on concepts (Auth, Tokens, etc.) - **summaries only**
|
|
94
107
|
|
|
95
|
-
|
|
108
|
+
One call for immediate context. Related topics give you paths to dive deeper if needed.
|
|
96
109
|
|
|
97
110
|
**Parameters:**
|
|
98
111
|
|
|
99
112
|
- `file_path` (string, required): Path to the source code file
|
|
100
113
|
- `include_content` (boolean, optional): Include full content (default: true)
|
|
114
|
+
- `compact` (boolean, optional): Return condensed output for quick lookups (default: false)
|
|
101
115
|
|
|
102
116
|
**Example:**
|
|
103
117
|
|
|
@@ -108,17 +122,44 @@ Get docs for src/services/payment-processor.ts
|
|
|
108
122
|
Returns:
|
|
109
123
|
|
|
110
124
|
```
|
|
125
|
+
# 📄 Unit Documentation
|
|
126
|
+
## PaymentProcessor Class
|
|
127
|
+
Detailed API for the payment processor...
|
|
128
|
+
[full content]
|
|
129
|
+
|
|
111
130
|
# 🏗️ Module Context
|
|
112
131
|
## Billing & Payments
|
|
113
132
|
Overview of the billing system architecture...
|
|
133
|
+
[full content]
|
|
114
134
|
|
|
115
|
-
# 📚
|
|
116
|
-
|
|
117
|
-
|
|
135
|
+
# 📚 Related Topics (3)
|
|
136
|
+
- **Payment Processing** (payments)
|
|
137
|
+
Path: docs/topics/payments.md
|
|
138
|
+
How payments flow through the system
|
|
118
139
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
140
|
+
- **Validation** (validation)
|
|
141
|
+
Path: docs/topics/validation.md
|
|
142
|
+
Input validation patterns
|
|
143
|
+
|
|
144
|
+
- **Error Handling** (errors)
|
|
145
|
+
Path: docs/topics/errors.md
|
|
146
|
+
Error handling strategies
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
**Compact mode** returns summaries with topic list:
|
|
150
|
+
|
|
151
|
+
```
|
|
152
|
+
get_docs_for_file({ file_path: "src/auth/jwt.ts", compact: true })
|
|
153
|
+
|
|
154
|
+
→ ## src/auth/jwt.ts
|
|
155
|
+
**JWT Handler**
|
|
156
|
+
Handles JWT token creation and validation
|
|
157
|
+
|
|
158
|
+
- **Module:** Security — Security patterns
|
|
159
|
+
|
|
160
|
+
**Related Topics (2):**
|
|
161
|
+
- Authentication (authentication): docs/topics/auth.md
|
|
162
|
+
- Token Management (tokens): docs/topics/tokens.md
|
|
122
163
|
```
|
|
123
164
|
|
|
124
165
|
### list_docs
|
|
@@ -128,6 +169,7 @@ Browse all documentation, optionally filtered by level.
|
|
|
128
169
|
**Parameters:**
|
|
129
170
|
|
|
130
171
|
- `level` (string, optional): Filter by "module", "topic", "unit", or "all" (default)
|
|
172
|
+
- `compact` (boolean, optional): Return condensed output with just titles and paths (default: false)
|
|
131
173
|
|
|
132
174
|
**Example:**
|
|
133
175
|
|
|
@@ -135,6 +177,19 @@ Browse all documentation, optionally filtered by level.
|
|
|
135
177
|
List all module-level docs
|
|
136
178
|
```
|
|
137
179
|
|
|
180
|
+
**Compact mode** returns a simple list without summaries:
|
|
181
|
+
|
|
182
|
+
```
|
|
183
|
+
list_docs({ level: "module", compact: true })
|
|
184
|
+
|
|
185
|
+
→ **3 docs in MyProject**
|
|
186
|
+
|
|
187
|
+
**Module** (3)
|
|
188
|
+
- Authentication: docs/modules/auth.md
|
|
189
|
+
- Billing: docs/modules/billing.md
|
|
190
|
+
- API: docs/modules/api.md
|
|
191
|
+
```
|
|
192
|
+
|
|
138
193
|
## Environment Variables
|
|
139
194
|
|
|
140
195
|
| Variable | Required | Description |
|
|
@@ -176,6 +231,7 @@ The document ID may be stale if documentation was recently updated. Run a new se
|
|
|
176
231
|
|
|
177
232
|
### Connection issues
|
|
178
233
|
|
|
179
|
-
1.
|
|
180
|
-
2.
|
|
181
|
-
3.
|
|
234
|
+
1. Make sure your config uses `npx` with the `-y` flag: `"args": ["-y", "@docsyncdev/mcp-server"]`. The `-y` flag lets npx auto-install the package without prompting, which is required for MCP stdio communication.
|
|
235
|
+
2. Check that your API key is valid in DocSync settings
|
|
236
|
+
3. Verify your project ID is correct
|
|
237
|
+
4. Ensure you have internet connectivity
|
package/dist/index.d.ts
CHANGED
|
@@ -52,6 +52,13 @@ interface ListDocsResponse {
|
|
|
52
52
|
}>;
|
|
53
53
|
count: number;
|
|
54
54
|
}
|
|
55
|
+
interface TopicSummary {
|
|
56
|
+
id: string;
|
|
57
|
+
file_path: string;
|
|
58
|
+
title: string;
|
|
59
|
+
concept: string;
|
|
60
|
+
summary: string | null;
|
|
61
|
+
}
|
|
55
62
|
interface FileDocsResponse {
|
|
56
63
|
success: boolean;
|
|
57
64
|
project_id: string;
|
|
@@ -59,8 +66,8 @@ interface FileDocsResponse {
|
|
|
59
66
|
file_path: string;
|
|
60
67
|
doc_path: string;
|
|
61
68
|
unit_doc: DocInfo | null;
|
|
62
|
-
topic: DocInfo | null;
|
|
63
69
|
module: DocInfo | null;
|
|
70
|
+
related_topics: TopicSummary[];
|
|
64
71
|
}
|
|
65
72
|
/**
|
|
66
73
|
* Search results cache
|
|
@@ -82,6 +89,12 @@ interface ClientConfig {
|
|
|
82
89
|
projectId: string;
|
|
83
90
|
baseUrl?: string;
|
|
84
91
|
}
|
|
92
|
+
interface ClientMetadata {
|
|
93
|
+
hostname: string;
|
|
94
|
+
os: string;
|
|
95
|
+
editor: string | undefined;
|
|
96
|
+
version: string;
|
|
97
|
+
}
|
|
85
98
|
/**
|
|
86
99
|
* DocSync API client for MCP server
|
|
87
100
|
*/
|
|
@@ -102,6 +115,18 @@ declare class DocSyncClient {
|
|
|
102
115
|
* Get documentation related to a source file with hierarchy context
|
|
103
116
|
*/
|
|
104
117
|
getDocsForFile(filePath: string, includeContent?: boolean): Promise<FileDocsResponse>;
|
|
118
|
+
/**
|
|
119
|
+
* Register a new MCP session with the server
|
|
120
|
+
*/
|
|
121
|
+
registerSession(metadata: ClientMetadata): Promise<string>;
|
|
122
|
+
/**
|
|
123
|
+
* Send a heartbeat for an active session
|
|
124
|
+
*/
|
|
125
|
+
heartbeat(sessionId: string): Promise<void>;
|
|
126
|
+
/**
|
|
127
|
+
* End an active session (graceful disconnect)
|
|
128
|
+
*/
|
|
129
|
+
endSession(sessionId: string): Promise<void>;
|
|
105
130
|
/**
|
|
106
131
|
* Make authenticated request to DocSync API
|
|
107
132
|
*/
|
|
@@ -175,6 +200,7 @@ declare const searchToolDefinition: Tool;
|
|
|
175
200
|
interface SearchToolInput {
|
|
176
201
|
query: string;
|
|
177
202
|
limit?: number;
|
|
203
|
+
compact?: boolean;
|
|
178
204
|
}
|
|
179
205
|
/**
|
|
180
206
|
* Execute search_docs tool
|
|
@@ -194,6 +220,7 @@ declare const LIST_DOCS_TOOL_NAME = "list_docs";
|
|
|
194
220
|
declare const listDocsToolDefinition: Tool;
|
|
195
221
|
interface ListDocsToolInput {
|
|
196
222
|
level?: 'module' | 'topic' | 'unit' | 'all';
|
|
223
|
+
compact?: boolean;
|
|
197
224
|
}
|
|
198
225
|
/**
|
|
199
226
|
* Execute list_docs tool
|
|
@@ -204,12 +231,12 @@ declare function executeListDocsTool(client: DocSyncClient, input: ListDocsToolI
|
|
|
204
231
|
* get_docs_for_file MCP Tool
|
|
205
232
|
*
|
|
206
233
|
* The killer feature: given a source code file, returns related documentation
|
|
207
|
-
*
|
|
234
|
+
* with module context and related topics based on concepts.
|
|
208
235
|
*
|
|
209
236
|
* This gives agents full context about what they're working on:
|
|
210
|
-
* - Specific docs for the file/component
|
|
211
|
-
* -
|
|
212
|
-
* -
|
|
237
|
+
* - Specific docs for the file/component (full content)
|
|
238
|
+
* - Module-level architecture (full content)
|
|
239
|
+
* - Related topics by concept (metadata only - fetch if needed)
|
|
213
240
|
*/
|
|
214
241
|
|
|
215
242
|
declare const FILE_DOCS_TOOL_NAME = "get_docs_for_file";
|
|
@@ -220,6 +247,7 @@ declare const fileDocsToolDefinition: Tool;
|
|
|
220
247
|
interface FileDocsToolInput {
|
|
221
248
|
file_path: string;
|
|
222
249
|
include_content?: boolean;
|
|
250
|
+
compact?: boolean;
|
|
223
251
|
}
|
|
224
252
|
/**
|
|
225
253
|
* Execute get_docs_for_file tool
|