Skip to main content
Glama

Airtable OAuth MCP Server

by onimsha
test_oauth_mcp.pyโ€ข3.44 kB
#!/usr/bin/env python3 """Test script for OAuth MCP implementation.""" import asyncio import os # Set environment variables for testing os.environ["GOOGLE_CLOUD_PROJECT"] = "test-project" os.environ["AIRTABLE_CLIENT_ID"] = "your-client-id" os.environ["AIRTABLE_CLIENT_SECRET"] = "your-client-secret" os.environ["AIRTABLE_REDIRECT_URI"] = "http://localhost:8000/callback" from src.airtable_mcp.main import create_server async def test_oauth_flow(): """Test the OAuth flow implementation.""" print("๐Ÿš€ Testing Airtable OAuth MCP Server") print("=" * 50) # Create server server = create_server() print("โœ… Server created successfully") # Test OAuth authorize resource print("\n๐Ÿ“‹ Testing OAuth authorize resource...") try: auth_resource = await server.mcp.get_resource("oauth://authorize") auth_response = await auth_resource.read() print("โœ… OAuth authorization URL generated") print( "Contains Airtable OAuth URL:", "airtable.com/oauth2/v1/authorize" in auth_response, ) print("Contains state parameter:", "State parameter:" in auth_response) # Extract state parameter for testing import re state_match = re.search(r"State parameter: ([a-zA-Z0-9_-]+)", auth_response) if state_match: test_state = state_match.group(1) print(f"โœ… State parameter extracted: {test_state[:10]}...") except Exception as e: print(f"โŒ OAuth authorize resource error: {e}") return # Test OAuth status resource print("\n๐Ÿ“Š Testing OAuth status resource...") try: status_resource = await server.mcp.get_resource("oauth://status") status_response = await status_resource.read() print("โœ… OAuth status checked") print("Status message:", status_response.strip()) except Exception as e: print(f"โŒ OAuth status resource error: {e}") # Test available tools print("\n๐Ÿ”ง Testing available tools...") try: tools = await server.mcp.get_tools() print(f"โœ… Found {len(tools)} total tools") oauth_tools = [] airtable_tools = [] for tool_name in tools: if "oauth" in tool_name: oauth_tools.append(tool_name) else: airtable_tools.append(tool_name) print(f"OAuth tools ({len(oauth_tools)}): {oauth_tools}") print(f"Airtable tools ({len(airtable_tools)}): {airtable_tools[:5]}...") except Exception as e: print(f"โŒ Tools listing error: {e}") print("\n๐ŸŽ‰ OAuth MCP Implementation Summary:") print("=" * 50) print("โœ… OAuth resources: oauth://authorize, oauth://status") print("โœ… OAuth tools: oauth_callback, oauth_refresh, oauth_revoke") print("โœ… Integration with existing Airtable tools") print() print("๐Ÿ“– Usage Instructions:") print("1. Read oauth://authorize resource to get authorization URL") print("2. Visit the URL and authorize the application") print("3. Use oauth_callback tool with the authorization code") print("4. Use regular Airtable tools (list_bases, create_record, etc.)") print() print("๐Ÿ”„ OAuth Flow:") print( "MCP Client โ†’ oauth://authorize โ†’ Browser โ†’ Airtable โ†’ oauth_callback โ†’ Authenticated!" ) if __name__ == "__main__": asyncio.run(test_oauth_flow())

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/onimsha/airtable-mcp-server-oauth'

If you have feedback or need assistance with the MCP directory API, please join our Discord server