A production-ready Model Context Protocol (MCP) server for Airtable with secure OAuth 2.0 authentication. This server enables AI assistants and applications to interact with Airtable bases through a standardized MCP interface, providing complete API coverage for all Airtable operations.
- π OAuth 2.0 Authentication - Secure token-based authentication with Airtable
- π Complete Airtable API Coverage - 10 comprehensive MCP tools covering all operations
- β‘ FastMCP Framework - Built on the high-performance FastMCP framework
- βοΈ Cloud-Ready - Production-ready deployment support
- π Dual Transport - Support for both STDIO and HTTP transport protocols
- π Environment-based Configuration - Secure credential management
- β Type Safety - Full type hints and validation with Pydantic
- π§ͺ Comprehensive Testing - Unit tests with pytest and coverage reporting
- π Code Quality - Linting with Ruff and type checking with MyPy
- π Rich Documentation - Comprehensive setup and usage guides
- π§ Easy Setup - Simple installation with uv package manager
- π― Typed Parameters - Clear, typed tool parameters for better IDE support
- π Flexible Querying - Advanced filtering, sorting, and search capabilities
- Python 3.11+ - Latest Python version for optimal performance
- uv - Fast Python package manager (install guide)
- Airtable Developer Account - To create OAuth applications (sign up)
Clone the repository and install dependencies:
git clone https://github.com/onimsha/airtable-mcp-server-oauth.git
cd airtable-mcp-server-oauth
uv sync
- Create an Airtable OAuth Application:
- Visit Airtable Developer Hub
- Create a new OAuth integration
- Note your
Client ID
andClient Secret
- Set redirect URI to
http://localhost:8000/oauth/callback
Copy the environment template and configure your credentials:
cp .env.example .env
Edit .env
with your values:
# Airtable OAuth Configuration
AIRTABLE_CLIENT_ID="your_airtable_client_id_here"
AIRTABLE_CLIENT_SECRET="your_airtable_client_secret_here"
AIRTABLE_REDIRECT_URI="http://localhost:8000/oauth/callback"
# Server Configuration
HOST="0.0.0.0"
PORT=8000
LOG_LEVEL="INFO"
Use the official MCP Inspector to test and interact with your server:
-
Start the server:
uv run python -m airtable_mcp http
-
Open MCP Inspector: Visit https://modelcontextprotocol.io/docs/tools/inspector
-
Connect to your server:
- Select "HTTP Streaming" transport
- Enter the URL:
http://localhost:8000/mcp
- Click "Connect"
-
Authenticate with Airtable:
- The server will guide you through OAuth authentication
- Use the inspector to test available MCP tools
STDIO Transport (default):
uv run python -m airtable_mcp
# or
uv run airtable-oauth-mcp
HTTP Transport:
uv run python -m airtable_mcp http
# or with custom host/port
uv run python -m airtable_mcp http localhost 8001
Additional Options:
# Set log level
uv run python -m airtable_mcp --log-level DEBUG
# Show help
uv run python -m airtable_mcp --help
# Show version
uv run python -m airtable_mcp --version
The HTTP server will be available at http://localhost:8000/
(or custom host:port) with OAuth endpoints for web integration.
The server provides 10 MCP tools for Airtable operations:
Base Operations:
list_bases()
- List all accessible baseslist_tables(base_id, detail_level?)
- List tables in a basedescribe_table(base_id, table_id)
- Get detailed table schema
Record Operations:
list_records(base_id, table_id, view?, filter_by_formula?, sort?, fields?)
- List records with filteringget_record(base_id, table_id, record_id)
- Get a specific recordcreate_record(base_id, table_id, fields, typecast?)
- Create a single recordcreate_records(base_id, table_id, records, typecast?)
- Create multiple recordsupdate_records(base_id, table_id, records, typecast?)
- Update multiple recordsdelete_records(base_id, table_id, record_ids)
- Delete multiple recordssearch_records(base_id, table_id, filter_by_formula, view?, fields?)
- Search records with formulas
All tools now use typed parameters instead of generic args
, making them more transparent to MCP clients.
Parameter Flexibility:
fields
parameter accepts either a single field name (string) or array of field namessort
parameter expects array of objects:[{"field": "Name", "direction": "asc"}]
# List all records in a table
records = await client.call_tool("list_records", {
"base_id": "appXXXXXXXXXXXXXX",
"table_id": "tblYYYYYYYYYYYYYY"
})
# Create a new record
new_record = await client.call_tool("create_record", {
"base_id": "appXXXXXXXXXXXXXX",
"table_id": "tblYYYYYYYYYYYYYY",
"fields": {
"Name": "John Doe",
"Email": "[email protected]",
"Status": "Active"
}
})
# Search records with filtering
filtered_records = await client.call_tool("search_records", {
"base_id": "appXXXXXXXXXXXXXX",
"table_id": "tblYYYYYYYYYYYYYY",
"filter_by_formula": "AND({Status} = 'Active', {Email} != '')",
"fields": ["Name", "Email", "Status"]
})
# List records with sorting and filtering
records = await client.call_tool("list_records", {
"base_id": "appXXXXXXXXXXXXXX",
"table_id": "tblYYYYYYYYYYYYYY",
"view": "Grid view",
"filter_by_formula": "{Priority} = 'High'",
"sort": [
{"field": "Created", "direction": "desc"},
{"field": "Name", "direction": "asc"}
],
"fields": ["Name", "Priority", "Created", "Status"]
})
# Batch operations
batch_create = await client.call_tool("create_records", {
"base_id": "appXXXXXXXXXXXXXX",
"table_id": "tblYYYYYYYYYYYYYY",
"records": [
{"fields": {"Name": "Record 1", "Value": 100}},
{"fields": {"Name": "Record 2", "Value": 200}},
{"fields": {"Name": "Record 3", "Value": 300}}
],
"typecast": True
})
# List all bases you have access to
bases = await client.call_tool("list_bases")
# Get detailed information about a specific table
table_info = await client.call_tool("describe_table", {
"base_id": "appXXXXXXXXXXXXXX",
"table_id": "tblYYYYYYYYYYYYYY"
})
# List all tables in a base
tables = await client.call_tool("list_tables", {
"base_id": "appXXXXXXXXXXXXXX",
"detail_level": "full"
})
-
Fork and Clone:
git clone https://github.com/onimsha/airtable-mcp-server-oauth.git cd airtable-mcp-server-oauth
-
Setup Development Environment:
uv sync --all-extras
-
Run Tests:
uv run pytest uv run pytest --cov=src/airtable_mcp --cov-report=html
Type Checking:
uv run mypy src/
Linting:
uv run ruff check src/
uv run ruff format src/
Pre-commit Hooks:
pip install pre-commit
pre-commit install
The project includes comprehensive test coverage:
- Unit Tests: Test individual components and functions
- Integration Tests: Test OAuth flow and Airtable API interactions
- Coverage Reports: Ensure >90% code coverage
# Run all tests
uv run pytest
# Run with coverage
uv run pytest --cov=src/airtable_mcp
# Run specific test files
uv run pytest tests/test_oauth.py
uv run pytest tests/test_tools.py
src/
βββ airtable_mcp/ # Main MCP server package
β βββ __init__.py # Package initialization
β βββ __main__.py # Module entry point
β βββ main.py # CLI and application entry
β βββ api/ # Airtable API client
β β βββ __init__.py
β β βββ client.py # HTTP client for Airtable API
β β βββ exceptions.py # API-specific exceptions
β β βββ models.py # Pydantic models for API responses
β βββ mcp/ # MCP server implementation
β βββ __init__.py
β βββ schemas.py # MCP tool schemas
β βββ server.py # FastMCP server with tools
βββ mcp_oauth_lib/ # Reusable OAuth library
βββ __init__.py # Library initialization
βββ auth/ # Authentication components
β βββ __init__.py
β βββ context.py # Auth context management
β βββ middleware.py # OAuth middleware
β βββ utils.py # Auth utilities
βββ core/ # Core OAuth functionality
β βββ __init__.py
β βββ config.py # OAuth configuration
β βββ flow.py # OAuth flow implementation
β βββ server.py # OAuth server endpoints
βββ providers/ # OAuth provider implementations
β βββ __init__.py
β βββ airtable.py # Airtable OAuth provider
β βββ base.py # Base provider interface
βββ utils/ # OAuth utilities
βββ __init__.py
βββ pkce.py # PKCE implementation
βββ state.py # State management
All configuration is handled through environment variables (loaded from .env
):
AIRTABLE_CLIENT_ID
- OAuth client ID from AirtableAIRTABLE_CLIENT_SECRET
- OAuth client secretAIRTABLE_REDIRECT_URI
- OAuth callback URL
HOST
- Server host (default:0.0.0.0
)PORT
- Server port (default:8000
)LOG_LEVEL
- Logging level (default:INFO
)MCP_SERVER_NAME
- Server name (optional)MCP_SERVER_VERSION
- Server version (optional)
We welcome contributions! Please see our contribution guidelines:
- Fork the repository and create a feature branch
- Write tests for any new functionality
- Ensure code quality with our linting and formatting tools
- Update documentation for any API changes
- Submit a pull request with a clear description
- π Bug fixes - Help us squash bugs
- β¨ New features - Add new Airtable API endpoints
- π Documentation - Improve setup guides and examples
- π§ͺ Testing - Increase test coverage
- π Performance - Optimize API calls and caching
This project is licensed under the MIT License - see the LICENSE file for details.
- FastMCP - Excellent MCP framework
- Airtable - Powerful database platform
- Model Context Protocol - Standard for AI tool integration
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Documentation: Project Wiki