Skip to main content
Glama
yangkyeongmo

MCP Server for Apache Airflow

by yangkyeongmo

create_connection

Configure and store connection settings for external data sources and services in Apache Airflow, enabling secure data pipeline integration.

Instructions

Create a connection

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
conn_idYes
conn_typeYes
hostNo
portNo
loginNo
passwordNo
schemaNo
extraNo

Implementation Reference

  • The core handler function for the 'create_connection' tool. It constructs a connection request from input parameters and uses the Airflow ConnectionApi to create the connection, returning the response as text content.
    async def create_connection(
        conn_id: str,
        conn_type: str,
        host: Optional[str] = None,
        port: Optional[int] = None,
        login: Optional[str] = None,
        password: Optional[str] = None,
        schema: Optional[str] = None,
        extra: Optional[str] = None,
    ) -> List[Union[types.TextContent, types.ImageContent, types.EmbeddedResource]]:
        connection_request = {
            "connection_id": conn_id,
            "conn_type": conn_type,
        }
        if host is not None:
            connection_request["host"] = host
        if port is not None:
            connection_request["port"] = port
        if login is not None:
            connection_request["login"] = login
        if password is not None:
            connection_request["password"] = password
        if schema is not None:
            connection_request["schema"] = schema
        if extra is not None:
            connection_request["extra"] = extra
    
        response = connection_api.post_connection(connection_request=connection_request)
        return [types.TextContent(type="text", text=str(response.to_dict()))]
  • Registers the create_connection tool (along with other connection tools) by including it in the list returned by get_all_functions(), with name 'create_connection', description 'Create a connection', and is_read_only=False.
    def get_all_functions() -> list[tuple[Callable, str, str, bool]]:
        """Return list of (function, name, description, is_read_only) tuples for registration."""
        return [
            (list_connections, "list_connections", "List all connections", True),
            (create_connection, "create_connection", "Create a connection", False),
            (get_connection, "get_connection", "Get a connection by ID", True),
            (update_connection, "update_connection", "Update a connection by ID", False),
            (delete_connection, "delete_connection", "Delete a connection by ID", False),
            (test_connection, "test_connection", "Test a connection", True),
        ]
  • src/main.py:95-96 (registration)
    The generic registration loop in main.py that adds all tools (including create_connection when CONNECTION API is enabled) to the MCP app using fastmcp Tool.from_function.
    for func, name, description, *_ in functions:
        app.add_tool(Tool.from_function(func, name=name, description=description))

Latest Blog Posts

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/yangkyeongmo/mcp-server-apache-airflow'

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