@rashidazarang/airtable-mcp 3.1.0 → 3.2.5

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 (100) hide show
  1. package/README.md +62 -25
  2. package/bin/airtable-mcp.js +12 -32
  3. package/dist/typescript/airtable-mcp-server.js +77 -0
  4. package/dist/typescript/airtable-mcp-server.js.map +1 -0
  5. package/dist/typescript/app/airtable-client.js +325 -0
  6. package/dist/typescript/app/airtable-client.js.map +1 -0
  7. package/dist/typescript/app/config.js +141 -0
  8. package/dist/typescript/app/config.js.map +1 -0
  9. package/dist/typescript/app/context.js +3 -0
  10. package/dist/typescript/app/context.js.map +1 -0
  11. package/dist/typescript/app/exceptions.js +85 -0
  12. package/dist/typescript/app/exceptions.js.map +1 -0
  13. package/dist/typescript/app/governance.js +58 -0
  14. package/dist/typescript/app/governance.js.map +1 -0
  15. package/dist/typescript/app/logger.js +47 -0
  16. package/dist/typescript/app/logger.js.map +1 -0
  17. package/dist/typescript/app/rateLimiter.js +37 -0
  18. package/dist/typescript/app/rateLimiter.js.map +1 -0
  19. package/dist/typescript/app/tools/create.js +54 -0
  20. package/dist/typescript/app/tools/create.js.map +1 -0
  21. package/dist/typescript/app/tools/describe.js +146 -0
  22. package/dist/typescript/app/tools/describe.js.map +1 -0
  23. package/dist/typescript/app/tools/handleError.js +54 -0
  24. package/dist/typescript/app/tools/handleError.js.map +1 -0
  25. package/dist/typescript/app/tools/index.js +24 -0
  26. package/dist/typescript/app/tools/index.js.map +1 -0
  27. package/dist/typescript/app/tools/listBases.js +52 -0
  28. package/dist/typescript/app/tools/listBases.js.map +1 -0
  29. package/dist/typescript/app/tools/listExceptions.js +18 -0
  30. package/dist/typescript/app/tools/listExceptions.js.map +1 -0
  31. package/dist/typescript/app/tools/listGovernance.js +17 -0
  32. package/dist/typescript/app/tools/listGovernance.js.map +1 -0
  33. package/dist/typescript/app/tools/query.js +126 -0
  34. package/dist/typescript/app/tools/query.js.map +1 -0
  35. package/dist/typescript/app/tools/update.js +56 -0
  36. package/dist/typescript/app/tools/update.js.map +1 -0
  37. package/dist/typescript/app/tools/upsert.js +65 -0
  38. package/dist/typescript/app/tools/upsert.js.map +1 -0
  39. package/dist/typescript/app/tools/webhooks.js +44 -0
  40. package/dist/typescript/app/tools/webhooks.js.map +1 -0
  41. package/dist/typescript/app/types.js +282 -0
  42. package/dist/typescript/app/types.js.map +1 -0
  43. package/dist/typescript/apps-sdk/mappers.js +70 -0
  44. package/dist/typescript/apps-sdk/mappers.js.map +1 -0
  45. package/dist/typescript/errors.js +75 -0
  46. package/dist/typescript/errors.js.map +1 -0
  47. package/dist/typescript/index.js +27 -0
  48. package/dist/typescript/index.js.map +1 -0
  49. package/package.json +49 -30
  50. package/tsconfig.json +10 -4
  51. package/types/typescript/airtable-mcp-server.d.ts +2 -0
  52. package/types/typescript/app/airtable-client.d.ts +49 -0
  53. package/types/typescript/app/config.d.ts +16 -0
  54. package/types/typescript/app/context.d.ts +12 -0
  55. package/types/typescript/app/exceptions.d.ts +12 -0
  56. package/types/typescript/app/governance.d.ts +18 -0
  57. package/types/typescript/app/logger.d.ts +13 -0
  58. package/types/typescript/app/rateLimiter.d.ts +13 -0
  59. package/types/typescript/app/tools/create.d.ts +3 -0
  60. package/types/typescript/app/tools/describe.d.ts +3 -0
  61. package/types/typescript/app/tools/handleError.d.ts +8 -0
  62. package/types/typescript/app/tools/index.d.ts +3 -0
  63. package/types/typescript/app/tools/listBases.d.ts +33 -0
  64. package/types/typescript/app/tools/listExceptions.d.ts +3 -0
  65. package/types/typescript/app/tools/listGovernance.d.ts +3 -0
  66. package/types/typescript/app/tools/query.d.ts +3 -0
  67. package/types/typescript/app/tools/update.d.ts +3 -0
  68. package/types/typescript/app/tools/upsert.d.ts +3 -0
  69. package/types/typescript/app/tools/webhooks.d.ts +3 -0
  70. package/types/typescript/app/types.d.ts +830 -0
  71. package/types/typescript/apps-sdk/mappers.d.ts +53 -0
  72. package/types/typescript/errors.d.ts +55 -0
  73. package/types/typescript/index.d.ts +10 -0
  74. package/types/typescript/prompt-templates.d.ts +5 -0
  75. package/types/typescript/tools-schemas.d.ts +5 -0
  76. package/airtable_simple.js +0 -1561
  77. package/airtable_simple_production.js +0 -1564
  78. package/dist/airtable-mcp-server.js +0 -660
  79. package/dist/airtable-mcp-server.js.map +0 -1
  80. package/dist/test-suite.js +0 -421
  81. package/dist/test-suite.js.map +0 -1
  82. package/examples/airtable-crud-example.js +0 -203
  83. package/examples/building-mcp.md +0 -6666
  84. package/examples/claude_config.json +0 -4
  85. package/examples/claude_simple_config.json +0 -7
  86. package/examples/env-demo.js +0 -172
  87. package/examples/example-tasks-update.json +0 -23
  88. package/examples/example-tasks.json +0 -26
  89. package/examples/example_usage.md +0 -124
  90. package/examples/python_debug_patch.txt +0 -27
  91. package/examples/sample-transform.js +0 -76
  92. package/examples/typescript/advanced-ai-prompts.ts +0 -447
  93. package/examples/typescript/basic-usage.ts +0 -174
  94. package/examples/typescript/claude-desktop-config.json +0 -29
  95. package/examples/windsurf_mcp_config.json +0 -17
  96. package/types/ai-prompts.d.ts +0 -321
  97. package/types/airtable-mcp-server.d.ts +0 -52
  98. package/types/index.d.ts +0 -357
  99. package/types/tools.d.ts +0 -514
  100. /package/types/{test-suite.d.ts → typescript/test-suite.d.ts} +0 -0
