44reports-mcp 1.0.7 → 1.0.8
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/dist/api-client.d.ts +41 -0
- package/dist/api-client.js +34 -0
- package/dist/index.js +22 -0
- package/dist/tools/folders.d.ts +43 -0
- package/dist/tools/folders.js +70 -0
- package/package.json +1 -1
package/dist/api-client.d.ts
CHANGED
|
@@ -46,6 +46,15 @@ export interface PulledFile {
|
|
|
46
46
|
content_type: string;
|
|
47
47
|
size: number;
|
|
48
48
|
}
|
|
49
|
+
export interface Folder {
|
|
50
|
+
id: string;
|
|
51
|
+
slug: string;
|
|
52
|
+
name: string;
|
|
53
|
+
description: string | null;
|
|
54
|
+
allowed_domains: string[];
|
|
55
|
+
created_at: string;
|
|
56
|
+
updated_at: string;
|
|
57
|
+
}
|
|
49
58
|
export declare class ApiClient {
|
|
50
59
|
private readonly config;
|
|
51
60
|
constructor(config: Config);
|
|
@@ -76,4 +85,36 @@ export declare class ApiClient {
|
|
|
76
85
|
pullContextFiles(slug: string, filePaths?: string[]): Promise<{
|
|
77
86
|
files: PulledFile[];
|
|
78
87
|
}>;
|
|
88
|
+
listFolders(): Promise<{
|
|
89
|
+
folders: Folder[];
|
|
90
|
+
}>;
|
|
91
|
+
createFolder(data: {
|
|
92
|
+
name: string;
|
|
93
|
+
slug?: string;
|
|
94
|
+
description?: string;
|
|
95
|
+
allowed_domains: string[];
|
|
96
|
+
}): Promise<{
|
|
97
|
+
folder: Folder;
|
|
98
|
+
}>;
|
|
99
|
+
getFolder(slug: string): Promise<{
|
|
100
|
+
folder: Folder;
|
|
101
|
+
reports: Report[];
|
|
102
|
+
}>;
|
|
103
|
+
updateFolder(slug: string, data: {
|
|
104
|
+
name?: string;
|
|
105
|
+
description?: string;
|
|
106
|
+
allowed_domains?: string[];
|
|
107
|
+
}): Promise<{
|
|
108
|
+
folder: Folder;
|
|
109
|
+
}>;
|
|
110
|
+
deleteFolder(slug: string): Promise<{
|
|
111
|
+
success: boolean;
|
|
112
|
+
}>;
|
|
113
|
+
addReportsToFolder(slug: string, reportSlugs: string[]): Promise<{
|
|
114
|
+
added: string[];
|
|
115
|
+
not_found: string[];
|
|
116
|
+
}>;
|
|
117
|
+
removeReportFromFolder(folderSlug: string, reportSlug: string): Promise<{
|
|
118
|
+
success: boolean;
|
|
119
|
+
}>;
|
|
79
120
|
}
|
package/dist/api-client.js
CHANGED
|
@@ -56,4 +56,38 @@ export class ApiClient {
|
|
|
56
56
|
body: JSON.stringify({ files: filePaths }),
|
|
57
57
|
});
|
|
58
58
|
}
|
|
59
|
+
async listFolders() {
|
|
60
|
+
return this.request('/api/folders');
|
|
61
|
+
}
|
|
62
|
+
async createFolder(data) {
|
|
63
|
+
return this.request('/api/folders', {
|
|
64
|
+
method: 'POST',
|
|
65
|
+
body: JSON.stringify(data),
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
async getFolder(slug) {
|
|
69
|
+
return this.request(`/api/folders/${slug}`);
|
|
70
|
+
}
|
|
71
|
+
async updateFolder(slug, data) {
|
|
72
|
+
return this.request(`/api/folders/${slug}`, {
|
|
73
|
+
method: 'PUT',
|
|
74
|
+
body: JSON.stringify(data),
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
async deleteFolder(slug) {
|
|
78
|
+
return this.request(`/api/folders/${slug}`, {
|
|
79
|
+
method: 'DELETE',
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
async addReportsToFolder(slug, reportSlugs) {
|
|
83
|
+
return this.request(`/api/folders/${slug}/reports`, {
|
|
84
|
+
method: 'POST',
|
|
85
|
+
body: JSON.stringify({ report_slugs: reportSlugs }),
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
async removeReportFromFolder(folderSlug, reportSlug) {
|
|
89
|
+
return this.request(`/api/folders/${folderSlug}/reports/${reportSlug}`, {
|
|
90
|
+
method: 'DELETE',
|
|
91
|
+
});
|
|
92
|
+
}
|
|
59
93
|
}
|
package/dist/index.js
CHANGED
|
@@ -7,6 +7,7 @@ import { ApiClient } from './api-client.js';
|
|
|
7
7
|
import { deployReportSchema, updateReportSchema, createDeployTool, createUpdateTool, } from './tools/deploy.js';
|
|
8
8
|
import { listReportsSchema, getReportSchema, deleteReportSchema, createListTool, createGetTool, createDeleteTool, } from './tools/reports.js';
|
|
9
9
|
import { pullContextSchema, createPullTool, } from './tools/pull.js';
|
|
10
|
+
import { manageFoldersSchema, createManageFoldersTool, } from './tools/folders.js';
|
|
10
11
|
const config = loadConfig();
|
|
11
12
|
const client = new ApiClient(config);
|
|
12
13
|
function prop(type, description, extra = {}) {
|
|
@@ -113,6 +114,27 @@ const toolDefinitions = [
|
|
|
113
114
|
schema: pullContextSchema,
|
|
114
115
|
handler: createPullTool(client),
|
|
115
116
|
},
|
|
117
|
+
{
|
|
118
|
+
name: 'manage_folders',
|
|
119
|
+
description: 'Manage folders for domain-scoped access control. Folders let you share specific contexts with external users by email domain (e.g., share investor reports with vgames.vc).',
|
|
120
|
+
inputSchema: {
|
|
121
|
+
type: 'object',
|
|
122
|
+
properties: {
|
|
123
|
+
action: prop('string', 'Action: list, create, get, update, delete, add_reports, remove_report', {
|
|
124
|
+
enum: ['list', 'create', 'get', 'update', 'delete', 'add_reports', 'remove_report'],
|
|
125
|
+
}),
|
|
126
|
+
slug: prop('string', 'Folder slug (required for get/update/delete/add_reports/remove_report)'),
|
|
127
|
+
name: prop('string', 'Folder name (required for create)'),
|
|
128
|
+
description: prop('string', 'Folder description'),
|
|
129
|
+
allowed_domains: prop('array', 'Email domains that can access this folder (required for create)', { items: { type: 'string' } }),
|
|
130
|
+
report_slugs: prop('array', 'Report slugs to add to folder (for add_reports)', { items: { type: 'string' } }),
|
|
131
|
+
report_slug: prop('string', 'Report slug to remove (for remove_report)'),
|
|
132
|
+
},
|
|
133
|
+
required: ['action'],
|
|
134
|
+
},
|
|
135
|
+
schema: manageFoldersSchema,
|
|
136
|
+
handler: createManageFoldersTool(client),
|
|
137
|
+
},
|
|
116
138
|
];
|
|
117
139
|
const toolHandlers = Object.fromEntries(toolDefinitions.map((t) => [t.name, { schema: t.schema, handler: t.handler }]));
|
|
118
140
|
const server = new Server({ name: '44reports', version: '1.0.0' }, { capabilities: { tools: {} } });
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { ApiClient } from '../api-client.js';
|
|
3
|
+
export declare const manageFoldersSchema: z.ZodObject<{
|
|
4
|
+
action: z.ZodEnum<["list", "create", "get", "update", "delete", "add_reports", "remove_report"]>;
|
|
5
|
+
slug: z.ZodOptional<z.ZodString>;
|
|
6
|
+
name: z.ZodOptional<z.ZodString>;
|
|
7
|
+
description: z.ZodOptional<z.ZodString>;
|
|
8
|
+
allowed_domains: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
9
|
+
report_slugs: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
10
|
+
report_slug: z.ZodOptional<z.ZodString>;
|
|
11
|
+
}, "strip", z.ZodTypeAny, {
|
|
12
|
+
action: "list" | "create" | "get" | "update" | "delete" | "add_reports" | "remove_report";
|
|
13
|
+
name?: string | undefined;
|
|
14
|
+
slug?: string | undefined;
|
|
15
|
+
description?: string | undefined;
|
|
16
|
+
allowed_domains?: string[] | undefined;
|
|
17
|
+
report_slugs?: string[] | undefined;
|
|
18
|
+
report_slug?: string | undefined;
|
|
19
|
+
}, {
|
|
20
|
+
action: "list" | "create" | "get" | "update" | "delete" | "add_reports" | "remove_report";
|
|
21
|
+
name?: string | undefined;
|
|
22
|
+
slug?: string | undefined;
|
|
23
|
+
description?: string | undefined;
|
|
24
|
+
allowed_domains?: string[] | undefined;
|
|
25
|
+
report_slugs?: string[] | undefined;
|
|
26
|
+
report_slug?: string | undefined;
|
|
27
|
+
}>;
|
|
28
|
+
export declare function createManageFoldersTool(client: ApiClient): (input: z.infer<typeof manageFoldersSchema>) => Promise<{
|
|
29
|
+
folder: import("../api-client.js").Folder;
|
|
30
|
+
} | {
|
|
31
|
+
added: string[];
|
|
32
|
+
not_found: string[];
|
|
33
|
+
} | {
|
|
34
|
+
count: number;
|
|
35
|
+
folders: import("../api-client.js").Folder[];
|
|
36
|
+
success?: undefined;
|
|
37
|
+
message?: undefined;
|
|
38
|
+
} | {
|
|
39
|
+
success: boolean;
|
|
40
|
+
message: string;
|
|
41
|
+
count?: undefined;
|
|
42
|
+
folders?: undefined;
|
|
43
|
+
}>;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const manageFoldersSchema = z.object({
|
|
3
|
+
action: z.enum(['list', 'create', 'get', 'update', 'delete', 'add_reports', 'remove_report'])
|
|
4
|
+
.describe('Action to perform'),
|
|
5
|
+
slug: z.string().optional().describe('Folder slug (required for get, update, delete, add_reports, remove_report)'),
|
|
6
|
+
name: z.string().optional().describe('Folder name (required for create)'),
|
|
7
|
+
description: z.string().optional().describe('Folder description'),
|
|
8
|
+
allowed_domains: z.array(z.string()).optional().describe('Email domains that can access this folder (required for create)'),
|
|
9
|
+
report_slugs: z.array(z.string()).optional().describe('Report slugs to add (for add_reports action)'),
|
|
10
|
+
report_slug: z.string().optional().describe('Report slug to remove (for remove_report action)'),
|
|
11
|
+
});
|
|
12
|
+
export function createManageFoldersTool(client) {
|
|
13
|
+
return async (input) => {
|
|
14
|
+
switch (input.action) {
|
|
15
|
+
case 'list': {
|
|
16
|
+
const { folders } = await client.listFolders();
|
|
17
|
+
return { count: folders.length, folders };
|
|
18
|
+
}
|
|
19
|
+
case 'create': {
|
|
20
|
+
if (!input.name)
|
|
21
|
+
throw new Error('name is required for create');
|
|
22
|
+
if (!input.allowed_domains || input.allowed_domains.length === 0) {
|
|
23
|
+
throw new Error('allowed_domains is required for create');
|
|
24
|
+
}
|
|
25
|
+
return client.createFolder({
|
|
26
|
+
name: input.name,
|
|
27
|
+
slug: input.slug,
|
|
28
|
+
description: input.description,
|
|
29
|
+
allowed_domains: input.allowed_domains,
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
case 'get': {
|
|
33
|
+
if (!input.slug)
|
|
34
|
+
throw new Error('slug is required for get');
|
|
35
|
+
return client.getFolder(input.slug);
|
|
36
|
+
}
|
|
37
|
+
case 'update': {
|
|
38
|
+
if (!input.slug)
|
|
39
|
+
throw new Error('slug is required for update');
|
|
40
|
+
return client.updateFolder(input.slug, {
|
|
41
|
+
name: input.name,
|
|
42
|
+
description: input.description,
|
|
43
|
+
allowed_domains: input.allowed_domains,
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
case 'delete': {
|
|
47
|
+
if (!input.slug)
|
|
48
|
+
throw new Error('slug is required for delete');
|
|
49
|
+
await client.deleteFolder(input.slug);
|
|
50
|
+
return { success: true, message: `Folder "${input.slug}" deleted successfully` };
|
|
51
|
+
}
|
|
52
|
+
case 'add_reports': {
|
|
53
|
+
if (!input.slug)
|
|
54
|
+
throw new Error('slug is required for add_reports');
|
|
55
|
+
if (!input.report_slugs || input.report_slugs.length === 0) {
|
|
56
|
+
throw new Error('report_slugs is required for add_reports');
|
|
57
|
+
}
|
|
58
|
+
return client.addReportsToFolder(input.slug, input.report_slugs);
|
|
59
|
+
}
|
|
60
|
+
case 'remove_report': {
|
|
61
|
+
if (!input.slug)
|
|
62
|
+
throw new Error('slug is required for remove_report');
|
|
63
|
+
if (!input.report_slug)
|
|
64
|
+
throw new Error('report_slug is required for remove_report');
|
|
65
|
+
await client.removeReportFromFolder(input.slug, input.report_slug);
|
|
66
|
+
return { success: true, message: `Report "${input.report_slug}" removed from folder "${input.slug}"` };
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
}
|