@rashidazarang/airtable-mcp 3.0.0 → 3.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/README.md +160 -30
- package/dist/airtable-mcp-server.js +660 -0
- package/dist/airtable-mcp-server.js.map +1 -0
- package/dist/test-suite.js +421 -0
- package/dist/test-suite.js.map +1 -0
- package/examples/typescript/advanced-ai-prompts.ts +447 -0
- package/examples/typescript/basic-usage.ts +174 -0
- package/examples/typescript/claude-desktop-config.json +29 -0
- package/package.json +32 -5
- package/tsconfig.json +38 -0
- package/types/ai-prompts.d.ts +321 -0
- package/types/airtable-mcp-server.d.ts +52 -0
- package/types/index.d.ts +357 -0
- package/types/test-suite.d.ts +33 -0
- package/types/tools.d.ts +514 -0
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,357 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Airtable MCP Server TypeScript Definitions
|
|
3
|
+
* Enterprise-grade type safety for AI-powered Airtable operations
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
// ============================================================================
|
|
7
|
+
// MCP Protocol Types (2024-11-05 Specification)
|
|
8
|
+
// ============================================================================
|
|
9
|
+
|
|
10
|
+
export interface MCPRequest {
|
|
11
|
+
jsonrpc: '2.0';
|
|
12
|
+
id: string | number;
|
|
13
|
+
method: string;
|
|
14
|
+
params?: Record<string, unknown>;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface MCPResponse {
|
|
18
|
+
jsonrpc: '2.0';
|
|
19
|
+
id: string | number;
|
|
20
|
+
result?: unknown;
|
|
21
|
+
error?: MCPError;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface MCPError {
|
|
25
|
+
code: number;
|
|
26
|
+
message: string;
|
|
27
|
+
data?: unknown;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface MCPServerCapabilities {
|
|
31
|
+
tools?: {
|
|
32
|
+
listChanged?: boolean;
|
|
33
|
+
};
|
|
34
|
+
prompts?: {
|
|
35
|
+
listChanged?: boolean;
|
|
36
|
+
};
|
|
37
|
+
resources?: {
|
|
38
|
+
subscribe?: boolean;
|
|
39
|
+
listChanged?: boolean;
|
|
40
|
+
};
|
|
41
|
+
roots?: {
|
|
42
|
+
listChanged?: boolean;
|
|
43
|
+
};
|
|
44
|
+
sampling?: Record<string, unknown>;
|
|
45
|
+
logging?: Record<string, unknown>;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface MCPServerInfo {
|
|
49
|
+
name: string;
|
|
50
|
+
version: string;
|
|
51
|
+
protocolVersion: string;
|
|
52
|
+
capabilities: MCPServerCapabilities;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// ============================================================================
|
|
56
|
+
// Tool Schema Types
|
|
57
|
+
// ============================================================================
|
|
58
|
+
|
|
59
|
+
export interface ToolParameter {
|
|
60
|
+
type: 'string' | 'number' | 'boolean' | 'object' | 'array';
|
|
61
|
+
description: string;
|
|
62
|
+
required?: boolean;
|
|
63
|
+
default?: unknown;
|
|
64
|
+
enum?: string[];
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export interface ToolSchema {
|
|
68
|
+
name: string;
|
|
69
|
+
description: string;
|
|
70
|
+
inputSchema: {
|
|
71
|
+
type: 'object';
|
|
72
|
+
properties: Record<string, ToolParameter>;
|
|
73
|
+
required?: string[];
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// ============================================================================
|
|
78
|
+
// AI Prompt Types
|
|
79
|
+
// ============================================================================
|
|
80
|
+
|
|
81
|
+
export interface PromptArgument {
|
|
82
|
+
name: string;
|
|
83
|
+
description: string;
|
|
84
|
+
required: boolean;
|
|
85
|
+
type?: 'string' | 'number' | 'boolean';
|
|
86
|
+
enum?: string[];
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export interface PromptSchema {
|
|
90
|
+
name: string;
|
|
91
|
+
description: string;
|
|
92
|
+
arguments: PromptArgument[];
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export type AnalysisType =
|
|
96
|
+
| 'trends'
|
|
97
|
+
| 'statistical'
|
|
98
|
+
| 'patterns'
|
|
99
|
+
| 'predictive'
|
|
100
|
+
| 'anomaly_detection'
|
|
101
|
+
| 'correlation_matrix';
|
|
102
|
+
|
|
103
|
+
export type ConfidenceLevel = 0.90 | 0.95 | 0.99;
|
|
104
|
+
|
|
105
|
+
export interface AnalysisOptions {
|
|
106
|
+
table: string;
|
|
107
|
+
analysis_type?: AnalysisType;
|
|
108
|
+
field_focus?: string;
|
|
109
|
+
time_dimension?: string;
|
|
110
|
+
confidence_level?: ConfidenceLevel;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export interface PredictiveAnalyticsOptions {
|
|
114
|
+
table: string;
|
|
115
|
+
target_field: string;
|
|
116
|
+
prediction_periods?: number;
|
|
117
|
+
algorithm?: 'linear_regression' | 'arima' | 'exponential_smoothing' | 'random_forest';
|
|
118
|
+
include_confidence_intervals?: boolean;
|
|
119
|
+
historical_periods?: number;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export interface StatisticalResult {
|
|
123
|
+
confidence_interval: [number, number];
|
|
124
|
+
significance_level: number;
|
|
125
|
+
p_value?: number;
|
|
126
|
+
correlation_coefficient?: number;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// ============================================================================
|
|
130
|
+
// Airtable API Types
|
|
131
|
+
// ============================================================================
|
|
132
|
+
|
|
133
|
+
export interface AirtableFieldType {
|
|
134
|
+
type: 'singleLineText' | 'multilineText' | 'richText' | 'email' | 'url' | 'phoneNumber' |
|
|
135
|
+
'number' | 'percent' | 'currency' | 'singleSelect' | 'multipleSelects' |
|
|
136
|
+
'date' | 'dateTime' | 'checkbox' | 'rating' | 'formula' | 'rollup' |
|
|
137
|
+
'count' | 'lookup' | 'createdTime' | 'lastModifiedTime' | 'createdBy' |
|
|
138
|
+
'lastModifiedBy' | 'attachment' | 'barcode' | 'button';
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export interface AirtableField {
|
|
142
|
+
id: string;
|
|
143
|
+
name: string;
|
|
144
|
+
type: AirtableFieldType['type'];
|
|
145
|
+
options?: Record<string, unknown>;
|
|
146
|
+
description?: string;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export interface AirtableTable {
|
|
150
|
+
id: string;
|
|
151
|
+
name: string;
|
|
152
|
+
description?: string;
|
|
153
|
+
primaryFieldId: string;
|
|
154
|
+
fields: AirtableField[];
|
|
155
|
+
views: AirtableView[];
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export interface AirtableView {
|
|
159
|
+
id: string;
|
|
160
|
+
name: string;
|
|
161
|
+
type: 'grid' | 'form' | 'calendar' | 'gallery' | 'kanban';
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export interface AirtableRecord {
|
|
165
|
+
id: string;
|
|
166
|
+
fields: Record<string, unknown>;
|
|
167
|
+
createdTime: string;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
export interface AirtableBase {
|
|
171
|
+
id: string;
|
|
172
|
+
name: string;
|
|
173
|
+
permissionLevel: 'read' | 'comment' | 'edit' | 'create';
|
|
174
|
+
tables: AirtableTable[];
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
export interface AirtableWebhook {
|
|
178
|
+
id: string;
|
|
179
|
+
macSecretBase64: string;
|
|
180
|
+
expirationTime: string;
|
|
181
|
+
notificationUrl: string;
|
|
182
|
+
isHookEnabled: boolean;
|
|
183
|
+
cursorForNextPayload: number;
|
|
184
|
+
lastSuccessfulNotificationTime?: string;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
export interface WebhookPayload {
|
|
188
|
+
timestamp: string;
|
|
189
|
+
base: {
|
|
190
|
+
id: string;
|
|
191
|
+
};
|
|
192
|
+
webhook: {
|
|
193
|
+
id: string;
|
|
194
|
+
};
|
|
195
|
+
changedTablesById: Record<string, {
|
|
196
|
+
changedRecordsById: Record<string, {
|
|
197
|
+
current?: AirtableRecord;
|
|
198
|
+
previous?: AirtableRecord;
|
|
199
|
+
}>;
|
|
200
|
+
}>;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
// ============================================================================
|
|
204
|
+
// Server Configuration Types
|
|
205
|
+
// ============================================================================
|
|
206
|
+
|
|
207
|
+
export interface ServerConfig {
|
|
208
|
+
PORT: number;
|
|
209
|
+
HOST: string;
|
|
210
|
+
MAX_REQUESTS_PER_MINUTE: number;
|
|
211
|
+
LOG_LEVEL: 'ERROR' | 'WARN' | 'INFO' | 'DEBUG' | 'TRACE';
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
export interface AuthConfig {
|
|
215
|
+
AIRTABLE_TOKEN: string;
|
|
216
|
+
AIRTABLE_BASE_ID: string;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
export interface OAuth2Config {
|
|
220
|
+
client_id: string;
|
|
221
|
+
redirect_uri: string;
|
|
222
|
+
state: string;
|
|
223
|
+
code_challenge?: string;
|
|
224
|
+
code_challenge_method?: 'S256';
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
// ============================================================================
|
|
228
|
+
// Batch Operation Types
|
|
229
|
+
// ============================================================================
|
|
230
|
+
|
|
231
|
+
export interface BatchCreateRecord {
|
|
232
|
+
fields: Record<string, unknown>;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
export interface BatchUpdateRecord {
|
|
236
|
+
id: string;
|
|
237
|
+
fields: Record<string, unknown>;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
export interface BatchDeleteRecord {
|
|
241
|
+
id: string;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
export interface BatchUpsertRecord {
|
|
245
|
+
key_field: string;
|
|
246
|
+
key_value: string;
|
|
247
|
+
fields: Record<string, unknown>;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
// ============================================================================
|
|
251
|
+
// Advanced Analytics Types
|
|
252
|
+
// ============================================================================
|
|
253
|
+
|
|
254
|
+
export interface DataQualityReport {
|
|
255
|
+
total_records: number;
|
|
256
|
+
missing_values: Record<string, number>;
|
|
257
|
+
duplicate_records: string[];
|
|
258
|
+
data_types: Record<string, string>;
|
|
259
|
+
quality_score: number;
|
|
260
|
+
recommendations: string[];
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
export interface WorkflowOptimization {
|
|
264
|
+
current_efficiency: number;
|
|
265
|
+
bottlenecks: string[];
|
|
266
|
+
automation_opportunities: Array<{
|
|
267
|
+
field: string;
|
|
268
|
+
suggestion: string;
|
|
269
|
+
impact_level: 'high' | 'medium' | 'low';
|
|
270
|
+
implementation_complexity: 'simple' | 'moderate' | 'complex';
|
|
271
|
+
}>;
|
|
272
|
+
estimated_time_savings: string;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
export interface SchemaOptimization {
|
|
276
|
+
field_recommendations: Array<{
|
|
277
|
+
field: string;
|
|
278
|
+
current_type: string;
|
|
279
|
+
suggested_type: string;
|
|
280
|
+
reason: string;
|
|
281
|
+
}>;
|
|
282
|
+
index_suggestions: string[];
|
|
283
|
+
normalization_opportunities: string[];
|
|
284
|
+
compliance_notes: string[];
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
// ============================================================================
|
|
288
|
+
// Root Directory Types
|
|
289
|
+
// ============================================================================
|
|
290
|
+
|
|
291
|
+
export interface RootDirectory {
|
|
292
|
+
uri: string;
|
|
293
|
+
name: string;
|
|
294
|
+
description?: string;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
// ============================================================================
|
|
298
|
+
// Error Types
|
|
299
|
+
// ============================================================================
|
|
300
|
+
|
|
301
|
+
export class AirtableError extends Error {
|
|
302
|
+
public code: string;
|
|
303
|
+
public statusCode?: number;
|
|
304
|
+
|
|
305
|
+
constructor(message: string, code: string, statusCode?: number) {
|
|
306
|
+
super(message);
|
|
307
|
+
this.name = 'AirtableError';
|
|
308
|
+
this.code = code;
|
|
309
|
+
this.statusCode = statusCode;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
export class ValidationError extends Error {
|
|
314
|
+
public field: string;
|
|
315
|
+
|
|
316
|
+
constructor(message: string, field: string) {
|
|
317
|
+
super(message);
|
|
318
|
+
this.name = 'ValidationError';
|
|
319
|
+
this.field = field;
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
// ============================================================================
|
|
324
|
+
// Utility Types
|
|
325
|
+
// ============================================================================
|
|
326
|
+
|
|
327
|
+
export type DeepPartial<T> = {
|
|
328
|
+
[P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
|
|
329
|
+
};
|
|
330
|
+
|
|
331
|
+
export type RequiredFields<T, K extends keyof T> = T & Required<Pick<T, K>>;
|
|
332
|
+
|
|
333
|
+
export type OptionalFields<T, K extends keyof T> = T & Partial<Pick<T, K>>;
|
|
334
|
+
|
|
335
|
+
// ============================================================================
|
|
336
|
+
// Main Server Class Type
|
|
337
|
+
// ============================================================================
|
|
338
|
+
|
|
339
|
+
export interface AirtableMCPServer {
|
|
340
|
+
config: ServerConfig;
|
|
341
|
+
authConfig: AuthConfig;
|
|
342
|
+
tools: ToolSchema[];
|
|
343
|
+
prompts: PromptSchema[];
|
|
344
|
+
|
|
345
|
+
initialize(capabilities: MCPServerCapabilities): Promise<MCPServerInfo>;
|
|
346
|
+
handleToolCall(name: string, params: Record<string, unknown>): Promise<unknown>;
|
|
347
|
+
handlePromptGet(name: string, args: Record<string, unknown>): Promise<{ messages: Array<{ role: string; content: { type: string; text: string } }> }>;
|
|
348
|
+
start(): Promise<void>;
|
|
349
|
+
stop(): Promise<void>;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
// ============================================================================
|
|
353
|
+
// Export All Types
|
|
354
|
+
// ============================================================================
|
|
355
|
+
|
|
356
|
+
export * from './tools';
|
|
357
|
+
export * from './ai-prompts';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TypeScript Test Suite for Airtable MCP Server
|
|
3
|
+
* Comprehensive type-safe testing with enterprise validation
|
|
4
|
+
*/
|
|
5
|
+
interface TestResult {
|
|
6
|
+
name: string;
|
|
7
|
+
passed: boolean;
|
|
8
|
+
error?: string;
|
|
9
|
+
duration: number;
|
|
10
|
+
}
|
|
11
|
+
interface TestSuite {
|
|
12
|
+
name: string;
|
|
13
|
+
tests: TestResult[];
|
|
14
|
+
totalPassed: number;
|
|
15
|
+
totalFailed: number;
|
|
16
|
+
totalDuration: number;
|
|
17
|
+
}
|
|
18
|
+
declare class TypeScriptTestRunner {
|
|
19
|
+
private results;
|
|
20
|
+
runTest(name: string, testFn: () => Promise<void>): Promise<TestResult>;
|
|
21
|
+
runSuite(suiteName: string, tests: Array<{
|
|
22
|
+
name: string;
|
|
23
|
+
fn: () => Promise<void>;
|
|
24
|
+
}>): Promise<TestSuite>;
|
|
25
|
+
generateReport(): void;
|
|
26
|
+
}
|
|
27
|
+
declare class MockAirtableMCPServer {
|
|
28
|
+
initialize(): Promise<any>;
|
|
29
|
+
handleToolCall(name: string, params: Record<string, unknown>): Promise<any>;
|
|
30
|
+
handlePromptGet(_name: string, _args: Record<string, unknown>): Promise<any>;
|
|
31
|
+
}
|
|
32
|
+
declare function runAllTests(): Promise<void>;
|
|
33
|
+
export { TypeScriptTestRunner, MockAirtableMCPServer, runAllTests, TestResult, TestSuite };
|