@@ -1,447 +0,0 @@
1
- /**
2
- * Advanced AI Prompts TypeScript Example
3
- * Demonstrates enterprise-grade AI capabilities with strict typing
4
- */
5
-
6
- import {
7
- AirtableMCPServer,
8
- AnalyzeDataPrompt,
9
- CreateReportPrompt,
10
- PredictiveAnalyticsPrompt,
11
- NaturalLanguageQueryPrompt,
12
- SmartSchemaDesignPrompt,
13
- DataQualityAuditPrompt,
14
- OptimizeWorkflowPrompt,
15
- AutomationRecommendationsPrompt,
16
- AnalysisResult,
17
- ReportResult,
18
- PredictionResult,
19
- WorkflowOptimizationResult
20
- } from '@rashidazarang/airtable-mcp/types';
21
-
22
- // Enterprise AI Analytics Class
23
- class EnterpriseAIAnalytics {
24
- private server: AirtableMCPServer;
25
-
26
- constructor() {
27
- this.server = new AirtableMCPServer();
28
- }
29
-
30
- // Advanced Statistical Analysis with Type Safety
31
- async performStatisticalAnalysis(table: string): Promise<AnalysisResult> {
32
- const params: AnalyzeDataPrompt = {
33
- table,
34
- analysis_type: 'statistical',
35
- confidence_level: 0.99,
36
- field_focus: 'revenue,conversion_rate,customer_satisfaction',
37
- time_dimension: 'created_date'
38
- };
39
-
40
- const response = await this.server.handlePromptGet('analyze_data', params);
41
-
42
- // Type-safe result processing
43
- const result: AnalysisResult = {
44
- summary: 'Comprehensive statistical analysis completed',
45
- key_findings: [
46
- 'Revenue shows 15.3% growth trend',
47
- 'Conversion rate correlation: 0.78',
48
- 'Customer satisfaction: 94.2% positive'
49
- ],
50
- statistical_measures: {
51
- mean: 45670.23,
52
- median: 42150.00,
53
- std_deviation: 12340.56,
54
- correlation_coefficients: {
55
- 'revenue_conversion': 0.78,
56
- 'satisfaction_retention': 0.85
57
- },
58
- confidence_intervals: [
59
- { field: 'revenue', lower: 40000, upper: 51000, confidence: 0.99 },
60
- { field: 'conversion_rate', lower: 0.12, upper: 0.18, confidence: 0.99 }
61
- ]
62
- },
63
- trends: [
64
- {
65
- field: 'revenue',
66
- direction: 'increasing',
67
- strength: 'strong',
68
- significance: 0.97
69
- }
70
- ],
71
- recommendations: [
72
- 'Implement predictive modeling for revenue forecasting',
73
- 'Establish monitoring dashboard for key metrics',
74
- 'Consider A/B testing for conversion optimization'
75
- ],
76
- next_steps: [
77
- 'Set up automated reporting pipeline',
78
- 'Deploy real-time analytics dashboard',
79
- 'Schedule quarterly deep-dive analysis'
80
- ]
81
- };
82
-
83
- return result;
84
- }
85
-
86
- // Executive Report Generation with Business Intelligence
87
- async generateExecutiveReport(table: string, audience: 'executives' | 'managers' | 'analysts' | 'technical_team'): Promise<ReportResult> {
88
- const params: CreateReportPrompt = {
89
- table,
90
- report_type: 'executive_summary',
91
- target_audience: audience,
92
- include_recommendations: true,
93
- time_period: 'Q4 2024',
94
- format_preference: 'mixed'
95
- };
96
-
97
- const response = await this.server.handlePromptGet('create_report', params);
98
-
99
- const result: ReportResult = {
100
- title: `Q4 2024 Executive Summary - ${table} Analysis`,
101
- executive_summary: 'Strategic overview of business performance with actionable insights and growth opportunities.',
102
- detailed_sections: [
103
- {
104
- heading: 'Performance Metrics',
105
- content: 'Comprehensive analysis of key performance indicators showing strong growth trajectory.',
106
- supporting_data: [
107
- { metric: 'Revenue Growth', value: '15.3%', trend: 'positive' },
108
- { metric: 'Customer Acquisition', value: '1,247', trend: 'positive' },
109
- { metric: 'Retention Rate', value: '94.2%', trend: 'stable' }
110
- ],
111
- visualizations: [
112
- { type: 'line_chart', data: {}, description: 'Revenue trend over time' },
113
- { type: 'bar_chart', data: {}, description: 'Customer acquisition by channel' }
114
- ]
115
- },
116
- {
117
- heading: 'Strategic Opportunities',
118
- content: 'Identified high-impact areas for business expansion and optimization.',
119
- supporting_data: [
120
- { opportunity: 'Market Expansion', impact: 'High', effort: 'Medium' },
121
- { opportunity: 'Process Automation', impact: 'Medium', effort: 'Low' }
122
- ]
123
- }
124
- ],
125
- key_metrics: {
126
- 'Revenue': { value: '$2.4M', change: '+15.3%', significance: 'high' },
127
- 'Customer Count': { value: '12,470', change: '+8.2%', significance: 'medium' },
128
- 'Satisfaction Score': { value: '4.7/5', change: '+0.3', significance: 'high' }
129
- },
130
- recommendations: [
131
- {
132
- priority: 'high',
133
- recommendation: 'Implement predictive analytics for demand forecasting',
134
- expected_impact: '12-18% efficiency improvement',
135
- implementation_effort: 'medium'
136
- },
137
- {
138
- priority: 'medium',
139
- recommendation: 'Enhance customer segmentation strategy',
140
- expected_impact: '8-12% conversion rate improvement',
141
- implementation_effort: 'low'
142
- }
143
- ],
144
- appendices: [
145
- { title: 'Technical Methodology', content: 'Detailed explanation of analytical methods used' },
146
- { title: 'Data Sources', content: 'Comprehensive list of data sources and validation methods' }
147
- ]
148
- };
149
-
150
- return result;
151
- }
152
-
153
- // Advanced Predictive Analytics with Machine Learning
154
- async performPredictiveAnalytics(table: string, targetField: string): Promise<PredictionResult> {
155
- const params: PredictiveAnalyticsPrompt = {
156
- table,
157
- target_field: targetField,
158
- prediction_periods: 12,
159
- algorithm: 'random_forest',
160
- include_confidence_intervals: true,
161
- historical_periods: 24,
162
- external_factors: ['market_trends', 'seasonality', 'economic_indicators'],
163
- business_context: 'Enterprise revenue forecasting with risk assessment'
164
- };
165
-
166
- const response = await this.server.handlePromptGet('predictive_analytics', params);
167
-
168
- const result: PredictionResult = {
169
- predictions: [
170
- {
171
- period: '2025-01',
172
- predicted_value: 125670.45,
173
- confidence_interval: { lower: 118450.23, upper: 132890.67 },
174
- probability_bands: [
175
- { probability: 0.68, range: [120000, 131000] },
176
- { probability: 0.95, range: [115000, 136000] }
177
- ]
178
- },
179
- {
180
- period: '2025-02',
181
- predicted_value: 128340.12,
182
- confidence_interval: { lower: 121120.89, upper: 135559.35 }
183
- }
184
- ],
185
- model_performance: {
186
- algorithm_used: 'random_forest',
187
- accuracy_metrics: {
188
- 'r_squared': 0.847,
189
- 'mae': 4567.89,
190
- 'rmse': 6234.12,
191
- 'mape': 3.8
192
- },
193
- feature_importance: {
194
- 'historical_revenue': 0.34,
195
- 'seasonality': 0.28,
196
- 'market_trends': 0.23,
197
- 'customer_count': 0.15
198
- },
199
- validation_results: {
200
- 'cross_validation_score': 0.82,
201
- 'holdout_accuracy': 0.79,
202
- 'stability_index': 0.91
203
- }
204
- },
205
- business_insights: {
206
- trend_direction: 'positive',
207
- seasonality_detected: true,
208
- external_factors_impact: [
209
- 'Strong correlation with market expansion',
210
- 'Seasonal peak in Q4 consistently observed',
211
- 'Economic indicators show positive influence'
212
- ],
213
- risk_factors: [
214
- 'Market volatility could impact 15% variance',
215
- 'Supply chain disruptions possible',
216
- 'Competitive landscape changes'
217
- ]
218
- },
219
- recommendations: [
220
- {
221
- type: 'strategic',
222
- recommendation: 'Prepare for 23% capacity increase by Q3 2025',
223
- timing: '6 months lead time',
224
- confidence: 0.87
225
- },
226
- {
227
- type: 'operational',
228
- recommendation: 'Implement dynamic pricing based on demand forecasts',
229
- timing: 'Immediate',
230
- confidence: 0.94
231
- },
232
- {
233
- type: 'tactical',
234
- recommendation: 'Establish risk monitoring for volatility indicators',
235
- timing: '3 months',
236
- confidence: 0.89
237
- }
238
- ]
239
- };
240
-
241
- return result;
242
- }
243
-
244
- // Natural Language Query Processing
245
- async processNaturalLanguageQuery(question: string, tables?: string[]): Promise<string> {
246
- const params: NaturalLanguageQueryPrompt = {
247
- question,
248
- tables: tables?.join(','),
249
- response_format: 'natural_language',
250
- context_awareness: true,
251
- confidence_threshold: 0.85,
252
- clarifying_questions: true
253
- };
254
-
255
- const response = await this.server.handlePromptGet('natural_language_query', params);
256
- return response.messages[0].content.text;
257
- }
258
-
259
- // Smart Schema Design with Compliance
260
- async designOptimalSchema(purpose: string, requirements: string[]): Promise<any> {
261
- const params: SmartSchemaDesignPrompt = {
262
- purpose,
263
- data_types: ['text', 'number', 'date', 'select', 'attachment'],
264
- expected_volume: 'enterprise',
265
- compliance_requirements: ['GDPR', 'HIPAA'],
266
- performance_priorities: ['query_speed', 'scalability'],
267
- integration_needs: ['API access', 'webhook notifications'],
268
- user_access_patterns: 'Multi-team collaboration with role-based permissions'
269
- };
270
-
271
- const response = await this.server.handlePromptGet('smart_schema_design', params);
272
- return response;
273
- }
274
-
275
- // Comprehensive Data Quality Audit
276
- async performDataQualityAudit(table: string): Promise<any> {
277
- const params: DataQualityAuditPrompt = {
278
- table,
279
- quality_dimensions: ['completeness', 'accuracy', 'consistency', 'timeliness', 'validity'],
280
- automated_fixes: true,
281
- severity_threshold: 'medium',
282
- compliance_context: 'Enterprise data governance standards',
283
- reporting_requirements: ['executive_summary', 'detailed_findings', 'remediation_plan']
284
- };
285
-
286
- const response = await this.server.handlePromptGet('data_quality_audit', params);
287
- return response;
288
- }
289
-
290
- // Workflow Optimization Analysis
291
- async optimizeWorkflow(workflowDescription: string, painPoints: string[]): Promise<WorkflowOptimizationResult> {
292
- const params: OptimizeWorkflowPrompt = {
293
- table: 'workflow_data',
294
- current_process_description: workflowDescription,
295
- optimization_goals: ['efficiency', 'accuracy', 'cost_reduction'],
296
- constraints: ['regulatory_compliance', 'legacy_system_integration'],
297
- automation_preference: 'moderate',
298
- change_tolerance: 'medium'
299
- };
300
-
301
- const response = await this.server.handlePromptGet('optimize_workflow', params);
302
-
303
- // Return a comprehensive optimization result
304
- const result: WorkflowOptimizationResult = {
305
- current_state_analysis: {
306
- efficiency_score: 72,
307
- bottlenecks: [
308
- { step: 'Manual data entry', impact: 'high', description: 'Causes 40% of processing delays' },
309
- { step: 'Approval routing', impact: 'medium', description: 'Average 2.3 day approval time' }
310
- ],
311
- resource_utilization: {
312
- 'staff_time': 0.68,
313
- 'system_capacity': 0.84,
314
- 'automation_coverage': 0.23
315
- }
316
- },
317
- optimization_recommendations: [
318
- {
319
- category: 'automation',
320
- recommendation: 'Implement automated data validation and entry',
321
- expected_benefits: ['45% time reduction', '90% error reduction'],
322
- implementation_complexity: 'moderate',
323
- estimated_roi: '340% within 12 months',
324
- timeline: '3-4 months'
325
- },
326
- {
327
- category: 'process_redesign',
328
- recommendation: 'Parallel approval workflow with smart routing',
329
- expected_benefits: ['60% faster approvals', 'Improved transparency'],
330
- implementation_complexity: 'complex',
331
- estimated_roi: '220% within 18 months',
332
- timeline: '6-8 months'
333
- }
334
- ],
335
- implementation_roadmap: [
336
- {
337
- phase: 1,
338
- duration: '3 months',
339
- objectives: ['Implement basic automation', 'Staff training'],
340
- deliverables: ['Automated validation system', 'Training materials'],
341
- success_metrics: ['25% efficiency improvement', '95% staff adoption']
342
- },
343
- {
344
- phase: 2,
345
- duration: '4 months',
346
- objectives: ['Advanced workflow redesign', 'Integration testing'],
347
- deliverables: ['New approval system', 'Performance dashboard'],
348
- success_metrics: ['60% approval time reduction', '99.5% system uptime']
349
- }
350
- ],
351
- risk_assessment: [
352
- {
353
- risk: 'Staff resistance to change',
354
- probability: 'medium',
355
- impact: 'medium',
356
- mitigation: 'Comprehensive change management and training program'
357
- },
358
- {
359
- risk: 'System integration challenges',
360
- probability: 'low',
361
- impact: 'high',
362
- mitigation: 'Phased rollout with fallback procedures'
363
- }
364
- ]
365
- };
366
-
367
- return result;
368
- }
369
-
370
- // Automation Recommendations Engine
371
- async generateAutomationRecommendations(workflowDescription: string): Promise<any> {
372
- const params: AutomationRecommendationsPrompt = {
373
- workflow_description: workflowDescription,
374
- current_pain_points: ['manual_data_entry', 'approval_delays', 'reporting_overhead'],
375
- automation_scope: 'end_to_end',
376
- technical_constraints: ['legacy_system_compatibility', 'security_requirements'],
377
- business_impact_priority: ['time_efficiency', 'error_reduction', 'cost_savings'],
378
- implementation_timeline: 'medium_term',
379
- risk_tolerance: 'moderate'
380
- };
381
-
382
- const response = await this.server.handlePromptGet('automation_recommendations', params);
383
- return response;
384
- }
385
- }
386
-
387
- // Example usage with comprehensive error handling
388
- async function demonstrateEnterpriseAI(): Promise<void> {
389
- const analytics = new EnterpriseAIAnalytics();
390
-
391
- try {
392
- console.log('🤖 Starting Enterprise AI Analysis...');
393
-
394
- // Statistical Analysis
395
- console.log('\n📊 Performing Statistical Analysis...');
396
- const analysisResult = await analytics.performStatisticalAnalysis('Sales');
397
- console.log('Analysis completed:', analysisResult.summary);
398
-
399
- // Executive Report
400
- console.log('\n📋 Generating Executive Report...');
401
- const reportResult = await analytics.generateExecutiveReport('Sales', 'executives');
402
- console.log('Report generated:', reportResult.title);
403
-
404
- // Predictive Analytics
405
- console.log('\n🔮 Running Predictive Analytics...');
406
- const predictionResult = await analytics.performPredictiveAnalytics('Sales', 'revenue');
407
- console.log('Predictions generated:', predictionResult.predictions.length, 'periods');
408
-
409
- // Natural Language Query
410
- console.log('\n🗣️ Processing Natural Language Query...');
411
- const nlResult = await analytics.processNaturalLanguageQuery(
412
- 'What are the top 5 performing products by revenue this quarter?',
413
- ['Products', 'Sales']
414
- );
415
- console.log('NL Response:', nlResult.substring(0, 100) + '...');
416
-
417
- // Workflow Optimization
418
- console.log('\n⚡ Analyzing Workflow Optimization...');
419
- const workflowResult = await analytics.optimizeWorkflow(
420
- 'Manual invoice processing with email approvals',
421
- ['Slow approval times', 'Manual data entry errors']
422
- );
423
- console.log('Optimization completed, efficiency score:', workflowResult.current_state_analysis.efficiency_score);
424
-
425
- console.log('\n✅ All Enterprise AI operations completed successfully!');
426
-
427
- } catch (error) {
428
- console.error('❌ Enterprise AI Error:', error);
429
- throw error;
430
- }
431
- }
432
-
433
- // Export for testing and integration
434
- export {
435
- EnterpriseAIAnalytics,
436
- demonstrateEnterpriseAI
437
- };
438
-
439
- // Run demonstration if executed directly
440
- if (require.main === module) {
441
- demonstrateEnterpriseAI()
442
- .then(() => process.exit(0))
443
- .catch((error) => {
444
- console.error('Fatal error:', error);
445
- process.exit(1);
446
- });
447
- }
@@ -1,174 +0,0 @@
1
- /**
2
- * Basic TypeScript Usage Example
3
- * Demonstrates type-safe Airtable MCP operations
4
- */
5
-
6
- import {
7
- AirtableMCPServer,
8
- MCPServerCapabilities,
9
- ListRecordsInput,
10
- CreateRecordInput,
11
- AnalyzeDataPrompt
12
- } from '@rashidazarang/airtable-mcp/types';
13
-
14
- // Type-safe server initialization
15
- async function initializeServer(): Promise<void> {
16
- const server = new AirtableMCPServer();
17
-
18
- const capabilities: MCPServerCapabilities = {
19
- tools: { listChanged: false },
20
- prompts: { listChanged: false },
21
- resources: { subscribe: false, listChanged: false },
22
- roots: { listChanged: false },
23
- sampling: {},
24
- logging: {}
25
- };
26
-
27
- const serverInfo = await server.initialize(capabilities);
28
- console.log('Server initialized:', serverInfo);
29
- }
30
-
31
- // Type-safe data operations
32
- async function performDataOperations(): Promise<void> {
33
- const server = new AirtableMCPServer();
34
-
35
- // List records with type safety
36
- const listParams: ListRecordsInput = {
37
- table: 'Tasks',
38
- maxRecords: 10,
39
- filterByFormula: "Status = 'Active'"
40
- };
41
-
42
- const records = await server.handleToolCall('list_records', listParams);
43
- console.log('Records retrieved:', records);
44
-
45
- // Create record with validated types
46
- const createParams: CreateRecordInput = {
47
- table: 'Tasks',
48
- fields: {
49
- 'Name': 'New Task',
50
- 'Status': 'Active',
51
- 'Priority': 'High',
52
- 'Due Date': new Date().toISOString()
53
- },
54
- typecast: true
55
- };
56
-
57
- const newRecord = await server.handleToolCall('create_record', createParams);
58
- console.log('Record created:', newRecord);
59
- }
60
-
61
- // Type-safe AI prompt usage
62
- async function useAIPrompts(): Promise<void> {
63
- const server = new AirtableMCPServer();
64
-
65
- // Advanced data analysis with strict typing
66
- const analysisParams: AnalyzeDataPrompt = {
67
- table: 'Sales',
68
- analysis_type: 'predictive',
69
- field_focus: 'revenue,conversion_rate',
70
- time_dimension: 'created_date',
71
- confidence_level: 0.95
72
- };
73
-
74
- const analysis = await server.handlePromptGet('analyze_data', analysisParams);
75
- console.log('AI Analysis:', analysis);
76
-
77
- // Type-safe error handling
78
- try {
79
- // This will cause a TypeScript compile error if types don't match
80
- const invalidParams = {
81
- table: 'Sales',
82
- analysis_type: 'invalid_type', // TypeScript will catch this!
83
- confidence_level: 1.5 // TypeScript will catch this too!
84
- };
85
-
86
- // await server.handlePromptGet('analyze_data', invalidParams);
87
- } catch (error) {
88
- console.error('Type-safe error handling:', error);
89
- }
90
- }
91
-
92
- // Enterprise-grade type validation
93
- interface BusinessMetrics {
94
- revenue: number;
95
- conversion_rate: number;
96
- customer_count: number;
97
- timestamp: Date;
98
- }
99
-
100
- function validateBusinessMetrics(data: unknown): data is BusinessMetrics {
101
- const metrics = data as BusinessMetrics;
102
- return (
103
- typeof metrics.revenue === 'number' &&
104
- typeof metrics.conversion_rate === 'number' &&
105
- typeof metrics.customer_count === 'number' &&
106
- metrics.timestamp instanceof Date
107
- );
108
- }
109
-
110
- // Type-safe configuration
111
- interface AppConfig {
112
- airtable: {
113
- token: string;
114
- baseId: string;
115
- };
116
- server: {
117
- port: number;
118
- host: string;
119
- logLevel: 'ERROR' | 'WARN' | 'INFO' | 'DEBUG' | 'TRACE';
120
- };
121
- ai: {
122
- enablePredictiveAnalytics: boolean;
123
- confidenceThreshold: number;
124
- maxAnalysisFields: number;
125
- };
126
- }
127
-
128
- const config: AppConfig = {
129
- airtable: {
130
- token: process.env.AIRTABLE_TOKEN!,
131
- baseId: process.env.AIRTABLE_BASE_ID!
132
- },
133
- server: {
134
- port: 8010,
135
- host: 'localhost',
136
- logLevel: 'INFO'
137
- },
138
- ai: {
139
- enablePredictiveAnalytics: true,
140
- confidenceThreshold: 0.85,
141
- maxAnalysisFields: 10
142
- }
143
- };
144
-
145
- // Main execution with comprehensive error handling
146
- async function main(): Promise<void> {
147
- try {
148
- console.log('🚀 Starting TypeScript Airtable MCP Example');
149
-
150
- await initializeServer();
151
- await performDataOperations();
152
- await useAIPrompts();
153
-
154
- console.log('✅ All operations completed successfully with type safety!');
155
- } catch (error) {
156
- console.error('❌ Error occurred:', error);
157
- process.exit(1);
158
- }
159
- }
160
-
161
- // Export for testing and reuse
162
- export {
163
- initializeServer,
164
- performDataOperations,
165
- useAIPrompts,
166
- validateBusinessMetrics,
167
- BusinessMetrics,
168
- AppConfig
169
- };
170
-
171
- // Run if this file is executed directly
172
- if (require.main === module) {
173
- main();
174
- }
@@ -1,29 +0,0 @@
1
- {
2
- "mcpServers": {
3
- "airtable-typescript": {
4
- "command": "npx",
5
- "args": [
6
- "@rashidazarang/airtable-mcp",
7
- "--token",
8
- "YOUR_AIRTABLE_TOKEN",
9
- "--base",
10
- "YOUR_BASE_ID"
11
- ],
12
- "env": {
13
- "NODE_ENV": "production",
14
- "LOG_LEVEL": "INFO"
15
- }
16
- },
17
- "airtable-typescript-dev": {
18
- "command": "npm",
19
- "args": ["run", "start:ts"],
20
- "cwd": "/path/to/your/airtable-mcp",
21
- "env": {
22
- "AIRTABLE_TOKEN": "YOUR_AIRTABLE_TOKEN",
23
- "AIRTABLE_BASE_ID": "YOUR_BASE_ID",
24
- "NODE_ENV": "development",
25
- "LOG_LEVEL": "DEBUG"
26
- }
27
- }
28
- }
29
- }
@@ -1,17 +0,0 @@
1
- {
2
- "mcpServers": {
3
- "AIRTABLE": {
4
- "command": "npx",
5
- "args": [
6
- "-y",
7
- "@smithery/cli@latest",
8
- "run",
9
- "@rashidazarang/airtable-mcp",
10
- "--token",
11
- "YOUR_AIRTABLE_TOKEN",
12
- "--base",
13
- "YOUR_BASE_ID"
14
- ]
15
- }
16
- }
17
- }