Metadata-Version: 2.4
Name: airbyte-internal-ops
Version: 0.1.9
Summary: MCP and API interfaces that let the agents do the admin work
Author-email: Aaron Steers <aj@airbyte.io>
Keywords: admin,airbyte,api,mcp
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: <3.13,>=3.11
Requires-Dist: airbyte-cdk<8.0,>=7.3.9
Requires-Dist: airbyte-protocol-models-pdv2>=0.13.0
Requires-Dist: airbyte>=0.34.0
Requires-Dist: asyncer<1.0,>=0.0.4
Requires-Dist: click<9.0,>=8.1.3
Requires-Dist: cloud-sql-python-connector[pg8000]<2.0,>=1.7.0
Requires-Dist: cyclopts<5.0,>=4.0.0
Requires-Dist: docker<7.0,>=6.0
Requires-Dist: dpath<3.0,>=2.1.5
Requires-Dist: fastmcp<3.0,>=2.12.1
Requires-Dist: gitpython<4.0,>=3.1.29
Requires-Dist: google-cloud-logging<4.0,>=3.9.0
Requires-Dist: google-cloud-secret-manager<3.0,>=2.18.0
Requires-Dist: google-cloud-storage<3.0,>=2.8.0
Requires-Dist: jinja2<4.0,>=3.1.2
Requires-Dist: pydantic>=2.0.0
Requires-Dist: python-dotenv<2.0,>=1.0.0
Requires-Dist: pyyaml<7.0,>=6.0.0
Requires-Dist: requests<3.0,>=2.31.0
Requires-Dist: rich<14.0,>=13.0.0
Requires-Dist: semver<4.0,>=3.0.1
Requires-Dist: slack-sdk<4.0,>=3.36.0
Requires-Dist: sqlalchemy<3.0,>=2.0.0
Requires-Dist: toml<1.0,>=0.10.2
Description-Content-Type: text/markdown

# airbyte-ops-mcp

MCP and API interfaces that let the agents do the admin work.

## Installing Ops MCP in your Client

This config example will help you add the MCP server to your client:

```json
{
  "mcpServers": {
    "airbyte-ops-mcp": {
      "type": "stdio",
      "command": "uv",
      "args": [
        "run",
        "--project=/Users/aj.steers/repos/airbyte-ops-mcp/",
        "airbyte-ops-mcp"
      ],
      "env": {
        "AIRBYTE_MCP_ENV_FILE": "/Users/{user-id}/.mcp/airbyte_mcp.env"
      }
    },
    "airbyte-coral-mcp": {
      "type": "stdio",
      "command": "uvx",
      "args": [
        "--python=3.11",
        "--from=airbyte@latest",
        "airbyte-mcp"
      ],
      "env": {
        "AIRBYTE_MCP_ENV_FILE": "/Users/{user-id}/.mcp/airbyte_mcp.env"
      }
    }
  }
}
```

Your `.env` file should include the following values:

```ini
# Creds for Airbyte Cloud OAuth
AIRBYTE_CLOUD_CLIENT_ID="..."
AIRBYTE_CLOUD_CLIENT_SECRET="..."

# Required for elevated admin operations
AIRBYTE_INTERNAL_ADMIN_FLAG=airbyte.io
AIRBYTE_INTERNAL_ADMIN_USER={my-id}@airbyte.io

# Workspace ID for Testing
AIRBYTE_CLOUD_TEST_WORKSPACE_ID="..."
```

## Getting Started

Once configured, use the `test_my_tools` prompt by typing "/test" into your agent and selecting the auto-complete option for the `test_my_tools` prompt.

This prompt will step through all the tools, demoing their capabilities.

## Usage Examples

### Testing MCP Tools Locally

Use the `mcp-tool-test` poe task to test tools directly:

```bash
# List connectors in a repo
poe mcp-tool-test list_connectors_in_repo '{"repo_path": "/path/to/airbyte"}'

# Get cloud connector version
poe mcp-tool-test get_cloud_connector_version '{"workspace_id": "...", "actor_id": "..."}'
```

### Using Cloud SQL Proxy for Database Tools

Some tools (like `list_org_connections_by_source_type_db`) require access to the Airbyte Cloud Prod DB Replica. To test these locally:

1. Authenticate with GCP:
   ```bash
   gcloud auth login
   gcloud auth application-default login
   ```

2. Start Cloud SQL Proxy:
   ```bash
   cloud-sql-proxy prod-ab-cloud-proj:us-west3:prod-pgsql-replica --port=15432
   ```

3. Run the tool with proxy environment variables:
   ```bash
   USE_CLOUD_SQL_PROXY=1 DB_PORT=15432 poe mcp-tool-test list_org_connections_by_source_type_db \
     '{"organization_id": "...", "connector_canonical_name": "source-youtube-analytics"}'
   ```

## Instructions for Agents

When working with a user to set up and use this MCP server, agents should follow these steps for authentication:

### GCP Authentication Flow

For tools that require GCP access (database queries, secret manager, etc.), guide the user through authentication:

1. **Check if gcloud is installed.** If not, install it:
   ```bash
   curl -sSL https://sdk.cloud.google.com | bash -s -- --disable-prompts
   ```

2. **Run gcloud auth login with `--no-launch-browser`** to get a verification URL:
   ```bash
   gcloud auth login --no-launch-browser
   ```
   Send the verification URL to the user and ask them to complete sign-in and provide the verification code.

3. **Set up Application Default Credentials (ADC)** for library access:
   ```bash
   gcloud auth application-default login --no-launch-browser
   ```
   Again, send the URL to the user and collect the verification code.

4. **For database tools**, start Cloud SQL Proxy on an available port and use the `USE_CLOUD_SQL_PROXY` and `DB_PORT` environment variables.

### Airbyte Cloud Authentication

For tools that interact with Airbyte Cloud API, ensure the user has configured:
- `AIRBYTE_CLOUD_CLIENT_ID` and `AIRBYTE_CLOUD_CLIENT_SECRET` in their `.env` file
- For admin operations: `AIRBYTE_INTERNAL_ADMIN_FLAG=airbyte.io` and `AIRBYTE_INTERNAL_ADMIN_USER`
