@meldocio/mcp-stdio-proxy 1.0.23 → 1.0.25
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/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/bin/cli.js +33 -1088
- package/bin/meldoc-mcp-proxy.js +136 -1110
- package/lib/cli/commands.js +277 -0
- package/lib/cli/formatters.js +137 -0
- package/lib/core/constants.js +98 -0
- package/lib/http/client.js +61 -0
- package/lib/http/error-handler.js +195 -0
- package/lib/install/config-manager.js +203 -0
- package/lib/install/config-paths.js +198 -0
- package/lib/install/installers.js +328 -0
- package/lib/install/templates.js +266 -0
- package/lib/mcp/handlers.js +185 -0
- package/lib/mcp/tools-call.js +179 -0
- package/lib/protocol/error-codes.js +143 -0
- package/lib/protocol/json-rpc.js +183 -0
- package/lib/protocol/tools-schema.js +239 -0
- package/package.json +1 -1
- package/lib/constants.js +0 -31
- /package/lib/{auth.js → core/auth.js} +0 -0
- /package/lib/{config.js → core/config.js} +0 -0
- /package/lib/{credentials.js → core/credentials.js} +0 -0
- /package/lib/{device-flow.js → core/device-flow.js} +0 -0
- /package/lib/{logger.js → core/logger.js} +0 -0
- /package/lib/{workspace.js → core/workspace.js} +0 -0
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Tools Schema Definitions
|
|
3
|
+
*
|
|
4
|
+
* This module contains all tool definitions for the Meldoc MCP server.
|
|
5
|
+
* Each tool has a name, description, and JSON Schema for input validation.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Get the complete list of MCP tools supported by this proxy
|
|
10
|
+
* @returns {Array<Object>} Array of tool definitions with name, description, and inputSchema
|
|
11
|
+
*/
|
|
12
|
+
function getToolsList() {
|
|
13
|
+
return [
|
|
14
|
+
{
|
|
15
|
+
name: 'docs_list',
|
|
16
|
+
description: 'List documents in workspace/project. For public tokens, only shows published public documents.',
|
|
17
|
+
inputSchema: {
|
|
18
|
+
type: 'object',
|
|
19
|
+
properties: {
|
|
20
|
+
workspaceAlias: { type: 'string', description: 'Workspace alias (auto-selected if user has only one workspace)' },
|
|
21
|
+
workspaceId: { type: 'string', description: 'Workspace UUID (auto-selected if user has only one workspace)' },
|
|
22
|
+
projectId: { type: 'string', description: 'UUID of the project to list documents from' },
|
|
23
|
+
cursor: { type: 'string', description: 'Pagination cursor' },
|
|
24
|
+
limit: { type: 'integer', description: 'Maximum number of documents to return (default: 50, max: 100)' }
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: 'docs_get',
|
|
30
|
+
description: 'Get a specific document by ID or path. For public tokens, allows access to public and unlisted documents.',
|
|
31
|
+
inputSchema: {
|
|
32
|
+
type: 'object',
|
|
33
|
+
required: ['docId'],
|
|
34
|
+
properties: {
|
|
35
|
+
workspaceAlias: { type: 'string', description: 'Workspace alias (auto-selected if user has only one workspace)' },
|
|
36
|
+
workspaceId: { type: 'string', description: 'Workspace UUID (auto-selected if user has only one workspace)' },
|
|
37
|
+
docId: { type: 'string', description: 'UUID of the document (alias: id)' },
|
|
38
|
+
id: { type: 'string', description: 'UUID of the document (alias for docId)' },
|
|
39
|
+
path: { type: 'string', description: 'Path of the document (not yet implemented)' }
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
name: 'docs_tree',
|
|
45
|
+
description: 'Get the document tree structure for a project. For public tokens, only includes published public documents.',
|
|
46
|
+
inputSchema: {
|
|
47
|
+
type: 'object',
|
|
48
|
+
required: ['projectId'],
|
|
49
|
+
properties: {
|
|
50
|
+
workspaceAlias: { type: 'string', description: 'Workspace alias (auto-selected if user has only one workspace)' },
|
|
51
|
+
workspaceId: { type: 'string', description: 'Workspace UUID (auto-selected if user has only one workspace)' },
|
|
52
|
+
projectId: { type: 'string', description: 'UUID of the project' },
|
|
53
|
+
project_alias: { type: 'string', description: 'Alias of the project (alternative to projectId)' }
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
name: 'docs_search',
|
|
59
|
+
description: 'Search documents by text query. For public tokens, only searches published public documents.',
|
|
60
|
+
inputSchema: {
|
|
61
|
+
type: 'object',
|
|
62
|
+
required: ['query'],
|
|
63
|
+
properties: {
|
|
64
|
+
workspaceAlias: { type: 'string', description: 'Workspace alias (auto-selected if user has only one workspace)' },
|
|
65
|
+
workspaceId: { type: 'string', description: 'Workspace UUID (auto-selected if user has only one workspace)' },
|
|
66
|
+
query: { type: 'string', description: 'Search query text' },
|
|
67
|
+
projectId: { type: 'string', description: 'UUID of the project to search in' },
|
|
68
|
+
limit: { type: 'integer', description: 'Maximum number of results (default: 20, max: 50)' }
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
name: 'docs_update',
|
|
74
|
+
description: 'Update a document\'s content and/or metadata. Requires update permission (internal tokens only).',
|
|
75
|
+
inputSchema: {
|
|
76
|
+
type: 'object',
|
|
77
|
+
required: ['docId'],
|
|
78
|
+
properties: {
|
|
79
|
+
workspaceAlias: { type: 'string', description: 'Workspace alias (auto-selected if user has only one workspace)' },
|
|
80
|
+
workspaceId: { type: 'string', description: 'Workspace UUID (auto-selected if user has only one workspace)' },
|
|
81
|
+
docId: { type: 'string', description: 'UUID of the document to update' },
|
|
82
|
+
contentMd: { type: 'string', description: 'New markdown content for the document (optional, can update individual fields without content)' },
|
|
83
|
+
title: { type: 'string', description: 'New title for the document' },
|
|
84
|
+
alias: { type: 'string', description: 'New alias for the document' },
|
|
85
|
+
parentAlias: { type: 'string', description: 'Alias of the parent document (set to empty string to remove parent)' },
|
|
86
|
+
workflow: { type: 'string', enum: ['published', 'draft'], description: 'Workflow status: \'published\' or \'draft\'' },
|
|
87
|
+
visibility: { type: 'string', enum: ['visible', 'hidden'], description: 'Visibility: \'visible\' or \'hidden\'' },
|
|
88
|
+
exposure: { type: 'string', enum: ['private', 'unlisted', 'public', 'inherit'], description: 'Exposure level: \'private\', \'unlisted\', \'public\', or \'inherit\'' },
|
|
89
|
+
expectedUpdatedAt: { type: 'string', description: 'Expected updatedAt timestamp for optimistic locking (RFC3339 format)' }
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
name: 'docs_create',
|
|
95
|
+
description: 'Create a new document. Requires create permission (internal tokens only).',
|
|
96
|
+
inputSchema: {
|
|
97
|
+
type: 'object',
|
|
98
|
+
required: ['projectId', 'title', 'contentMd'],
|
|
99
|
+
properties: {
|
|
100
|
+
workspaceAlias: { type: 'string', description: 'Workspace alias (auto-selected if user has only one workspace)' },
|
|
101
|
+
workspaceId: { type: 'string', description: 'Workspace UUID (auto-selected if user has only one workspace)' },
|
|
102
|
+
projectId: { type: 'string', description: 'UUID of the project to create the document in' },
|
|
103
|
+
title: { type: 'string', description: 'Title of the document' },
|
|
104
|
+
contentMd: { type: 'string', description: 'Markdown content for the document' },
|
|
105
|
+
alias: { type: 'string', description: 'Alias for the document (will be auto-generated from title if not provided)' },
|
|
106
|
+
parentAlias: { type: 'string', description: 'Alias of the parent document' }
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
name: 'docs_delete',
|
|
112
|
+
description: 'Delete a document. Requires delete permission (internal tokens only).',
|
|
113
|
+
inputSchema: {
|
|
114
|
+
type: 'object',
|
|
115
|
+
required: ['docId'],
|
|
116
|
+
properties: {
|
|
117
|
+
workspaceAlias: { type: 'string', description: 'Workspace alias (auto-selected if user has only one workspace)' },
|
|
118
|
+
workspaceId: { type: 'string', description: 'Workspace UUID (auto-selected if user has only one workspace)' },
|
|
119
|
+
docId: { type: 'string', description: 'UUID of the document to delete' }
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
name: 'docs_links',
|
|
125
|
+
description: 'Get all outgoing links from a document (links that point from this document to other documents).',
|
|
126
|
+
inputSchema: {
|
|
127
|
+
type: 'object',
|
|
128
|
+
required: ['docId'],
|
|
129
|
+
properties: {
|
|
130
|
+
workspaceAlias: { type: 'string', description: 'Workspace alias (auto-selected if user has only one workspace)' },
|
|
131
|
+
workspaceId: { type: 'string', description: 'Workspace UUID (auto-selected if user has only one workspace)' },
|
|
132
|
+
docId: { type: 'string', description: 'UUID of the document' }
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
name: 'docs_backlinks',
|
|
138
|
+
description: 'Get all backlinks to a document (links from other documents that point to this document).',
|
|
139
|
+
inputSchema: {
|
|
140
|
+
type: 'object',
|
|
141
|
+
required: ['docId'],
|
|
142
|
+
properties: {
|
|
143
|
+
docId: { type: 'string', description: 'UUID of the document' }
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
name: 'projects_list',
|
|
149
|
+
description: 'List projects accessible by this token. For public tokens, only shows public projects.',
|
|
150
|
+
inputSchema: {
|
|
151
|
+
type: 'object',
|
|
152
|
+
properties: {
|
|
153
|
+
workspaceAlias: { type: 'string', description: 'Workspace alias (auto-selected if user has only one workspace)' },
|
|
154
|
+
workspaceId: { type: 'string', description: 'Workspace UUID (auto-selected if user has only one workspace)' }
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
name: 'server_info',
|
|
160
|
+
description: 'Get information about this MCP server\'s configuration, capabilities, and accessible projects.',
|
|
161
|
+
inputSchema: {
|
|
162
|
+
type: 'object',
|
|
163
|
+
properties: {
|
|
164
|
+
workspaceAlias: { type: 'string', description: 'Workspace alias (auto-selected if user has only one workspace)' },
|
|
165
|
+
workspaceId: { type: 'string', description: 'Workspace UUID (auto-selected if user has only one workspace)' }
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
name: 'list_workspaces',
|
|
171
|
+
description: 'List all workspaces accessible by the current user or integration token. For integration tokens, returns the workspace from token scope. Works without workspace header via /mcp/v1/rpc endpoint.',
|
|
172
|
+
inputSchema: {
|
|
173
|
+
type: 'object',
|
|
174
|
+
properties: {}
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
name: 'get_workspace',
|
|
179
|
+
description: 'Get the current workspace alias from repo config or global config. Reads workspaceAlias from configuration files.',
|
|
180
|
+
inputSchema: {
|
|
181
|
+
type: 'object',
|
|
182
|
+
properties: {}
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
name: 'set_workspace',
|
|
187
|
+
description: 'Set the workspace alias in global config (~/.meldoc/config.json). This workspace will be used automatically if user has multiple workspaces.',
|
|
188
|
+
inputSchema: {
|
|
189
|
+
type: 'object',
|
|
190
|
+
required: ['alias'],
|
|
191
|
+
properties: {
|
|
192
|
+
alias: { type: 'string', description: 'Workspace alias to set' }
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
name: 'auth_status',
|
|
198
|
+
description: 'Check authentication status. Returns whether user is logged in and authentication details.',
|
|
199
|
+
inputSchema: {
|
|
200
|
+
type: 'object',
|
|
201
|
+
properties: {}
|
|
202
|
+
}
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
name: 'auth_login_instructions',
|
|
206
|
+
description: 'Get instructions for logging in. Returns the command to run for authentication.',
|
|
207
|
+
inputSchema: {
|
|
208
|
+
type: 'object',
|
|
209
|
+
properties: {}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
];
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Check if a tool name exists in the schema
|
|
217
|
+
* @param {string} toolName - The name of the tool to check
|
|
218
|
+
* @returns {boolean} True if tool exists
|
|
219
|
+
*/
|
|
220
|
+
function isValidToolName(toolName) {
|
|
221
|
+
const tools = getToolsList();
|
|
222
|
+
return tools.some(tool => tool.name === toolName);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Get a specific tool definition by name
|
|
227
|
+
* @param {string} toolName - The name of the tool
|
|
228
|
+
* @returns {Object|null} Tool definition or null if not found
|
|
229
|
+
*/
|
|
230
|
+
function getToolByName(toolName) {
|
|
231
|
+
const tools = getToolsList();
|
|
232
|
+
return tools.find(tool => tool.name === toolName) || null;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
module.exports = {
|
|
236
|
+
getToolsList,
|
|
237
|
+
isValidToolName,
|
|
238
|
+
getToolByName
|
|
239
|
+
};
|
package/package.json
CHANGED
package/lib/constants.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Default configuration constants
|
|
3
|
-
* Production values used when environment variables are not set
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
// Production API URL
|
|
7
|
-
const DEFAULT_API_URL = 'https://api.meldoc.io';
|
|
8
|
-
|
|
9
|
-
// Production App URL (frontend)
|
|
10
|
-
const DEFAULT_APP_URL = 'https://app.meldoc.io';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Get API URL from environment or use production default
|
|
14
|
-
*/
|
|
15
|
-
function getApiUrl() {
|
|
16
|
-
return process.env.MELDOC_API_URL || DEFAULT_API_URL;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Get App URL from environment or use production default
|
|
21
|
-
*/
|
|
22
|
-
function getAppUrl() {
|
|
23
|
-
return process.env.MELDOC_APP_URL || DEFAULT_APP_URL;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
module.exports = {
|
|
27
|
-
DEFAULT_API_URL,
|
|
28
|
-
DEFAULT_APP_URL,
|
|
29
|
-
getApiUrl,
|
|
30
|
-
getAppUrl
|
|
31
|
-
};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|