From fa8688cabbffc31f732eb000028a5e9fdefa7487 Mon Sep 17 00:00:00 2001
From: Paython Veazie
Date: Tue, 2 Dec 2025 16:59:14 -0800
Subject: [PATCH] Fix MCP nested response handling for repo_reader tool
---
client/src/lib/api.ts | 26 +++++++++++++++-----------
client/src/pages/ConnectPage.tsx | 6 +++++-
client/src/store/useRepoStore.ts | 32 ++++++++++++++++++++++++--------
3 files changed, 44 insertions(+), 20 deletions(-)
diff --git a/client/src/lib/api.ts b/client/src/lib/api.ts
index b9a0727..76366fe 100644
--- a/client/src/lib/api.ts
+++ b/client/src/lib/api.ts
@@ -36,21 +36,25 @@ async function mcp(tool: string, input: Record = {}): Promise
export const api = {
// ✅ method syntax (preferred)
async listRepos(): Promise<{ repos: string[] }> {
- const data = await mcp<{ repositories: { full_name: string; branches?: string[] }[] }>(
- "repo_reader",
- {}
- );
- const repos = (data.repositories ?? []).map(r => r.full_name);
+ const outer = await mcp<{
+ success: boolean;
+ data: { provider: string; user: string; repositories: { full_name: string }[] };
+ }>("repo_reader", {});
+
+ const inner = outer?.data;
+ const repos = inner?.repositories?.map(r => r.full_name) ?? [];
return { repos };
},
async listBranches(repo: string): Promise<{ branches: string[] }> {
- const data = await mcp<{ repositories: { full_name: string; branches?: string[] }[] }>(
- "repo_reader",
- {}
- );
- const item = (data.repositories ?? []).find(r => r.full_name === repo);
- return { branches: item?.branches ?? [] };
+ const outer = await mcp<{
+ success: boolean;
+ data: { provider: string; user: string; repositories: { full_name: string; branches?: string[] }[] };
+ }>("repo_reader", {});
+
+ const inner = outer?.data;
+ const match = inner?.repositories?.find(r => r.full_name === repo);
+ return { branches: match?.branches ?? [] };
},
async createPipeline(payload: any) {
diff --git a/client/src/pages/ConnectPage.tsx b/client/src/pages/ConnectPage.tsx
index 403fe63..493ecb1 100644
--- a/client/src/pages/ConnectPage.tsx
+++ b/client/src/pages/ConnectPage.tsx
@@ -48,7 +48,10 @@ export default function ConnectPage() {
{
+ console.log("[Page] Re-sync clicked");
+ loadRepos();
+ }}
>
Re-sync Repos
@@ -61,6 +64,7 @@ export default function ConnectPage() {