feat(api): /api/v2/* MCP-parity endpoints#695
Draft
DvirDukhan wants to merge 1 commit into
Draft
Conversation
Add seven new HTTP endpoints that wrap the existing async tool functions in api.mcp.tools.* directly, with no logic duplication (FastMCP's @app.tool returns the original callable, so importing them and awaiting from a FastAPI route works as-is): POST /api/v2/search_code POST /api/v2/get_callers POST /api/v2/get_callees POST /api/v2/get_dependencies POST /api/v2/impact_analysis POST /api/v2/find_path POST /api/v2/ask Each accepts a small pydantic request body matching the MCP tool's kwargs (project, branch, symbol_id, ...) and returns the function's native payload unchanged. Auth follows the existing read-route pattern (public_or_auth). Motivation: the React UI keeps using the existing UI-shaped routes (/api/graph_entities, /api/get_neighbors, /api/find_paths, ...). Agent integrations (and our SWE-bench harness) want the agent-shaped verb surface the MCP server already exposes. Until now the only way to get that over HTTP was to reshape responses client-side. With these endpoints, an HTTP client and an MCP client get byte-identical output for the same query. No existing routes change; this is purely additive. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Adds 7 new HTTP endpoints that wrap the existing async tool functions in
api.mcp.tools.*directly. No logic duplication: FastMCP's@app.tooldecorator returns the original callable, so importing the functions and awaiting them from a FastAPI route works as-is.Each accepts a small pydantic request body matching the MCP tool's kwargs (
project,branch,symbol_id, …) and returns the function's native payload unchanged. Auth follows the existing read-route pattern (public_or_auth).Why
The React UI keeps using the existing UI-shaped routes (
/api/graph_entities,/api/get_neighbors,/api/find_paths, …). Agent integrations (and our SWE-bench harness) want the agent-shaped verb surface the MCP server already exposes. Until now the only way to get that over HTTP was to reshape responses client-side. With these endpoints, an HTTP client and an MCP client get byte-identical output for the same query.Risk
Purely additive. No existing routes change. New routes are async wrappers around already-tested MCP tool functions.
Stacked
dvirdukhan/bench-combined(needs the MCP tools stack feat(mcp): query tools — get_callers/callees/deps, find_path, search_code (T5/T7/T8) #679 + feat(mcp): GraphRAG ask tool — init + prompt seam + tool (T9/T10/T11) #681 + dependents to be present in api/mcp/tools/).