@meldocio/mcp-stdio-proxy 1.0.6 → 1.0.7

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 (2) hide show
  1. package/README.md +289 -173
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,90 +1,107 @@
1
- # @meldocio/mcp-stdio-proxy
1
+ # Meldoc MCP for Claude Desktop
2
2
 
3
- MCP stdio proxy for meldoc - connects Claude Desktop to meldoc MCP API without requiring CLI installation.
3
+ This package allows you to connect Claude Desktop to your Meldoc account, so you can use all your documentation directly in Claude.
4
4
 
5
- ## Description
5
+ ## What is this?
6
6
 
7
- This npm package provides a lightweight proxy that bridges JSON-RPC communication between Claude Desktop and the meldoc MCP API. It reads JSON-RPC requests from stdin and forwards them to the meldoc API over HTTP, then returns the responses via stdout.
7
+ This is a bridge between Claude Desktop and Meldoc. After setup, Claude will be able to:
8
8
 
9
- The package follows MCP best practices:
9
+ - 📖 Read your documentation from Meldoc
10
+ - 🔍 Search through documents
11
+ - ✏️ Create and update documents (if you have permissions)
12
+ - 📁 Work with projects and workspaces
10
13
 
11
- - Pure stdio communication (no interactive prompts)
12
- - ✅ All logs go to stderr (stdout is clean JSON-RPC only)
13
- - ✅ No required arguments at startup
14
- - ✅ Graceful error handling with proper JSON-RPC error codes
15
- - ✅ Configurable logging levels
14
+ **No additional installation required** - everything works automatically through Claude Desktop.
16
15
 
17
- ## Installation
16
+ ## Quick Setup
18
17
 
19
- ### Using Claude Desktop MCP Command
18
+ ### Step 1: Find Claude Desktop configuration file
20
19
 
21
- ```bash
22
- claude mcp add meldoc npx @meldocio/mcp-stdio-proxy@latest
23
- ```
24
-
25
- ### Manual Configuration
26
-
27
- Add the following configuration to your `claude_desktop_config.json` file:
20
+ Open the configuration file depending on your operating system:
28
21
 
29
22
  **macOS:**
30
23
 
31
- ```
24
+ ```text
32
25
  ~/Library/Application Support/Claude/claude_desktop_config.json
33
26
  ```
34
27
 
35
28
  **Windows:**
36
29
 
37
- ```
30
+ ```text
38
31
  %APPDATA%\Claude\claude_desktop_config.json
39
32
  ```
40
33
 
41
34
  **Linux:**
42
35
 
43
- ```
36
+ ```text
44
37
  ~/.config/Claude/claude_desktop_config.json
45
38
  ```
46
39
 
40
+ > 💡 **Tip:** If the file doesn't exist, create it. Make sure the folder exists.
41
+
42
+ ### Step 2: Add Meldoc configuration
43
+
44
+ Open the file in any text editor and add the following:
45
+
47
46
  ```json
48
47
  {
49
48
  "mcpServers": {
50
49
  "meldoc": {
51
50
  "command": "npx",
52
- "args": ["-y", "@meldocio/mcp-stdio-proxy@latest"],
53
- "env": {
54
- "MELDOC_TOKEN": "your_token_here"
55
- }
51
+ "args": ["-y", "@meldocio/mcp-stdio-proxy@latest"]
56
52
  }
57
53
  }
58
54
  }
59
55
  ```
60
56
 
61
- After adding the configuration, restart Claude Desktop.
57
+ > ⚠️ **Important:** If the file already has other MCP servers, simply add `"meldoc"` to the existing `mcpServers` object.
62
58
 
63
- ## Authentication
59
+ ### Step 3: Restart Claude Desktop
64
60
 
65
- Meldoc MCP requires an access token. The token is checked in this order:
61
+ Completely close and reopen Claude Desktop for the changes to take effect.
66
62
 
67
- 1. `MELDOC_TOKEN` environment variable (recommended)
68
- 2. `MELDOC_MCP_TOKEN` environment variable (backward compatibility)
69
- 3. `~/.meldoc/config.json` file
70
- 4. If none found, tools will return an authentication error
63
+ ### Step 4: Log in to your Meldoc account
71
64
 
72
- ### Option 1: Environment variable (recommended)
73
-
74
- Set the token as an environment variable:
65
+ Open a terminal and run:
75
66
 
76
67
  ```bash
77
- export MELDOC_TOKEN=your_token_here
68
+ npx @meldoc/mcp@latest auth login
78
69
  ```
79
70
 
80
- For permanent setup (macOS/Linux):
71
+ Follow the on-screen instructions - you'll need to open a link in your browser and enter a code.
72
+
73
+ Done! Now Claude can work with your Meldoc documentation.
74
+
75
+ ## Authentication (Logging in)
76
+
77
+ For Claude to work with your documentation, you need to log in to your Meldoc account. There are several ways to do this:
78
+
79
+ ### Method 1: Interactive login (recommended) ✨
80
+
81
+ The easiest way is to use the login command:
81
82
 
82
83
  ```bash
83
- echo 'export MELDOC_TOKEN=your_token_here' >> ~/.zshrc # or ~/.bashrc
84
- source ~/.zshrc
84
+ npx @meldoc/mcp@latest auth login
85
85
  ```
86
86
 
87
- For Claude Desktop, add it to your configuration:
87
+ **What will happen:**
88
+
89
+ 1. A link and code will appear in the terminal
90
+ 2. Open the link in your browser
91
+ 3. Enter the code on the Meldoc website
92
+ 4. Done! Your data will be saved automatically
93
+
94
+ **Advantages:**
95
+
96
+ - ✅ No need to copy tokens manually
97
+ - ✅ Tokens are updated automatically
98
+ - ✅ Secure data storage
99
+
100
+ ### Method 2: Using a token (for integrations)
101
+
102
+ If you're using a token for integration (e.g., for CI/CD), you can specify it directly.
103
+
104
+ **In Claude Desktop configuration:**
88
105
 
89
106
  ```json
90
107
  {
@@ -93,199 +110,268 @@ For Claude Desktop, add it to your configuration:
93
110
  "command": "npx",
94
111
  "args": ["-y", "@meldocio/mcp-stdio-proxy@latest"],
95
112
  "env": {
96
- "MELDOC_TOKEN": "your_token_here"
113
+ "MELDOC_ACCESS_TOKEN": "your_token_here"
97
114
  }
98
115
  }
99
116
  }
100
117
  }
101
118
  ```
102
119
 
103
- ### Option 2: Meldoc CLI
104
-
105
- If you have the Meldoc CLI installed, run:
120
+ **Or via environment variable:**
106
121
 
107
122
  ```bash
108
- meldoc auth login
123
+ export MELDOC_ACCESS_TOKEN=your_token_here
109
124
  ```
110
125
 
111
- This will store the token in `~/.meldoc/config.json`, which the MCP proxy will automatically use.
126
+ ### Check login status
112
127
 
113
- ### Option 3: Manual config file
128
+ To check if you're logged in:
114
129
 
115
- Create `~/.meldoc/config.json` manually:
130
+ ```bash
131
+ npx @meldoc/mcp@latest auth status
132
+ ```
116
133
 
117
- ```json
118
- {
119
- "token": "your_token_here"
120
- }
134
+ ### Logging out
135
+
136
+ To log out and remove saved data:
137
+
138
+ ```bash
139
+ npx @meldoc/mcp@latest auth logout
121
140
  ```
122
141
 
123
- ### Environment Variables
142
+ ### Automatic token refresh
124
143
 
125
- - **MELDOC_TOKEN** (recommended): Your meldoc authentication token
126
- - **MELDOC_MCP_TOKEN** (optional): Alternative token variable (for backward compatibility)
127
- - **LOG_LEVEL** (optional): Logging level - `ERROR`, `WARN`, `INFO`, or `DEBUG` (default: `ERROR`)
144
+ If you used `auth login`, tokens will be automatically refreshed 5 minutes before expiration. You don't need to do anything - everything works automatically!
128
145
 
