Skip to content

Conversation

aaronsteers
Copy link
Contributor

@aaronsteers aaronsteers commented Sep 16, 2025

chore(mcp): add mcp-tool-test Poe task

Summary

This PR adds a new mcp-tool-test Poe task and updates MCP testing documentation to use built-in Poe tasks instead of the external mcp-cli tool (which is not publicly available).

Key changes:

  • Added 5 new MCP Poe tasks in pyproject.toml: mcp-serve-local, mcp-serve-http, mcp-serve-sse, mcp-inspect, and mcp-tool-test
  • Created bin/test_mcp_tool.py - executable script for testing MCP tools with JSON arguments, featuring PyAirbyte-specific examples
  • Updated MCP documentation in airbyte/mcp/__init__.py to completely remove mcp-cli references and replace with Poe task examples
  • Improved developer experience by providing built-in testing tools that automatically inherit environment variables

The new poe mcp-tool-test command allows developers to easily test both connector operations (list_connectors, get_config_spec, etc.) and cloud operations (check_airbyte_cloud_workspace, list_deployed_cloud_connections) without requiring external tooling.

Review & Testing Checklist for Human

This is a medium-risk change affecting developer tooling and documentation:

  • Test the core functionality: Run poe mcp-tool-test check_airbyte_cloud_workspace '{}' to verify cloud operations work
  • Verify environment variable inheritance: Ensure .envrc credentials are automatically picked up by the poe tasks (no manual export needed)
  • Test connector operations: Run poe mcp-tool-test list_connectors '{}' to verify connector functionality works
  • Validate all new poe tasks: Try poe mcp-serve-local, poe mcp-inspect to ensure they work as documented

Notes

  • All lint/type checks pass (poe check successful)
  • Environment variable inheritance relies on Poetry's process inheritance - this should work but needs verification in different shell environments
  • Completely removed dependency on external mcp-cli tool per maintainer request

Requested by: @aaronsteers
Devin session: https://app.devin.ai/sessions/6b6e50fa185a426e966816a8f6cf46ec

Summary by CodeRabbit

  • New Features

    • Added Poe commands to run the MCP server via STDIO, HTTP, or SSE.
    • Introduced a tool inspection command to view available MCP tools and schemas.
    • Added a testing command to invoke MCP tools directly with JSON arguments (supports listing connectors, fetching specs, validating configs, and running syncs).
  • Documentation

    • Rewrote MCP testing guidance to use Poe-based workflows instead of prior CLI steps.
    • Added examples for inspecting tools, verifying Airbyte Cloud workspaces, listing cloud connections, and running end-to-end tests.

Important

Auto-merge enabled.

This PR is set to merge automatically when all requirements are met.

devin-ai-integration bot and others added 3 commits September 16, 2025 19:39
- Add mcp-tool-test Poe task for testing MCP tools with JSON arguments
- Update airbyte.mcp module documentation to reference poe mcp-tool-test method
- Remove all mcp-cli references from documentation since it's not publicly available
- Update bin/test_mcp_tool.py with PyAirbyte-specific usage examples
- Move usage examples to docstring and reference __doc__ for help text
- Document other MCP-related Poe tasks (mcp-serve-local, mcp-serve-http, mcp-serve-sse, mcp-inspect)

Co-Authored-By: AJ Steers <[email protected]>
- Fix line length issues in documentation examples
- Add copyright notice and shebang to test script
- Fix import ordering and typing issues
- Make test script executable

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

Original prompt from AJ Steers
@Devin - see if your new creds are working for PyAirbyte cloud operations MCP tools. Use the test-tool Poe command to confirm you can get workspace info and list connections
Thread URL: https://airbytehq-team.slack.com/archives/D089P0UPVT4/p1758043576617179?thread_ts=1758043576.617179

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

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/1758051186-add-mcp-tool-test-poe-task' pyairbyte --help

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

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.

@aaronsteers aaronsteers requested a review from Copilot September 16, 2025 19:49
@aaronsteers aaronsteers enabled auto-merge (squash) September 16, 2025 19:49
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds built-in Poe tasks for MCP testing and removes dependencies on the external mcp-cli tool to improve developer experience.

  • Adds 5 new Poe tasks for serving, inspecting, and testing MCP tools
  • Creates a standalone test script for MCP tools with JSON arguments
  • Updates documentation to use Poe-based workflows instead of external CLI tools

Reviewed Changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 2 comments.

File Description
pyproject.toml Adds 5 new MCP-related Poe tasks for server operations and testing
airbyte/mcp/init.py Replaces mcp-cli documentation with Poe task examples and simplified testing workflow

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link

PyTest Results (Fast Tests Only, No Creds)

301 tests  ±0   300 ✅ ±0   4m 38s ⏱️ -3s
  1 suites ±0     1 💤 ±0 
  1 files   ±0     0 ❌ ±0 

