Skip to content

Conversation

@aaronsteers
Copy link
Contributor

feat: Add airbyte-mcp-cli tool for direct MCP tool invocation

Summary

This PR adds a new CLI tool airbyte-mcp-cli that allows direct invocation of MCP (Model Context Protocol) tools without running the full MCP server. The tool is designed to work with uvx for one-off invocations and supports multiple input styles:

  • JSON input: uvx --from=airbyte airbyte-mcp-cli list_connectors '{"keyword_filter": "faker"}'
  • Named arguments: uvx --from=airbyte airbyte-mcp-cli list_connectors --keyword_filter=faker
  • Mixed: uvx --from=airbyte airbyte-mcp-cli list_connectors '{"keyword_filter": "s3"}' --connector_type_filter=source

The CLI also provides tool discovery via --list-tools and per-tool help via --help-tool.

Key implementation details:

  • Extracts Pydantic Field defaults from type hint metadata to support optional parameters
  • Handles argument parsing to distinguish between JSON input and named flags
  • Provides 35+ MCP tools across local, cloud, and registry domains

Review & Testing Checklist for Human

Risk Level: Yellow - Core functionality works but has some complexity around Pydantic metadata extraction

  • Test with uvx: Verify uvx --from=airbyte airbyte-mcp-cli --list-tools works without pre-installation
  • Test argument parsing: Try all three input styles (JSON only, named args only, mixed) with a few different tools
  • Verify Pydantic defaults: Test tools with optional parameters (like list_connectors) to ensure defaults are correctly applied when args are omitted
  • Check error handling: Try malformed JSON, missing required args, and invalid tool names to verify error messages are helpful

Suggested Test Plan:

# Install and test locally
poetry install
poetry run airbyte-mcp-cli --list-tools

# Test various input styles
poetry run airbyte-mcp-cli list_connectors
poetry run airbyte-mcp-cli list_connectors --keyword_filter=faker
poetry run airbyte-mcp-cli list_connectors '{"keyword_filter": "postgres"}'
poetry run airbyte-mcp-cli list_connectors '{"keyword_filter": "s3"}' --connector_type_filter=source

# Test with uvx (requires published package)
uvx --from=airbyte airbyte-mcp-cli --list-tools

Notes

  • The poetry.lock changes are just greenlet hash additions for musllinux platforms - likely Poetry updating its lock file format
  • The Pydantic Field defaults extraction (lines 222-235 in cli.py) is the most complex part and relies on accessing __metadata__ attributes. This works with current Pydantic but could be fragile if Pydantic internals change.
  • No automated tests were added for the CLI - manual testing was performed but edge cases may exist
  • Documentation (README, etc.) was not updated to mention the new tool

Requested by: AJ Steers (@aaronsteers)
Devin Session: https://app.devin.ai/sessions/665558f023ae4c55af447753dfb3509f

- Add new CLI entry point 'airbyte-mcp-cli' for calling MCP tools directly
- Support JSON input, named arguments, and mixed input styles
- Extract and apply Pydantic Field defaults for optional parameters
- Add --list-tools and --help-tool options for tool discovery
- Enable usage with uvx for one-off invocations without installation

Co-Authored-By: AJ Steers <[email protected]>
@devin-ai-integration
Copy link
Contributor

Original prompt from AJ Steers
Received message in Slack channel #ask-devin-ai:

@Devin - Let's make all Airbyte mcp tool calls accessible from CLI, specifically with something like `uvx --from=airbyte airbyte-mcp-cli {tool-name} {json-input-arg | --arg1=something --arg2=else}. Propose a few options to do so.
Thread URL: https://airbytehq-team.slack.com/archives/C08BHPUMEPJ/p1762905192417569

@devin-ai-integration
Copy link
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 12, 2025

Warning

Rate limit exceeded

@devin-ai-integration[bot] has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 4 minutes and 29 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 813d0d0 and d3c30ff.

⛔ Files ignored due to path filters (1)
  • poetry.lock is excluded by !**/*.lock
📒 Files selected for processing (2)
  • airbyte/mcp/cli.py (1 hunks)
  • pyproject.toml (1 hunks)
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch devin/1762906405-add-mcp-cli-tool

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link

👋 Greetings, Airbyte Team Member!

Here are some helpful tips and reminders for your convenience.

Testing This PyAirbyte Version

You can test this version of PyAirbyte using the following:

# Run PyAirbyte CLI from this branch:
uvx --from 'git+https://github.com/airbytehq/PyAirbyte.git@devin/1762906405-add-mcp-cli-tool' pyairbyte --help

# Install PyAirbyte from this branch for development:
pip install 'git+https://github.com/airbytehq/PyAirbyte.git@devin/1762906405-add-mcp-cli-tool'

Helpful Resources

PR Slash Commands

Airbyte Maintainers can execute the following slash commands on your PR:

  • /fix-pr - Fixes most formatting and linting issues
  • /poetry-lock - Updates poetry.lock file
  • /test-pr - Runs tests with the updated PyAirbyte

Community Support

Questions? Join the #pyairbyte channel in our Slack workspace.

📝 Edit this welcome message.

set_mcp_mode()
initialize_secrets()

from airbyte.mcp import cloud_ops, connector_registry, local_ops # noqa: E402, F401
@github-actions
Copy link

PyTest Results (Fast Tests Only, No Creds)

312 tests  ±0   312 ✅ ±0   5m 53s ⏱️ +11s
  1 suites ±0     0 💤 ±0 
  1 files   ±0     0 ❌ ±0 

Results for commit d3c30ff. ± Comparison against base commit 813d0d0.

@github-actions
Copy link

PyTest Results (Full)

381 tests  ±0   365 ✅ ±0   23m 47s ⏱️ - 2m 39s
  1 suites ±0    16 💤 ±0 
  1 files   ±0     0 ❌ ±0 

Results for commit d3c30ff. ± Comparison against base commit 813d0d0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants