@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.
- package/README.md +62 -25
- package/bin/airtable-mcp.js +12 -32
- package/dist/typescript/airtable-mcp-server.js +77 -0
- package/dist/typescript/airtable-mcp-server.js.map +1 -0
- package/dist/typescript/app/airtable-client.js +325 -0
- package/dist/typescript/app/airtable-client.js.map +1 -0
- package/dist/typescript/app/config.js +141 -0
- package/dist/typescript/app/config.js.map +1 -0
- package/dist/typescript/app/context.js +3 -0
- package/dist/typescript/app/context.js.map +1 -0
- package/dist/typescript/app/exceptions.js +85 -0
- package/dist/typescript/app/exceptions.js.map +1 -0
- package/dist/typescript/app/governance.js +58 -0
- package/dist/typescript/app/governance.js.map +1 -0
- package/dist/typescript/app/logger.js +47 -0
- package/dist/typescript/app/logger.js.map +1 -0
- package/dist/typescript/app/rateLimiter.js +37 -0
- package/dist/typescript/app/rateLimiter.js.map +1 -0
- package/dist/typescript/app/tools/create.js +54 -0
- package/dist/typescript/app/tools/create.js.map +1 -0
- package/dist/typescript/app/tools/describe.js +146 -0
- package/dist/typescript/app/tools/describe.js.map +1 -0
- package/dist/typescript/app/tools/handleError.js +54 -0
- package/dist/typescript/app/tools/handleError.js.map +1 -0
- package/dist/typescript/app/tools/index.js +24 -0
- package/dist/typescript/app/tools/index.js.map +1 -0
- package/dist/typescript/app/tools/listBases.js +52 -0
- package/dist/typescript/app/tools/listBases.js.map +1 -0
- package/dist/typescript/app/tools/listExceptions.js +18 -0
- package/dist/typescript/app/tools/listExceptions.js.map +1 -0
- package/dist/typescript/app/tools/listGovernance.js +17 -0
- package/dist/typescript/app/tools/listGovernance.js.map +1 -0
- package/dist/typescript/app/tools/query.js +126 -0
- package/dist/typescript/app/tools/query.js.map +1 -0
- package/dist/typescript/app/tools/update.js +56 -0
- package/dist/typescript/app/tools/update.js.map +1 -0
- package/dist/typescript/app/tools/upsert.js +65 -0
- package/dist/typescript/app/tools/upsert.js.map +1 -0
- package/dist/typescript/app/tools/webhooks.js +44 -0
- package/dist/typescript/app/tools/webhooks.js.map +1 -0
- package/dist/typescript/app/types.js +282 -0
- package/dist/typescript/app/types.js.map +1 -0
- package/dist/typescript/apps-sdk/mappers.js +70 -0
- package/dist/typescript/apps-sdk/mappers.js.map +1 -0
- package/dist/typescript/errors.js +75 -0
- package/dist/typescript/errors.js.map +1 -0
- package/dist/typescript/index.js +27 -0
- package/dist/typescript/index.js.map +1 -0
- package/package.json +49 -30
- package/tsconfig.json +10 -4
- package/types/typescript/airtable-mcp-server.d.ts +2 -0
- package/types/typescript/app/airtable-client.d.ts +49 -0
- package/types/typescript/app/config.d.ts +16 -0
- package/types/typescript/app/context.d.ts +12 -0
- package/types/typescript/app/exceptions.d.ts +12 -0
- package/types/typescript/app/governance.d.ts +18 -0
- package/types/typescript/app/logger.d.ts +13 -0
- package/types/typescript/app/rateLimiter.d.ts +13 -0
- package/types/typescript/app/tools/create.d.ts +3 -0
- package/types/typescript/app/tools/describe.d.ts +3 -0
- package/types/typescript/app/tools/handleError.d.ts +8 -0
- package/types/typescript/app/tools/index.d.ts +3 -0
- package/types/typescript/app/tools/listBases.d.ts +33 -0
- package/types/typescript/app/tools/listExceptions.d.ts +3 -0
- package/types/typescript/app/tools/listGovernance.d.ts +3 -0
- package/types/typescript/app/tools/query.d.ts +3 -0
- package/types/typescript/app/tools/update.d.ts +3 -0
- package/types/typescript/app/tools/upsert.d.ts +3 -0
- package/types/typescript/app/tools/webhooks.d.ts +3 -0
- package/types/typescript/app/types.d.ts +830 -0
- package/types/typescript/apps-sdk/mappers.d.ts +53 -0
- package/types/typescript/errors.d.ts +55 -0
- package/types/typescript/index.d.ts +10 -0
- package/types/typescript/prompt-templates.d.ts +5 -0
- package/types/typescript/tools-schemas.d.ts +5 -0
- package/airtable_simple.js +0 -1561
- package/airtable_simple_production.js +0 -1564
- package/dist/airtable-mcp-server.js +0 -660
- package/dist/airtable-mcp-server.js.map +0 -1
- package/dist/test-suite.js +0 -421
- package/dist/test-suite.js.map +0 -1
- package/examples/airtable-crud-example.js +0 -203
- package/examples/building-mcp.md +0 -6666
- package/examples/claude_config.json +0 -4
- package/examples/claude_simple_config.json +0 -7
- package/examples/env-demo.js +0 -172
- package/examples/example-tasks-update.json +0 -23
- package/examples/example-tasks.json +0 -26
- package/examples/example_usage.md +0 -124
- package/examples/python_debug_patch.txt +0 -27
- package/examples/sample-transform.js +0 -76
- package/examples/typescript/advanced-ai-prompts.ts +0 -447
- package/examples/typescript/basic-usage.ts +0 -174
- package/examples/typescript/claude-desktop-config.json +0 -29
- package/examples/windsurf_mcp_config.json +0 -17
- package/types/ai-prompts.d.ts +0 -321
- package/types/airtable-mcp-server.d.ts +0 -52
- package/types/index.d.ts +0 -357
- package/types/tools.d.ts +0 -514
- /package/types/{test-suite.d.ts → typescript/test-suite.d.ts} +0 -0
|
@@ -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,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 {};
|