Results for commit 025547f. ± Comparison against base commit 6c1c954.

Copy link
Contributor

coderabbitai bot commented Sep 16, 2025

📝 Walkthrough

Walkthrough

Replaces MCP CLI-based testing guidance with Poe task-based workflows, adds a new CLI script to invoke MCP tools via FastMCP, and introduces Poe tasks in pyproject.toml to serve, inspect, and test the MCP server and tools.

Changes

Cohort / File(s) Summary
Docs: MCP testing shift to Poe tasks
airbyte/mcp/__init__.py
Rewrites the Testing section to remove mcp-cli instructions and replace them with Poe tasks for serving, inspecting, validating configs, listing connectors, and running syncs.
New CLI for tool testing
bin/test_mcp_tool.py
Adds an async CLI to call MCP tools via FastMCP against the server app; includes JSON arg parsing, result printing, and error handling. Exposes call_mcp_tool(...) and main().
Poe tasks for MCP serve/inspect/test
pyproject.toml
Adds mcp-serve-local, mcp-serve-http, mcp-serve-sse, mcp-inspect, and mcp-tool-test tasks to run/inspect the MCP server and test tools with JSON args.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    participant U as User
    participant Poe as Poe Tasks
    participant CLI as bin/test_mcp_tool.py
    participant FMC as FastMCP Client
    participant App as Airbyte MCP Server (app)
    participant Tool as MCP Tool

    U->>Poe: poe mcp-tool-test <tool> '<json_args>'
    Poe->>CLI: Launch script with args
    CLI->>FMC: Open async client to app
    FMC->>App: Connect and call tool(<json_args>)
    App->>Tool: Execute with provided args
    Tool-->>App: Result
    App-->>FMC: Tool response
    FMC-->>CLI: Response object
    CLI-->>U: Print result (text or str)

    rect rgba(230, 246, 255, 0.6)
    note over Poe,CLI: New testing flow via Poe + FastMCP
    end
Loading
sequenceDiagram
    autonumber
    participant U as User
    participant Poe as Poe Tasks
    participant App as Airbyte MCP Server (app)

    U->>Poe: poe mcp-serve-local | http | sse
    Poe->>App: app.run(transport=stdio/http/sse, host, port)
    App-->>U: Server ready
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Would you like to add brief examples in the docs showing typical poe mcp-tool-test invocations for one connector config validate and one sync call, wdyt?

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title "chore(mcp): add mcp-tool-test Poe task" is concise, specific, and directly reflects the main change in the PR (adding the mcp-tool-test Poe task and related tooling), so it communicates the primary intent clearly to reviewers.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch devin/1758051186-add-mcp-tool-test-poe-task

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Please see the documentation for more information.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.


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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (8)
airbyte/mcp/__init__.py (3)

60-75: Document required env vars for cloud ops?

Since these commands rely on inherited env, could we add a short “Environment” note listing the expected variables for cloud calls (e.g., API base URL, auth token, workspace id if needed) plus a reminder to poetry install --all-extras before running, wdyt?


79-84: Make server host/port configurable in the examples

Would you add a note that poe mcp-serve-http/mcp-serve-sse use 127.0.0.1:8000 by default and how to override (env vars or flags) if a port is busy, wdyt?


79-84: Reference the new poe mcp-inspect earlier

Since inspection helps discover tool names/schemas, should we cross-link poe mcp-inspect right before the mcp-tool-test examples to guide first-time users, wdyt?

bin/test_mcp_tool.py (4)

34-38: Add a timeout to avoid hanging calls

If a tool misbehaves, the CLI can hang indefinitely. Shall we wrap the await in asyncio.wait_for with a sensible default (e.g., 120s) and make it configurable, wdyt?

Apply this diff:

-async def call_mcp_tool(tool_name: str, args: dict[str, Any]) -> object:
-    """Call an MCP tool using the FastMCP client."""
-    async with Client(app) as client:
-        return await client.call_tool(tool_name, args)
+async def call_mcp_tool(tool_name: str, args: dict[str, Any], timeout: float | None = 120.0) -> object:
+    """Call an MCP tool using the FastMCP client."""
+    async with Client(app) as client:
+        coro = client.call_tool(tool_name, args)
+        return await (asyncio.wait_for(coro, timeout) if timeout else coro)

40-54: Improve CLI UX: help flag, file/stdin JSON, and object-type validation

Would you consider: (1) supporting -h/--help, (2) allowing JSON via @file.json or stdin -, and (3) ensuring args are a JSON object (mapping), wdyt?

Apply this diff:

 def main() -> None:
     """Main entry point for the MCP tool tester."""
