-
Notifications
You must be signed in to change notification settings - Fork 71
feat(mcp): proxy Kapa knowledge MCP server for inline Airbyte doc search #988
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
Aaron ("AJ") Steers (aaronsteers)
wants to merge
1
commit into
main
Choose a base branch
from
devin/1772232983-kapa-mcp-proxy
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion | 🟠 Major
🧩 Analysis chain
🏁 Script executed:
cat airbyte/mcp/server.py | head -150Repository: airbytehq/PyAirbyte
Length of output: 5110
🏁 Script executed:
Repository: airbytehq/PyAirbyte
Length of output: 79
🏁 Script executed:
Repository: airbytehq/PyAirbyte
Length of output: 320
🏁 Script executed:
Repository: airbytehq/PyAirbyte
Length of output: 957
🏁 Script executed:
Repository: airbytehq/PyAirbyte
Length of output: 1791
🏁 Script executed:
Repository: airbytehq/PyAirbyte
Length of output: 154
🌐 Web query:
FastMCP 2.11.3 as_proxy lazy initialization documentation💡 Result:
FastMCP 2.11.3 (released 2025-08-11) is documented as having proxy support via
FastMCP.as_proxy(), but the docs/API reference do not describe an explicitlazy=/ “lazy initialization” option foras_proxyitself. [1][2]What is documented (and effectively gives you “lazy” backend startup semantics) is that proxying is driven by a client factory / disconnected client, so the backend session/handshake happens when a request is made (e.g.,
tools/list,tools/call), not at proxy object construction:ProxyClient(...)intoFastMCP.as_proxy(...)(fresh isolated backend session per request). [3]client_factory(fresh or shared client) viaFastMCPProxy/create_proxy(...). [3][2]If what you mean by “lazy initialization” is delaying the MCP initialize handshake of a
Client, that is documented viaauto_initialize=False(but that applies to usingClient, not a specialas_proxyflag). [4]Key docs to read:
FastMCP.as_proxy,ProxyClient, session behavior, andFastMCPProxy+client_factory). [3]create_proxy(...)(recommended helper) andas_proxy(...)signature. [2][1]auto_initialize=False). [4]Sources
[1] https://fastmcp.wiki/en/python-sdk/fastmcp-server-server
[2] https://fastmcp.mintlify.app/python-sdk/fastmcp-server-server
[3] https://fastmcp.wiki/en/servers/proxy
[4] https://fastmcp.mintlify.app/clients/client
🏁 Script executed:
Repository: airbytehq/PyAirbyte
Length of output: 1603
🏁 Script executed:
Repository: airbytehq/PyAirbyte
Length of output: 1012
Add error handling around proxy creation and mounting to prevent optional dependency from breaking server startup.
Since the Kapa integration is optional and
_mount_kapa_proxy()is invoked at module level, ifFastMCP.as_proxy()orapp.mount()throws (invalid config, network issues, etc.), the entire server fails to start. Worth wrapping in try/except to gracefully skip Kapa when unavailable, wdyt?🛡️ Proposed defensive wrapper
Note:
FastMCP.as_proxy()in v2.11.3 uses a lazy proxy pattern—the backend session/handshake happens when a request is made (not at construction)—so as_proxy() itself won't trigger eager connections. However, theapp.mount()call should still be protected since it's at initialization time and failures there would crash startup.🤖 Prompt for AI Agents