@pipeworx/mcp-airtable 0.1.0
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/LICENSE +21 -0
- package/README.md +39 -0
- package/package.json +20 -0
- package/server.json +18 -0
- package/src/index.ts +168 -0
- package/tsconfig.json +14 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Pipeworx
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# mcp-airtable
|
|
2
|
+
|
|
3
|
+
Airtable MCP Pack — wraps the Airtable REST API v0
|
|
4
|
+
|
|
5
|
+
Part of the [Pipeworx](https://pipeworx.io) open MCP gateway.
|
|
6
|
+
|
|
7
|
+
## Tools
|
|
8
|
+
|
|
9
|
+
| Tool | Description |
|
|
10
|
+
|------|-------------|
|
|
11
|
+
| `airtable_list_records` | List records from an Airtable table. Supports optional formula filtering. |
|
|
12
|
+
| `airtable_get_record` | Get a single record by ID from an Airtable table. |
|
|
13
|
+
| `airtable_create_record` | Create a new record in an Airtable table. |
|
|
14
|
+
| `airtable_list_bases` | List all bases accessible to the authenticated user. |
|
|
15
|
+
| `airtable_get_base_schema` | Get the schema (tables and fields) for an Airtable base. |
|
|
16
|
+
|
|
17
|
+
## Quick Start
|
|
18
|
+
|
|
19
|
+
Add to your MCP client config:
|
|
20
|
+
|
|
21
|
+
```json
|
|
22
|
+
{
|
|
23
|
+
"mcpServers": {
|
|
24
|
+
"airtable": {
|
|
25
|
+
"url": "https://gateway.pipeworx.io/airtable/mcp"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Or use the CLI:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
npx pipeworx use airtable
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## License
|
|
38
|
+
|
|
39
|
+
MIT
|
package/package.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@pipeworx/mcp-airtable",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Airtable MCP Pack — wraps the Airtable REST API v0",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "src/index.ts",
|
|
7
|
+
"types": "src/index.ts",
|
|
8
|
+
"keywords": ["mcp", "mcp-server", "model-context-protocol", "pipeworx", "airtable"],
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "https://github.com/pipeworx-io/mcp-airtable"
|
|
13
|
+
},
|
|
14
|
+
"scripts": {
|
|
15
|
+
"typecheck": "tsc --noEmit"
|
|
16
|
+
},
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"typescript": "^5.7.0"
|
|
19
|
+
}
|
|
20
|
+
}
|
package/server.json
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
|
|
3
|
+
"name": "io.github.pipeworx-io/airtable",
|
|
4
|
+
"title": "airtaule",
|
|
5
|
+
"description": "Airtable MCP Pack — wraps the Airtable REST API v0",
|
|
6
|
+
"version": "0.1.0",
|
|
7
|
+
"websiteUrl": "https://pipeworx.io/packs/airtable",
|
|
8
|
+
"repository": {
|
|
9
|
+
"url": "https://github.com/pipeworx-io/mcp-airtable",
|
|
10
|
+
"source": "github"
|
|
11
|
+
},
|
|
12
|
+
"remotes": [
|
|
13
|
+
{
|
|
14
|
+
"type": "streamable-http",
|
|
15
|
+
"url": "https://gateway.pipeworx.io/airtable/mcp"
|
|
16
|
+
}
|
|
17
|
+
]
|
|
18
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
interface McpToolDefinition {
|
|
2
|
+
name: string;
|
|
3
|
+
description: string;
|
|
4
|
+
inputSchema: {
|
|
5
|
+
type: 'object';
|
|
6
|
+
properties: Record<string, unknown>;
|
|
7
|
+
required?: string[];
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
interface McpToolExport {
|
|
12
|
+
tools: McpToolDefinition[];
|
|
13
|
+
callTool: (name: string, args: Record<string, unknown>) => Promise<unknown>;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Airtable MCP Pack — wraps the Airtable REST API v0
|
|
18
|
+
*
|
|
19
|
+
* BYO key: _apiKey = personal access token.
|
|
20
|
+
* Auth: Bearer token.
|
|
21
|
+
* Tools: list/get records, create record, list bases, get base schema.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
const API = 'https://api.airtable.com/v0';
|
|
26
|
+
|
|
27
|
+
async function airtableGet(apiKey: string, path: string): Promise<unknown> {
|
|
28
|
+
const res = await fetch(`${API}${path}`, {
|
|
29
|
+
headers: {
|
|
30
|
+
Authorization: `Bearer ${apiKey}`,
|
|
31
|
+
'Content-Type': 'application/json',
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
if (!res.ok) {
|
|
35
|
+
const text = await res.text();
|
|
36
|
+
throw new Error(`Airtable API error (${res.status}): ${text}`);
|
|
37
|
+
}
|
|
38
|
+
return res.json();
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
async function airtablePost(apiKey: string, path: string, body: unknown): Promise<unknown> {
|
|
42
|
+
const res = await fetch(`${API}${path}`, {
|
|
43
|
+
method: 'POST',
|
|
44
|
+
headers: {
|
|
45
|
+
Authorization: `Bearer ${apiKey}`,
|
|
46
|
+
'Content-Type': 'application/json',
|
|
47
|
+
},
|
|
48
|
+
body: JSON.stringify(body),
|
|
49
|
+
});
|
|
50
|
+
if (!res.ok) {
|
|
51
|
+
const text = await res.text();
|
|
52
|
+
throw new Error(`Airtable API error (${res.status}): ${text}`);
|
|
53
|
+
}
|
|
54
|
+
return res.json();
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const tools: McpToolExport['tools'] = [
|
|
58
|
+
{
|
|
59
|
+
name: 'airtable_list_records',
|
|
60
|
+
description: 'List records from an Airtable table. Supports optional formula filtering.',
|
|
61
|
+
inputSchema: {
|
|
62
|
+
type: 'object' as const,
|
|
63
|
+
properties: {
|
|
64
|
+
_apiKey: { type: 'string', description: 'Airtable personal access token' },
|
|
65
|
+
baseId: { type: 'string', description: 'Airtable base ID (e.g., appXXXXXXXXXXXX)' },
|
|
66
|
+
tableIdOrName: { type: 'string', description: 'Table ID or name' },
|
|
67
|
+
filterByFormula: { type: 'string', description: 'Airtable formula to filter records (optional)' },
|
|
68
|
+
maxRecords: { type: 'number', description: 'Maximum number of records to return (default 100)' },
|
|
69
|
+
},
|
|
70
|
+
required: ['_apiKey', 'baseId', 'tableIdOrName'],
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
name: 'airtable_get_record',
|
|
75
|
+
description: 'Get a single record by ID from an Airtable table.',
|
|
76
|
+
inputSchema: {
|
|
77
|
+
type: 'object' as const,
|
|
78
|
+
properties: {
|
|
79
|
+
_apiKey: { type: 'string', description: 'Airtable personal access token' },
|
|
80
|
+
baseId: { type: 'string', description: 'Airtable base ID' },
|
|
81
|
+
tableIdOrName: { type: 'string', description: 'Table ID or name' },
|
|
82
|
+
recordId: { type: 'string', description: 'Record ID (e.g., recXXXXXXXXXXXX)' },
|
|
83
|
+
},
|
|
84
|
+
required: ['_apiKey', 'baseId', 'tableIdOrName', 'recordId'],
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
name: 'airtable_create_record',
|
|
89
|
+
description: 'Create a new record in an Airtable table.',
|
|
90
|
+
inputSchema: {
|
|
91
|
+
type: 'object' as const,
|
|
92
|
+
properties: {
|
|
93
|
+
_apiKey: { type: 'string', description: 'Airtable personal access token' },
|
|
94
|
+
baseId: { type: 'string', description: 'Airtable base ID' },
|
|
95
|
+
tableIdOrName: { type: 'string', description: 'Table ID or name' },
|
|
96
|
+
fields: { type: 'object', description: 'Object of field name/value pairs to set on the new record' },
|
|
97
|
+
},
|
|
98
|
+
required: ['_apiKey', 'baseId', 'tableIdOrName', 'fields'],
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
name: 'airtable_list_bases',
|
|
103
|
+
description: 'List all bases accessible to the authenticated user.',
|
|
104
|
+
inputSchema: {
|
|
105
|
+
type: 'object' as const,
|
|
106
|
+
properties: {
|
|
107
|
+
_apiKey: { type: 'string', description: 'Airtable personal access token' },
|
|
108
|
+
},
|
|
109
|
+
required: ['_apiKey'],
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
name: 'airtable_get_base_schema',
|
|
114
|
+
description: 'Get the schema (tables and fields) for an Airtable base.',
|
|
115
|
+
inputSchema: {
|
|
116
|
+
type: 'object' as const,
|
|
117
|
+
properties: {
|
|
118
|
+
_apiKey: { type: 'string', description: 'Airtable personal access token' },
|
|
119
|
+
baseId: { type: 'string', description: 'Airtable base ID' },
|
|
120
|
+
},
|
|
121
|
+
required: ['_apiKey', 'baseId'],
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
];
|
|
125
|
+
|
|
126
|
+
async function callTool(name: string, args: Record<string, unknown>): Promise<unknown> {
|
|
127
|
+
const apiKey = args._apiKey as string;
|
|
128
|
+
|
|
129
|
+
switch (name) {
|
|
130
|
+
case 'airtable_list_records': {
|
|
131
|
+
const baseId = args.baseId as string;
|
|
132
|
+
const table = encodeURIComponent(args.tableIdOrName as string);
|
|
133
|
+
const params = new URLSearchParams();
|
|
134
|
+
if (args.filterByFormula) params.set('filterByFormula', args.filterByFormula as string);
|
|
135
|
+
if (args.maxRecords) params.set('maxRecords', String(args.maxRecords));
|
|
136
|
+
const qs = params.toString();
|
|
137
|
+
return airtableGet(apiKey, `/${baseId}/${table}${qs ? `?${qs}` : ''}`);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
case 'airtable_get_record': {
|
|
141
|
+
const baseId = args.baseId as string;
|
|
142
|
+
const table = encodeURIComponent(args.tableIdOrName as string);
|
|
143
|
+
const recordId = args.recordId as string;
|
|
144
|
+
return airtableGet(apiKey, `/${baseId}/${table}/${recordId}`);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
case 'airtable_create_record': {
|
|
148
|
+
const baseId = args.baseId as string;
|
|
149
|
+
const table = encodeURIComponent(args.tableIdOrName as string);
|
|
150
|
+
const fields = args.fields as Record<string, unknown>;
|
|
151
|
+
return airtablePost(apiKey, `/${baseId}/${table}`, { fields });
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
case 'airtable_list_bases': {
|
|
155
|
+
return airtableGet(apiKey, '/meta/bases');
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
case 'airtable_get_base_schema': {
|
|
159
|
+
const baseId = args.baseId as string;
|
|
160
|
+
return airtableGet(apiKey, `/meta/bases/${baseId}/tables`);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
default:
|
|
164
|
+
throw new Error(`Unknown tool: ${name}`);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export default { tools, callTool, meter: { credits: 10 } } satisfies McpToolExport;
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "bundler",
|
|
6
|
+
"strict": true,
|
|
7
|
+
"esModuleInterop": true,
|
|
8
|
+
"skipLibCheck": true,
|
|
9
|
+
"outDir": "dist",
|
|
10
|
+
"rootDir": "src",
|
|
11
|
+
"declaration": true
|
|
12
|
+
},
|
|
13
|
+
"include": ["src"]
|
|
14
|
+
}
|