- Airtable MCP Server
Airtable MCP Server
Airtable MCP Server
An MCP (Model Context Protocol) server that enables AI models to interact with Airtable databases. This server provides a bridge between Large Language Models (LLMs) and Airtable, allowing for operations like creating records, listing tables, and searching data.
Features
-
🔍 Base & Table Management
- List accessible bases
- Browse tables within bases
- View table schemas
-
📝 Record Operations
- Create new records
- List existing records
- Search records using Airtable formulas
- Filter and paginate results
-
🔐 Security
- Secure API key management
- Rate limiting protection
- Input validation
- Error handling
-
🛠 Developer Features
- TypeScript support
- Comprehensive testing suite
- Detailed logging
- Easy configuration
Prerequisites
- Node.js (v16 or higher)
- npm or yarn
- Airtable account and API key
Installation
- Clone the repository
git clone https://github.com/your-username/airtable-mcp-server.git
cd airtable-mcp-server
- Install dependencies
npm install
- Configure environment variables
cp .env.example .env
Edit .env with your Airtable API key and other configuration options.
- Build the server
npm run build
Configuration
Environment Variables
| Variable | Description | Required | Default |
|---|---|---|---|
AIRTABLE_API_KEY | Your Airtable API key | Yes | - |
DEBUG | Enable debug logging | No | false |
MAX_RECORDS_PER_REQUEST | Maximum records per request | No | 100 |
REQUEST_TIMEOUT | API request timeout (ms) | No | 30000 |
RATE_LIMIT | Requests per minute | No | 5 |
Airtable API Key Setup
- Log in to your Airtable account
- Go to your account page
- Under the API section:
- Generate a new API key or use an existing one
- Copy the API key
- Add the key to your
.envfile
Usage
Starting the Server
npm start
Integration with Claude Desktop
-
Open your Claude Desktop configuration:
- Windows:
%APPDATA%\Claude\claude_desktop_config.json - macOS:
~/Library/Application Support/Claude/claude_desktop_config.json
- Windows:
-
Add the server configuration:
{
"mcpServers": {
"airtable": {
"command": "node",
"args": ["/path/to/airtable-mcp-server/dist/index.js"],
"env": {
"AIRTABLE_API_KEY": "your_api_key_here"
}
}
}
}
- Restart Claude Desktop
Available Tools
create-record
Creates a new record in an Airtable table.
{
baseId: string; // Airtable base ID
tableId: string; // Table ID or name
fields: object; // Record fields
}
list-records
Lists records from a table.
{
baseId: string; // Airtable base ID
tableId: string; // Table ID or name
maxRecords?: number; // Maximum records to return
view?: string; // Optional view name
}
search-records
Searches records using Airtable formula.
{
baseId: string; // Airtable base ID
tableId: string; // Table ID or name
filterFormula: string; // Search formula
}
Available Resources
airtable://bases- List accessible basesairtable://bases/{baseId}/tables- List tables in a baseairtable://bases/{baseId}/tables/{tableId}/schema- Get table schema
Development
Project Structure
airtable-mcp-server/
├── src/
│ ├── index.ts # Entry point
│ ├── server.ts # MCP server implementation
│ ├── airtable/
│ │ ├── client.ts # Airtable client wrapper
│ │ └── types.ts # TypeScript types
│ └── utils/
│ ├── error-handler.ts
│ └── validators.ts
├── test/
│ ├── integration.test.ts
│ ├── server.test.ts
│ └── airtable.test.ts
└── dist/ # Compiled JavaScript
Running Tests
# Run all tests
npm test
# Run with coverage
npm test -- --coverage
# Run integration tests
npm test -- integration.test.ts
Building
# Build once
npm run build
# Build in watch mode
npm run dev
Error Handling
The server implements comprehensive error handling:
- Input validation errors
- API rate limiting
- Network timeouts
- Authentication failures
- Resource not found errors
Security Considerations
- API Key Protection
- Never commit API keys to version control
- Use environment variables
- Rotate keys regularly
- Rate Limiting
- Configurable rate limits
- Protection against abuse
- Input Validation
- All inputs are validated
- Protection against injection
Contributing
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
Testing
Unit Tests
npm test
Integration Tests
# Setup test environment
cp .env.example .env.test
# Edit .env.test with test credentials
npm test -- integration.test.ts
Troubleshooting
Common Issues
-
Connection Errors
- Check API key validity
- Verify network connection
- Check rate limiting
-
Permission Errors
- Verify base access permissions
- Check API key scopes
-
Rate Limiting
- Adjust
RATE_LIMITin.env - Implement request queuing
- Add delay between requests
- Adjust
License
MIT
Support
For issues and feature requests, please open an issue.
Acknowledgments
- Model Context Protocol (MCP) team
- Airtable API team
- Contributors and maintainers