mcp-quickbase 2.0.4 → 2.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/.crewchief/runs/state.json +3 -0
- package/.mcp.json +6 -32
- package/README.md +8 -2
- package/crewchief.config.js +31 -0
- package/dist/client/quickbase.d.ts +7 -2
- package/dist/client/quickbase.js +64 -51
- package/dist/client/quickbase.js.map +1 -1
- package/dist/mcp/index.d.ts +1 -1
- package/dist/mcp/server.d.ts +3 -3
- package/dist/mcp/server.js +21 -17
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp-stdio-server.js +120 -64
- package/dist/mcp-stdio-server.js.map +1 -1
- package/dist/server.js +84 -83
- package/dist/server.js.map +1 -1
- package/dist/tools/apps/create_app.d.ts +2 -2
- package/dist/tools/apps/create_app.js +23 -23
- package/dist/tools/apps/create_app.js.map +1 -1
- package/dist/tools/apps/index.d.ts +4 -4
- package/dist/tools/apps/index.js +3 -3
- package/dist/tools/apps/list_tables.d.ts +2 -2
- package/dist/tools/apps/list_tables.js +27 -26
- package/dist/tools/apps/list_tables.js.map +1 -1
- package/dist/tools/apps/update_app.d.ts +2 -2
- package/dist/tools/apps/update_app.js +28 -26
- package/dist/tools/apps/update_app.js.map +1 -1
- package/dist/tools/base.d.ts +3 -3
- package/dist/tools/base.js +7 -7
- package/dist/tools/base.js.map +1 -1
- package/dist/tools/configure_cache.d.ts +3 -3
- package/dist/tools/configure_cache.js +16 -16
- package/dist/tools/configure_cache.js.map +1 -1
- package/dist/tools/fields/create_field.d.ts +8 -7
- package/dist/tools/fields/create_field.js +39 -29
- package/dist/tools/fields/create_field.js.map +1 -1
- package/dist/tools/fields/delete_field.d.ts +79 -0
- package/dist/tools/fields/delete_field.js +105 -0
- package/dist/tools/fields/delete_field.js.map +1 -0
- package/dist/tools/fields/get_field.d.ts +91 -0
- package/dist/tools/fields/get_field.js +82 -0
- package/dist/tools/fields/get_field.js.map +1 -0
- package/dist/tools/fields/index.d.ts +5 -3
- package/dist/tools/fields/index.js +11 -5
- package/dist/tools/fields/index.js.map +1 -1
- package/dist/tools/fields/update_field.d.ts +7 -15
- package/dist/tools/fields/update_field.js +39 -38
- package/dist/tools/fields/update_field.js.map +1 -1
- package/dist/tools/files/download_file.d.ts +2 -2
- package/dist/tools/files/download_file.js +35 -35
- package/dist/tools/files/download_file.js.map +1 -1
- package/dist/tools/files/index.d.ts +3 -3
- package/dist/tools/files/index.js +3 -3
- package/dist/tools/files/upload_file.d.ts +2 -2
- package/dist/tools/files/upload_file.js +52 -44
- package/dist/tools/files/upload_file.js.map +1 -1
- package/dist/tools/index.d.ts +12 -12
- package/dist/tools/index.js +2 -2
- package/dist/tools/records/bulk_create_records.d.ts +2 -2
- package/dist/tools/records/bulk_create_records.js +28 -28
- package/dist/tools/records/bulk_create_records.js.map +1 -1
- package/dist/tools/records/bulk_update_records.d.ts +2 -2
- package/dist/tools/records/bulk_update_records.js +27 -27
- package/dist/tools/records/bulk_update_records.js.map +1 -1
- package/dist/tools/records/create_record.d.ts +2 -2
- package/dist/tools/records/create_record.js +40 -40
- package/dist/tools/records/create_record.js.map +1 -1
- package/dist/tools/records/index.d.ts +6 -6
- package/dist/tools/records/index.js +3 -3
- package/dist/tools/records/query_records.d.ts +3 -3
- package/dist/tools/records/query_records.js +82 -78
- package/dist/tools/records/query_records.js.map +1 -1
- package/dist/tools/records/update_record.d.ts +2 -2
- package/dist/tools/records/update_record.js +31 -29
- package/dist/tools/records/update_record.js.map +1 -1
- package/dist/tools/registry.d.ts +1 -1
- package/dist/tools/registry.js +1 -1
- package/dist/tools/reports/index.d.ts +2 -2
- package/dist/tools/reports/index.js +3 -3
- package/dist/tools/reports/run_report.d.ts +3 -3
- package/dist/tools/reports/run_report.js +29 -29
- package/dist/tools/reports/run_report.js.map +1 -1
- package/dist/tools/tables/create_table.d.ts +2 -49
- package/dist/tools/tables/create_table.js +26 -49
- package/dist/tools/tables/create_table.js.map +1 -1
- package/dist/tools/tables/get_table_fields.d.ts +2 -2
- package/dist/tools/tables/get_table_fields.js +25 -25
- package/dist/tools/tables/get_table_fields.js.map +1 -1
- package/dist/tools/tables/index.d.ts +4 -4
- package/dist/tools/tables/index.js +3 -3
- package/dist/tools/tables/update_table.d.ts +2 -2
- package/dist/tools/tables/update_table.js +28 -26
- package/dist/tools/tables/update_table.js.map +1 -1
- package/dist/tools/test_connection.d.ts +2 -2
- package/dist/tools/test_connection.js +28 -28
- package/dist/tools/test_connection.js.map +1 -1
- package/dist/types/api.d.ts +1 -1
- package/dist/types/mcp.d.ts +1 -1
- package/dist/utils/cache.js +16 -16
- package/dist/utils/cache.js.map +1 -1
- package/dist/utils/file.js +44 -40
- package/dist/utils/file.js.map +1 -1
- package/dist/utils/logger.js +30 -28
- package/dist/utils/logger.js.map +1 -1
- package/dist/utils/retry.js +10 -10
- package/dist/utils/retry.js.map +1 -1
- package/dist/utils/validation.d.ts +1 -1
- package/dist/utils/validation.js +39 -36
- package/dist/utils/validation.js.map +1 -1
- package/docs/README.md +6 -0
- package/docs/future-improvements.md +33 -0
- package/docs/migration-guide.md +160 -0
- package/docs/release-notes.md +89 -0
- package/package.json +5 -4
- /package/{HARDENING_SUMMARY.md → docs/hardening-summary.md} +0 -0
package/.mcp.json
CHANGED
|
@@ -1,41 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"mcpServers": {
|
|
3
|
-
"
|
|
4
|
-
"command": "
|
|
3
|
+
"quickbase": {
|
|
4
|
+
"command": "node",
|
|
5
5
|
"args": [
|
|
6
|
-
"-
|
|
7
|
-
"@modelcontextprotocol/server-github"
|
|
6
|
+
"/workspace/repos/mcp-quickbase/MCP-Quickbase/dist/mcp-stdio-server.js"
|
|
8
7
|
],
|
|
9
8
|
"env": {
|
|
10
|
-
"
|
|
9
|
+
"QUICKBASE_REALM_HOST": "team.quickbase.com",
|
|
10
|
+
"QUICKBASE_USER_TOKEN": "b4pekw_uyp_0_dzurqa6dx5jqgecnfgxavdcrfpqj",
|
|
11
|
+
"QUICKBASE_APP_ID": "buy74gngz"
|
|
11
12
|
}
|
|
12
|
-
},
|
|
13
|
-
"memory": {
|
|
14
|
-
"command": "docker",
|
|
15
|
-
"args": [
|
|
16
|
-
"run",
|
|
17
|
-
"-i",
|
|
18
|
-
"-v",
|
|
19
|
-
"claude-memory:/app/dist",
|
|
20
|
-
"--rm",
|
|
21
|
-
"mcp/memory"
|
|
22
|
-
]
|
|
23
|
-
},
|
|
24
|
-
"sequentialthinking": {
|
|
25
|
-
"command": "docker",
|
|
26
|
-
"args": [
|
|
27
|
-
"run",
|
|
28
|
-
"--rm",
|
|
29
|
-
"-i",
|
|
30
|
-
"mcp/sequentialthinking"
|
|
31
|
-
]
|
|
32
|
-
},
|
|
33
|
-
"context7": {
|
|
34
|
-
"command": "npx",
|
|
35
|
-
"args": [
|
|
36
|
-
"-y",
|
|
37
|
-
"@upstash/context7-mcp"
|
|
38
|
-
]
|
|
39
13
|
}
|
|
40
14
|
}
|
|
41
15
|
}
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Quickbase MCP Server
|
|
2
2
|
|
|
3
|
-
A TypeScript-based Model Context Protocol (MCP)
|
|
3
|
+
A TypeScript-based Model Context Protocol (MCP) server for Quickbase, designed for seamless integration with Claude Desktop and other AI assistants.
|
|
4
4
|
|
|
5
5
|
> **📋 Community Project Notice**
|
|
6
6
|
> This is a community-developed integration that is not an official Quickbase product. While it uses Quickbase's public APIs, it is not officially supported by Quickbase, Inc. This project is provided "as is" and maintained by the community. For official Quickbase products and support, please visit [quickbase.com](https://www.quickbase.com).
|
|
@@ -86,11 +86,16 @@ For source installation, use this Claude Desktop configuration:
|
|
|
86
86
|
|
|
87
87
|
## 🔧 Configuration
|
|
88
88
|
|
|
89
|
+
The server can start without environment variables configured, but tools will not be functional until proper configuration is provided. Use the `check_configuration` tool to verify your setup.
|
|
90
|
+
|
|
89
91
|
### Required Environment Variables
|
|
90
92
|
|
|
91
93
|
- **`QUICKBASE_REALM_HOST`** - Your Quickbase realm (e.g., `company.quickbase.com`)
|
|
92
94
|
- **`QUICKBASE_USER_TOKEN`** - Your Quickbase API token ([Get one here](https://help.quickbase.com/en/articles/8672050))
|
|
93
|
-
|
|
95
|
+
|
|
96
|
+
### Optional Environment Variables
|
|
97
|
+
|
|
98
|
+
- **`QUICKBASE_APP_ID`** - Default application ID
|
|
94
99
|
|
|
95
100
|
### Optional Settings
|
|
96
101
|
|
|
@@ -102,6 +107,7 @@ For source installation, use this Claude Desktop configuration:
|
|
|
102
107
|
## 🛠️ Available Tools
|
|
103
108
|
|
|
104
109
|
### Connection & Configuration
|
|
110
|
+
- **`check_configuration`** - Check if Quickbase configuration is properly set up
|
|
105
111
|
- **`test_connection`** - Test connection to Quickbase
|
|
106
112
|
- **`configure_cache`** - Configure caching behavior
|
|
107
113
|
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
repository: {
|
|
3
|
+
mainBranch: "main",
|
|
4
|
+
worktreeBasePath: '/workspace/repos/mcp-quickbase'
|
|
5
|
+
},
|
|
6
|
+
worktree: {
|
|
7
|
+
copyIgnoredFiles: [
|
|
8
|
+
".claude/settings.json",
|
|
9
|
+
".claude/settings.local.json",
|
|
10
|
+
"crewchief.config.js",
|
|
11
|
+
"crewchief.config.local.js",
|
|
12
|
+
".env"
|
|
13
|
+
],
|
|
14
|
+
copyFromPath: '.',
|
|
15
|
+
overwriteStrategy: 'skip'
|
|
16
|
+
},
|
|
17
|
+
launch: {
|
|
18
|
+
askToUpdateLlmGuides: false
|
|
19
|
+
},
|
|
20
|
+
terminal: {
|
|
21
|
+
backend: 'iterm',
|
|
22
|
+
iterm: {
|
|
23
|
+
sessionName: 'mcp-quickbase'
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
evaluation: {
|
|
27
|
+
autoMergeThreshold: 0.95,
|
|
28
|
+
requireTestsPass: true,
|
|
29
|
+
requireReview: false
|
|
30
|
+
}
|
|
31
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { QuickbaseConfig } from
|
|
2
|
-
import { ApiResponse, RequestOptions } from
|
|
1
|
+
import { QuickbaseConfig } from "../types/config";
|
|
2
|
+
import { ApiResponse, RequestOptions } from "../types/api";
|
|
3
3
|
/**
|
|
4
4
|
* Client for interacting with the Quickbase API
|
|
5
5
|
*/
|
|
@@ -19,6 +19,11 @@ export declare class QuickbaseClient {
|
|
|
19
19
|
* @returns Current configuration
|
|
20
20
|
*/
|
|
21
21
|
getConfig(): QuickbaseConfig;
|
|
22
|
+
/**
|
|
23
|
+
* Invalidate a cache entry
|
|
24
|
+
* @param key Cache key to invalidate
|
|
25
|
+
*/
|
|
26
|
+
invalidateCache(key: string): void;
|
|
22
27
|
/**
|
|
23
28
|
* Sends a request to the Quickbase API with retry logic
|
|
24
29
|
* @param options Request options
|
package/dist/client/quickbase.js
CHANGED
|
@@ -4,7 +4,7 @@ exports.QuickbaseClient = void 0;
|
|
|
4
4
|
const cache_1 = require("../utils/cache");
|
|
5
5
|
const logger_1 = require("../utils/logger");
|
|
6
6
|
const retry_1 = require("../utils/retry");
|
|
7
|
-
const logger = (0, logger_1.createLogger)(
|
|
7
|
+
const logger = (0, logger_1.createLogger)("QuickbaseClient");
|
|
8
8
|
/**
|
|
9
9
|
* Thread-safe rate limiter to prevent API overload
|
|
10
10
|
*/
|
|
@@ -23,14 +23,14 @@ class RateLimiter {
|
|
|
23
23
|
async checkRateLimit() {
|
|
24
24
|
const now = Date.now();
|
|
25
25
|
// Remove requests outside the current window
|
|
26
|
-
this.requests = this.requests.filter(time => now - time < this.windowMs);
|
|
26
|
+
this.requests = this.requests.filter((time) => now - time < this.windowMs);
|
|
27
27
|
if (this.requests.length >= this.maxRequests) {
|
|
28
28
|
// Calculate wait time until oldest request expires
|
|
29
29
|
const oldestRequest = Math.min(...this.requests);
|
|
30
30
|
const waitTime = this.windowMs - (now - oldestRequest) + 10; // +10ms buffer
|
|
31
31
|
if (waitTime > 0) {
|
|
32
32
|
logger.debug(`Rate limiting: waiting ${waitTime}ms`);
|
|
33
|
-
await new Promise(resolve => setTimeout(resolve, waitTime));
|
|
33
|
+
await new Promise((resolve) => setTimeout(resolve, waitTime));
|
|
34
34
|
// Re-check after waiting (recursive but bounded by maxRequests)
|
|
35
35
|
return this.checkRateLimit();
|
|
36
36
|
}
|
|
@@ -56,22 +56,24 @@ class QuickbaseClient {
|
|
|
56
56
|
const requestTimeout = config.requestTimeout !== undefined ? config.requestTimeout : 30000;
|
|
57
57
|
// Validate numeric values
|
|
58
58
|
if (rateLimit < 1 || rateLimit > 100) {
|
|
59
|
-
throw new Error(
|
|
59
|
+
throw new Error("Rate limit must be between 1 and 100 requests per second");
|
|
60
60
|
}
|
|
61
|
-
if (cacheTtl < 0 || cacheTtl > 86400) {
|
|
62
|
-
|
|
61
|
+
if (cacheTtl < 0 || cacheTtl > 86400) {
|
|
62
|
+
// Max 24 hours
|
|
63
|
+
throw new Error("Cache TTL must be between 0 and 86400 seconds (24 hours)");
|
|
63
64
|
}
|
|
64
65
|
if (maxRetries < 0 || maxRetries > 10) {
|
|
65
|
-
throw new Error(
|
|
66
|
+
throw new Error("Max retries must be between 0 and 10");
|
|
66
67
|
}
|
|
67
68
|
if (retryDelay < 100 || retryDelay > 60000) {
|
|
68
|
-
throw new Error(
|
|
69
|
+
throw new Error("Retry delay must be between 100ms and 60 seconds");
|
|
69
70
|
}
|
|
70
|
-
if (requestTimeout < 1000 || requestTimeout > 300000) {
|
|
71
|
-
|
|
71
|
+
if (requestTimeout < 1000 || requestTimeout > 300000) {
|
|
72
|
+
// 1s to 5 minutes
|
|
73
|
+
throw new Error("Request timeout must be between 1 second and 5 minutes");
|
|
72
74
|
}
|
|
73
75
|
this.config = {
|
|
74
|
-
userAgent:
|
|
76
|
+
userAgent: "QuickbaseMCPConnector/2.0",
|
|
75
77
|
cacheEnabled: true,
|
|
76
78
|
debug: false,
|
|
77
79
|
...config,
|
|
@@ -80,29 +82,29 @@ class QuickbaseClient {
|
|
|
80
82
|
maxRetries,
|
|
81
83
|
retryDelay,
|
|
82
84
|
requestTimeout,
|
|
83
|
-
rateLimit
|
|
85
|
+
rateLimit,
|
|
84
86
|
};
|
|
85
87
|
if (!this.config.realmHost) {
|
|
86
|
-
throw new Error(
|
|
88
|
+
throw new Error("Realm hostname is required");
|
|
87
89
|
}
|
|
88
90
|
if (!this.config.userToken) {
|
|
89
|
-
throw new Error(
|
|
91
|
+
throw new Error("User token is required");
|
|
90
92
|
}
|
|
91
93
|
this.baseUrl = `https://api.quickbase.com/v1`;
|
|
92
94
|
this.headers = {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
95
|
+
"QB-Realm-Hostname": this.config.realmHost,
|
|
96
|
+
Authorization: `QB-USER-TOKEN ${this.config.userToken}`,
|
|
97
|
+
"Content-Type": "application/json",
|
|
98
|
+
"User-Agent": this.config.userAgent || "QuickbaseMCPConnector/2.0",
|
|
97
99
|
};
|
|
98
100
|
this.cache = new cache_1.CacheService(this.config.cacheTtl, this.config.cacheEnabled);
|
|
99
101
|
// Initialize rate limiter (10 requests per second by default)
|
|
100
102
|
this.rateLimiter = new RateLimiter(this.config.rateLimit || 10, 1000);
|
|
101
|
-
logger.info(
|
|
103
|
+
logger.info("Quickbase client initialized", {
|
|
102
104
|
realmHost: this.config.realmHost,
|
|
103
105
|
appId: this.config.appId,
|
|
104
106
|
cacheEnabled: this.config.cacheEnabled,
|
|
105
|
-
rateLimit: this.config.rateLimit || 10
|
|
107
|
+
rateLimit: this.config.rateLimit || 10,
|
|
106
108
|
});
|
|
107
109
|
}
|
|
108
110
|
/**
|
|
@@ -112,6 +114,14 @@ class QuickbaseClient {
|
|
|
112
114
|
getConfig() {
|
|
113
115
|
return { ...this.config };
|
|
114
116
|
}
|
|
117
|
+
/**
|
|
118
|
+
* Invalidate a cache entry
|
|
119
|
+
* @param key Cache key to invalidate
|
|
120
|
+
*/
|
|
121
|
+
invalidateCache(key) {
|
|
122
|
+
this.cache.del(key);
|
|
123
|
+
logger.debug(`Cache invalidated for key: ${key}`);
|
|
124
|
+
}
|
|
115
125
|
/**
|
|
116
126
|
* Sends a request to the Quickbase API with retry logic
|
|
117
127
|
* @param options Request options
|
|
@@ -119,7 +129,7 @@ class QuickbaseClient {
|
|
|
119
129
|
*/
|
|
120
130
|
async request(options) {
|
|
121
131
|
const makeRequest = async () => {
|
|
122
|
-
const { method, path, body, params, headers = {}, skipCache = false } = options;
|
|
132
|
+
const { method, path, body, params, headers = {}, skipCache = false, } = options;
|
|
123
133
|
// Build full URL with query parameters
|
|
124
134
|
let url = `${this.baseUrl}${path}`;
|
|
125
135
|
if (params && Object.keys(params).length > 0) {
|
|
@@ -131,10 +141,10 @@ class QuickbaseClient {
|
|
|
131
141
|
}
|
|
132
142
|
// Check cache for GET requests
|
|
133
143
|
const cacheKey = `${method}:${url}`;
|
|
134
|
-
if (method ===
|
|
144
|
+
if (method === "GET" && !skipCache) {
|
|
135
145
|
const cachedResponse = this.cache.get(cacheKey);
|
|
136
146
|
if (cachedResponse) {
|
|
137
|
-
logger.debug(
|
|
147
|
+
logger.debug("Returning cached response", { url, method });
|
|
138
148
|
return cachedResponse;
|
|
139
149
|
}
|
|
140
150
|
}
|
|
@@ -145,18 +155,18 @@ class QuickbaseClient {
|
|
|
145
155
|
// Log request (with redacted sensitive info)
|
|
146
156
|
const redactedHeaders = { ...requestHeaders };
|
|
147
157
|
if (redactedHeaders.Authorization) {
|
|
148
|
-
redactedHeaders.Authorization =
|
|
158
|
+
redactedHeaders.Authorization = "***REDACTED***";
|
|
149
159
|
}
|
|
150
|
-
if (redactedHeaders[
|
|
160
|
+
if (redactedHeaders["QB-Realm-Hostname"]) {
|
|
151
161
|
// Keep realm hostname structure for debugging but redact sensitive parts
|
|
152
162
|
// Example: "company-name.quickbase.com" becomes "***.quickbase.com"
|
|
153
|
-
redactedHeaders[
|
|
163
|
+
redactedHeaders["QB-Realm-Hostname"] = redactedHeaders["QB-Realm-Hostname"].replace(/^[^.]+/, "***");
|
|
154
164
|
}
|
|
155
|
-
logger.debug(
|
|
156
|
-
url: url.replace(/[?&]userToken=[^&]*/g,
|
|
165
|
+
logger.debug("Sending API request", {
|
|
166
|
+
url: url.replace(/[?&]userToken=[^&]*/g, "&userToken=***REDACTED***"), // Redact tokens in URL too
|
|
157
167
|
method,
|
|
158
168
|
headers: redactedHeaders,
|
|
159
|
-
body: body ? JSON.stringify(body) : undefined
|
|
169
|
+
body: body ? JSON.stringify(body) : undefined,
|
|
160
170
|
});
|
|
161
171
|
// Send request with timeout protection
|
|
162
172
|
const controller = new AbortController();
|
|
@@ -167,7 +177,7 @@ class QuickbaseClient {
|
|
|
167
177
|
method,
|
|
168
178
|
headers: requestHeaders,
|
|
169
179
|
body: body ? JSON.stringify(body) : undefined,
|
|
170
|
-
signal: controller.signal
|
|
180
|
+
signal: controller.signal,
|
|
171
181
|
});
|
|
172
182
|
}
|
|
173
183
|
finally {
|
|
@@ -179,28 +189,31 @@ class QuickbaseClient {
|
|
|
179
189
|
responseData = await response.json();
|
|
180
190
|
}
|
|
181
191
|
catch (error) {
|
|
182
|
-
throw new Error(`Invalid JSON response: ${error instanceof Error ? error.message :
|
|
192
|
+
throw new Error(`Invalid JSON response: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
183
193
|
}
|
|
184
194
|
// Ensure responseData is an object
|
|
185
|
-
if (typeof responseData !==
|
|
186
|
-
throw new Error(
|
|
195
|
+
if (typeof responseData !== "object" || responseData === null) {
|
|
196
|
+
throw new Error("API response is not a valid object");
|
|
187
197
|
}
|
|
188
198
|
const data = responseData;
|
|
189
199
|
// Check for error response
|
|
190
200
|
if (!response.ok) {
|
|
191
|
-
const errorMessage = typeof data.message ===
|
|
201
|
+
const errorMessage = typeof data.message === "string" ? data.message : response.statusText;
|
|
192
202
|
const error = {
|
|
193
203
|
message: errorMessage,
|
|
194
204
|
code: response.status,
|
|
195
|
-
details: data
|
|
205
|
+
details: data,
|
|
196
206
|
};
|
|
197
|
-
logger.error(
|
|
207
|
+
logger.error("API request failed", {
|
|
198
208
|
status: response.status,
|
|
199
|
-
error
|
|
209
|
+
error,
|
|
200
210
|
});
|
|
201
211
|
// Create error with proper metadata for retry logic
|
|
202
212
|
const httpError = new Error(`HTTP Error ${response.status}: ${errorMessage}`);
|
|
203
|
-
Object.assign(httpError, {
|
|
213
|
+
Object.assign(httpError, {
|
|
214
|
+
status: response.status,
|
|
215
|
+
data: responseData,
|
|
216
|
+
});
|
|
204
217
|
// Always throw HTTP errors - let retry logic determine if they're retryable
|
|
205
218
|
// The retry logic will check the status code and decide whether to retry
|
|
206
219
|
throw httpError;
|
|
@@ -208,10 +221,10 @@ class QuickbaseClient {
|
|
|
208
221
|
// Successful response
|
|
209
222
|
const result = {
|
|
210
223
|
success: true,
|
|
211
|
-
data: responseData
|
|
224
|
+
data: responseData,
|
|
212
225
|
};
|
|
213
226
|
// Cache successful GET responses
|
|
214
|
-
if (method ===
|
|
227
|
+
if (method === "GET" && !skipCache) {
|
|
215
228
|
this.cache.set(cacheKey, result);
|
|
216
229
|
}
|
|
217
230
|
return result;
|
|
@@ -225,20 +238,20 @@ class QuickbaseClient {
|
|
|
225
238
|
if (!error)
|
|
226
239
|
return false;
|
|
227
240
|
// Handle HTTP errors
|
|
228
|
-
if (typeof error ===
|
|
241
|
+
if (typeof error === "object" && error !== null && "status" in error) {
|
|
229
242
|
const httpError = error;
|
|
230
|
-
return httpError.status === 429 || // Too Many Requests
|
|
243
|
+
return (httpError.status === 429 || // Too Many Requests
|
|
231
244
|
httpError.status === 408 || // Request Timeout
|
|
232
|
-
(httpError.status >= 500 && httpError.status < 600); // Server errors
|
|
245
|
+
(httpError.status >= 500 && httpError.status < 600)); // Server errors
|
|
233
246
|
}
|
|
234
247
|
// Handle network errors
|
|
235
248
|
if (error instanceof Error) {
|
|
236
|
-
return error.message.includes(
|
|
237
|
-
error.message.includes(
|
|
238
|
-
error.message.includes(
|
|
249
|
+
return (error.message.includes("network") ||
|
|
250
|
+
error.message.includes("timeout") ||
|
|
251
|
+
error.message.includes("connection"));
|
|
239
252
|
}
|
|
240
253
|
return false;
|
|
241
|
-
}
|
|
254
|
+
},
|
|
242
255
|
};
|
|
243
256
|
try {
|
|
244
257
|
// Use withRetry to add retry logic to the request
|
|
@@ -246,13 +259,13 @@ class QuickbaseClient {
|
|
|
246
259
|
}
|
|
247
260
|
catch (error) {
|
|
248
261
|
// Handle errors that weren't handled by the retry logic
|
|
249
|
-
logger.error(
|
|
262
|
+
logger.error("Request failed after retries", { error });
|
|
250
263
|
return {
|
|
251
264
|
success: false,
|
|
252
265
|
error: {
|
|
253
|
-
message: error instanceof Error ? error.message :
|
|
254
|
-
type:
|
|
255
|
-
}
|
|
266
|
+
message: error instanceof Error ? error.message : "Unknown error",
|
|
267
|
+
type: "NetworkError",
|
|
268
|
+
},
|
|
256
269
|
};
|
|
257
270
|
}
|
|
258
271
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quickbase.js","sourceRoot":"","sources":["../../src/client/quickbase.ts"],"names":[],"mappings":";;;AAEA,0CAA8C;AAC9C,4CAA+C;AAC/C,0CAAyD;AAEzD,MAAM,MAAM,GAAG,IAAA,qBAAY,EAAC,iBAAiB,CAAC,CAAC;AAE/C;;GAEG;AACH,MAAM,WAAW;IAMf,YAAY,cAAsB,EAAE,EAAE,WAAmB,IAAI;QALrD,aAAQ,GAAa,EAAE,CAAC;QAGxB,YAAO,GAAkB,OAAO,CAAC,OAAO,EAAE,CAAC;QAGjD,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;IAED,KAAK,CAAC,IAAI;QACR,6DAA6D;QAC7D,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC,CAAC;QAC9D,OA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AC,WAAW,EAAE,YAAY,CAAC,EAAE,CAAC;QACtD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,wDAAwD;YACxD,MAAM,CAAC,KAAK,CAAC,8BAA8B,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;YAExD,OAAO;gBACL,OAAO,EAAE,KAAK;gBACd,KAAK,EAAE;oBACL,OAAO,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe;oBACjE,IAAI,EAAE,cAAc;iBACrB;aACF,CAAC;QACJ,CAAC;IACH,CAAC;CACF;AAvSD,0CAuSC"}
|
package/dist/mcp/index.d.ts
CHANGED
package/dist/mcp/server.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Request, Response } from
|
|
2
|
-
import { McpServer } from
|
|
3
|
-
import { StreamableHTTPServerTransport } from
|
|
1
|
+
import { Request, Response } from "express";
|
|
2
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
|
+
import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
|
|
4
4
|
/**
|
|
5
5
|
* Create and configure an MCP server instance
|
|
6
6
|
*/
|
package/dist/mcp/server.js
CHANGED
|
@@ -13,17 +13,17 @@ const streamableHttp_js_1 = require("@modelcontextprotocol/sdk/server/streamable
|
|
|
13
13
|
const logger_1 = require("../utils/logger");
|
|
14
14
|
const tools_1 = require("../tools");
|
|
15
15
|
const validation_1 = require("../utils/validation");
|
|
16
|
-
const logger = (0, logger_1.createLogger)(
|
|
16
|
+
const logger = (0, logger_1.createLogger)("mcp-server");
|
|
17
17
|
/**
|
|
18
18
|
* Create and configure an MCP server instance
|
|
19
19
|
*/
|
|
20
20
|
function createMcpServer() {
|
|
21
21
|
// Initialize the MCP server with our app info
|
|
22
22
|
const server = new mcp_js_1.McpServer({
|
|
23
|
-
name:
|
|
24
|
-
version:
|
|
23
|
+
name: "Quickbase MCP Server",
|
|
24
|
+
version: "2.0.0",
|
|
25
25
|
});
|
|
26
|
-
logger.info(
|
|
26
|
+
logger.info("MCP Server created");
|
|
27
27
|
return server;
|
|
28
28
|
}
|
|
29
29
|
/**
|
|
@@ -37,7 +37,7 @@ function registerMcpTools(server) {
|
|
|
37
37
|
*/
|
|
38
38
|
function registerTools(server) {
|
|
39
39
|
const tools = tools_1.toolRegistry.getAllTools();
|
|
40
|
-
tools.forEach(tool => {
|
|
40
|
+
tools.forEach((tool) => {
|
|
41
41
|
// Create a Zod schema from our tool's parameter schema
|
|
42
42
|
const schema = (0, validation_1.createMcpZodSchema)(tool.paramSchema);
|
|
43
43
|
// Register the tool with the MCP server
|
|
@@ -47,16 +47,20 @@ function registerTools(server) {
|
|
|
47
47
|
const apiResponse = await tool.execute(params);
|
|
48
48
|
// Handle API response - only return the data if successful
|
|
49
49
|
if (!apiResponse.success || apiResponse.error) {
|
|
50
|
-
const errorMessage = apiResponse.error?.message ||
|
|
51
|
-
logger.error(`Tool ${tool.name} failed`, {
|
|
50
|
+
const errorMessage = apiResponse.error?.message || "Tool execution failed";
|
|
51
|
+
logger.error(`Tool ${tool.name} failed`, {
|
|
52
|
+
error: apiResponse.error,
|
|
53
|
+
});
|
|
52
54
|
throw new Error(errorMessage);
|
|
53
55
|
}
|
|
54
56
|
// Ensure proper JSON formatting by using a standardized response structure
|
|
55
57
|
return {
|
|
56
|
-
content: [
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
content: [
|
|
59
|
+
{
|
|
60
|
+
type: "text",
|
|
61
|
+
text: JSON.stringify(apiResponse.data, null, 2),
|
|
62
|
+
},
|
|
63
|
+
],
|
|
60
64
|
};
|
|
61
65
|
}
|
|
62
66
|
catch (error) {
|
|
@@ -76,7 +80,7 @@ function createHttpTransport() {
|
|
|
76
80
|
// Following the TypeScript SDK examples for HTTP transport
|
|
77
81
|
return new streamableHttp_js_1.StreamableHTTPServerTransport({
|
|
78
82
|
sessionIdGenerator: () => (0, crypto_1.randomUUID)(),
|
|
79
|
-
enableJsonResponse: true
|
|
83
|
+
enableJsonResponse: true,
|
|
80
84
|
});
|
|
81
85
|
}
|
|
82
86
|
/**
|
|
@@ -84,18 +88,18 @@ function createHttpTransport() {
|
|
|
84
88
|
*/
|
|
85
89
|
async function handleMcpRequest(server, transport, req, res) {
|
|
86
90
|
try {
|
|
87
|
-
logger.info(
|
|
91
|
+
logger.info("Handling MCP request");
|
|
88
92
|
await transport.handleRequest(req, res, req.body);
|
|
89
93
|
}
|
|
90
94
|
catch (error) {
|
|
91
|
-
logger.error(
|
|
95
|
+
logger.error("Error handling MCP request", { error });
|
|
92
96
|
res.status(500).json({
|
|
93
|
-
jsonrpc:
|
|
97
|
+
jsonrpc: "2.0",
|
|
94
98
|
error: {
|
|
95
99
|
code: -32000,
|
|
96
|
-
message: error instanceof Error ? error.message :
|
|
100
|
+
message: error instanceof Error ? error.message : "Unknown error",
|
|
97
101
|
},
|
|
98
|
-
id: req.body?.id || null
|
|
102
|
+
id: req.body?.id || null,
|
|
99
103
|
});
|
|
100
104
|
}
|
|
101
105
|
}
|
package/dist/mcp/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/mcp/server.ts"],"names":[],"mappings":";;AAgBA,0CAUC;AAKD,4CAEC;
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/mcp/server.ts"],"names":[],"mappings":";;AAgBA,0CAUC;AAKD,4CAEC;AAyDD,kDAOC;AAKD,4CAoBC;AA1HD;;GAEG;AACH,mCAAoC;AAEpC,oEAAoE;AACpE,0FAAmG;AACnG,4CAA+C;AAC/C,oCAAwC;AACxC,oDAAyD;AAEzD,MAAM,MAAM,GAAG,IAAA,qBAAY,EAAC,YAAY,CAAC,CAAC;AAE1C;;GAEG;AACH,SAAgB,eAAe;IAC7B,8CAA8C;IAC9C,MAAM,MAAM,GAAG,IAAI,k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