sulaiman013/AIRTABLE-MCP
If you are the rightful owner of AIRTABLE-MCP and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
The Airtable MCP Server is a sophisticated server that facilitates interaction between AI assistants and Airtable databases using natural language, leveraging the Model Context Protocol (MCP).
Airtable MCP Server
An advanced Model Context Protocol (MCP) server that enables AI assistants to interact with Airtable databases through natural language. Features intelligent filtering, aggregation, and comprehensive security validation.
Features โข Installation โข Configuration โข Usage โข Tools โข Security
๐ Features
- Advanced Filtering: Date range filtering, formula-based queries, and field-specific searches
- Data Aggregation: Sum, count, average, min/max operations with grouping support
- Intelligent Search: Natural language date parsing and partial text matching
- Comprehensive Security: Input validation, dangerous pattern detection, and sanitization
- Schema Inspection: Detailed table structure and field type information
- Field Analysis: Extract unique values and analyze field distributions
- Error Handling: Detailed logging and user-friendly error messages
- No Rate Limiting: Optimized for smooth, uninterrupted operations
๐ Prerequisites
- Python 3.9 or higher
- Airtable account with API key (Personal Access Token)
- MCP-compatible client (Claude Desktop, Cursor, VS Code, etc.)
๐ ๏ธ Installation
Using uv
(Recommended)
# Install with uv
uvx install airtable-mcp-server
# Or install from GitHub
uvx install git+https://github.com/yourusername/airtable-mcp-server.git
Using pip
# Clone the repository
git clone https://github.com/yourusername/airtable-mcp-server.git
cd airtable-mcp-server
# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
โ๏ธ Configuration
1. Set up Airtable API Key
Create a .env
file in the project root:
AIRTABLE_API_KEY=patXXXXXXXXXXXXXX
To get your API key:
- Go to Airtable Account
- Generate a personal access token with appropriate scopes
- Copy the token (starts with
pat
)
2. Configure MCP Client
Claude Desktop
Add to your Claude Desktop configuration:
{
"mcpServers": {
"airtable": {
"command": "python",
"args": ["/path/to/airtable-mcp-server/server.py"],
"env": {
"AIRTABLE_API_KEY": "patXXXXXXXXXXXXXX"
}
}
}
}
VS Code / Cursor
Add to .vscode/mcp.json
or user settings:
{
"mcpServers": {
"airtable": {
"command": "uvx",
"args": ["airtable-mcp-server"],
"env": {
"AIRTABLE_API_KEY": "patXXXXXXXXXXXXXX"
}
}
}
}
๐ง Available Tools
1. list_bases
List all accessible Airtable bases.
Example: "Show me all my Airtable bases"
2. list_tables
List all tables in a specific base.
Parameters:
base_id
(required): The Airtable base ID
Example: "List tables in base appXXXXXXXXXXXXXX"
3. search_records
Search and filter records with advanced options.
Parameters:
base_id
(required): The Airtable base IDtable_id
(required): The table IDfilter_by_formula
: Airtable formula for filteringsearch_field
: Field name to search insearch_value
: Value to search fordate_field
: Field name for date filteringdate_range
: Date range (e.g., "May 2024", "2024-05")max_records
: Maximum records to return (default: 100)fields
: Specific fields to return
Example: "Find all sales records from May 2024 where amount > 1000"
4. aggregate_records
Perform aggregation operations on records.
Parameters:
base_id
(required): The Airtable base IDtable_id
(required): The table IDoperation
(required): sum, count, avg, average, min, or maxfield
: Field to aggregate (for sum/avg/min/max)filter_by_formula
: Airtable formula for filteringgroup_by
: Field to group results bydate_field
: Field name for date filteringdate_range
: Date range for filtering
Example: "Calculate total revenue by product category for Q2 2024"
5. get_field_values
Get distinct values from a field.
Parameters:
base_id
(required): The Airtable base IDtable_id
(required): The table IDfield
(required): Field name to get values fromunique
: Return only unique values (default: true)
Example: "Show me all unique customer names"
6. get_table_schema
Get detailed schema information about a table.
Parameters:
base_id
(required): The Airtable base IDtable_id
(required): The table ID
Example: "Show me the structure of the Orders table"
๐ Usage Examples
Basic Queries
"List all my Airtable bases"
"Show tables in my CRM base"
"Find records where Status is 'Active'"
Advanced Filtering
"Find all orders from May 2024 with amount greater than $1000"
"Search for customers with 'John' in their name"
"Show projects due this month"
Aggregation Queries
"Calculate total sales by region"
"Count active projects by team"
"What's the average order value for premium customers?"
Schema Exploration
"What fields are in the Customers table?"
"Show me all product categories in the inventory"
"Describe the Orders table structure"
๐ Security
This server implements comprehensive security measures:
- Input Validation: Strict validation of all Airtable IDs and parameters
- Pattern Detection: Blocks potentially dangerous content (XSS, SQL injection attempts)
- Data Sanitization: Automatic sanitization of suspicious content
- Error Handling: Sanitized error messages prevent information leakage
- Type Safety: Strong typing prevents type confusion attacks
- Rate Limiting: Built-in protections against abuse (configurable)
See validators.py
for implementation details.
๐งช Development
Running Tests
# Run all tests
pytest
# Run with coverage
pytest --cov=src
# Run specific test
pytest tests/test_validators.py
Local Development
# Install in development mode
pip install -e .
# Run the server locally
python src/server.py
# Enable debug logging
export MCP_DEBUG=true
python src/server.py
๐ Logging
Logs are written to:
- Console output (configurable level)
airtable_mcp.log
file (UTF-8 encoded)
Configure logging level:
# In server.py
logging.basicConfig(level=logging.DEBUG) # For verbose output
๐ค Contributing
We welcome contributions! Please see our for details.
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
๐ Troubleshooting
Common Issues
"Base ID not found"
- Ensure your API key has access to the base
- Verify the base ID format (starts with
app
)
"Invalid table ID"
- Check table ID format (starts with
tbl
) - Confirm table exists in the specified base
"Authentication failed"
- Verify your API key is correct
- Check if the token has required scopes
Date filtering not working
- Ensure date field contains proper date values
- Use supported formats: "May 2024", "2024-05", "2024-05-15"
๐ License
This project is licensed under the MIT License - see the file for details.
๐ Acknowledgments
- Airtable for their excellent API
- Anthropic for the Model Context Protocol
- pyairtable for the Python SDK
- MCP community for inspiration and best practices
๐ Resources
- Model Context Protocol Documentation
- Airtable API Documentation
- MCP Python SDK
- Airtable Formula Reference