mcp-quickbase 2.0.1
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/CHANGELOG.md +82 -0
- package/LICENSE +21 -0
- package/README.md +301 -0
- package/dist/client/quickbase.d.ts +28 -0
- package/dist/client/quickbase.js +235 -0
- package/dist/client/quickbase.js.map +1 -0
- package/dist/mcp/index.d.ts +4 -0
- package/dist/mcp/index.js +21 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/mcp/server.d.ts +19 -0
- package/dist/mcp/server.js +102 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/mcp-stdio-server.d.ts +2 -0
- package/dist/mcp-stdio-server.js +168 -0
- package/dist/mcp-stdio-server.js.map +1 -0
- package/dist/server.d.ts +2 -0
- package/dist/server.js +318 -0
- package/dist/server.js.map +1 -0
- package/dist/tools/apps/create_app.d.ts +87 -0
- package/dist/tools/apps/create_app.js +87 -0
- package/dist/tools/apps/create_app.js.map +1 -0
- package/dist/tools/apps/index.d.ts +9 -0
- package/dist/tools/apps/index.js +40 -0
- package/dist/tools/apps/index.js.map +1 -0
- package/dist/tools/apps/list_tables.d.ts +108 -0
- package/dist/tools/apps/list_tables.js +100 -0
- package/dist/tools/apps/list_tables.js.map +1 -0
- package/dist/tools/apps/update_app.d.ts +91 -0
- package/dist/tools/apps/update_app.js +99 -0
- package/dist/tools/apps/update_app.js.map +1 -0
- package/dist/tools/base.d.ts +47 -0
- package/dist/tools/base.js +63 -0
- package/dist/tools/base.js.map +1 -0
- package/dist/tools/configure_cache.d.ts +81 -0
- package/dist/tools/configure_cache.js +77 -0
- package/dist/tools/configure_cache.js.map +1 -0
- package/dist/tools/fields/create_field.d.ts +121 -0
- package/dist/tools/fields/create_field.js +102 -0
- package/dist/tools/fields/create_field.js.map +1 -0
- package/dist/tools/fields/index.d.ts +8 -0
- package/dist/tools/fields/index.js +37 -0
- package/dist/tools/fields/index.js.map +1 -0
- package/dist/tools/fields/update_field.d.ts +112 -0
- package/dist/tools/fields/update_field.js +114 -0
- package/dist/tools/fields/update_field.js.map +1 -0
- package/dist/tools/files/download_file.d.ts +111 -0
- package/dist/tools/files/download_file.js +173 -0
- package/dist/tools/files/download_file.js.map +1 -0
- package/dist/tools/files/index.d.ts +8 -0
- package/dist/tools/files/index.js +37 -0
- package/dist/tools/files/index.js.map +1 -0
- package/dist/tools/files/upload_file.d.ts +107 -0
- package/dist/tools/files/upload_file.js +211 -0
- package/dist/tools/files/upload_file.js.map +1 -0
- package/dist/tools/index.d.ts +18 -0
- package/dist/tools/index.js +65 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/records/bulk_create_records.d.ts +75 -0
- package/dist/tools/records/bulk_create_records.js +104 -0
- package/dist/tools/records/bulk_create_records.js.map +1 -0
- package/dist/tools/records/bulk_update_records.d.ts +77 -0
- package/dist/tools/records/bulk_update_records.js +102 -0
- package/dist/tools/records/bulk_update_records.js.map +1 -0
- package/dist/tools/records/create_record.d.ts +68 -0
- package/dist/tools/records/create_record.js +123 -0
- package/dist/tools/records/create_record.js.map +1 -0
- package/dist/tools/records/index.d.ts +11 -0
- package/dist/tools/records/index.js +46 -0
- package/dist/tools/records/index.js.map +1 -0
- package/dist/tools/records/query_records.d.ts +164 -0
- package/dist/tools/records/query_records.js +261 -0
- package/dist/tools/records/query_records.js.map +1 -0
- package/dist/tools/records/update_record.d.ts +81 -0
- package/dist/tools/records/update_record.js +99 -0
- package/dist/tools/records/update_record.js.map +1 -0
- package/dist/tools/registry.d.ts +41 -0
- package/dist/tools/registry.js +66 -0
- package/dist/tools/registry.js.map +1 -0
- package/dist/tools/reports/index.d.ts +6 -0
- package/dist/tools/reports/index.js +31 -0
- package/dist/tools/reports/index.js.map +1 -0
- package/dist/tools/reports/run_report.d.ts +70 -0
- package/dist/tools/reports/run_report.js +72 -0
- package/dist/tools/reports/run_report.js.map +1 -0
- package/dist/tools/tables/create_table.d.ts +142 -0
- package/dist/tools/tables/create_table.js +119 -0
- package/dist/tools/tables/create_table.js.map +1 -0
- package/dist/tools/tables/get_table_fields.d.ts +108 -0
- package/dist/tools/tables/get_table_fields.js +96 -0
- package/dist/tools/tables/get_table_fields.js.map +1 -0
- package/dist/tools/tables/index.d.ts +9 -0
- package/dist/tools/tables/index.js +40 -0
- package/dist/tools/tables/index.js.map +1 -0
- package/dist/tools/tables/update_table.d.ts +91 -0
- package/dist/tools/tables/update_table.js +99 -0
- package/dist/tools/tables/update_table.js.map +1 -0
- package/dist/tools/test_connection.d.ts +51 -0
- package/dist/tools/test_connection.js +101 -0
- package/dist/tools/test_connection.js.map +1 -0
- package/dist/types/api.d.ts +70 -0
- package/dist/types/api.js +6 -0
- package/dist/types/api.js.map +1 -0
- package/dist/types/config.d.ts +49 -0
- package/dist/types/config.js +3 -0
- package/dist/types/config.js.map +1 -0
- package/dist/types/mcp.d.ts +55 -0
- package/dist/types/mcp.js +3 -0
- package/dist/types/mcp.js.map +1 -0
- package/dist/utils/cache.d.ts +87 -0
- package/dist/utils/cache.js +211 -0
- package/dist/utils/cache.js.map +1 -0
- package/dist/utils/file.d.ts +40 -0
- package/dist/utils/file.js +167 -0
- package/dist/utils/file.js.map +1 -0
- package/dist/utils/logger.d.ts +37 -0
- package/dist/utils/logger.js +144 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/retry.d.ts +39 -0
- package/dist/utils/retry.js +88 -0
- package/dist/utils/retry.js.map +1 -0
- package/dist/utils/validation.d.ts +32 -0
- package/dist/utils/validation.js +227 -0
- package/dist/utils/validation.js.map +1 -0
- package/docs/README.md +41 -0
- package/docs/architecture.md +94 -0
- package/docs/claude-prompts.md +218 -0
- package/docs/deployment.md +244 -0
- package/docs/developer-guide.md +537 -0
- package/docs/final-qa-report.md +243 -0
- package/docs/performance-benchmarks.md +306 -0
- package/docs/quick-reference.md +109 -0
- package/docs/quickstart.md +183 -0
- package/docs/security-review.md +263 -0
- package/docs/tools.md +269 -0
- package/package.json +68 -0
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { BaseTool } from '../base';
|
|
2
|
+
import { QuickbaseClient } from '../../client/quickbase';
|
|
3
|
+
/**
|
|
4
|
+
* Parameters for update_table tool
|
|
5
|
+
*/
|
|
6
|
+
export interface UpdateTableParams {
|
|
7
|
+
/**
|
|
8
|
+
* The ID of the table to update
|
|
9
|
+
*/
|
|
10
|
+
table_id: string;
|
|
11
|
+
/**
|
|
12
|
+
* New name for the table
|
|
13
|
+
*/
|
|
14
|
+
name?: string;
|
|
15
|
+
/**
|
|
16
|
+
* New description for the table
|
|
17
|
+
*/
|
|
18
|
+
description?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Additional options for table update
|
|
21
|
+
*/
|
|
22
|
+
options?: Record<string, any>;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Response from updating a table
|
|
26
|
+
*/
|
|
27
|
+
export interface UpdateTableResult {
|
|
28
|
+
/**
|
|
29
|
+
* The ID of the updated table
|
|
30
|
+
*/
|
|
31
|
+
tableId: string;
|
|
32
|
+
/**
|
|
33
|
+
* The updated name of the table
|
|
34
|
+
*/
|
|
35
|
+
name?: string;
|
|
36
|
+
/**
|
|
37
|
+
* The updated description of the table
|
|
38
|
+
*/
|
|
39
|
+
description?: string;
|
|
40
|
+
/**
|
|
41
|
+
* The date the table was updated
|
|
42
|
+
*/
|
|
43
|
+
updated?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Additional details returned from the API
|
|
46
|
+
*/
|
|
47
|
+
[key: string]: any;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Tool for updating an existing table in a Quickbase application
|
|
51
|
+
*/
|
|
52
|
+
export declare class UpdateTableTool extends BaseTool<UpdateTableParams, UpdateTableResult> {
|
|
53
|
+
name: string;
|
|
54
|
+
description: string;
|
|
55
|
+
/**
|
|
56
|
+
* Parameter schema for update_table
|
|
57
|
+
*/
|
|
58
|
+
paramSchema: {
|
|
59
|
+
type: string;
|
|
60
|
+
properties: {
|
|
61
|
+
table_id: {
|
|
62
|
+
type: string;
|
|
63
|
+
description: string;
|
|
64
|
+
};
|
|
65
|
+
name: {
|
|
66
|
+
type: string;
|
|
67
|
+
description: string;
|
|
68
|
+
};
|
|
69
|
+
description: {
|
|
70
|
+
type: string;
|
|
71
|
+
description: string;
|
|
72
|
+
};
|
|
73
|
+
options: {
|
|
74
|
+
type: string;
|
|
75
|
+
description: string;
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
required: string[];
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* Constructor
|
|
82
|
+
* @param client Quickbase client
|
|
83
|
+
*/
|
|
84
|
+
constructor(client: QuickbaseClient);
|
|
85
|
+
/**
|
|
86
|
+
* Run the update_table tool
|
|
87
|
+
* @param params Tool parameters
|
|
88
|
+
* @returns Updated table details
|
|
89
|
+
*/
|
|
90
|
+
protected run(params: UpdateTableParams): Promise<UpdateTableResult>;
|
|
91
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UpdateTableTool = void 0;
|
|
4
|
+
const base_1 = require("../base");
|
|
5
|
+
const logger_1 = require("../../utils/logger");
|
|
6
|
+
const logger = (0, logger_1.createLogger)('UpdateTableTool');
|
|
7
|
+
/**
|
|
8
|
+
* Tool for updating an existing table in a Quickbase application
|
|
9
|
+
*/
|
|
10
|
+
class UpdateTableTool extends base_1.BaseTool {
|
|
11
|
+
/**
|
|
12
|
+
* Constructor
|
|
13
|
+
* @param client Quickbase client
|
|
14
|
+
*/
|
|
15
|
+
constructor(client) {
|
|
16
|
+
super(client);
|
|
17
|
+
this.name = 'update_table';
|
|
18
|
+
this.description = 'Updates an existing Quickbase table';
|
|
19
|
+
/**
|
|
20
|
+
* Parameter schema for update_table
|
|
21
|
+
*/
|
|
22
|
+
this.paramSchema = {
|
|
23
|
+
type: 'object',
|
|
24
|
+
properties: {
|
|
25
|
+
table_id: {
|
|
26
|
+
type: 'string',
|
|
27
|
+
description: 'The ID of the table'
|
|
28
|
+
},
|
|
29
|
+
name: {
|
|
30
|
+
type: 'string',
|
|
31
|
+
description: 'New name for the table'
|
|
32
|
+
},
|
|
33
|
+
description: {
|
|
34
|
+
type: 'string',
|
|
35
|
+
description: 'New description for the table'
|
|
36
|
+
},
|
|
37
|
+
options: {
|
|
38
|
+
type: 'object',
|
|
39
|
+
description: 'Additional options for table update'
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
required: ['table_id']
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Run the update_table tool
|
|
47
|
+
* @param params Tool parameters
|
|
48
|
+
* @returns Updated table details
|
|
49
|
+
*/
|
|
50
|
+
async run(params) {
|
|
51
|
+
logger.info('Updating Quickbase table', {
|
|
52
|
+
tableId: params.table_id
|
|
53
|
+
});
|
|
54
|
+
const { table_id, name, description, options } = params;
|
|
55
|
+
// At least one update field is required
|
|
56
|
+
if (!name && !description && (!options || Object.keys(options).length === 0)) {
|
|
57
|
+
throw new Error('At least one update field (name, description, or options) is required');
|
|
58
|
+
}
|
|
59
|
+
// Prepare request body with only the fields that are provided
|
|
60
|
+
const body = {};
|
|
61
|
+
if (name !== undefined) {
|
|
62
|
+
body.name = name;
|
|
63
|
+
}
|
|
64
|
+
if (description !== undefined) {
|
|
65
|
+
body.description = description;
|
|
66
|
+
}
|
|
67
|
+
// Add any additional options
|
|
68
|
+
if (options) {
|
|
69
|
+
Object.assign(body, options);
|
|
70
|
+
}
|
|
71
|
+
// Update the table
|
|
72
|
+
const response = await this.client.request({
|
|
73
|
+
method: 'POST',
|
|
74
|
+
path: `/tables/${table_id}`,
|
|
75
|
+
body
|
|
76
|
+
});
|
|
77
|
+
if (!response.success || !response.data) {
|
|
78
|
+
logger.error('Failed to update table', {
|
|
79
|
+
error: response.error,
|
|
80
|
+
tableId: table_id
|
|
81
|
+
});
|
|
82
|
+
throw new Error(response.error?.message || 'Failed to update table');
|
|
83
|
+
}
|
|
84
|
+
const table = response.data;
|
|
85
|
+
logger.info('Successfully updated table', {
|
|
86
|
+
tableId: table.id,
|
|
87
|
+
updates: Object.keys(body).join(', ')
|
|
88
|
+
});
|
|
89
|
+
return {
|
|
90
|
+
tableId: table.id,
|
|
91
|
+
name: table.name,
|
|
92
|
+
description: table.description,
|
|
93
|
+
updated: table.updated || new Date().toISOString(),
|
|
94
|
+
...table
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
exports.UpdateTableTool = UpdateTableTool;
|
|
99
|
+
//# sourceMappingURL=update_table.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update_table.js","sourceRoot":"","sources":["../../../src/tools/tables/update_table.ts"],"names":[],"mappings":";;;AAAA,kCAAmC;AAEnC,+CAAkD;AAElD,MAAM,MAAM,GAAG,IAAA,qBAAY,EAAC,iBAAiB,CAAC,CAAC;AAyD/C;;GAEG;AACH,MAAa,eAAgB,SAAQ,eAA8C;IA8BjF;;;OAGG;IACH,YAAY,MAAuB;QACjC,KAAK,CAAC,MAAM,CAAC,CAAC;QAlCT,SAAI,GAAG,cAAc,CAAC;QACtB,gBAAW,GAAG,qCAAqC,CAAC;QAE3D;;WAEG;QACI,gBAAW,GAAG;YACnB,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,QAAQ,EAAE;oBACR,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,qBAAqB;iBACnC;gBACD,IAAI,EAAE;oBACJ,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,wBAAwB;iBACtC;gBACD,WAAW,EAAE;oBACX,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,+BAA+B;iBAC7C;gBACD,OAAO,EAAE;oBACP,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,qCAAqC;iBACnD;aACF;YACD,QAAQ,EAAE,CAAC,UAAU,CAAC;SACvB,CAAC;IAQF,CAA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,CAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,IAAI,wBAAwB,CAAC,CAAC;QACvE,CAAC;QAED,MAAM,KAAK,GAAG,QAAQ,CAAC,IAA2B,CAAC;QAEnD,MAAM,CAAC,IAAI,CAAC,4BAA4B,EAAE;YACxC,OAAO,EAAE,KAAK,CAAC,EAAE;YACjB,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;SACtC,CAAC,CAAC;QAEH,OAAO;YACL,OAAO,EAAE,KAAK,CAAC,EAAE;YACjB,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,WAAW,EAAE,KAAK,CAAC,WAAW;YAC9B,OAAO,EAAE,KAAK,CAAC,OAAO,IAAI,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YAClD,GAAG,KAAK;SACT,CAAC;IACJ,CAAC;CACF;AArGD,0CAqGC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { BaseTool } from './base';
|
|
2
|
+
import { QuickbaseClient } from '../client/quickbase';
|
|
3
|
+
/**
|
|
4
|
+
* Test connection parameters
|
|
5
|
+
*/
|
|
6
|
+
export interface TestConnectionParams {
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Test connection result
|
|
10
|
+
*/
|
|
11
|
+
export interface TestConnectionResult {
|
|
12
|
+
connected: boolean;
|
|
13
|
+
userInfo?: {
|
|
14
|
+
id: string;
|
|
15
|
+
email: string;
|
|
16
|
+
name: string;
|
|
17
|
+
[key: string]: unknown;
|
|
18
|
+
};
|
|
19
|
+
realmInfo?: {
|
|
20
|
+
hostname: string;
|
|
21
|
+
id: string;
|
|
22
|
+
[key: string]: unknown;
|
|
23
|
+
};
|
|
24
|
+
errorMessage?: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Tool for testing the connection to Quickbase
|
|
28
|
+
*/
|
|
29
|
+
export declare class TestConnectionTool extends BaseTool<TestConnectionParams, TestConnectionResult> {
|
|
30
|
+
name: string;
|
|
31
|
+
description: string;
|
|
32
|
+
/**
|
|
33
|
+
* Parameter schema for test_connection
|
|
34
|
+
*/
|
|
35
|
+
paramSchema: {
|
|
36
|
+
type: string;
|
|
37
|
+
properties: {};
|
|
38
|
+
required: never[];
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Constructor
|
|
42
|
+
* @param client Quickbase client
|
|
43
|
+
*/
|
|
44
|
+
constructor(client: QuickbaseClient);
|
|
45
|
+
/**
|
|
46
|
+
* Run the test_connection tool
|
|
47
|
+
* @param params Tool parameters (none required)
|
|
48
|
+
* @returns Test result
|
|
49
|
+
*/
|
|
50
|
+
protected run(_params: TestConnectionParams): Promise<TestConnectionResult>;
|
|
51
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TestConnectionTool = void 0;
|
|
4
|
+
const base_1 = require("./base");
|
|
5
|
+
const logger_1 = require("../utils/logger");
|
|
6
|
+
const logger = (0, logger_1.createLogger)('TestConnectionTool');
|
|
7
|
+
/**
|
|
8
|
+
* Tool for testing the connection to Quickbase
|
|
9
|
+
*/
|
|
10
|
+
class TestConnectionTool extends base_1.BaseTool {
|
|
11
|
+
/**
|
|
12
|
+
* Constructor
|
|
13
|
+
* @param client Quickbase client
|
|
14
|
+
*/
|
|
15
|
+
constructor(client) {
|
|
16
|
+
super(client);
|
|
17
|
+
this.name = 'test_connection';
|
|
18
|
+
this.description = 'Tests the connection to Quickbase';
|
|
19
|
+
/**
|
|
20
|
+
* Parameter schema for test_connection
|
|
21
|
+
*/
|
|
22
|
+
this.paramSchema = {
|
|
23
|
+
type: 'object',
|
|
24
|
+
properties: {},
|
|
25
|
+
required: []
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Run the test_connection tool
|
|
30
|
+
* @param params Tool parameters (none required)
|
|
31
|
+
* @returns Test result
|
|
32
|
+
*/
|
|
33
|
+
async run(_params) {
|
|
34
|
+
logger.info('Testing connection to Quickbase');
|
|
35
|
+
try {
|
|
36
|
+
// Try to get apps list as a simple test
|
|
37
|
+
// This endpoint requires authentication and will validate our credentials
|
|
38
|
+
const config = this.client.getConfig();
|
|
39
|
+
// If we have an app ID, try to get that specific app
|
|
40
|
+
// Otherwise, just try to list apps (which should return at least one)
|
|
41
|
+
let response;
|
|
42
|
+
if (config.appId) {
|
|
43
|
+
response = await this.client.request({
|
|
44
|
+
method: 'GET',
|
|
45
|
+
path: `/apps/${config.appId}`
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
response = await this.client.request({
|
|
50
|
+
method: 'GET',
|
|
51
|
+
path: '/apps'
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
if (!response.success) {
|
|
55
|
+
logger.error('Connection test failed', { error: response.error });
|
|
56
|
+
throw new Error(response.error?.message || 'Failed to connect to Quickbase');
|
|
57
|
+
}
|
|
58
|
+
logger.info('Connection test successful');
|
|
59
|
+
// Extract some basic info from the response
|
|
60
|
+
const data = response.data;
|
|
61
|
+
return {
|
|
62
|
+
connected: true,
|
|
63
|
+
userInfo: {
|
|
64
|
+
id: 'authenticated',
|
|
65
|
+
email: 'authenticated-user',
|
|
66
|
+
name: 'Quickbase User',
|
|
67
|
+
},
|
|
68
|
+
realmInfo: {
|
|
69
|
+
hostname: config.realmHost,
|
|
70
|
+
id: config.appId || 'no-app-specified',
|
|
71
|
+
appName: data?.name || 'Unknown App'
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
logger.error('Connection test failed with error', { error });
|
|
77
|
+
// Provide more specific error messages
|
|
78
|
+
let errorMessage = 'Failed to connect to Quickbase';
|
|
79
|
+
if (error instanceof Error) {
|
|
80
|
+
if (error.message.includes('401')) {
|
|
81
|
+
errorMessage = 'Authentication failed. Please check your user token.';
|
|
82
|
+
}
|
|
83
|
+
else if (error.message.includes('404')) {
|
|
84
|
+
errorMessage = 'App not found. Please check your app ID.';
|
|
85
|
+
}
|
|
86
|
+
else if (error.message.includes('403')) {
|
|
87
|
+
errorMessage = 'Access denied. Please check your permissions.';
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
errorMessage = error.message;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return {
|
|
94
|
+
connected: false,
|
|
95
|
+
errorMessage
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
exports.TestConnectionTool = TestConnectionTool;
|
|
101
|
+
//# sourceMappingURL=test_connection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test_connection.js","sourceRoot":"","sources":["../../src/tools/test_connection.ts"],"names":[],"mappings":";;;AAAA,iCAAkC;AAElC,4CAA+C;AAE/C,MAAM,MAAM,GAAG,IAAA,qBAAY,EAAC,oBAAoB,CAAC,CAAC;AA4BlD;;GAEG;AACH,MAAa,kBAAmB,SAAQ,eAAoD;IAa1F;;;OAGG;IACH,YAAY,MAAuB;QACjC,KAAK,CAAC,MAAM,CAAC,CAAC;QAjBT,SAAI,GAAG,iBAAiB,CAAC;QACzB,gBAAW,GAAG,mCAAmC,CAAC;QAEzD;;WAEG;QACI,gBAAW,GAAG;YACnB,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE,EAAE;YACd,QAAQ,EAAE,EAAE;SACb,CAAC;IAQF,CAAC;IAED;;;;OAIG;IACO,KAAK,CAAC,GAAG,CAAC,OAA6B;QAC/C,MAAM,CAAC,IAAI,CAAC,iCAAiC,CAAC,CAAC;QAE/C,IAAI,CAAC;YACH,wCAAwC;YACxC,0EAA0E;YAC1E,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC;YAEvC,qDAAqD;YACrD,sEAAsE;YACtE,IAAI,QAAQ,CAAC;YACb,IAAI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Y,KAAK,EAAE,CAAC;gBAC3B,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;oBAClC,YAAY,GAAG,sDAAsD,CAAC;gBACxE,CAAC;qBAAM,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;oBACzC,YAAY,GAAG,0CAA0C,CAAC;gBAC5D,CAAC;qBAAM,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;oBACzC,YAAY,GAAG,+CAA+C,CAAC;gBACjE,CAAC;qBAAM,CAAC;oBACN,YAAY,GAAG,KAAK,CAAC,OAAO,CAAC;gBAC/B,CAAC;YACH,CAAC;YAED,OAAO;gBACL,SAAS,EAAE,KAAK;gBAChB,YAAY;aACb,CAAC;QACJ,CAAC;IACH,CAAC;CACF;AA/FD,gDA+FC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Common API interfaces for Quickbase client
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Base API response
|
|
6
|
+
*/
|
|
7
|
+
export interface ApiResponse<T> {
|
|
8
|
+
/**
|
|
9
|
+
* Whether the request was successful
|
|
10
|
+
*/
|
|
11
|
+
success: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Response data (present if success is true)
|
|
14
|
+
*/
|
|
15
|
+
data?: T;
|
|
16
|
+
/**
|
|
17
|
+
* Error information (present if success is false)
|
|
18
|
+
*/
|
|
19
|
+
error?: ApiError;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* API error structure
|
|
23
|
+
*/
|
|
24
|
+
export interface ApiError {
|
|
25
|
+
/**
|
|
26
|
+
* Error message
|
|
27
|
+
*/
|
|
28
|
+
message: string;
|
|
29
|
+
/**
|
|
30
|
+
* Error code
|
|
31
|
+
*/
|
|
32
|
+
code?: number;
|
|
33
|
+
/**
|
|
34
|
+
* Error type
|
|
35
|
+
*/
|
|
36
|
+
type?: string;
|
|
37
|
+
/**
|
|
38
|
+
* Additional error details
|
|
39
|
+
*/
|
|
40
|
+
details?: Record<string, unknown>;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* HTTP request options
|
|
44
|
+
*/
|
|
45
|
+
export interface RequestOptions {
|
|
46
|
+
/**
|
|
47
|
+
* HTTP method
|
|
48
|
+
*/
|
|
49
|
+
method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
|
|
50
|
+
/**
|
|
51
|
+
* Path to the API endpoint
|
|
52
|
+
*/
|
|
53
|
+
path: string;
|
|
54
|
+
/**
|
|
55
|
+
* Request body
|
|
56
|
+
*/
|
|
57
|
+
body?: Record<string, unknown>;
|
|
58
|
+
/**
|
|
59
|
+
* Query parameters
|
|
60
|
+
*/
|
|
61
|
+
params?: Record<string, string>;
|
|
62
|
+
/**
|
|
63
|
+
* Additional headers
|
|
64
|
+
*/
|
|
65
|
+
headers?: Record<string, string>;
|
|
66
|
+
/**
|
|
67
|
+
* Whether to skip caching
|
|
68
|
+
*/
|
|
69
|
+
skipCache?: boolean;
|
|
70
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../src/types/api.ts"],"names":[],"mappings":";AAAA;;GAEG"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration interface for the Quickbase connector
|
|
3
|
+
*/
|
|
4
|
+
export interface QuickbaseConfig {
|
|
5
|
+
/**
|
|
6
|
+
* Quickbase realm hostname
|
|
7
|
+
*/
|
|
8
|
+
realmHost: string;
|
|
9
|
+
/**
|
|
10
|
+
* Quickbase user token for authentication
|
|
11
|
+
*/
|
|
12
|
+
userToken: string;
|
|
13
|
+
/**
|
|
14
|
+
* Application ID
|
|
15
|
+
*/
|
|
16
|
+
appId?: string;
|
|
17
|
+
/**
|
|
18
|
+
* User agent string
|
|
19
|
+
*/
|
|
20
|
+
userAgent?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Enable caching of API responses
|
|
23
|
+
*/
|
|
24
|
+
cacheEnabled?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Cache time-to-live in seconds
|
|
27
|
+
*/
|
|
28
|
+
cacheTtl?: number;
|
|
29
|
+
/**
|
|
30
|
+
* Maximum number of retry attempts
|
|
31
|
+
*/
|
|
32
|
+
maxRetries?: number;
|
|
33
|
+
/**
|
|
34
|
+
* Retry delay in milliseconds
|
|
35
|
+
*/
|
|
36
|
+
retryDelay?: number;
|
|
37
|
+
/**
|
|
38
|
+
* Enable debug logging
|
|
39
|
+
*/
|
|
40
|
+
debug?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Request timeout in milliseconds
|
|
43
|
+
*/
|
|
44
|
+
requestTimeout?: number;
|
|
45
|
+
/**
|
|
46
|
+
* Rate limit - maximum requests per second
|
|
47
|
+
*/
|
|
48
|
+
rateLimit?: number;
|
|
49
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/types/config.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types for the MCP (Model Context Protocol) integration
|
|
3
|
+
*/
|
|
4
|
+
import { ApiResponse } from './api';
|
|
5
|
+
/**
|
|
6
|
+
* Base MCP tool interface
|
|
7
|
+
*/
|
|
8
|
+
export interface McpTool<TParams, TResult> {
|
|
9
|
+
/**
|
|
10
|
+
* Tool name
|
|
11
|
+
*/
|
|
12
|
+
name: string;
|
|
13
|
+
/**
|
|
14
|
+
* Tool description
|
|
15
|
+
*/
|
|
16
|
+
description: string;
|
|
17
|
+
/**
|
|
18
|
+
* Function to execute the tool
|
|
19
|
+
*/
|
|
20
|
+
execute: (params: TParams) => Promise<ApiResponse<TResult>>;
|
|
21
|
+
/**
|
|
22
|
+
* Parameter schema for the tool
|
|
23
|
+
*/
|
|
24
|
+
paramSchema: Record<string, unknown>;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* MCP tool registry
|
|
28
|
+
*/
|
|
29
|
+
export interface ToolRegistry {
|
|
30
|
+
/**
|
|
31
|
+
* Get a tool by name
|
|
32
|
+
*/
|
|
33
|
+
getTool(name: string): McpTool<unknown, unknown> | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* Register a tool
|
|
36
|
+
*/
|
|
37
|
+
registerTool<TParams, TResult>(tool: McpTool<TParams, TResult>): void;
|
|
38
|
+
/**
|
|
39
|
+
* Get all registered tools
|
|
40
|
+
*/
|
|
41
|
+
getAllTools(): McpTool<unknown, unknown>[];
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* MCP request format
|
|
45
|
+
*/
|
|
46
|
+
export interface McpRequest {
|
|
47
|
+
/**
|
|
48
|
+
* Name of the tool to execute
|
|
49
|
+
*/
|
|
50
|
+
tool: string;
|
|
51
|
+
/**
|
|
52
|
+
* Tool parameters
|
|
53
|
+
*/
|
|
54
|
+
params?: Record<string, unknown>;
|
|
55
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp.js","sourceRoot":"","sources":["../../src/types/mcp.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cache service for API responses
|
|
3
|
+
*/
|
|
4
|
+
export declare class CacheService {
|
|
5
|
+
private cache;
|
|
6
|
+
private enabled;
|
|
7
|
+
private static instances;
|
|
8
|
+
private static cleanupHandlerInstalled;
|
|
9
|
+
private operationLock;
|
|
10
|
+
/**
|
|
11
|
+
* Creates a new cache service
|
|
12
|
+
* @param ttl Default TTL in seconds (default: 3600)
|
|
13
|
+
* @param enabled Whether caching is enabled (default: true)
|
|
14
|
+
*/
|
|
15
|
+
constructor(ttl?: number, enabled?: boolean);
|
|
16
|
+
/**
|
|
17
|
+
* Gets a value from the cache
|
|
18
|
+
* @param key Cache key
|
|
19
|
+
* @returns The cached value or undefined if not found
|
|
20
|
+
*/
|
|
21
|
+
get<T>(key: string): T | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* Sets a value in the cache
|
|
24
|
+
* @param key Cache key
|
|
25
|
+
* @param value Value to cache
|
|
26
|
+
* @param ttl TTL in seconds (optional, uses default if not specified)
|
|
27
|
+
*/
|
|
28
|
+
set<T>(key: string, value: T, ttl?: number): void;
|
|
29
|
+
/**
|
|
30
|
+
* Removes a value from the cache
|
|
31
|
+
* @param key Cache key
|
|
32
|
+
*/
|
|
33
|
+
del(key: string): void;
|
|
34
|
+
/**
|
|
35
|
+
* Clears all cache entries
|
|
36
|
+
*/
|
|
37
|
+
clear(): void;
|
|
38
|
+
/**
|
|
39
|
+
* Enables or disables the cache
|
|
40
|
+
* @param enabled Whether the cache should be enabled
|
|
41
|
+
*/
|
|
42
|
+
setEnabled(enabled: boolean): void;
|
|
43
|
+
/**
|
|
44
|
+
* Returns whether the cache is enabled
|
|
45
|
+
*/
|
|
46
|
+
isEnabled(): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Checks if a key exists in the cache
|
|
49
|
+
* @param key Cache key
|
|
50
|
+
* @returns True if the key exists, false otherwise
|
|
51
|
+
*/
|
|
52
|
+
has(key: string): boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Removes a value from the cache (alias for del)
|
|
55
|
+
* @param key Cache key
|
|
56
|
+
*/
|
|
57
|
+
delete(key: string): void;
|
|
58
|
+
/**
|
|
59
|
+
* Gets cache statistics
|
|
60
|
+
* @returns Cache statistics
|
|
61
|
+
*/
|
|
62
|
+
getStats(): {
|
|
63
|
+
hits: number;
|
|
64
|
+
misses: number;
|
|
65
|
+
keys: number;
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* Sets a new default TTL
|
|
69
|
+
* @param ttl New TTL in seconds
|
|
70
|
+
*/
|
|
71
|
+
setTtl(ttl: number): void;
|
|
72
|
+
private safeTtlUpdate;
|
|
73
|
+
/**
|
|
74
|
+
* Cleanup this cache instance
|
|
75
|
+
*/
|
|
76
|
+
cleanup(): void;
|
|
77
|
+
/**
|
|
78
|
+
* Install process cleanup handlers (called once)
|
|
79
|
+
*/
|
|
80
|
+
private static installCleanupHandlers;
|
|
81
|
+
/**
|
|
82
|
+
* Get cleanup statistics
|
|
83
|
+
*/
|
|
84
|
+
static getStats(): {
|
|
85
|
+
instances: number;
|
|
86
|
+
};
|
|
87
|
+
}
|