-    if len(sys.argv) < MIN_ARGS:
+    if any(a in ("-h", "--help", "help") for a in sys.argv[1:]):
+        print(__doc__)
+        sys.exit(0)
+    if len(sys.argv) < MIN_ARGS:
         print(__doc__, file=sys.stderr)
         sys.exit(1)
 
     tool_name = sys.argv[1]
     json_args = sys.argv[2]
 
     try:
-        args: dict[str, Any] = json.loads(json_args)
+        if json_args == "-":
+            raw = sys.stdin.read()
+            args = json.loads(raw)
+        elif json_args.startswith("@"):
+            with open(json_args[1:], "r", encoding="utf-8") as f:
+                args = json.load(f)
+        else:
+            args = json.loads(json_args)
+        if not isinstance(args, dict):
+            raise TypeError("Tool arguments must be a JSON object (e.g., {}).")
     except json.JSONDecodeError as e:
         print(f"Error parsing JSON arguments: {e}", file=sys.stderr)
         sys.exit(1)
+    except TypeError as e:
+        print(str(e), file=sys.stderr)
+        sys.exit(1)

58-62: Prefer structured output for JSON-like results

To improve ergonomics, shall we pretty-print dict/list results as JSON and fall back gracefully otherwise, wdyt?

Apply this diff:

-        if hasattr(result, "text"):
-            print(result.text)
-        else:
-            print(str(result))
+        if hasattr(result, "text"):
+            print(result.text)
+        elif isinstance(result, (dict, list)):
+            print(json.dumps(result, indent=2, ensure_ascii=False))
+        else:
+            print(str(result))

3-18: Docstring: mention stdin/@file JSON and --help

If we add those UX tweaks, would you extend the usage examples to show '-' and @args.json, plus --help, wdyt?

Example:

-    poe mcp-tool-test <tool_name> '<json_args>'
+    poe mcp-tool-test <tool_name> '<json_args|@file.json|->'
+
+    # read JSON from file
+    poe mcp-tool-test validate_config @examples/pokeapi_config.json
+    # read JSON from stdin
+    cat examples/pokeapi_config.json | poe mcp-tool-test validate_config -
+    # help
+    poe mcp-tool-test --help
pyproject.toml (1)

202-208: Tasks are great; consider hardening cross‑platform invocation and configurability

  • For the python -c tasks, quoting can get brittle across shells/OS. Would you consider routing through a tiny runner (e.g., airbyte.mcp.server_cli:main) so tasks become poetry run airbyte-mcp --transport http --host 127.0.0.1 --port 8000 if supported, wdyt?
  • Do we want to allow overriding host/port via env (e.g., MCP_HOST, MCP_PORT) so users can avoid port conflicts without editing the file, wdyt?
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6c1c954 and 025547f.

📒 Files selected for processing (3)
  • airbyte/mcp/__init__.py (1 hunks)
  • bin/test_mcp_tool.py (1 hunks)
  • pyproject.toml (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: Pytest (All, Python 3.10, Windows)
  • GitHub Check: Pytest (All, Python 3.11, Windows)
  • GitHub Check: Pytest (All, Python 3.10, Ubuntu)
  • GitHub Check: Pytest (All, Python 3.11, Ubuntu)
  • GitHub Check: Pytest (No Creds)
  • GitHub Check: Pytest (Fast)
🔇 Additional comments (3)
airbyte/mcp/__init__.py (1)

60-75: Docs shift to Poe tasks reads clearly — nice!

The examples are straightforward and replace the prior mcp-cli guidance cleanly.

bin/test_mcp_tool.py (1)

26-37: Confirm FastMCP client usage against current API

Client(app) and call_tool(name, args) look right, but FastMCP has had minor API shifts. Can you double-check against fastmcp>=2.11.3 that the return shape for tool calls aligns with your result.text assumption (and adjust printing accordingly if it’s .content), wdyt?

pyproject.toml (1)

207-207: Confirm Poe arg pass‑through for mcp-tool-test

Sandbox lacks poe (command not found); bin/test_mcp_tool.py reads sys.argv[1] and sys.argv[2] (lines 42,46–47). Can you run locally and confirm: 1) poe --version; 2) poe mcp-tool-test list_connectors '{}' after adding a temporary print(sys.argv) to bin/test_mcp_tool.py and paste the printed argv so we can verify argv[1:] == ['list_connectors','{}'] — wdyt?

Copy link

PyTest Results (Full)

364 tests  ±0   348 ✅ ±0   23m 55s ⏱️ + 1m 20s
  1 suites ±0    16 💤 ±0 
  1 files   ±0     0 ❌ ±0 

Results for commit 025547f. ± Comparison against base commit 6c1c954.

@aaronsteers aaronsteers merged commit 2295dd2 into main Sep 16, 2025
24 checks passed
@aaronsteers aaronsteers deleted the devin/1758051186-add-mcp-tool-test-poe-task branch September 16, 2025 20:35
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.

1 participant