129
- ### Command Line Testing
146
+ ## Frequently Asked Questions
130
147
 
131
- You can test the proxy directly from the command line:
148
+ ### Do I need to install anything additional?
132
149
 
133
- ```bash
134
- # Test initialize (works without token)
135
- echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"test","version":"1.0.0"}}}' | \
136
- npx @meldocio/mcp-stdio-proxy@latest
150
+ No! Everything works through `npx`, which automatically downloads the necessary files on first use.
137
151
 
138
- # Test tools/list (requires token)
139
- echo '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' | \
140
- MELDOC_TOKEN=your_token_here npx @meldocio/mcp-stdio-proxy@latest
152
+ ### Is this secure?
141
153
 
142
- # Test with debug logging
143
- echo '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' | \
144
- MELDOC_TOKEN=your_token_here LOG_LEVEL=DEBUG npx @meldocio/mcp-stdio-proxy@latest
145
- ```
154
+ Yes! Your tokens are stored locally on your computer with proper access permissions. Tokens are automatically refreshed so they don't expire.
146
155
 
147
- ## How It Works
156
+ ### Can I use multiple accounts?
148
157
 
149
- 1. The proxy reads JSON-RPC requests from `stdin` (newline-delimited JSON)
150
- 2. Protocol methods (`initialize`, `ping`, `resources/list`) are handled locally
151
- 3. Tool requests are forwarded to `https://api.meldoc.io/mcp/v1/rpc`
152
- 4. The `Authorization: Bearer {token}` header is automatically added
153
- 5. Responses are written to `stdout` in JSON-RPC format (stdout is clean - only JSON-RPC)
154
- 6. All logs and diagnostics go to `stderr`
155
- 7. Errors are handled and returned as proper JSON-RPC error responses
158
+ Yes, but you need to switch between them using the `auth logout` and `auth login` commands.
156
159
 
157
- ### Supported Features
160
+ ### What to do if something doesn't work?
158
161
 
159
- - JSON-RPC 2.0 protocol
160
- - Single and batch requests
161
- - Proper error handling with JSON-RPC error codes
162
- - Custom error codes: `AUTH_REQUIRED`, `NOT_FOUND`, `RATE_LIMIT`
163
- - ✅ Request timeout handling (25 seconds)
164
- - ✅ Network error recovery
165
- - ✅ Line-by-line processing for streaming
166
- - ✅ Automatic support for all MCP tools (including `server_info`)
167
- - ✅ Configurable logging levels (ERROR, WARN, INFO, DEBUG)
168
- - ✅ Graceful shutdown on SIGINT/SIGTERM
169
- - ✅ No required arguments at startup
162
+ 1. Check that you're logged in: `npx @meldoc/mcp@latest auth status`
163
+ 2. Check workspace: `npx @meldoc/mcp@latest config get-workspace`
164
+ 3. See the "Troubleshooting" section above
165
+ 4. If nothing helps, create an issue on GitHub
170
166
 
171
- ## JSON-RPC Error Codes
167
+ ## How does it work?
172
168
 
173
- The proxy uses standard JSON-RPC 2.0 error codes plus custom codes:
169
+ When you ask Claude to do something with your documentation:
174
170
 
175
- ### Standard JSON-RPC 2.0 Codes
171
+ 1. Claude sends a request through MCP (Model Context Protocol)
172
+ 2. Our proxy receives the request and adds your authorization token
173
+ 3. The request is sent to the Meldoc server
174
+ 4. The response is returned back to Claude
175
+ 5. Claude shows you the result
176
176
 
177
- - `-32700`: Parse error (invalid JSON)
178
- - `-32600`: Invalid Request (malformed JSON-RPC)
179
- - `-32601`: Method not found
180
- - `-32602`: Invalid params
181
- - `-32603`: Internal error (network errors, timeouts, etc.)
182
- - `-32000`: Server error (HTTP 4xx/5xx responses)
177
+ **Everything happens automatically** - you don't need to do anything manually!
183
178
 
