@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
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ /**
3
+ * Airtable MCP Server - Main Export
4
+ *
5
+ * This module exports the main server functionality for programmatic use.
6
+ * For CLI usage, use the bin/airtable-mcp.js executable.
7
+ */
8
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
9
+ if (k2 === undefined) k2 = k;
10
+ var desc = Object.getOwnPropertyDescriptor(m, k);
11
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
12
+ desc = { enumerable: true, get: function() { return m[k]; } };
13
+ }
14
+ Object.defineProperty(o, k2, desc);
15
+ }) : (function(o, m, k, k2) {
16
+ if (k2 === undefined) k2 = k;
17
+ o[k2] = m[k];
18
+ }));
19
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
20
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
21
+ };
22
+ Object.defineProperty(exports, "__esModule", { value: true });
23
+ exports.start = void 0;
24
+ var airtable_mcp_server_1 = require("./airtable-mcp-server");
25
+ Object.defineProperty(exports, "start", { enumerable: true, get: function () { return airtable_mcp_server_1.start; } });
26
+ __exportStar(require("./errors"), exports);
27
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/typescript/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;;AAEH,6DAA8C;AAArC,4GAAA,KAAK,OAAA;AACd,2CAAyB"}
package/package.json CHANGED
@@ -1,17 +1,42 @@
1
1
  {
2
2
  "name": "@rashidazarang/airtable-mcp",
3
- "version": "3.0.0",
4
- "description": "Advanced AI-powered Airtable MCP server with intelligent analytics, predictive modeling, and enterprise automation capabilities",
5
- "main": "airtable_simple_production.js",
3
+ "version": "3.2.5",
4
+ "description": "Advanced AI-powered Airtable MCP server with TypeScript support, intelligent analytics, predictive modeling, and enterprise automation capabilities",
5
+ "main": "dist/typescript/index.js",
6
+ "exports": {
7
+ ".": {
8
+ "import": "./dist/typescript/index.js",
9
+ "require": "./dist/typescript/index.js",
10
+ "types": "./types/typescript/index.d.ts"
11
+ },
12
+ "./types": "./types/typescript/app/types.d.ts",
13
+ "./types/*": "./types/typescript/**/*.d.ts"
14
+ },
6
15
  "bin": {
7
- "airtable-mcp": "./airtable_simple_production.js"
16
+ "airtable-mcp": "./bin/airtable-mcp.js",
17
+ "airtable-mcp-cli": "./bin/airtable-crud-cli.js"
8
18
  },
9
19
  "scripts": {
10
- "start": "node airtable_simple_production.js",
11
- "start:python": "python3.10 inspector_server.py",
12
- "test": "node test_mcp_comprehensive.js",
13
- "test:quick": "./quick_test.sh",
14
- "dev": "node airtable_simple_production.js --token YOUR_TOKEN --base YOUR_BASE_ID"
20
+ "build": "tsc",
21
+ "build:watch": "tsc --watch",
22
+ "clean": "rm -rf dist",
23
+ "prebuild": "npm run clean",
24
+ "start": "node dist/typescript/airtable-mcp-server.js",
25
+ "start:dev": "ts-node src/typescript/airtable-mcp-server.ts",
26
+ "start:js": "node src/javascript/airtable_simple_production.js",
27
+ "start:python": "python3 src/python/inspector_server.py",
28
+ "test": "jest",
29
+ "test:unit": "jest tests/unit",
30
+ "test:integration": "jest tests/integration",
31
+ "test:e2e": "jest tests/e2e",
32
+ "test:types": "tsc --noEmit",
33
+ "lint": "eslint src/**/*.{js,ts}",
34
+ "lint:fix": "eslint src/**/*.{js,ts} --fix",
35
+ "format": "prettier --write \"src/**/*.{js,ts,json,md}\"",
36
+ "format:check": "prettier --check \"src/**/*.{js,ts,json,md}\"",
37
+ "dev": "nodemon --watch src --exec ts-node src/typescript/airtable-mcp-server.ts",
38
+ "prepare": "npm run build",
39
+ "prepublishOnly": "npm run build"
15
40
  },
16
41
  "keywords": [
17
42
  "airtable",
@@ -20,26 +45,47 @@
20
45
  "claude-desktop",
21
46
  "anthropic",
22
47
  "ai",
23
- "database"
48
+ "database",
49
+ "typescript",
50
+ "automation",
51
+ "enterprise",
52
+ "analytics"
24
53
  ],
25
54
  "files": [
26
- "airtable_simple.js",
27
- "airtable_simple_production.js",
55
+ "dist/",
56
+ "types/",
57
+ "bin/",
28
58
  "README.md",
29
59
  "LICENSE",
30
60
  "package.json",
31
- "examples/",
32
- "bin/"
61
+ "tsconfig.json"
33
62
  ],
63
+ "types": "types/typescript/index.d.ts",
34
64
  "author": "Rashid Azarang",
35
65
  "license": "MIT",
36
66
  "dependencies": {
67
+ "@modelcontextprotocol/sdk": "1.19.1",
37
68
  "@smithery/cli": "^1.0.0",
38
- "airtable": "^0.12.2",
39
- "dotenv": "^16.0.0"
69
+ "dotenv": "^16.0.0",
70
+ "zod": "^3.23.8"
71
+ },
72
+ "devDependencies": {
73
+ "@types/dotenv": "^8.2.0",
74
+ "@types/jest": "^29.5.0",
75
+ "@types/node": "^20.10.0",
76
+ "@typescript-eslint/eslint-plugin": "^6.0.0",
77
+ "@typescript-eslint/parser": "^6.0.0",
78
+ "eslint": "^8.50.0",
79
+ "eslint-config-prettier": "^9.0.0",
80
+ "jest": "^29.7.0",
81
+ "nodemon": "^3.0.0",
82
+ "prettier": "^3.0.0",
83
+ "ts-jest": "^29.1.0",
84
+ "ts-node": "^10.9.0",
85
+ "typescript": "^5.3.0"
40
86
  },
41
87
  "engines": {
42
- "node": ">=14.0.0"
88
+ "node": ">=18.0.0"
43
89
  },
44
90
  "repository": {
45
91
  "type": "git",
package/tsconfig.json ADDED
@@ -0,0 +1,44 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2020",
4
+ "module": "CommonJS",
5
+ "lib": ["ES2020"],
6
+ "outDir": "./dist",
7
+ "rootDir": "./src",
8
+ "strict": true,
9
+ "esModuleInterop": true,
10
+ "skipLibCheck": true,
11
+ "forceConsistentCasingInFileNames": true,
12
+ "moduleResolution": "node",
13
+ "resolveJsonModule": true,
14
+ "declaration": true,
15
+ "declarationDir": "./types",
16
+ "sourceMap": true,
17
+ "removeComments": false,
18
+ "noImplicitAny": true,
19
+ "noImplicitReturns": true,
20
+ "noImplicitThis": true,
21
+ "noUnusedLocals": true,
22
+ "noUnusedParameters": true,
23
+ "exactOptionalPropertyTypes": true,
24
+ "noImplicitOverride": true,
25
+ "noPropertyAccessFromIndexSignature": false,
26
+ "noUncheckedIndexedAccess": true,
27
+ "types": []
28
+ },
29
+ "include": [
30
+ "src/typescript/**/*"
31
+ ],
32
+ "exclude": [
33
+ "node_modules",
34
+ "dist",
35
+ "types",
36
+ "**/*.test.ts",
37
+ "**/*.spec.ts",
38
+ "src/javascript/**/*",
39
+ "src/python/**/*",
40
+ "src/typescript/prompt-templates.ts",
41
+ "src/typescript/tools-schemas.ts",
42
+ "src/typescript/**/*.d.ts"
43
+ ]
44
+ }
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export declare function start(): Promise<void>;
@@ -0,0 +1,49 @@
1
+ import { RateLimiter } from './rateLimiter';
2
+ import { Logger } from './logger';
3
+ interface RequestOptions {
4
+ method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
5
+ /**
6
+ * Path including leading slash and version segment, e.g. `/v0/meta/bases/app123`.
7
+ */
8
+ path: string;
9
+ query?: Record<string, string | number | boolean | Array<string | number | boolean> | undefined>;
10
+ body?: unknown;
11
+ baseId?: string;
12
+ idempotencyKey?: string;
13
+ }
14
+ interface ClientOptions {
15
+ baseLimiter: RateLimiter;
16
+ patLimiter: RateLimiter;
17
+ logger: Logger;
18
+ userAgent: string;
19
+ patHash: string;
20
+ maxRetries?: number;
21
+ }
22
+ export declare class AirtableClient {
23
+ private readonly baseLimiter;
24
+ private readonly patLimiter;
25
+ private readonly logger;
26
+ private readonly userAgent;
27
+ private readonly pat;
28
+ private readonly patHash;
29
+ private readonly maxRetries;
30
+ constructor(personalAccessToken: string, options: ClientOptions);
31
+ listBases(): Promise<{
32
+ bases: unknown[];
33
+ }>;
34
+ getBase(baseId: string): Promise<unknown>;
35
+ listTables(baseId: string): Promise<{
36
+ tables: unknown[];
37
+ }>;
38
+ queryRecords<T = unknown>(baseId: string, table: string, query?: RequestOptions['query']): Promise<T>;
39
+ createRecords<T = unknown>(baseId: string, table: string, payload: unknown, idempotencyKey?: string): Promise<T>;
40
+ updateRecords<T = unknown>(baseId: string, table: string, payload: unknown, idempotencyKey?: string): Promise<T>;
41
+ upsertRecords<T = unknown>(baseId: string, table: string, payload: unknown, idempotencyKey?: string): Promise<T>;
42
+ private request;
43
+ private withRetry;
44
+ private backoffWithJitter;
45
+ private performRequest;
46
+ private toDomainError;
47
+ private safeExtractErrorType;
48
+ }
49
+ export {};
@@ -0,0 +1,16 @@
1
+ import { GovernanceSnapshot } from './types';
2
+ export type LogLevel = 'error' | 'warn' | 'info' | 'debug';
3
+ export interface AirtableAuthConfig {
4
+ personalAccessToken: string;
5
+ patHash: string;
6
+ defaultBaseId?: string;
7
+ allowedBases: string[];
8
+ }
9
+ export interface AppConfig {
10
+ version: string;
11
+ auth: AirtableAuthConfig;
12
+ governance: GovernanceSnapshot;
13
+ logLevel: LogLevel;
14
+ exceptionQueueSize: number;
15
+ }
16
+ export declare function loadConfig(): AppConfig;
@@ -0,0 +1,12 @@
1
+ import { AppConfig } from './config';
2
+ import { AirtableClient } from './airtable-client';
3
+ import { GovernanceService } from './governance';
4
+ import { ExceptionStore } from './exceptions';
5
+ import { Logger } from './logger';
6
+ export interface AppContext {
7
+ config: AppConfig;
8
+ logger: Logger;
9
+ airtable: AirtableClient;
10
+ governance: GovernanceService;
11
+ exceptions: ExceptionStore;
12
+ }
@@ -0,0 +1,12 @@
1
+ import { Logger } from './logger';
2
+ import { ListExceptionsInput, ListExceptionsOutput } from './types';
3
+ import { AirtableBrainError } from '../errors';
4
+ export declare class ExceptionStore {
5
+ private readonly capacity;
6
+ private readonly items;
7
+ private readonly logger;
8
+ constructor(capacity: number, logger: Logger);
9
+ record(error: AirtableBrainError, summary: string, details?: string, proposedFix?: Record<string, unknown>): void;
10
+ list(params: ListExceptionsInput): ListExceptionsOutput;
11
+ private parseCursor;
12
+ }
@@ -0,0 +1,18 @@
1
+ import { GovernanceSnapshot } from './types';
2
+ type Operation = GovernanceSnapshot['allowedOperations'][number];
3
+ export declare class GovernanceService {
4
+ private readonly snapshot;
5
+ private readonly tablesByBase;
6
+ constructor(snapshot: GovernanceSnapshot);
7
+ ensureBaseAllowed(baseId: string): void;
8
+ ensureOperationAllowed(operation: Operation): void;
9
+ ensureTableAllowed(baseId: string, table: string): void;
10
+ listPiiPolicies(baseId: string, table: string): Array<{
11
+ field: string;
12
+ policy: string;
13
+ }>;
14
+ getSnapshot(): GovernanceSnapshot;
15
+ isTableAllowed(baseId: string, table: string): boolean;
16
+ private buildTableIndex;
17
+ }
18
+ export {};
@@ -0,0 +1,13 @@
1
+ import { LogLevel } from './config';
2
+ export type LogMetadata = Record<string, unknown>;
3
+ export declare class Logger {
4
+ private readonly level;
5
+ private readonly context;
6
+ constructor(level: LogLevel, context?: LogMetadata);
7
+ child(context: LogMetadata): Logger;
8
+ error(message: string, metadata?: LogMetadata): void;
9
+ warn(message: string, metadata?: LogMetadata): void;
10
+ info(message: string, metadata?: LogMetadata): void;
11
+ debug(message: string, metadata?: LogMetadata): void;
12
+ private log;
13
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Lightweight token-based rate limiter to enforce Airtable quotas.
3
+ * Maintains per-key queues to preserve ordering and fairness.
4
+ */
5
+ export declare class RateLimiter {
6
+ private readonly minIntervalMs;
7
+ private readonly lockByKey;
8
+ private readonly nextAvailableByKey;
9
+ constructor({ maxRequestsPerSecond }: {
10
+ maxRequestsPerSecond: number;
11
+ });
12
+ schedule(key: string): Promise<void>;
13
+ }
@@ -0,0 +1,3 @@
1
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp';
2
+ import { AppContext } from '../context';
3
+ export declare function registerCreateTool(server: McpServer, ctx: AppContext): void;
@@ -0,0 +1,3 @@
1
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp';
2
+ import { AppContext } from '../context';
3
+ export declare function registerDescribeTool(server: McpServer, ctx: AppContext): void;
@@ -0,0 +1,8 @@
1
+ import { AppContext } from '../context';
2
+ export declare function handleToolError(toolName: string, error: unknown, ctx: AppContext): {
3
+ isError: boolean;
4
+ content: {
5
+ type: "text";
6
+ text: string;
7
+ }[];
8
+ };
@@ -0,0 +1,3 @@
1
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp';
2
+ import { AppContext } from '../context';
3
+ export declare function registerAllTools(server: McpServer, ctx: AppContext): void;
@@ -0,0 +1,33 @@
1
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp';
2
+ import { AppContext } from '../context';
3
+ import { z } from 'zod';
4
+ declare const listBasesOutputSchema: z.ZodObject<{
5
+ bases: z.ZodArray<z.ZodObject<{
6
+ id: z.ZodString;
7
+ name: z.ZodString;
8
+ permissionLevel: z.ZodOptional<z.ZodString>;
9
+ }, "strip", z.ZodTypeAny, {
10
+ id: string;
11
+ name: string;
12
+ permissionLevel?: string | undefined;
13
+ }, {
14
+ id: string;
15
+ name: string;
16
+ permissionLevel?: string | undefined;
17
+ }>, "many">;
18
+ }, "strip", z.ZodTypeAny, {
19
+ bases: {
20
+ id: string;
21
+ name: string;
22
+ permissionLevel?: string | undefined;
23
+ }[];
24
+ }, {
25
+ bases: {
26
+ id: string;
27
+ name: string;
28
+ permissionLevel?: string | undefined;
29
+ }[];
30
+ }>;
31
+ export type ListBasesOutput = z.infer<typeof listBasesOutputSchema>;
32
+ export declare function registerListBasesTool(server: McpServer, ctx: AppContext): void;
33
+ export {};
@@ -0,0 +1,3 @@
1
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp';
2
+ import { AppContext } from '../context';
3
+ export declare function registerExceptionsTool(server: McpServer, ctx: AppContext): void;
@@ -0,0 +1,3 @@
1
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp';
2
+ import { AppContext } from '../context';
3
+ export declare function registerGovernanceTool(server: McpServer, ctx: AppContext): void;
@@ -0,0 +1,3 @@
1
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp';
2
+ import { AppContext } from '../context';
3
+ export declare function registerQueryTool(server: McpServer, ctx: AppContext): void;
@@ -0,0 +1,3 @@
1
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp';
2
+ import { AppContext } from '../context';
3
+ export declare function registerUpdateTool(server: McpServer, ctx: AppContext): void;
@@ -0,0 +1,3 @@
1
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp';
2
+ import { AppContext } from '../context';
3
+ export declare function registerUpsertTool(server: McpServer, ctx: AppContext): void;
@@ -0,0 +1,3 @@
1
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp';
2
+ import { AppContext } from '../context';
3
+ export declare function registerWebhookTools(server: McpServer, ctx: AppContext): void;