@rashidazarang/airtable-mcp 1.6.0 → 2.1.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/README.md +1 -0
- package/airtable_simple_production.js +532 -0
- package/package.json +15 -6
- package/.claude/settings.local.json +0 -12
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -38
- package/.github/ISSUE_TEMPLATE/custom.md +0 -10
- package/.github/ISSUE_TEMPLATE/feature_request.md +0 -20
- package/CAPABILITY_REPORT.md +0 -118
- package/CLAUDE_INTEGRATION.md +0 -96
- package/CONTRIBUTING.md +0 -81
- package/DEVELOPMENT.md +0 -190
- package/Dockerfile +0 -39
- package/Dockerfile.node +0 -20
- package/IMPROVEMENT_PROPOSAL.md +0 -371
- package/INSTALLATION.md +0 -183
- package/ISSUE_RESPONSES.md +0 -171
- package/MCP_REVIEW_SUMMARY.md +0 -142
- package/QUICK_START.md +0 -60
- package/RELEASE_NOTES_v1.2.0.md +0 -50
- package/RELEASE_NOTES_v1.2.1.md +0 -40
- package/RELEASE_NOTES_v1.2.2.md +0 -48
- package/RELEASE_NOTES_v1.2.3.md +0 -105
- package/RELEASE_NOTES_v1.2.4.md +0 -60
- package/RELEASE_NOTES_v1.4.0.md +0 -104
- package/RELEASE_NOTES_v1.5.0.md +0 -185
- package/RELEASE_NOTES_v1.6.0.md +0 -248
- package/SECURITY_NOTICE.md +0 -40
- package/airtable-mcp-1.1.0.tgz +0 -0
- package/airtable_enhanced.js +0 -499
- package/airtable_mcp/__init__.py +0 -5
- package/airtable_mcp/src/server.py +0 -329
- package/airtable_simple_v1.2.4_backup.js +0 -277
- package/airtable_v1.4.0.js +0 -654
- package/cleanup.sh +0 -71
- package/index.js +0 -179
- package/inspector.py +0 -148
- package/inspector_server.py +0 -337
- package/publish-steps.txt +0 -27
- package/quick_test.sh +0 -30
- package/rashidazarang-airtable-mcp-1.1.0.tgz +0 -0
- package/rashidazarang-airtable-mcp-1.2.0.tgz +0 -0
- package/rashidazarang-airtable-mcp-1.2.1.tgz +0 -0
- package/requirements.txt +0 -10
- package/setup.py +0 -29
- package/simple_airtable_server.py +0 -151
- package/smithery.yaml +0 -45
- package/test_all_features.sh +0 -146
- package/test_all_operations.sh +0 -120
- package/test_client.py +0 -70
- package/test_enhanced_features.js +0 -389
- package/test_mcp_comprehensive.js +0 -163
- package/test_mock_server.js +0 -180
- package/test_v1.4.0_final.sh +0 -131
- package/test_v1.5.0_comprehensive.sh +0 -96
- package/test_v1.5.0_final.sh +0 -224
- package/test_v1.6.0_comprehensive.sh +0 -187
- package/test_webhooks.sh +0 -105
package/inspector_server.py
DELETED
|
@@ -1,337 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
"""
|
|
3
|
-
Airtable MCP Inspector Server
|
|
4
|
-
-----------------------------
|
|
5
|
-
A simple MCP server that implements the Airtable tools
|
|
6
|
-
"""
|
|
7
|
-
import os
|
|
8
|
-
import sys
|
|
9
|
-
import json
|
|
10
|
-
import logging
|
|
11
|
-
import requests
|
|
12
|
-
import argparse
|
|
13
|
-
import traceback
|
|
14
|
-
from typing import Optional, Dict, Any, List
|
|
15
|
-
|
|
16
|
-
try:
|
|
17
|
-
from mcp.server.fastmcp import FastMCP
|
|
18
|
-
except ImportError:
|
|
19
|
-
print("Error: MCP SDK not found. Please install with 'pip install mcp'")
|
|
20
|
-
sys.exit(1)
|
|
21
|
-
|
|
22
|
-
# Parse command line arguments
|
|
23
|
-
def parse_args():
|
|
24
|
-
parser = argparse.ArgumentParser(description="Airtable MCP Server")
|
|
25
|
-
parser.add_argument("--token", dest="api_token", help="Airtable Personal Access Token")
|
|
26
|
-
parser.add_argument("--base", dest="base_id", help="Airtable Base ID")
|
|
27
|
-
parser.add_argument("--config", dest="config_json", help="Configuration as JSON (for Smithery integration)")
|
|
28
|
-
return parser.parse_args()
|
|
29
|
-
|
|
30
|
-
# Set up logging
|
|
31
|
-
logging.basicConfig(level=logging.INFO)
|
|
32
|
-
logger = logging.getLogger("airtable-mcp")
|
|
33
|
-
|
|
34
|
-
# Parse arguments
|
|
35
|
-
args = parse_args()
|
|
36
|
-
|
|
37
|
-
# Handle config JSON from Smithery if provided
|
|
38
|
-
config = {}
|
|
39
|
-
if args.config_json:
|
|
40
|
-
try:
|
|
41
|
-
# Strip any trailing quotes or backslashes that might be present
|
|
42
|
-
config_str = args.config_json.rstrip('\\"')
|
|
43
|
-
# Additional sanitization for JSON format
|
|
44
|
-
config_str = config_str.strip()
|
|
45
|
-
# Handle escaped quotes
|
|
46
|
-
if config_str.startswith('"') and config_str.endswith('"'):
|
|
47
|
-
config_str = config_str[1:-1]
|
|
48
|
-
# Fix escaped quotes within JSON
|
|
49
|
-
config_str = config_str.replace('\\"', '"')
|
|
50
|
-
# Replace escaped backslashes
|
|
51
|
-
config_str = config_str.replace('\\\\', '\\')
|
|
52
|
-
|
|
53
|
-
logger.info(f"Parsing sanitized config: {config_str}")
|
|
54
|
-
config = json.loads(config_str)
|
|
55
|
-
logger.info(f"Successfully parsed config: {config}")
|
|
56
|
-
except json.JSONDecodeError as e:
|
|
57
|
-
logger.error(f"Failed to parse config JSON: {e}")
|
|
58
|
-
logger.error(f"Raw config string: {args.config_json}")
|
|
59
|
-
# Try one more approach - sometimes config is double-quoted JSON
|
|
60
|
-
try:
|
|
61
|
-
# Try to interpret as Python string literal
|
|
62
|
-
import ast
|
|
63
|
-
literal_str = ast.literal_eval(f"'''{args.config_json}'''")
|
|
64
|
-
config = json.loads(literal_str)
|
|
65
|
-
logger.info(f"Successfully parsed config using ast: {config}")
|
|
66
|
-
except Exception as ast_error:
|
|
67
|
-
logger.error(f"Failed alternate parsing method: {ast_error}")
|
|
68
|
-
|
|
69
|
-
# Create MCP server
|
|
70
|
-
app = FastMCP("Airtable Tools")
|
|
71
|
-
|
|
72
|
-
# Add error handling wrapper for all MCP methods
|
|
73
|
-
def handle_exceptions(func):
|
|
74
|
-
"""Decorator to properly handle and format exceptions in MCP functions"""
|
|
75
|
-
async def wrapper(*args, **kwargs):
|
|
76
|
-
try:
|
|
77
|
-
return await func(*args, **kwargs)
|
|
78
|
-
except Exception as e:
|
|
79
|
-
error_trace = traceback.format_exc()
|
|
80
|
-
logger.error(f"Error in MCP handler: {str(e)}\n{error_trace}")
|
|
81
|
-
sys.stderr.write(f"Error in MCP handler: {str(e)}\n{error_trace}\n")
|
|
82
|
-
|
|
83
|
-
# For tool functions that return strings, return a formatted error message
|
|
84
|
-
if hasattr(func, "__annotations__") and func.__annotations__.get("return") == str:
|
|
85
|
-
return f"Error: {str(e)}"
|
|
86
|
-
|
|
87
|
-
# For RPC methods that return dicts, return a properly formatted JSON error
|
|
88
|
-
return {"error": {"code": -32000, "message": str(e)}}
|
|
89
|
-
return wrapper
|
|
90
|
-
|
|
91
|
-
# Patch the tool method to automatically apply error handling
|
|
92
|
-
original_tool = app.tool
|
|
93
|
-
def patched_tool(*args, **kwargs):
|
|
94
|
-
def decorator(func):
|
|
95
|
-
wrapped_func = handle_exceptions(func)
|
|
96
|
-
return original_tool(*args, **kwargs)(wrapped_func)
|
|
97
|
-
return decorator
|
|
98
|
-
|
|
99
|
-
# Replace app.tool with our patched version
|
|
100
|
-
app.tool = patched_tool
|
|
101
|
-
|
|
102
|
-
# Get token from arguments, config, or environment
|
|
103
|
-
token = args.api_token or config.get("airtable_token", "") or os.environ.get("AIRTABLE_PERSONAL_ACCESS_TOKEN", "")
|
|
104
|
-
# Clean up token if it has trailing quote
|
|
105
|
-
if token and token.endswith('"'):
|
|
106
|
-
token = token[:-1]
|
|
107
|
-
|
|
108
|
-
base_id = args.base_id or config.get("base_id", "") or os.environ.get("AIRTABLE_BASE_ID", "")
|
|
109
|
-
|
|
110
|
-
if not token:
|
|
111
|
-
logger.warning("No Airtable API token provided. Use --token, --config, or set AIRTABLE_PERSONAL_ACCESS_TOKEN environment variable.")
|
|
112
|
-
else:
|
|
113
|
-
logger.info("Airtable authentication configured")
|
|
114
|
-
|
|
115
|
-
if base_id:
|
|
116
|
-
logger.info(f"Using base ID: {base_id}")
|
|
117
|
-
else:
|
|
118
|
-
logger.warning("No base ID provided. Use --base, --config, or set AIRTABLE_BASE_ID environment variable.")
|
|
119
|
-
|
|
120
|
-
# Helper functions for Airtable API calls
|
|
121
|
-
async def api_call(endpoint, method="GET", data=None, params=None):
|
|
122
|
-
"""Make an Airtable API call"""
|
|
123
|
-
if not token:
|
|
124
|
-
return {"error": "No Airtable API token provided. Use --token, --config, or set AIRTABLE_PERSONAL_ACCESS_TOKEN environment variable."}
|
|
125
|
-
|
|
126
|
-
headers = {
|
|
127
|
-
"Authorization": f"Bearer {token}",
|
|
128
|
-
"Content-Type": "application/json"
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
url = f"https://api.airtable.com/v0/{endpoint}"
|
|
132
|
-
|
|
133
|
-
try:
|
|
134
|
-
if method == "GET":
|
|
135
|
-
response = requests.get(url, headers=headers, params=params)
|
|
136
|
-
elif method == "POST":
|
|
137
|
-
response = requests.post(url, headers=headers, json=data)
|
|
138
|
-
elif method == "PATCH":
|
|
139
|
-
response = requests.patch(url, headers=headers, json=data)
|
|
140
|
-
elif method == "DELETE":
|
|
141
|
-
response = requests.delete(url, headers=headers, params=params)
|
|
142
|
-
else:
|
|
143
|
-
raise ValueError(f"Unsupported method: {method}")
|
|
144
|
-
|
|
145
|
-
response.raise_for_status()
|
|
146
|
-
return response.json()
|
|
147
|
-
except Exception as e:
|
|
148
|
-
logger.error(f"API call error: {str(e)}")
|
|
149
|
-
return {"error": str(e)}
|
|
150
|
-
|
|
151
|
-
# Define MCP tool functions
|
|
152
|
-
@app.tool()
|
|
153
|
-
async def list_bases() -> str:
|
|
154
|
-
"""List all accessible Airtable bases"""
|
|
155
|
-
if not token:
|
|
156
|
-
return "Please provide an Airtable API token to list your bases."
|
|
157
|
-
|
|
158
|
-
result = await api_call("meta/bases")
|
|
159
|
-
|
|
160
|
-
if "error" in result:
|
|
161
|
-
return f"Error: {result['error']}"
|
|
162
|
-
|
|
163
|
-
bases = result.get("bases", [])
|
|
164
|
-
if not bases:
|
|
165
|
-
return "No bases found accessible with your token."
|
|
166
|
-
|
|
167
|
-
base_list = [f"{i+1}. {base['name']} (ID: {base['id']})" for i, base in enumerate(bases)]
|
|
168
|
-
return "Available bases:\n" + "\n".join(base_list)
|
|
169
|
-
|
|
170
|
-
@app.tool()
|
|
171
|
-
async def list_tables(base_id_param: Optional[str] = None) -> str:
|
|
172
|
-
"""List all tables in the specified base or the default base"""
|
|
173
|
-
global base_id
|
|
174
|
-
current_base = base_id_param or base_id
|
|
175
|
-
|
|
176
|
-
if not token:
|
|
177
|
-
return "Please provide an Airtable API token to list tables."
|
|
178
|
-
|
|
179
|
-
if not current_base:
|
|
180
|
-
return "Error: No base ID provided. Please specify a base_id or set AIRTABLE_BASE_ID environment variable."
|
|
181
|
-
|
|
182
|
-
result = await api_call(f"meta/bases/{current_base}/tables")
|
|
183
|
-
|
|
184
|
-
if "error" in result:
|
|
185
|
-
return f"Error: {result['error']}"
|
|
186
|
-
|
|
187
|
-
tables = result.get("tables", [])
|
|
188
|
-
if not tables:
|
|
189
|
-
return "No tables found in this base."
|
|
190
|
-
|
|
191
|
-
table_list = [f"{i+1}. {table['name']} (ID: {table['id']}, Fields: {len(table.get('fields', []))})"
|
|
192
|
-
for i, table in enumerate(tables)]
|
|
193
|
-
return "Tables in this base:\n" + "\n".join(table_list)
|
|
194
|
-
|
|
195
|
-
@app.tool()
|
|
196
|
-
async def list_records(table_name: str, max_records: Optional[int] = 100, filter_formula: Optional[str] = None) -> str:
|
|
197
|
-
"""List records from a table with optional filtering"""
|
|
198
|
-
if not token:
|
|
199
|
-
return "Please provide an Airtable API token to list records."
|
|
200
|
-
|
|
201
|
-
if not base_id:
|
|
202
|
-
return "Error: No base ID set. Please use --base or set AIRTABLE_BASE_ID environment variable."
|
|
203
|
-
|
|
204
|
-
params = {"maxRecords": max_records}
|
|
205
|
-
|
|
206
|
-
if filter_formula:
|
|
207
|
-
params["filterByFormula"] = filter_formula
|
|
208
|
-
|
|
209
|
-
result = await api_call(f"{base_id}/{table_name}", params=params)
|
|
210
|
-
|
|
211
|
-
if "error" in result:
|
|
212
|
-
return f"Error: {result['error']}"
|
|
213
|
-
|
|
214
|
-
records = result.get("records", [])
|
|
215
|
-
if not records:
|
|
216
|
-
return "No records found in this table."
|
|
217
|
-
|
|
218
|
-
# Format the records for display
|
|
219
|
-
formatted_records = []
|
|
220
|
-
for i, record in enumerate(records):
|
|
221
|
-
record_id = record.get("id", "unknown")
|
|
222
|
-
fields = record.get("fields", {})
|
|
223
|
-
field_text = ", ".join([f"{k}: {v}" for k, v in fields.items()])
|
|
224
|
-
formatted_records.append(f"{i+1}. ID: {record_id} - {field_text}")
|
|
225
|
-
|
|
226
|
-
return "Records:\n" + "\n".join(formatted_records)
|
|
227
|
-
|
|
228
|
-
@app.tool()
|
|
229
|
-
async def get_record(table_name: str, record_id: str) -> str:
|
|
230
|
-
"""Get a specific record from a table"""
|
|
231
|
-
if not token:
|
|
232
|
-
return "Please provide an Airtable API token to get records."
|
|
233
|
-
|
|
234
|
-
if not base_id:
|
|
235
|
-
return "Error: No base ID set. Please set AIRTABLE_BASE_ID environment variable."
|
|
236
|
-
|
|
237
|
-
result = await api_call(f"{base_id}/{table_name}/{record_id}")
|
|
238
|
-
|
|
239
|
-
if "error" in result:
|
|
240
|
-
return f"Error: {result['error']}"
|
|
241
|
-
|
|
242
|
-
fields = result.get("fields", {})
|
|
243
|
-
if not fields:
|
|
244
|
-
return f"Record {record_id} found but contains no fields."
|
|
245
|
-
|
|
246
|
-
# Format the fields for display
|
|
247
|
-
formatted_fields = []
|
|
248
|
-
for key, value in fields.items():
|
|
249
|
-
formatted_fields.append(f"{key}: {value}")
|
|
250
|
-
|
|
251
|
-
return f"Record ID: {record_id}\n" + "\n".join(formatted_fields)
|
|
252
|
-
|
|
253
|
-
@app.tool()
|
|
254
|
-
async def create_records(table_name: str, records_json: str) -> str:
|
|
255
|
-
"""Create records in a table from JSON string"""
|
|
256
|
-
if not token:
|
|
257
|
-
return "Please provide an Airtable API token to create records."
|
|
258
|
-
|
|
259
|
-
if not base_id:
|
|
260
|
-
return "Error: No base ID set. Please set AIRTABLE_BASE_ID environment variable."
|
|
261
|
-
|
|
262
|
-
try:
|
|
263
|
-
records_data = json.loads(records_json)
|
|
264
|
-
|
|
265
|
-
# Format the records for Airtable API
|
|
266
|
-
if not isinstance(records_data, list):
|
|
267
|
-
records_data = [records_data]
|
|
268
|
-
|
|
269
|
-
records = [{"fields": record} for record in records_data]
|
|
270
|
-
|
|
271
|
-
data = {"records": records}
|
|
272
|
-
result = await api_call(f"{base_id}/{table_name}", method="POST", data=data)
|
|
273
|
-
|
|
274
|
-
if "error" in result:
|
|
275
|
-
return f"Error: {result['error']}"
|
|
276
|
-
|
|
277
|
-
created_records = result.get("records", [])
|
|
278
|
-
return f"Successfully created {len(created_records)} records."
|
|
279
|
-
|
|
280
|
-
except json.JSONDecodeError:
|
|
281
|
-
return "Error: Invalid JSON format in records_json parameter."
|
|
282
|
-
except Exception as e:
|
|
283
|
-
return f"Error creating records: {str(e)}"
|
|
284
|
-
|
|
285
|
-
@app.tool()
|
|
286
|
-
async def update_records(table_name: str, records_json: str) -> str:
|
|
287
|
-
"""Update records in a table from JSON string"""
|
|
288
|
-
if not token:
|
|
289
|
-
return "Please provide an Airtable API token to update records."
|
|
290
|
-
|
|
291
|
-
if not base_id:
|
|
292
|
-
return "Error: No base ID set. Please set AIRTABLE_BASE_ID environment variable."
|
|
293
|
-
|
|
294
|
-
try:
|
|
295
|
-
records_data = json.loads(records_json)
|
|
296
|
-
|
|
297
|
-
# Format the records for Airtable API
|
|
298
|
-
if not isinstance(records_data, list):
|
|
299
|
-
records_data = [records_data]
|
|
300
|
-
|
|
301
|
-
records = []
|
|
302
|
-
for record in records_data:
|
|
303
|
-
if "id" not in record:
|
|
304
|
-
return "Error: Each record must have an 'id' field."
|
|
305
|
-
|
|
306
|
-
rec_id = record.pop("id")
|
|
307
|
-
fields = record.get("fields", record) # Support both {id, fields} format and direct fields
|
|
308
|
-
records.append({"id": rec_id, "fields": fields})
|
|
309
|
-
|
|
310
|
-
data = {"records": records}
|
|
311
|
-
result = await api_call(f"{base_id}/{table_name}", method="PATCH", data=data)
|
|
312
|
-
|
|
313
|
-
if "error" in result:
|
|
314
|
-
return f"Error: {result['error']}"
|
|
315
|
-
|
|
316
|
-
updated_records = result.get("records", [])
|
|
317
|
-
return f"Successfully updated {len(updated_records)} records."
|
|
318
|
-
|
|
319
|
-
except json.JSONDecodeError:
|
|
320
|
-
return "Error: Invalid JSON format in records_json parameter."
|
|
321
|
-
except Exception as e:
|
|
322
|
-
return f"Error updating records: {str(e)}"
|
|
323
|
-
|
|
324
|
-
@app.tool()
|
|
325
|
-
async def set_base_id(base_id_param: str) -> str:
|
|
326
|
-
"""Set the current Airtable base ID"""
|
|
327
|
-
global base_id
|
|
328
|
-
base_id = base_id_param
|
|
329
|
-
return f"Base ID set to: {base_id}"
|
|
330
|
-
|
|
331
|
-
# Note: rpc_method is not available in the current MCP version
|
|
332
|
-
# These methods would be used for Claude-specific functionality
|
|
333
|
-
# but are not needed for basic MCP operation
|
|
334
|
-
|
|
335
|
-
# Start the server
|
|
336
|
-
if __name__ == "__main__":
|
|
337
|
-
app.start()
|
package/publish-steps.txt
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
# Steps to Publish to npm
|
|
2
|
-
|
|
3
|
-
## 1. Login to npm
|
|
4
|
-
```
|
|
5
|
-
npm login
|
|
6
|
-
```
|
|
7
|
-
|
|
8
|
-
## 2. Publish the package
|
|
9
|
-
```
|
|
10
|
-
npm publish --access public
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
## 3. Create GitHub Release
|
|
14
|
-
1. Go to https://github.com/rashidazarang/airtable-mcp/releases
|
|
15
|
-
2. Click "Draft a new release"
|
|
16
|
-
3. Select the tag: v1.2.0
|
|
17
|
-
4. Title: "v1.2.0: Claude & Windsurf Compatibility"
|
|
18
|
-
5. Copy and paste the content from RELEASE_NOTES_v1.2.0.md
|
|
19
|
-
6. Attach the file: rashidazarang-airtable-mcp-1.2.0.tgz
|
|
20
|
-
7. Click "Publish release"
|
|
21
|
-
|
|
22
|
-
## 4. Update Smithery
|
|
23
|
-
If you use Smithery, make sure to update the repository there:
|
|
24
|
-
1. Login to Smithery
|
|
25
|
-
2. Go to your package
|
|
26
|
-
3. Update the version information
|
|
27
|
-
4. Publish the update
|
package/quick_test.sh
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
echo "🔌 Airtable MCP Quick Tests"
|
|
4
|
-
echo "==========================="
|
|
5
|
-
|
|
6
|
-
# Test 1: List Tables
|
|
7
|
-
echo "📊 Testing: List Tables"
|
|
8
|
-
curl -s -X POST http://localhost:8010/mcp \
|
|
9
|
-
-H "Content-Type: application/json" \
|
|
10
|
-
-d '{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {"name": "list_tables"}}' | jq '.result.content[0].text'
|
|
11
|
-
|
|
12
|
-
echo -e "\n"
|
|
13
|
-
|
|
14
|
-
# Test 2: List Records from Requests
|
|
15
|
-
echo "📄 Testing: List Records (Requests)"
|
|
16
|
-
curl -s -X POST http://localhost:8010/mcp \
|
|
17
|
-
-H "Content-Type: application/json" \
|
|
18
|
-
-d '{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {"name": "list_records", "arguments": {"table_name": "requests", "max_records": 2}}}' | jq '.result.content[0].text'
|
|
19
|
-
|
|
20
|
-
echo -e "\n"
|
|
21
|
-
|
|
22
|
-
# Test 3: List Records from Providers
|
|
23
|
-
echo "👥 Testing: List Records (Providers)"
|
|
24
|
-
curl -s -X POST http://localhost:8010/mcp \
|
|
25
|
-
-H "Content-Type: application/json" \
|
|
26
|
-
-d '{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {"name": "list_records", "arguments": {"table_name": "providers", "max_records": 2}}}' | jq '.result.content[0].text'
|
|
27
|
-
|
|
28
|
-
echo -e "\n✅ All quick tests completed!"
|
|
29
|
-
|
|
30
|
-
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/requirements.txt
DELETED
package/setup.py
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
|
|
3
|
-
from setuptools import setup, find_packages
|
|
4
|
-
|
|
5
|
-
with open("README.md", "r", encoding="utf-8") as fh:
|
|
6
|
-
long_description = fh.read()
|
|
7
|
-
|
|
8
|
-
with open("requirements.txt", "r", encoding="utf-8") as req_file:
|
|
9
|
-
requirements = req_file.read().splitlines()
|
|
10
|
-
|
|
11
|
-
setup(
|
|
12
|
-
name="airtable-mcp",
|
|
13
|
-
version="1.1.0",
|
|
14
|
-
author="Rashid Azarang",
|
|
15
|
-
author_email="rashidazarang@gmail.com",
|
|
16
|
-
description="Airtable MCP for AI tools - updated to work with MCP SDK 1.4.1+",
|
|
17
|
-
long_description=long_description,
|
|
18
|
-
long_description_content_type="text/markdown",
|
|
19
|
-
url="https://github.com/rashidazarang/airtable-mcp",
|
|
20
|
-
packages=find_packages(),
|
|
21
|
-
install_requires=requirements,
|
|
22
|
-
classifiers=[
|
|
23
|
-
"Programming Language :: Python :: 3.10",
|
|
24
|
-
"License :: OSI Approved :: MIT License",
|
|
25
|
-
"Operating System :: OS Independent",
|
|
26
|
-
],
|
|
27
|
-
python_requires=">=3.10",
|
|
28
|
-
include_package_data=True,
|
|
29
|
-
)
|
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
"""
|
|
3
|
-
Simple Airtable MCP Server for Claude
|
|
4
|
-
-------------------------------------
|
|
5
|
-
A minimal MCP server that implements Airtable tools and Claude's special methods
|
|
6
|
-
"""
|
|
7
|
-
import os
|
|
8
|
-
import sys
|
|
9
|
-
import json
|
|
10
|
-
import logging
|
|
11
|
-
import requests
|
|
12
|
-
import traceback
|
|
13
|
-
from typing import Dict, Any, List, Optional
|
|
14
|
-
|
|
15
|
-
# Check if MCP SDK is installed
|
|
16
|
-
try:
|
|
17
|
-
from mcp.server.fastmcp import FastMCP
|
|
18
|
-
except ImportError:
|
|
19
|
-
print("Error: MCP SDK not found. Please install with 'pip install mcp'")
|
|
20
|
-
sys.exit(1)
|
|
21
|
-
|
|
22
|
-
# Parse command line arguments
|
|
23
|
-
if len(sys.argv) < 5:
|
|
24
|
-
print("Usage: python3 simple_airtable_server.py --token YOUR_TOKEN --base YOUR_BASE_ID")
|
|
25
|
-
sys.exit(1)
|
|
26
|
-
|
|
27
|
-
# Get the token and base ID from command line arguments
|
|
28
|
-
token = None
|
|
29
|
-
base_id = None
|
|
30
|
-
for i in range(1, len(sys.argv)):
|
|
31
|
-
if sys.argv[i] == "--token" and i+1 < len(sys.argv):
|
|
32
|
-
token = sys.argv[i+1]
|
|
33
|
-
elif sys.argv[i] == "--base" and i+1 < len(sys.argv):
|
|
34
|
-
base_id = sys.argv[i+1]
|
|
35
|
-
|
|
36
|
-
if not token:
|
|
37
|
-
print("Error: No Airtable token provided. Use --token parameter.")
|
|
38
|
-
sys.exit(1)
|
|
39
|
-
|
|
40
|
-
if not base_id:
|
|
41
|
-
print("Error: No base ID provided. Use --base parameter.")
|
|
42
|
-
sys.exit(1)
|
|
43
|
-
|
|
44
|
-
# Set up logging
|
|
45
|
-
logging.basicConfig(level=logging.INFO)
|
|
46
|
-
logger = logging.getLogger("airtable-mcp")
|
|
47
|
-
|
|
48
|
-
# Create MCP server
|
|
49
|
-
app = FastMCP("Airtable Tools")
|
|
50
|
-
|
|
51
|
-
# Helper function for Airtable API calls
|
|
52
|
-
async def airtable_api_call(endpoint, method="GET", data=None, params=None):
|
|
53
|
-
"""Make an Airtable API call with error handling"""
|
|
54
|
-
headers = {
|
|
55
|
-
"Authorization": f"Bearer {token}",
|
|
56
|
-
"Content-Type": "application/json"
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
url = f"https://api.airtable.com/v0/{endpoint}"
|
|
60
|
-
|
|
61
|
-
try:
|
|
62
|
-
if method == "GET":
|
|
63
|
-
response = requests.get(url, headers=headers, params=params)
|
|
64
|
-
elif method == "POST":
|
|
65
|
-
response = requests.post(url, headers=headers, json=data)
|
|
66
|
-
else:
|
|
67
|
-
raise ValueError(f"Unsupported method: {method}")
|
|
68
|
-
|
|
69
|
-
response.raise_for_status()
|
|
70
|
-
return response.json()
|
|
71
|
-
except Exception as e:
|
|
72
|
-
logger.error(f"API call error: {str(e)}")
|
|
73
|
-
return {"error": str(e)}
|
|
74
|
-
|
|
75
|
-
# Claude-specific methods
|
|
76
|
-
@app.rpc_method("resources/list")
|
|
77
|
-
async def resources_list(params: Dict = None) -> Dict:
|
|
78
|
-
"""List available Airtable resources for Claude"""
|
|
79
|
-
try:
|
|
80
|
-
# Return a simple list of resources
|
|
81
|
-
resources = [
|
|
82
|
-
{"id": "airtable_tables", "name": "Airtable Tables", "description": "Tables in your Airtable base"}
|
|
83
|
-
]
|
|
84
|
-
return {"resources": resources}
|
|
85
|
-
except Exception as e:
|
|
86
|
-
logger.error(f"Error in resources/list: {str(e)}")
|
|
87
|
-
return {"error": {"code": -32000, "message": str(e)}}
|
|
88
|
-
|
|
89
|
-
@app.rpc_method("prompts/list")
|
|
90
|
-
async def prompts_list(params: Dict = None) -> Dict:
|
|
91
|
-
"""List available prompts for Claude"""
|
|
92
|
-
try:
|
|
93
|
-
# Return a simple list of prompts
|
|
94
|
-
prompts = [
|
|
95
|
-
{"id": "tables_prompt", "name": "List Tables", "description": "List all tables"}
|
|
96
|
-
]
|
|
97
|
-
return {"prompts": prompts}
|
|
98
|
-
except Exception as e:
|
|
99
|
-
logger.error(f"Error in prompts/list: {str(e)}")
|
|
100
|
-
return {"error": {"code": -32000, "message": str(e)}}
|
|
101
|
-
|
|
102
|
-
# Airtable tool functions
|
|
103
|
-
@app.tool()
|
|
104
|
-
async def list_tables() -> str:
|
|
105
|
-
"""List all tables in the specified base"""
|
|
106
|
-
try:
|
|
107
|
-
result = await airtable_api_call(f"meta/bases/{base_id}/tables")
|
|
108
|
-
|
|
109
|
-
if "error" in result:
|
|
110
|
-
return f"Error: {result['error']}"
|
|
111
|
-
|
|
112
|
-
tables = result.get("tables", [])
|
|
113
|
-
if not tables:
|
|
114
|
-
return "No tables found in this base."
|
|
115
|
-
|
|
116
|
-
table_list = [f"{i+1}. {table['name']} (ID: {table['id']})"
|
|
117
|
-
for i, table in enumerate(tables)]
|
|
118
|
-
return "Tables in this base:\n" + "\n".join(table_list)
|
|
119
|
-
except Exception as e:
|
|
120
|
-
return f"Error listing tables: {str(e)}"
|
|
121
|
-
|
|
122
|
-
@app.tool()
|
|
123
|
-
async def list_records(table_name: str, max_records: int = 100) -> str:
|
|
124
|
-
"""List records from a table"""
|
|
125
|
-
try:
|
|
126
|
-
params = {"maxRecords": max_records}
|
|
127
|
-
result = await airtable_api_call(f"{base_id}/{table_name}", params=params)
|
|
128
|
-
|
|
129
|
-
if "error" in result:
|
|
130
|
-
return f"Error: {result['error']}"
|
|
131
|
-
|
|
132
|
-
records = result.get("records", [])
|
|
133
|
-
if not records:
|
|
134
|
-
return "No records found in this table."
|
|
135
|
-
|
|
136
|
-
# Format the records for display
|
|
137
|
-
formatted_records = []
|
|
138
|
-
for i, record in enumerate(records):
|
|
139
|
-
record_id = record.get("id", "unknown")
|
|
140
|
-
fields = record.get("fields", {})
|
|
141
|
-
field_text = ", ".join([f"{k}: {v}" for k, v in fields.items()])
|
|
142
|
-
formatted_records.append(f"{i+1}. ID: {record_id} - {field_text}")
|
|
143
|
-
|
|
144
|
-
return "Records:\n" + "\n".join(formatted_records)
|
|
145
|
-
except Exception as e:
|
|
146
|
-
return f"Error listing records: {str(e)}"
|
|
147
|
-
|
|
148
|
-
# Start the server
|
|
149
|
-
if __name__ == "__main__":
|
|
150
|
-
print(f"Starting Airtable MCP Server with token {token[:5]}...{token[-5:]} and base {base_id}")
|
|
151
|
-
app.start()
|
package/smithery.yaml
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
# Smithery.ai configuration
|
|
2
|
-
name: "@rashidazarang/airtable-mcp"
|
|
3
|
-
version: "1.2.4"
|
|
4
|
-
description: "Connect your AI tools directly to Airtable. Query, create, update, and delete records using natural language. Features include base management, table operations, schema manipulation, record filtering, and data migration—all through a standardized MCP interface compatible with Claude Desktop and other Claude-powered editors."
|
|
5
|
-
|
|
6
|
-
startCommand:
|
|
7
|
-
type: stdio
|
|
8
|
-
configSchema:
|
|
9
|
-
type: object
|
|
10
|
-
properties:
|
|
11
|
-
airtable_token:
|
|
12
|
-
type: string
|
|
13
|
-
description: "Your Airtable Personal Access Token"
|
|
14
|
-
required: true
|
|
15
|
-
base_id:
|
|
16
|
-
type: string
|
|
17
|
-
description: "Your default Airtable base ID"
|
|
18
|
-
required: true
|
|
19
|
-
required: ["airtable_token", "base_id"]
|
|
20
|
-
commandFunction: |
|
|
21
|
-
(config) => {
|
|
22
|
-
// Use the working JavaScript implementation
|
|
23
|
-
return {
|
|
24
|
-
command: "node",
|
|
25
|
-
args: ["airtable_simple.js", "--token", config.airtable_token, "--base", config.base_id],
|
|
26
|
-
env: {
|
|
27
|
-
AIRTABLE_TOKEN: config.airtable_token,
|
|
28
|
-
AIRTABLE_BASE_ID: config.base_id
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
listTools:
|
|
34
|
-
command: "node"
|
|
35
|
-
args: ["airtable_simple.js", "--list-tools"]
|
|
36
|
-
env: {}
|
|
37
|
-
|
|
38
|
-
build:
|
|
39
|
-
dockerfile: "Dockerfile.node"
|
|
40
|
-
|
|
41
|
-
metadata:
|
|
42
|
-
author: "Rashid Azarang"
|
|
43
|
-
license: "MIT"
|
|
44
|
-
repository: "https://github.com/rashidazarang/airtable-mcp"
|
|
45
|
-
homepage: "https://github.com/rashidazarang/airtable-mcp#readme"
|