184
- ### Custom Error Codes
179
+ ### Features
185
180
 
186
- - `-32001`: Authentication required (`AUTH_REQUIRED`) - Token missing or invalid
187
- - `-32002`: Not found (`NOT_FOUND`) - Resource not found
188
- - `-32003`: Rate limit exceeded (`RATE_LIMIT`) - Too many requests
181
+ - Automatic token refresh (no need to log in every time)
182
+ - Smart workspace selection (if there's only one, it's selected automatically)
183
+ - Secure data storage
184
+ - ✅ Works with multiple workspaces
185
+ - ✅ Support for projects and repositories
189
186
 
190
- Error responses include:
187
+ ## Working Commands
191
188
 
192
- - `code`: Error code
193
- - `message`: Human-readable error message
194
- - `data` (optional, DEBUG level only): Additional error details
189
+ ### Authentication commands
195
190
 
196
- ## Available Tools
191
+ ```bash
192
+ # Log in to account (browser will open)
193
+ npx @meldoc/mcp@latest auth login
197
194
 
198
- The proxy automatically supports all tools provided by the meldoc MCP API, including:
195
+ # Check if you're logged in
196
+ npx @meldoc/mcp@latest auth status
199
197
 
200
- - **`server_info`** - Get information about the server configuration, available projects, and token capabilities
201
- - **`docs_list`** - List available documentation
202
- - **`docs_get`** - Get specific documentation content
203
- - And other tools as provided by the API
198
+ # Log out of account
199
+ npx @meldoc/mcp@latest auth logout
200
+ ```
204
201
 
205
- ### Example: Using `server_info`
202
+ ### Workspace management commands
206
203
 
207
- You can get server information using the `server_info` tool:
204
+ If you have multiple workspaces, you can manage them:
208
205
 
209
206
  ```bash
210
- echo '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"server_info","arguments":{}}}' | \
211
- MELDOC_MCP_TOKEN=your_token_here npx @meldocio/mcp-stdio-proxy
207
+ # View all available workspaces
208
+ npx @meldoc/mcp@latest config list-workspaces
209
+
210
+ # Set default workspace
211
+ npx @meldoc/mcp@latest config set-workspace workspace-name
212
+
213
+ # View current workspace
214
+ npx @meldoc/mcp@latest config get-workspace
212
215
  ```
213
216
 
214
- The response includes:
217
+ ### Help
215
218
 
216
- - Server name (from token)
217
- - Token description (if provided)
218
- - Available projects with IDs, names, and aliases
219
- - Token capabilities (read, update, create, delete)
220
- - Usage hints
219
+ ```bash
220
+ # Show all available commands
221
+ npx @meldoc/mcp@latest help
222
+ ```
221
223
 
222
- ### Response Metadata
224
+ ## Working with Workspaces
223
225
 
224
- All tool responses now include a `_meta` field with contextual information:
226
+ If you have multiple workspaces in Meldoc, you need to specify which one to use.
225
227
 
226
- ```json
227
- {
228
- "items": [...],
229
- "_meta": {
230
- "server": "My Token",
231
- "projects": ["Frontend Docs", "Backend API"],
232
- "capabilities": ["read"],
233
- "hint": "Read permission required for this operation"
234
- }
235
- }
228
+ ### How is workspace selected?
229
+
230
+ The system selects a workspace in this order:
231
+
232
+ 1. **Specified in request** - if you explicitly specified `workspaceAlias` or `workspaceId`
233
+ 2. **Project file** - if there's a `.meldoc.yml` file in the project folder
234
+ 3. **Global setting** - if you set a default workspace
235
+ 4. **Automatically** - if you only have one workspace, it will be selected automatically
236
+
237
+ ### Setting default workspace
238
+
239
+ If you have multiple workspaces, set one as default:
240
+
241
+ ```bash
242
+ npx @meldoc/mcp@latest config set-workspace workspace-name
236
243
  ```
237
244
 
238
- This metadata helps AI assistants understand the context and limitations of the current token.
245
+ After this, Claude will automatically use this workspace.
246
+
247
+ ### Workspace for a specific project
248
+
249
+ If you want different projects to use different workspaces, create a `.meldoc.yml` file in the project root:
250
+
251
+ ```yaml
252
+ context:
253
+ workspace: workspace-name-for-this-project
254
+ ```
255
+
256
+ Now when working from this folder, the specified workspace will be used.
257
+
258
+ ## What can Claude do with your documentation?
259
+
260
+ After setup, Claude gets access to the following capabilities:
261
+
262
+ ### 📖 Working with documents
263
+
264
+ - **`docs_list`** - Show list of all documents in the project
265
+ - **`docs_get`** - Get content of a specific document
266
+ - **`docs_tree`** - Show document structure (tree)
267
+ - **`docs_search`** - Find documents by text
268
+ - **`docs_create`** - Create a new document (requires permissions)
269
+ - **`docs_update`** - Update a document (requires permissions)
270
+ - **`docs_delete`** - Delete a document (requires permissions)
271
+ - **`docs_links`** - Show all links from a document
272
+ - **`docs_backlinks`** - Show all documents that link to this one
273
+
274
+ ### 📁 Working with projects
275
+
276
+ - **`projects_list`** - Show all available projects
277
+
278
+ ### ⚙️ Management
279
+
280
+ - **`server_info`** - Information about your account and access permissions
281
+ - **`list_workspaces`** - Show all workspaces
282
+ - **`set_workspace`** - Set default workspace
283
+ - **`get_workspace`** - Get current workspace
284
+ - **`auth_status`** - Check login status
285
+
286
+ ### How to use this?
287
+
288
+ Just ask Claude in a regular conversation! For example:
289
+
290
+ - "Show me all documents in the API project"
291
+ - "Find information about the authorization function"
292
+ - "Create a new document with API description"
293
+ - "Which documents link to the database document?"
294
+
295
+ Claude will automatically select the right tool and execute the request.
239
296
 
240
297
  ## Troubleshooting
241
298
 
242
- ### Error: AUTH_REQUIRED - Meldoc token not found
299
+ ### Error: "AUTH_REQUIRED" - token not found
243
300
 
244
- **Solution:** Set the `MELDOC_TOKEN` environment variable or run `meldoc auth login` to store the token in `~/.meldoc/config.json`. The token is checked when tools are called, not at startup.
301
+ **What to do:**
245
302
 
246
- ### Connection timeout
303
+ 1. Run the login command:
247
304
 
248
- **Solution:** Check your internet connection and verify that `https://api.meldoc.io` is accessible. You can test with:
305
+ ```bash
306
+ npx @meldoc/mcp@latest auth login
307
+ ```
249
308
 
250
- ```bash
251
- curl https://api.meldoc.io/mcp/v1/rpc \
252
- -H "Authorization: Bearer your_token" \
253
- -H "Content-Type: application/json" \
254
- -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'
255
- ```
309
+ 2. Or check if you're logged in:
256
310
 
257
- ### Invalid token error
311
+ ```bash
312
+ npx @meldoc/mcp@latest auth status
313
+ ```
258
314
 
259
- **Solution:** Verify that your `MELDOC_MCP_TOKEN` is correct and hasn't expired. You can get a new token from the meldoc dashboard.
315
+ 3. If using a token directly, make sure it's specified in Claude Desktop configuration
260
316
 
261
- ### Claude Desktop not connecting
317
+ ### Error: "WORKSPACE_REQUIRED" - need to select workspace
262
318
 
263
- **Solution:**
319
+ **What to do:**
264
320
 
265
- 1. Verify the configuration JSON is valid (use a JSON validator)
266
- 2. Check that the file path is correct for your operating system
267
- 3. Restart Claude Desktop completely
268
- 4. Check Claude Desktop logs for error messages
321
+ If you have multiple workspaces, you need to specify which one to use:
269
322
 
270
- ### Testing the proxy manually
323
+ 1. View the list of available workspaces:
271
324
 
272
- To debug issues, you can test the proxy directly:
325
+ ```bash
326
+ npx @meldoc/mcp@latest config list-workspaces
327
+ ```
273
328
 
