@filepad/mcp-server 0.1.0
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/LICENSE +21 -0
- package/README.md +117 -0
- package/SECURITY.md +24 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +109 -0
- package/dist/cli.js.map +1 -0
- package/dist/handlers.d.ts +65 -0
- package/dist/handlers.d.ts.map +1 -0
- package/dist/handlers.js +502 -0
- package/dist/handlers.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/server.d.ts +17 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +88 -0
- package/dist/server.js.map +1 -0
- package/dist/tool-registry.d.ts +63 -0
- package/dist/tool-registry.d.ts.map +1 -0
- package/dist/tool-registry.js +289 -0
- package/dist/tool-registry.js.map +1 -0
- package/dist/transport.d.ts +12 -0
- package/dist/transport.d.ts.map +1 -0
- package/dist/transport.js +54 -0
- package/dist/transport.js.map +1 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +2 -0
- package/dist/version.js.map +1 -0
- package/package.json +64 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { AgentAccessScope, AgentApiSearchMode } from '@filepad/agent-access-sdk';
|
|
2
|
+
export interface McpToolDefinition {
|
|
3
|
+
name: string;
|
|
4
|
+
description: string;
|
|
5
|
+
inputSchema: Record<string, unknown>;
|
|
6
|
+
requiredScopes: AgentAccessScope[];
|
|
7
|
+
}
|
|
8
|
+
export interface SearchArgs {
|
|
9
|
+
query: string;
|
|
10
|
+
type?: AgentApiSearchMode | undefined;
|
|
11
|
+
limit?: number | undefined;
|
|
12
|
+
}
|
|
13
|
+
export interface ReadFileArgs {
|
|
14
|
+
fileNodeId: string;
|
|
15
|
+
}
|
|
16
|
+
export interface CreateArtifactArgs {
|
|
17
|
+
title: string;
|
|
18
|
+
text?: string | undefined;
|
|
19
|
+
}
|
|
20
|
+
export interface ProposeEditArgs {
|
|
21
|
+
fileNodeId: string;
|
|
22
|
+
baseVersionId: string;
|
|
23
|
+
summary: string;
|
|
24
|
+
newText: string;
|
|
25
|
+
}
|
|
26
|
+
export interface EmitEventArgs {
|
|
27
|
+
eventType: string;
|
|
28
|
+
payload?: Record<string, unknown> | undefined;
|
|
29
|
+
}
|
|
30
|
+
export interface CreateSignalArgs {
|
|
31
|
+
findingTypeKey: string;
|
|
32
|
+
summary: string;
|
|
33
|
+
severity?: 'info' | 'warn' | 'high_alert' | undefined;
|
|
34
|
+
value?: Record<string, unknown> | undefined;
|
|
35
|
+
}
|
|
36
|
+
export interface ListSignalsArgs {
|
|
37
|
+
findingTypeKey?: string | undefined;
|
|
38
|
+
severity?: 'info' | 'warn' | 'high_alert' | undefined;
|
|
39
|
+
status?: 'suggested' | 'accepted' | 'rejected' | undefined;
|
|
40
|
+
limit?: number | undefined;
|
|
41
|
+
cursor?: string | undefined;
|
|
42
|
+
}
|
|
43
|
+
export interface GetSignalArgs {
|
|
44
|
+
signalId: string;
|
|
45
|
+
}
|
|
46
|
+
export interface AckNotificationArgs {
|
|
47
|
+
ids: string[];
|
|
48
|
+
}
|
|
49
|
+
export type AgentProfileField = 'identity' | 'learnings' | 'goals' | 'timeline';
|
|
50
|
+
export interface GetProfileArgs {
|
|
51
|
+
fields?: AgentProfileField[] | undefined;
|
|
52
|
+
}
|
|
53
|
+
export interface UpdateProfileArgs {
|
|
54
|
+
field: AgentProfileField;
|
|
55
|
+
content: string;
|
|
56
|
+
mode?: 'append' | 'replace' | undefined;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Return tools visible to an agent given its granted scopes.
|
|
60
|
+
*/
|
|
61
|
+
export declare function listToolsForScopes(scopes: AgentAccessScope[]): McpToolDefinition[];
|
|
62
|
+
export declare function findTool(name: string): McpToolDefinition | undefined;
|
|
63
|
+
//# sourceMappingURL=tool-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-registry.d.ts","sourceRoot":"","sources":["../src/tool-registry.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAEtF,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,cAAc,EAAE,gBAAgB,EAAE,CAAC;CACpC;AAID,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,kBAAkB,GAAG,SAAS,CAAC;IACtC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC5B;AAED,MAAM,WAAW,YAAY;IAC3B,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC3B;AAED,MAAM,WAAW,eAAe;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC;CAC/C;AAED,MAAM,WAAW,gBAAgB;IAC/B,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,YAAY,GAAG,SAAS,CAAC;IACtD,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC;CAC7C;AAED,MAAM,WAAW,eAAe;IAC9B,cAAc,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,YAAY,GAAG,SAAS,CAAC;IACtD,MAAM,CAAC,EAAE,WAAW,GAAG,UAAU,GAAG,UAAU,GAAG,SAAS,CAAC;IAC3D,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC7B;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,mBAAmB;IAClC,GAAG,EAAE,MAAM,EAAE,CAAC;CACf;AAED,MAAM,MAAM,iBAAiB,GACzB,UAAU,GACV,WAAW,GACX,OAAO,GACP,UAAU,CAAC;AAEf,MAAM,WAAW,cAAc;IAC7B,MAAM,CAAC,EAAE,iBAAiB,EAAE,GAAG,SAAS,CAAC;CAC1C;AAED,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,iBAAiB,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,QAAQ,GAAG,SAAS,GAAG,SAAS,CAAC;CACzC;AAoSD;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,gBAAgB,EAAE,GACzB,iBAAiB,EAAE,CAKrB;AAED,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,iBAAiB,GAAG,SAAS,CAEpE"}
|
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
// FILE MEMO: Canonical tool registry mapping Filepad Agent Access capabilities to MCP tools.
|
|
2
|
+
// Filtered by scopes. Schemas are generated from Zod contracts where possible.
|
|
3
|
+
const TOOL_REGISTRY = [
|
|
4
|
+
{
|
|
5
|
+
name: 'filepad_health',
|
|
6
|
+
description: 'Check that Filepad MCP can authenticate to the workspace and report granted scopes.',
|
|
7
|
+
inputSchema: {
|
|
8
|
+
type: 'object',
|
|
9
|
+
properties: {},
|
|
10
|
+
},
|
|
11
|
+
requiredScopes: [],
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
name: 'filepad_search',
|
|
15
|
+
description: 'Search indexed workspace context using keyword, semantic, or hybrid retrieval. ' +
|
|
16
|
+
'Returns matching files with relevance scores and excerpts.',
|
|
17
|
+
inputSchema: {
|
|
18
|
+
type: 'object',
|
|
19
|
+
properties: {
|
|
20
|
+
query: { type: 'string', description: 'Search query string' },
|
|
21
|
+
type: {
|
|
22
|
+
type: 'string',
|
|
23
|
+
enum: ['hybrid', 'semantic', 'keyword'],
|
|
24
|
+
description: 'Search mode',
|
|
25
|
+
},
|
|
26
|
+
limit: {
|
|
27
|
+
type: 'number',
|
|
28
|
+
minimum: 1,
|
|
29
|
+
maximum: 30,
|
|
30
|
+
description: 'Maximum results to return',
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
required: ['query'],
|
|
34
|
+
},
|
|
35
|
+
requiredScopes: ['env:read'],
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
name: 'filepad_read_file',
|
|
39
|
+
description: 'Read the content of a workspace file by its file node id. ' +
|
|
40
|
+
'Returns inline text content or unsupported for binary files.',
|
|
41
|
+
inputSchema: {
|
|
42
|
+
type: 'object',
|
|
43
|
+
properties: {
|
|
44
|
+
fileNodeId: {
|
|
45
|
+
type: 'string',
|
|
46
|
+
description: 'File node id (fn_...)',
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
required: ['fileNodeId'],
|
|
50
|
+
},
|
|
51
|
+
requiredScopes: ['env:read'],
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
name: 'filepad_list_tree',
|
|
55
|
+
description: 'List the workspace file tree. Returns folders and files visible to the agent.',
|
|
56
|
+
inputSchema: {
|
|
57
|
+
type: 'object',
|
|
58
|
+
properties: {},
|
|
59
|
+
},
|
|
60
|
+
requiredScopes: ['env:read'],
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
name: 'filepad_create_artifact',
|
|
64
|
+
description: 'Create a new note artifact under the artifacts/ folder. ' +
|
|
65
|
+
'The artifact becomes a permanent workspace file.',
|
|
66
|
+
inputSchema: {
|
|
67
|
+
type: 'object',
|
|
68
|
+
properties: {
|
|
69
|
+
title: {
|
|
70
|
+
type: 'string',
|
|
71
|
+
maxLength: 500,
|
|
72
|
+
description: 'Artifact title',
|
|
73
|
+
},
|
|
74
|
+
text: {
|
|
75
|
+
type: 'string',
|
|
76
|
+
description: 'Markdown content',
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
required: ['title'],
|
|
80
|
+
},
|
|
81
|
+
requiredScopes: ['artifacts:write'],
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
name: 'filepad_propose_edit',
|
|
85
|
+
description: 'Propose a reviewable edit to an existing file. ' +
|
|
86
|
+
'The edit does not apply until a human approves it. ' +
|
|
87
|
+
'Only files under artifacts/, agents/, skills/, and memory/ can be targeted.',
|
|
88
|
+
inputSchema: {
|
|
89
|
+
type: 'object',
|
|
90
|
+
properties: {
|
|
91
|
+
fileNodeId: {
|
|
92
|
+
type: 'string',
|
|
93
|
+
description: 'Target file node id (fn_...)',
|
|
94
|
+
},
|
|
95
|
+
baseVersionId: {
|
|
96
|
+
type: 'string',
|
|
97
|
+
description: 'Current version id to base the proposal on',
|
|
98
|
+
},
|
|
99
|
+
summary: {
|
|
100
|
+
type: 'string',
|
|
101
|
+
maxLength: 2000,
|
|
102
|
+
description: 'Short summary of the proposed change',
|
|
103
|
+
},
|
|
104
|
+
newText: {
|
|
105
|
+
type: 'string',
|
|
106
|
+
description: 'Complete replacement text',
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
required: ['fileNodeId', 'baseVersionId', 'summary', 'newText'],
|
|
110
|
+
},
|
|
111
|
+
requiredScopes: ['files:propose'],
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
name: 'filepad_emit_event',
|
|
115
|
+
description: 'Emit an activity event into the workspace audit trail. ' +
|
|
116
|
+
'Use this to report completion, milestones, or errors.',
|
|
117
|
+
inputSchema: {
|
|
118
|
+
type: 'object',
|
|
119
|
+
properties: {
|
|
120
|
+
eventType: {
|
|
121
|
+
type: 'string',
|
|
122
|
+
maxLength: 200,
|
|
123
|
+
description: 'Event type identifier (e.g. agent.task.completed)',
|
|
124
|
+
},
|
|
125
|
+
payload: {
|
|
126
|
+
type: 'object',
|
|
127
|
+
description: 'Arbitrary JSON payload',
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
required: ['eventType'],
|
|
131
|
+
},
|
|
132
|
+
requiredScopes: ['events.write'],
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
name: 'filepad_create_signal',
|
|
136
|
+
description: 'Emit a signal (finding) into the workspace context engine. ' +
|
|
137
|
+
'Signals represent observations, warnings, or alerts.',
|
|
138
|
+
inputSchema: {
|
|
139
|
+
type: 'object',
|
|
140
|
+
properties: {
|
|
141
|
+
findingTypeKey: {
|
|
142
|
+
type: 'string',
|
|
143
|
+
maxLength: 120,
|
|
144
|
+
description: 'Signal classification key',
|
|
145
|
+
},
|
|
146
|
+
summary: {
|
|
147
|
+
type: 'string',
|
|
148
|
+
maxLength: 2000,
|
|
149
|
+
description: 'Human-readable summary',
|
|
150
|
+
},
|
|
151
|
+
severity: {
|
|
152
|
+
type: 'string',
|
|
153
|
+
enum: ['info', 'warn', 'high_alert'],
|
|
154
|
+
description: 'Signal severity',
|
|
155
|
+
},
|
|
156
|
+
value: {
|
|
157
|
+
type: 'object',
|
|
158
|
+
description: 'Structured signal payload',
|
|
159
|
+
},
|
|
160
|
+
},
|
|
161
|
+
required: ['findingTypeKey', 'summary'],
|
|
162
|
+
},
|
|
163
|
+
requiredScopes: ['signals:write'],
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
name: 'filepad_list_signals',
|
|
167
|
+
description: 'Query workspace signals visible to this agent. ' +
|
|
168
|
+
'Signals are structured observations created by agents, Filepad, or automations.',
|
|
169
|
+
inputSchema: {
|
|
170
|
+
type: 'object',
|
|
171
|
+
properties: {
|
|
172
|
+
findingTypeKey: {
|
|
173
|
+
type: 'string',
|
|
174
|
+
description: 'Filter by signal type key',
|
|
175
|
+
},
|
|
176
|
+
severity: {
|
|
177
|
+
type: 'string',
|
|
178
|
+
enum: ['info', 'warn', 'high_alert'],
|
|
179
|
+
description: 'Minimum severity to return',
|
|
180
|
+
},
|
|
181
|
+
status: {
|
|
182
|
+
type: 'string',
|
|
183
|
+
enum: ['suggested', 'accepted', 'rejected'],
|
|
184
|
+
description: 'Filter by signal status',
|
|
185
|
+
},
|
|
186
|
+
limit: {
|
|
187
|
+
type: 'number',
|
|
188
|
+
minimum: 1,
|
|
189
|
+
maximum: 100,
|
|
190
|
+
description: 'Maximum signals to return',
|
|
191
|
+
},
|
|
192
|
+
cursor: {
|
|
193
|
+
type: 'string',
|
|
194
|
+
description: 'Pagination cursor from a previous response',
|
|
195
|
+
},
|
|
196
|
+
},
|
|
197
|
+
},
|
|
198
|
+
requiredScopes: ['env:read'],
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
name: 'filepad_get_signal',
|
|
202
|
+
description: 'Read one workspace signal by id, including target, citations, provenance, status, and value.',
|
|
203
|
+
inputSchema: {
|
|
204
|
+
type: 'object',
|
|
205
|
+
properties: {
|
|
206
|
+
signalId: {
|
|
207
|
+
type: 'string',
|
|
208
|
+
description: 'Signal id',
|
|
209
|
+
},
|
|
210
|
+
},
|
|
211
|
+
required: ['signalId'],
|
|
212
|
+
},
|
|
213
|
+
requiredScopes: ['env:read'],
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
name: 'filepad_ack_notification',
|
|
217
|
+
description: 'Acknowledge one or more Filepad mailbox notifications after the agent has processed them.',
|
|
218
|
+
inputSchema: {
|
|
219
|
+
type: 'object',
|
|
220
|
+
properties: {
|
|
221
|
+
ids: {
|
|
222
|
+
type: 'array',
|
|
223
|
+
items: { type: 'string' },
|
|
224
|
+
minItems: 1,
|
|
225
|
+
maxItems: 100,
|
|
226
|
+
description: 'Mailbox notification ids to acknowledge',
|
|
227
|
+
},
|
|
228
|
+
},
|
|
229
|
+
required: ['ids'],
|
|
230
|
+
},
|
|
231
|
+
requiredScopes: ['notifications:read'],
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
name: 'filepad_get_profile',
|
|
235
|
+
description: 'Read this integration agent home profile from agents/integrations/{keyId}. ' +
|
|
236
|
+
'Returns identity, learnings, goals, and timeline profile files when present.',
|
|
237
|
+
inputSchema: {
|
|
238
|
+
type: 'object',
|
|
239
|
+
properties: {
|
|
240
|
+
fields: {
|
|
241
|
+
type: 'array',
|
|
242
|
+
items: {
|
|
243
|
+
type: 'string',
|
|
244
|
+
enum: ['identity', 'learnings', 'goals', 'timeline'],
|
|
245
|
+
},
|
|
246
|
+
description: 'Optional profile fields to read',
|
|
247
|
+
},
|
|
248
|
+
},
|
|
249
|
+
},
|
|
250
|
+
requiredScopes: ['env:read'],
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
name: 'filepad_update_profile',
|
|
254
|
+
description: 'Propose a human-reviewable update to this integration agent profile. ' +
|
|
255
|
+
'Writes are proposed edits, never direct mutations.',
|
|
256
|
+
inputSchema: {
|
|
257
|
+
type: 'object',
|
|
258
|
+
properties: {
|
|
259
|
+
field: {
|
|
260
|
+
type: 'string',
|
|
261
|
+
enum: ['identity', 'learnings', 'goals', 'timeline'],
|
|
262
|
+
description: 'Profile field to update',
|
|
263
|
+
},
|
|
264
|
+
content: {
|
|
265
|
+
type: 'string',
|
|
266
|
+
description: 'Markdown content to append or replace',
|
|
267
|
+
},
|
|
268
|
+
mode: {
|
|
269
|
+
type: 'string',
|
|
270
|
+
enum: ['append', 'replace'],
|
|
271
|
+
description: 'Append a dated entry or replace the full file',
|
|
272
|
+
},
|
|
273
|
+
},
|
|
274
|
+
required: ['field', 'content'],
|
|
275
|
+
},
|
|
276
|
+
requiredScopes: ['env:read', 'files:propose'],
|
|
277
|
+
},
|
|
278
|
+
];
|
|
279
|
+
/**
|
|
280
|
+
* Return tools visible to an agent given its granted scopes.
|
|
281
|
+
*/
|
|
282
|
+
export function listToolsForScopes(scopes) {
|
|
283
|
+
const scopeSet = new Set(scopes);
|
|
284
|
+
return TOOL_REGISTRY.filter((tool) => tool.requiredScopes.every((s) => scopeSet.has(s)));
|
|
285
|
+
}
|
|
286
|
+
export function findTool(name) {
|
|
287
|
+
return TOOL_REGISTRY.find((t) => t.name === name);
|
|
288
|
+
}
|
|
289
|
+
//# sourceMappingURL=tool-registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-registry.js","sourceRoot":"","sources":["../src/tool-registry.ts"],"names":[],"mappings":"AAAA,6FAA6F;AAC7F,+EAA+E;AA+E/E,MAAM,aAAa,GAAwB;IACzC;QACE,IAAI,EAAE,gBAAgB;QACtB,WAAW,EACT,qFAAqF;QACvF,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE,EAAE;SACf;QACD,cAAc,EAAE,EAAE;KACnB;IACD;QACE,IAAI,EAAE,gBAAgB;QACtB,WAAW,EACT,iFAAiF;YACjF,4DAA4D;QAC9D,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,qBAAqB,EAAE;gBAC7D,IAAI,EAAE;oBACJ,IAAI,EAAE,QAAQ;oBACd,IAAI,EAAE,CAAC,QAAQ,EAAE,UAAU,EAAE,SAAS,CAAC;oBACvC,WAAW,EAAE,aAAa;iBAC3B;gBACD,KAAK,EAAE;oBACL,IAAI,EAAE,QAAQ;oBACd,OAAO,EAAE,CAAC;oBACV,OAAO,EAAE,EAAE;oBACX,WAAW,EAAE,2BAA2B;iBACzC;aACF;YACD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;SAC/B;QACD,cAAc,EAAE,CAAC,UAAU,EAAE,eAAe,CAAC;KAC9C;CACF,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAChC,MAA0B;IAE1B,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC;IACjC,OAAO,aAAa,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CACnC,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAClD,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,IAAY;IACnC,OAAO,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;AACpD,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { JSONRPCMessage } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
export interface StreamableHttpConfig {
|
|
3
|
+
baseUrl: string;
|
|
4
|
+
workspaceId: string;
|
|
5
|
+
keyId: string;
|
|
6
|
+
secret: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Send a JSON-RPC message to the Filepad MCP endpoint via Streamable HTTP.
|
|
10
|
+
*/
|
|
11
|
+
export declare function sendMcpMessage(config: StreamableHttpConfig, message: JSONRPCMessage): Promise<JSONRPCMessage[]>;
|
|
12
|
+
//# sourceMappingURL=transport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../src/transport.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAEzE,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AA2BD;;GAEG;AACH,wBAAsB,cAAc,CAClC,MAAM,EAAE,oBAAoB,EAC5B,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,cAAc,EAAE,CAAC,CA8B3B"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// FILE MEMO: Streamable HTTP transport for MCP over Filepad Agent Access.
|
|
2
|
+
// Reuses HMAC auth at the transport boundary. No business logic.
|
|
3
|
+
import { createHash, createHmac, randomUUID } from 'node:crypto';
|
|
4
|
+
function signRequest(keyId, secret, method, pathWithQuery, body) {
|
|
5
|
+
const timestamp = Math.floor(Date.now() / 1000).toString();
|
|
6
|
+
const nonce = randomUUID();
|
|
7
|
+
const bodyHash = createHash('sha256')
|
|
8
|
+
.update(Buffer.from(body, 'utf8'))
|
|
9
|
+
.digest('hex');
|
|
10
|
+
const canonical = [method.toUpperCase(), pathWithQuery, timestamp, nonce, bodyHash].join('\n');
|
|
11
|
+
const signature = createHmac('sha256', secret)
|
|
12
|
+
.update(canonical, 'utf8')
|
|
13
|
+
.digest('base64');
|
|
14
|
+
return {
|
|
15
|
+
'content-type': 'application/json',
|
|
16
|
+
'x-integration-key-id': keyId,
|
|
17
|
+
'x-integration-timestamp': timestamp,
|
|
18
|
+
'x-integration-nonce': nonce,
|
|
19
|
+
'x-integration-signature': signature,
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Send a JSON-RPC message to the Filepad MCP endpoint via Streamable HTTP.
|
|
24
|
+
*/
|
|
25
|
+
export async function sendMcpMessage(config, message) {
|
|
26
|
+
const pathWithQuery = `/mcp/v1/workspaces/${encodeURIComponent(config.workspaceId)}/stream`;
|
|
27
|
+
const url = `${config.baseUrl.replace(/\/$/, '')}${pathWithQuery}`;
|
|
28
|
+
const body = JSON.stringify(message);
|
|
29
|
+
const headers = signRequest(config.keyId, config.secret, 'POST', pathWithQuery, body);
|
|
30
|
+
const response = await fetch(url, {
|
|
31
|
+
method: 'POST',
|
|
32
|
+
headers,
|
|
33
|
+
body,
|
|
34
|
+
});
|
|
35
|
+
if (!response.ok) {
|
|
36
|
+
const text = await response.text();
|
|
37
|
+
throw new Error(`MCP HTTP ${response.status}: ${text}`);
|
|
38
|
+
}
|
|
39
|
+
const responseText = await response.text();
|
|
40
|
+
if (!responseText.trim())
|
|
41
|
+
return [];
|
|
42
|
+
// Streamable HTTP can return newline-delimited JSON for multiple messages
|
|
43
|
+
const messages = [];
|
|
44
|
+
for (const line of responseText.split('\n').filter((l) => l.trim())) {
|
|
45
|
+
try {
|
|
46
|
+
messages.push(JSON.parse(line));
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
49
|
+
// Ignore non-JSON lines
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return messages;
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=transport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transport.js","sourceRoot":"","sources":["../src/transport.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,iEAAiE;AAEjE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAWjE,SAAS,WAAW,CAClB,KAAa,EACb,MAAc,EACd,MAAc,EACd,aAAqB,EACrB,IAAY;IAEZ,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC;IAC3D,MAAM,KAAK,GAAG,UAAU,EAAE,CAAC;IAC3B,MAAM,QAAQ,GAAG,UAAU,CAAC,QAAQ,CAAC;SAClC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;SACjC,MAAM,CAAC,KAAK,CAAC,CAAC;IACjB,MAAM,SAAS,GAAG,CAAC,MAAM,CAAC,WAAW,EAAE,EAAE,aAAa,EAAE,SAAS,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AC;IAC3C,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE;QAAE,OAAO,EAAE,CAAC;IAEpC,0EAA0E;IAC1E,MAAM,QAAQ,GAAqB,EAAE,CAAC;IACtC,KAAK,MAAM,IAAI,IAAI,YAAY,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC;QACpE,IAAI,CAAC;YACH,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAmB,CAAC,CAAC;QACpD,CAAC;QAAC,MAAM,CAAC;YACP,wBAAwB;QAC1B,CAAC;IACH,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,0BAA0B,UAAU,CAAC"}
|
package/dist/version.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,0BAA0B,GAAG,OAAO,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@filepad/mcp-server",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "MCP server for Filepad Agent Access. Exposes Filepad workspaces as tools to Claude Desktop, Cursor, and other MCP clients.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"bin": {
|
|
9
|
+
"filepad-mcp-server": "./dist/cli.js"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"dist",
|
|
13
|
+
"README.md",
|
|
14
|
+
"LICENSE",
|
|
15
|
+
"SECURITY.md"
|
|
16
|
+
],
|
|
17
|
+
"exports": {
|
|
18
|
+
".": {
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"default": "./dist/index.js"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"keywords": [
|
|
24
|
+
"filepad",
|
|
25
|
+
"mcp",
|
|
26
|
+
"model-context-protocol",
|
|
27
|
+
"agent",
|
|
28
|
+
"ai",
|
|
29
|
+
"claude",
|
|
30
|
+
"cursor"
|
|
31
|
+
],
|
|
32
|
+
"author": "Filepad <support@filepad.ai>",
|
|
33
|
+
"license": "MIT",
|
|
34
|
+
"repository": {
|
|
35
|
+
"type": "git",
|
|
36
|
+
"url": "git+https://github.com/filepad/filepad.git",
|
|
37
|
+
"directory": "packages/mcp-server"
|
|
38
|
+
},
|
|
39
|
+
"bugs": {
|
|
40
|
+
"url": "https://github.com/filepad/filepad/issues"
|
|
41
|
+
},
|
|
42
|
+
"homepage": "https://github.com/filepad/filepad#readme",
|
|
43
|
+
"engines": {
|
|
44
|
+
"node": ">=18.0.0"
|
|
45
|
+
},
|
|
46
|
+
"publishConfig": {
|
|
47
|
+
"access": "public"
|
|
48
|
+
},
|
|
49
|
+
"dependencies": {
|
|
50
|
+
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
51
|
+
"@filepad/agent-access-sdk": "^0.1.0"
|
|
52
|
+
},
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"typescript": "5.9.3",
|
|
55
|
+
"vitest": "^4.1.2"
|
|
56
|
+
},
|
|
57
|
+
"scripts": {
|
|
58
|
+
"build": "tsc -p tsconfig.build.json",
|
|
59
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
60
|
+
"test": "vitest run",
|
|
61
|
+
"start": "node dist/cli.js",
|
|
62
|
+
"pack:check": "node ../../scripts/ci/check-package-pack.mjs"
|
|
63
|
+
}
|
|
64
|
+
}
|