@fadlee/pocketbase-mcp 1.0.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.
Files changed (55) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +123 -0
  3. package/build/src/config/cli.d.ts +9 -0
  4. package/build/src/config/cli.js +31 -0
  5. package/build/src/config/environment.d.ts +9 -0
  6. package/build/src/config/environment.js +13 -0
  7. package/build/src/config/index.d.ts +13 -0
  8. package/build/src/config/index.js +20 -0
  9. package/build/src/index.d.ts +2 -0
  10. package/build/src/index.js +21 -0
  11. package/build/src/server.d.ts +10 -0
  12. package/build/src/server.js +211 -0
  13. package/build/src/tools/handlers/analysis.d.ts +10 -0
  14. package/build/src/tools/handlers/analysis.js +127 -0
  15. package/build/src/tools/handlers/auth.d.ts +10 -0
  16. package/build/src/tools/handlers/auth.js +51 -0
  17. package/build/src/tools/handlers/collection.d.ts +22 -0
  18. package/build/src/tools/handlers/collection.js +82 -0
  19. package/build/src/tools/handlers/file.d.ts +5 -0
  20. package/build/src/tools/handlers/file.js +124 -0
  21. package/build/src/tools/handlers/generation.d.ts +10 -0
  22. package/build/src/tools/handlers/generation.js +201 -0
  23. package/build/src/tools/handlers/index.d.ts +10 -0
  24. package/build/src/tools/handlers/index.js +17 -0
  25. package/build/src/tools/handlers/migration.d.ts +18 -0
  26. package/build/src/tools/handlers/migration.js +219 -0
  27. package/build/src/tools/handlers/record.d.ts +18 -0
  28. package/build/src/tools/handlers/record.js +94 -0
  29. package/build/src/tools/index.d.ts +5 -0
  30. package/build/src/tools/index.js +7 -0
  31. package/build/src/tools/schemas/analysis.d.ts +56 -0
  32. package/build/src/tools/schemas/analysis.js +54 -0
  33. package/build/src/tools/schemas/auth.d.ts +59 -0
  34. package/build/src/tools/schemas/auth.js +59 -0
  35. package/build/src/tools/schemas/collection.d.ts +192 -0
  36. package/build/src/tools/schemas/collection.js +194 -0
  37. package/build/src/tools/schemas/file.d.ts +70 -0
  38. package/build/src/tools/schemas/file.js +70 -0
  39. package/build/src/tools/schemas/generation.d.ts +49 -0
  40. package/build/src/tools/schemas/generation.js +49 -0
  41. package/build/src/tools/schemas/index.d.ts +10 -0
  42. package/build/src/tools/schemas/index.js +17 -0
  43. package/build/src/tools/schemas/migration.d.ts +133 -0
  44. package/build/src/tools/schemas/migration.js +146 -0
  45. package/build/src/tools/schemas/record.d.ts +103 -0
  46. package/build/src/tools/schemas/record.js +103 -0
  47. package/build/src/types/index.d.ts +188 -0
  48. package/build/src/types/index.js +1 -0
  49. package/build/src/utils/errors.d.ts +17 -0
  50. package/build/src/utils/errors.js +35 -0
  51. package/build/src/utils/response.d.ts +23 -0
  52. package/build/src/utils/response.js +62 -0
  53. package/build/src/utils/typescript.d.ts +24 -0
  54. package/build/src/utils/typescript.js +130 -0
  55. package/package.json +57 -0