274
- ```bash
275
- # Test initialize (works without token)
276
- echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"test","version":"1.0.0"}}}' | \
277
- npx @meldocio/mcp-stdio-proxy@latest
278
-
279
- # Test with a simple request
280
- echo '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' | \
281
- MELDOC_TOKEN=your_token npx @meldocio/mcp-stdio-proxy@latest
282
-
283
- # Test with debug logging
284
- echo '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' | \
285
- MELDOC_TOKEN=your_token \
286
- LOG_LEVEL=DEBUG \
287
- npx @meldocio/mcp-stdio-proxy@latest
288
- ```
329
+ 2. Set one as default:
330
+
331
+ ```bash
332
+ npx @meldoc/mcp@latest config set-workspace workspace-name
333
+ ```
334
+
335
+ ### Error: "Invalid token" - invalid token
336
+
337
+ **What to do:**
338
+
339
+ 1. If you used `auth login`, just log in again:
340
+
341
+ ```bash
342
+ npx @meldoc/mcp@latest auth login
343
+ ```
344
+
345
+ 2. Check status:
346
+
347
+ ```bash
348
+ npx @meldoc/mcp@latest auth status
349
+ ```
350
+
351
+ 3. If using a token manually, make sure it hasn't expired and is specified correctly
352
+
353
+ ### Claude Desktop won't connect
354
+
355
+ **What to do:**
356
+
357
+ 1. **Check the configuration file:**
358
+ - Make sure the JSON is valid (you can check on jsonlint.com)
359
+ - Verify that the file path is correct for your OS
360
+
361
+ 2. **Restart Claude Desktop:**
362
+ - Completely close the application
363
+ - Open it again
364
+
365
+ 3. **Check logs:**
366
+ - Claude Desktop has a logs section - check if there are any errors there
367
+
368
+ ### Internet connection issues
369
+
370
+ If you're experiencing connection errors:
371
+
372
+ 1. Check your internet connection
373
+ 2. Make sure the site `https://api.meldoc.io` is accessible
374
+ 3. Check if a firewall or proxy is blocking requests
289
375
 
290
376
  ## Development
291
377
 
@@ -318,10 +404,40 @@ No build step is required - the package uses plain JavaScript.
318
404
  npm publish --access public
319
405
  ```
320
406
 
407
+ ## Configuration Files
408
+
409
+ The system uses several files to store settings. Usually you don't need to edit them manually - everything is done through commands.
410
+
411
+ ### `~/.meldoc/credentials.json`
412
+
413
+ Created automatically when logging in via `auth login`. Contains:
414
+
415
+ - Access tokens
416
+ - User information
417
+ - Automatic refresh settings
418
+
419
+ **Do not edit this file manually!**
420
+
421
+ ### `~/.meldoc/config.json`
422
+
423
+ Global settings:
424
+
425
+ - Default workspace
426
+ - Other settings
427
+
428
+ Can be edited manually or through CLI commands.
429
+
430
+ ### `.meldoc.yml` (optional)
431
+
432
+ Project-specific settings. Create in the project root if you need to use a different workspace for this project.
433
+
321
434
  ## Requirements
322
435
 
323
- - Node.js >= 18.0.0
324
- - Valid meldoc MCP token (required for tool calls, not for startup)
436
+ - **Node.js 18.0.0 or newer** (usually already installed if Claude Desktop works)
437
+ - **Meldoc account** (can be created at [app.meldoc.io](https://app.meldoc.io))
438
+ - **Claude Desktop** installed and working
439
+
440
+ > 💡 **Checking Node.js:** Open a terminal and run `node --version`. If the command is not found, install Node.js from [nodejs.org](https://nodejs.org)
325
441
 
326
442
  ## License
327
443
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meldocio/mcp-stdio-proxy",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "description": "MCP stdio proxy for meldoc - connects Claude Desktop to meldoc MCP API",
5
5
  "bin": {
6
6
  "meldoc-mcp": "bin/meldoc-mcp-proxy.js"