@rashidazarang/airtable-mcp 3.0.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 (89) hide show
  1. package/README.md +210 -43
  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 +63 -17
  50. package/tsconfig.json +44 -0
  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/test-suite.d.ts +33 -0
  76. package/types/typescript/tools-schemas.d.ts +5 -0
  77. package/airtable_simple.js +0 -1561
  78. package/airtable_simple_production.js +0 -1564
  79. package/examples/airtable-crud-example.js +0 -203
  80. package/examples/building-mcp.md +0 -6666
  81. package/examples/claude_config.json +0 -4
  82. package/examples/claude_simple_config.json +0 -7
  83. package/examples/env-demo.js +0 -172
  84. package/examples/example-tasks-update.json +0 -23
  85. package/examples/example-tasks.json +0 -26
  86. package/examples/example_usage.md +0 -124
  87. package/examples/python_debug_patch.txt +0 -27
  88. package/examples/sample-transform.js +0 -76
  89. package/examples/windsurf_mcp_config.json +0 -17
@@ -1,203 +0,0 @@
1
- /**
2
- * Example script demonstrating how to use the Airtable CRUD utilities
3
- */
4
- const dotenv = require('dotenv');
5
- const baseUtils = require('../tools/airtable-base');
6
- const crudUtils = require('../tools/airtable-crud');
7
- const schemaUtils = require('../tools/airtable-schema');
8
-
9
- // Load environment variables
10
- dotenv.config();
11
-
12
- // Configuration
13
- const EXAMPLE_TABLE_NAME = 'Example Tasks';
14
- const EXAMPLE_RECORDS = [
15
- {
16
- Name: 'Complete project documentation',
17
- Description: 'Write comprehensive documentation for the project',
18
- Status: 'Not Started',
19
- Priority: 'High',
20
- DueDate: '2023-12-31'
21
- },
22
- {
23
- Name: 'Fix login bug',
24
- Description: 'Users are experiencing issues with the login process',
25
- Status: 'In Progress',
26
- Priority: 'Critical',
27
- DueDate: '2023-11-15'
28
- },
29
- {
30
- Name: 'Add new feature',
31
- Description: 'Implement the new feature requested by the client',
32
- Status: 'Not Started',
33
- Priority: 'Medium',
34
- DueDate: '2024-01-15'
35
- }
36
- ];
37
-
38
- /**
39
- * Main function to run the example
40
- */
41
- async function runExample() {
42
- console.log('Starting Airtable CRUD Example...\n');
43
-
44
- const baseId = process.env.AIRTABLE_BASE_ID;
45
- if (!baseId) {
46
- console.error('AIRTABLE_BASE_ID not set in .env file');
47
- process.exit(1);
48
- }
49
-
50
- try {
51
- // Step 1: Check if we have access to the base
52
- console.log('Step 1: Checking base access...');
53
- const bases = await baseUtils.listAllBases();
54
- const hasAccess = bases.some(base => base.id === baseId);
55
-
56
- if (!hasAccess) {
57
- throw new Error(`No access to base with ID: ${baseId}`);
58
- }
59
-
60
- console.log(`✅ Access confirmed to base: ${baseId}\n`);
61
-
62
- // Step 2: List existing tables
63
- console.log('Step 2: Listing existing tables...');
64
- const tables = await baseUtils.listTables(baseId);
65
- console.log(`Found ${tables.length} tables in the base:`);
66
- tables.forEach(table => console.log(`- ${table.name}`));
67
- console.log();
68
-
69
- // Step 3: Check if our example table exists
70
- console.log('Step 3: Checking if example table exists...');
71
- let tableExists = await crudUtils.tableExists(baseId, EXAMPLE_TABLE_NAME);
72
-
73
- if (tableExists) {
74
- console.log(`Table "${EXAMPLE_TABLE_NAME}" already exists\n`);
75
- } else {
76
- console.log(`Table "${EXAMPLE_TABLE_NAME}" does not exist, creating it...\n`);
77
-
78
- // Step 4: Create the example table
79
- console.log('Step 4: Creating example table...');
80
- const tableConfig = {
81
- name: EXAMPLE_TABLE_NAME,
82
- description: 'Example table for demonstrating CRUD operations',
83
- fields: [
84
- {
85
- name: 'Name',
86
- type: 'singleLineText',
87
- description: 'Task name'
88
- },
89
- {
90
- name: 'Description',
91
- type: 'multilineText',
92
- description: 'Task description'
93
- },
94
- {
95
- name: 'Status',
96
- type: 'singleSelect',
97
- options: {
98
- choices: [
99
- { name: 'Not Started' },
100
- { name: 'In Progress' },
101
- { name: 'Completed' }
102
- ]
103
- },
104
- description: 'Current status of the task'
105
- },
106
- {
107
- name: 'Priority',
108
- type: 'singleSelect',
109
- options: {
110
- choices: [
111
- { name: 'Low' },
112
- { name: 'Medium' },
113
- { name: 'High' },
114
- { name: 'Critical' }
115
- ]
116
- },
117
- description: 'Task priority'
118
- },
119
- {
120
- name: 'DueDate',
121
- type: 'date',
122
- description: 'When the task is due',
123
- options: {
124
- dateFormat: {
125
- name: 'local'
126
- }
127
- }
128
- }
129
- ]
130
- };
131
-
132
- await schemaUtils.createTable(baseId, tableConfig);
133
- console.log(`✅ Created table: ${EXAMPLE_TABLE_NAME}\n`);
134
- }
135
-
136
- // Step 5: Create records
137
- console.log('Step 5: Creating example records...');
138
- const createdRecords = await crudUtils.createRecords(baseId, EXAMPLE_TABLE_NAME, EXAMPLE_RECORDS);
139
- console.log(`✅ Created ${createdRecords.length} records\n`);
140
-
141
- // Step 6: Read all records
142
- console.log('Step 6: Reading all records...');
143
- const allRecords = await crudUtils.readRecords(baseId, EXAMPLE_TABLE_NAME, 100);
144
- console.log(`✅ Read ${allRecords.length} records`);
145
- console.log('Sample record:');
146
- console.log(JSON.stringify(allRecords[0], null, 2));
147
- console.log();
148
-
149
- // Step 7: Filter records
150
- console.log('Step 7: Filtering records by status...');
151
- const notStartedRecords = await crudUtils.readRecords(
152
- baseId,
153
- EXAMPLE_TABLE_NAME,
154
- 100,
155
- 'Status="Not Started"'
156
- );
157
- console.log(`✅ Found ${notStartedRecords.length} records with Status="Not Started"`);
158
- notStartedRecords.forEach(record => console.log(`- ${record.Name} (Priority: ${record.Priority})`));
159
- console.log();
160
-
161
- // Step 8: Update records
162
- console.log('Step 8: Updating records...');
163
- const recordsToUpdate = notStartedRecords.map(record => ({
164
- id: record.id,
165
- fields: { Status: 'In Progress' }
166
- }));
167
-
168
- const updatedRecords = await crudUtils.updateRecords(baseId, EXAMPLE_TABLE_NAME, recordsToUpdate);
169
- console.log(`✅ Updated ${updatedRecords.length} records to Status="In Progress"\n`);
170
-
171
- // Step 9: Verify updates
172
- console.log('Step 9: Verifying updates...');
173
- const inProgressRecords = await crudUtils.readRecords(
174
- baseId,
175
- EXAMPLE_TABLE_NAME,
176
- 100,
177
- 'Status="In Progress"'
178
- );
179
- console.log(`✅ Found ${inProgressRecords.length} records with Status="In Progress"`);
180
- inProgressRecords.forEach(record => console.log(`- ${record.Name} (Priority: ${record.Priority})`));
181
- console.log();
182
-
183
- // Step 10: Delete records (optional - commented out to preserve data)
184
- console.log('Step 10: Deleting records (optional)...');
185
- console.log('Skipping deletion to preserve example data.');
186
- console.log('To delete records, uncomment the code below:');
187
- console.log('```');
188
- console.log('const recordIdsToDelete = allRecords.map(record => record.id);');
189
- console.log('const deletedRecords = await crudUtils.deleteRecords(baseId, EXAMPLE_TABLE_NAME, recordIdsToDelete);');
190
- console.log('console.log(`✅ Deleted ${deletedRecords.length} records`);');
191
- console.log('```\n');
192
-
193
- console.log('Example completed successfully!');
194
- console.log('You can now view the data in your Airtable base.');
195
-
196
- } catch (error) {
197
- console.error('Error during example:', error.message);
198
- process.exit(1);
199
- }
200
- }
201
-
202
- // Run the example
203
- runExample();