@@ -0,0 +1,192 @@
1
+ /**
2
+ * Tool input schemas for collection-related operations
3
+ */
4
+ export declare const createCollectionSchema: {
5
+ type: string;
6
+ properties: {
7
+ name: {
8
+ type: string;
9
+ description: string;
10
+ };
11
+ type: {
12
+ type: string;
13
+ description: string;
14
+ enum: string[];
15
+ default: string;
16
+ };
17
+ fields: {
18
+ type: string;
19
+ description: string;
20
+ items: {
21
+ type: string;
22
+ properties: {
23
+ name: {
24
+ type: string;
25
+ description: string;
26
+ };
27
+ type: {
28
+ type: string;
29
+ description: string;
30
+ enum: string[];
31
+ };
32
+ required: {
33
+ type: string;
34
+ description: string;
35
+ };
36
+ system: {
37
+ type: string;
38
+ description: string;
39
+ };
40
+ unique: {
41
+ type: string;
42
+ description: string;
43
+ };
44
+ min: {
45
+ type: string;
46
+ description: string;
47
+ };
48
+ max: {
49
+ type: string;
50
+ description: string;
51
+ };
52
+ pattern: {
53
+ type: string;
54
+ description: string;
55
+ };
56
+ autogeneratePattern: {
57
+ type: string;
58
+ description: string;
59
+ };
60
+ collectionId: {
61
+ type: string;
62
+ description: string;
63
+ };
64
+ cascadeDelete: {
65
+ type: string;
66
+ description: string;
67
+ };
68
+ maxSelect: {
69
+ type: string;
70
+ description: string;
71
+ };
72
+ onCreate: {
73
+ type: string;
74
+ description: string;
75
+ };
76
+ onUpdate: {
77
+ type: string;
78
+ description: string;
79
+ };
80
+ presentable: {
81
+ type: string;
82
+ description: string;
83
+ };
84
+ hidden: {
85
+ type: string;
86
+ description: string;
87
+ };
88
+ values: {
89
+ type: string;
90
+ description: string;
91
+ items: {
92
+ type: string;
93
+ };
94
+ };
95
+ id: {
96
+ type: string;
97
+ description: string;
98
+ };
99
+ };
100
+ required: string[];
101
+ };
102
+ };
103
+ listRule: {
104
+ type: string;
105
+ description: string;
106
+ };
107
+ viewRule: {
108
+ type: string;
109
+ description: string;
110
+ };
111
+ createRule: {
112
+ type: string;
113
+ description: string;
114
+ };
115
+ updateRule: {
116
+ type: string;
117
+ description: string;
118
+ };
119
+ deleteRule: {
120
+ type: string;
121
+ description: string;
122
+ };
123
+ indexes: {
124
+ type: string;
125
+ items: {
126
+ type: string;
127
+ };
128
+ description: string;
129
+ };
130
+ viewQuery: {
131
+ type: string;
132
+ description: string;
133
+ };
134
+ passwordAuth: {
135
+ type: string;
136
+ description: string;
137
+ properties: {
138
+ enabled: {
139
+ type: string;
140
+ };
141
+ identityFields: {
142
+ type: string;
143
+ items: {
144
+ type: string;
145
+ };
146
+ };
147
+ };
148
+ };
149
+ };
150
+ required: string[];
151
+ };
152
+ export declare const deleteCollectionSchema: {
153
+ type: string;
154
+ properties: {
155
+ collection: {
156
+ type: string;
157
+ description: string;
158
+ };
159
+ };
160
+ required: string[];
161
+ };
162
+ export declare const getCollectionSchemaSchema: {
163
+ type: string;
164
+ properties: {
165
+ collection: {
166
+ type: string;
167
+ description: string;
168
+ };
169
+ };
170
+ required: string[];
171
+ };
172
+ export declare const listCollectionsSchema: {
173
+ type: string;
174
+ properties: {
175
+ sort: {
176
+ type: string;
177
+ description: string;
178
+ default: string;
179
+ };
180
+ };
181
+ required: never[];
182
+ };
183
+ export declare const truncateCollectionSchema: {
184
+ type: string;
185
+ properties: {
186
+ collection: {
187
+ type: string;
188
+ description: string;
189
+ };
190
+ };
191
+ required: string[];
192
+ };
@@ -0,0 +1,194 @@
1
+ /**
2
+ * Tool input schemas for collection-related operations
3
+ */
4
+ export const createCollectionSchema = {
5
+ type: "object",
6
+ properties: {
7
+ name: {
8
+ type: "string",
9
+ description: "Collection name",
10
+ },
11
+ type: {
12
+ type: "string",
13
+ description: "Collection type (base, auth, view)",
14
+ enum: ["base", "auth", "view"],
15
+ default: "base",
16
+ },
17
+ fields: {
18
+ type: "array",
19
+ description: "Collection fields configuration",
20
+ items: {
21
+ type: "object",
22
+ properties: {
23
+ name: { type: "string", description: "Field name" },
24
+ type: {
25
+ type: "string",
26
+ description: "Field type",
27
+ enum: [
28
+ "text",
29
+ "number",
30
+ "bool",
31
+ "email",
32
+ "url",
33
+ "date",
34
+ "select",
35
+ "relation",
36
+ "file",
37
+ "json",
38
+ "editor",
39
+ "autodate",
40
+ ],
41
+ },
42
+ required: {
43
+ type: "boolean",
44
+ description: "Whether the field is required",
45
+ },
46
+ system: {
47
+ type: "boolean",
48
+ description: "Whether this is a system field",
49
+ },
50
+ unique: {
51
+ type: "boolean",
52
+ description: "Whether the field should have unique values",
53
+ },
54
+ min: {
55
+ type: "number",
56
+ description: "Minimum text length or numeric value",
57
+ },
58
+ max: {
59
+ type: "number",
60
+ description: "Maximum text length or numeric value",
61
+ },
62
+ pattern: {
63
+ type: "string",
64
+ description: "Validation regex pattern for text fields",
65
+ },
66
+ autogeneratePattern: {
67
+ type: "string",
68
+ description: "Pattern for autogenerating field values (for text fields)",
69
+ },
70
+ collectionId: {
71
+ type: "string",
72
+ description: "Target collection ID for relation fields",
73
+ },
74
+ cascadeDelete: {
75
+ type: "boolean",
76
+ description: "Whether to delete related records when the parent is deleted",
77
+ },
78
+ maxSelect: {
79
+ type: "number",
80
+ description: "Maximum number of relations or select options (1 for single relation, > 1 for multiple)",
81
+ },
82
+ onCreate: {
83
+ type: "boolean",
84
+ description: "Whether to set date on record creation (for autodate fields)",
85
+ },
86
+ onUpdate: {
87
+ type: "boolean",
88
+ description: "Whether to update date on record update (for autodate fields)",
89
+ },
90
+ presentable: {
91
+ type: "boolean",
92
+ description: "Whether the field can be used as a presentable field in the UI",
93
+ },
94
+ hidden: {
95
+ type: "boolean",
96
+ description: "Whether the field is hidden in the UI",
97
+ },
98
+ values: {
99
+ type: "array",
100
+ description: "Predefined values for select fields (direct property)",
101
+ items: { type: "string" },
102
+ },
103
+ id: {
104
+ type: "string",
105
+ description: "Unique identifier for the field",
106
+ },
107
+ },
108
+ required: ["name", "type"],
109
+ },
110
+ },
111
+ listRule: {
112
+ type: "string",
113
+ description: "Rule for listing records",
114
+ },
115
+ viewRule: {
116
+ type: "string",
117
+ description: "Rule for viewing records",
118
+ },
119
+ createRule: {
120
+ type: "string",
121
+ description: "Rule for creating records",
122
+ },
123
+ updateRule: {
124
+ type: "string",
125
+ description: "Rule for updating records",
126
+ },
127
+ deleteRule: {
128
+ type: "string",
129
+ description: "Rule for deleting records",
130
+ },
131
+ indexes: {
132
+ type: "array",
133
+ items: { type: "string" },
134
+ description: "Collection indexes",
135
+ },
136
+ viewQuery: {
137
+ type: "string",
138
+ description: "SQL query for view collections",
139
+ },
140
+ passwordAuth: {
141
+ type: "object",
142
+ description: "Password authentication settings for auth collections",
143
+ properties: {
144
+ enabled: { type: "boolean" },
145
+ identityFields: {
146
+ type: "array",
147
+ items: { type: "string" },
148
+ },
149
+ },
150
+ },
151
+ },
152
+ required: ["name", "fields"],
153
+ };
154
+ export const deleteCollectionSchema = {
155
+ type: "object",
156
+ properties: {
157
+ collection: {
158
+ type: "string",
159
+ description: "Collection name or ID to delete",
160
+ },
161
+ },
162
+ required: ["collection"],
163
+ };
164
+ export const getCollectionSchemaSchema = {
165
+ type: "object",
166
+ properties: {
167
+ collection: {
168
+ type: "string",
169
+ description: "Collection name",
170
+ },
171
+ },
172
+ required: ["collection"],
173
+ };
174
+ export const listCollectionsSchema = {
175
+ type: "object",
176
+ properties: {
177
+ sort: {
178
+ type: "string",
179
+ description: "Sort order for collections (e.g., '-created', 'name')",
180
+ default: "-created",
181
+ },
182
+ },
183
+ required: [],
184
+ };
185
+ export const truncateCollectionSchema = {
186
+ type: "object",
187
+ properties: {
188
+ collection: {
189
+ type: "string",
190
+ description: "Collection name or ID to truncate (delete all records)",
191
+ },
192
+ },
193
+ required: ["collection"],
194
+ };
@@ -0,0 +1,70 @@
1
+ export declare const uploadFileSchema: {
2
+ type: "object";
3
+ properties: {
4
+ collection: {
5
+ type: "string";
6
+ description: string;
7
+ };
8
+ recordId: {
9
+ type: "string";
10
+ description: string;
11
+ };
12
+ fileField: {
13
+ type: "string";
14
+ description: string;
15
+ };
16
+ fileContent: {
17
+ type: "string";
18
+ description: string;
19
+ };
20
+ fileName: {
21
+ type: "string";
22
+ description: string;
23
+ };
24
+ };
25
+ required: ("collection" | "recordId" | "fileField" | "fileContent" | "fileName")[];
26
+ };
27
+ export declare const downloadFileSchema: {
28
+ type: "object";
29
+ properties: {
30
+ collection: {
31
+ type: "string";
32
+ description: string;
33
+ };
34
+ recordId: {
35
+ type: "string";
36
+ description: string;
37
+ };
38
+ fileField: {
39
+ type: "string";
40
+ description: string;
41
+ };
42
+ };
43
+ required: ("collection" | "recordId" | "fileField")[];
44
+ };
45
+ export declare const uploadFileFromUrlSchema: {
46
+ readonly type: "object";
47
+ readonly properties: {
48
+ readonly collection: {
49
+ readonly type: "string";
50
+ readonly description: "The name or ID of the collection";
51
+ };
52
+ readonly recordId: {
53
+ readonly type: "string";
54
+ readonly description: "The ID of the record to attach the file to";
55
+ };
56
+ readonly fileField: {
57
+ readonly type: "string";
58
+ readonly description: "The name of the file field in the collection schema";
59
+ };
60
+ readonly url: {
61
+ readonly type: "string";
62
+ readonly description: "The URL to download the file from";
63
+ };
64
+ readonly fileName: {
65
+ readonly type: "string";
66
+ readonly description: "Optional custom name for the uploaded file. If not provided, will extract from URL";
67
+ };
68
+ };
69
+ readonly required: readonly ["collection", "recordId", "fileField", "url"];
70
+ };
@@ -0,0 +1,70 @@
1
+ export const uploadFileSchema = {
2
+ type: "object",
3
+ properties: {
4
+ collection: {
5
+ type: "string",
6
+ description: "The name or ID of the collection"
7
+ },
8
+ recordId: {
9
+ type: "string",
10
+ description: "The ID of the record to attach the file to"
11
+ },
12
+ fileField: {
13
+ type: "string",
14
+ description: "The name of the file field in the collection schema"
15
+ },
16
+ fileContent: {
17
+ type: "string",
18
+ description: "The raw content of the file as a string"
19
+ },
20
+ fileName: {
21
+ type: "string",
22
+ description: "The desired name for the uploaded file (e.g., 'report.txt')"
23
+ }
24
+ },
25
+ required: ["collection", "recordId", "fileField", "fileContent", "fileName"]
26
+ };
27
+ export const downloadFileSchema = {
28
+ type: "object",
29
+ properties: {
30
+ collection: {
31
+ type: "string",
32
+ description: "The name or ID of the collection"
33
+ },
34
+ recordId: {
35
+ type: "string",
36
+ description: "The ID of the record containing the file"
37
+ },
38
+ fileField: {
39
+ type: "string",
40
+ description: "The name of the file field"
41
+ }
42
+ },
43
+ required: ["collection", "recordId", "fileField"]
44
+ };
45
+ export const uploadFileFromUrlSchema = {
46
+ type: 'object',
47
+ properties: {
48
+ collection: {
49
+ type: 'string',
50
+ description: 'The name or ID of the collection'
51
+ },
52
+ recordId: {
53
+ type: 'string',
54
+ description: 'The ID of the record to attach the file to'
55
+ },
56
+ fileField: {
57
+ type: 'string',
58
+ description: 'The name of the file field in the collection schema'
59
+ },
60
+ url: {
61
+ type: 'string',
62
+ description: 'The URL to download the file from'
63
+ },
64
+ fileName: {
65
+ type: 'string',
66
+ description: 'Optional custom name for the uploaded file. If not provided, will extract from URL'
67
+ }
68
+ },
69
+ required: ['collection', 'recordId', 'fileField', 'url']
70
+ };
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Tool input schemas for code generation operations
3
+ */
4
+ export declare const generatePbSchemaSchema: {
5
+ type: string;
6
+ properties: {
7
+ sourceCode: {
8
+ type: string;
9
+ description: string;
10
+ };
11
+ options: {
12
+ type: string;
13
+ description: string;
14
+ properties: {
15
+ includeAuthentication: {
16
+ type: string;
17
+ description: string;
18
+ };
19
+ includeTimestamps: {
20
+ type: string;
21
+ description: string;
22
+ };
23
+ };
24
+ };
25
+ };
26
+ required: string[];
27
+ };
28
+ export declare const generateTypescriptInterfacesSchema: {
29
+ type: string;
30
+ properties: {
31
+ collections: {
32
+ type: string;
33
+ description: string;
34
+ items: {
35
+ type: string;
36
+ };
37
+ };
38
+ options: {
39
+ type: string;
40
+ description: string;
41
+ properties: {
42
+ includeRelations: {
43
+ type: string;
44
+ description: string;
45
+ };
46
+ };
47
+ };
48
+ };
49
+ };
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Tool input schemas for code generation operations
3
+ */
4
+ export const generatePbSchemaSchema = {
5
+ type: "object",
6
+ properties: {
7
+ sourceCode: {
8
+ type: "string",
9
+ description: "TypeScript interface or database diagram to convert to PocketBase schema",
10
+ },
11
+ options: {
12
+ type: "object",
13
+ description: "Generation options",
14
+ properties: {
15
+ includeAuthentication: {
16
+ type: "boolean",
17
+ description: "Whether to include authentication related collections",
18
+ },
19
+ includeTimestamps: {
20
+ type: "boolean",
21
+ description: "Whether to include created/updated timestamps",
22
+ },
23
+ },
24
+ },
25
+ },
26
+ required: ["sourceCode"],
27
+ };
28
+ export const generateTypescriptInterfacesSchema = {
29
+ type: "object",
30
+ properties: {
31
+ collections: {
32
+ type: "array",
33
+ description: "Collection names to generate interfaces for (empty for all)",
34
+ items: {
35
+ type: "string",
36
+ },
37
+ },
38
+ options: {
39
+ type: "object",
40
+ description: "Generation options",
41
+ properties: {
42
+ includeRelations: {
43
+ type: "boolean",
44
+ description: "Whether to include relation types",
45
+ },
46
+ },
47
+ },
48
+ },
49
+ };
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Tool schema registry - exports all tool input schemas
3
+ */
4
+ export { createCollectionSchema, deleteCollectionSchema, getCollectionSchemaSchema, listCollectionsSchema, truncateCollectionSchema, } from "./collection.js";
5
+ export { createRecordSchema, listRecordsSchema, updateRecordSchema, deleteRecordSchema, } from "./record.js";
6
+ export { authenticateUserSchema, createUserSchema, } from "./auth.js";
7
+ export { analyzeCollectionDataSchema, queryCollectionSchema, } from "./analysis.js";
8
+ export { migrateCollectionSchema, backupDatabaseSchema, importDataSchema, manageIndexesSchema, } from "./migration.js";
9
+ export { generatePbSchemaSchema, generateTypescriptInterfacesSchema, } from "./generation.js";
10
+ export { uploadFileSchema, downloadFileSchema, uploadFileFromUrlSchema, } from "./file.js";
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Tool schema registry - exports all tool input schemas
3
+ */
4
+ // Collection schemas
5
+ export { createCollectionSchema, deleteCollectionSchema, getCollectionSchemaSchema, listCollectionsSchema, truncateCollectionSchema, } from "./collection.js";
6
+ // Record schemas
7
+ export { createRecordSchema, listRecordsSchema, updateRecordSchema, deleteRecordSchema, } from "./record.js";
8
+ // Auth schemas
9
+ export { authenticateUserSchema, createUserSchema, } from "./auth.js";
10
+ // Analysis schemas
11
+ export { analyzeCollectionDataSchema, queryCollectionSchema, } from "./analysis.js";
12
+ // Migration schemas
13
+ export { migrateCollectionSchema, backupDatabaseSchema, importDataSchema, manageIndexesSchema, } from "./migration.js";
14
+ // Generation schemas
15
+ export { generatePbSchemaSchema, generateTypescriptInterfacesSchema, } from "./generation.js";
16
+ // File schemas
17
+ export { uploadFileSchema, downloadFileSchema, uploadFileFromUrlSchema, } from "./file.js";