From 8c6185e6bbedcf4394703fc85228deeff4949be6 Mon Sep 17 00:00:00 2001 From: Ajax Davis Date: Fri, 9 Jan 2026 08:14:39 +1000 Subject: [PATCH] fix: update MCP copy URLs to use new /api/mcp/{username}/{slug} format - Update getCollectionCopyOptions to require username and slug params - Update getAgentCopyOptions to require username param - Add slug and username to public collections/agents API responses - Remove deprecated /mcp/collections/{id} and /mcp/agents/{uid} URL formats --- .vercel-trigger | 1 - apps/web/src/app/agents/page.tsx | 8 ++++++- apps/web/src/app/api/public/agents/route.ts | 1 + .../src/app/api/public/collections/route.ts | 2 ++ apps/web/src/app/collections/page.tsx | 16 ++++++++++---- apps/web/src/components/CopyDropdown.tsx | 21 ++++++++++++------- 6 files changed, 36 insertions(+), 13 deletions(-) delete mode 100644 .vercel-trigger diff --git a/.vercel-trigger b/.vercel-trigger deleted file mode 100644 index 8775052..0000000 --- a/.vercel-trigger +++ /dev/null @@ -1 +0,0 @@ -# Trigger deployment 1767909608 diff --git a/apps/web/src/app/agents/page.tsx b/apps/web/src/app/agents/page.tsx index cc477c0..ce54254 100644 --- a/apps/web/src/app/agents/page.tsx +++ b/apps/web/src/app/agents/page.tsx @@ -28,6 +28,7 @@ interface PublicAgent { id: string; name: string; image: string | null; + username: string | null; }; } @@ -202,7 +203,12 @@ export default function PublicAgentsPage(): React.ReactElement { - + {agent.createdBy.username && ( + + )} ); diff --git a/apps/web/src/app/api/public/agents/route.ts b/apps/web/src/app/api/public/agents/route.ts index d9ba8af..2bd4217 100644 --- a/apps/web/src/app/api/public/agents/route.ts +++ b/apps/web/src/app/api/public/agents/route.ts @@ -61,6 +61,7 @@ export async function GET(request: NextRequest): Promise ({ id: collection.id, + slug: collection.slug, name: collection.name, description: collection.description, likeCount: collection.likeCount, diff --git a/apps/web/src/app/collections/page.tsx b/apps/web/src/app/collections/page.tsx index 5676b92..af08633 100644 --- a/apps/web/src/app/collections/page.tsx +++ b/apps/web/src/app/collections/page.tsx @@ -15,6 +15,7 @@ import { LikeButton } from '~/components/LikeButton'; interface PublicCollection { id: string; + slug: string; name: string; description: string | null; likeCount: number; @@ -24,6 +25,7 @@ interface PublicCollection { id: string; name: string; image: string | null; + username: string | null; }; } @@ -179,10 +181,16 @@ export default function PublicCollectionsPage(): React.ReactElement { - + {collection.createdBy.username && ( + + )} ); diff --git a/apps/web/src/components/CopyDropdown.tsx b/apps/web/src/components/CopyDropdown.tsx index 9ae5ab6..49fd47d 100644 --- a/apps/web/src/components/CopyDropdown.tsx +++ b/apps/web/src/components/CopyDropdown.tsx @@ -86,12 +86,13 @@ export function CopyDropdown({ // Helper functions to generate copy options for different entity types export function getCollectionCopyOptions( - collectionId: string, + username: string, + slug: string, collectionName: string ): CopyOption[] { const baseUrl = 'https://tpmjs.com'; - const mcpUrlHttp = `${baseUrl}/mcp/collections/${collectionId}`; - const mcpUrlSse = `${baseUrl}/mcp/collections/${collectionId}/sse`; + const mcpUrlHttp = `${baseUrl}/api/mcp/${username}/${slug}/http`; + const mcpUrlSse = `${baseUrl}/api/mcp/${username}/${slug}/sse`; const claudeConfig = JSON.stringify( { @@ -117,16 +118,21 @@ export function getCollectionCopyOptions( ]; } -export function getAgentCopyOptions(agentUid: string, agentName: string): CopyOption[] { +export function getAgentCopyOptions( + username: string, + agentUid: string, + agentName: string +): CopyOption[] { const baseUrl = 'https://tpmjs.com'; - const mcpUrl = `${baseUrl}/mcp/agents/${agentUid}`; + const mcpUrlHttp = `${baseUrl}/api/mcp/${username}/${agentUid}/http`; + const mcpUrlSse = `${baseUrl}/api/mcp/${username}/${agentUid}/sse`; const claudeConfig = JSON.stringify( { mcpServers: { [agentName.toLowerCase().replace(/\s+/g, '-')]: { command: 'npx', - args: ['-y', '@anthropic-ai/mcp-remote', mcpUrl], + args: ['-y', '@anthropic-ai/mcp-remote', mcpUrlSse], }, }, }, @@ -136,7 +142,8 @@ export function getAgentCopyOptions(agentUid: string, agentName: string): CopyOp return [ { label: 'Agent UID', value: agentUid, description: agentUid }, - { label: 'MCP URL', value: mcpUrl, description: mcpUrl }, + { label: 'MCP URL (HTTP)', value: mcpUrlHttp, description: mcpUrlHttp }, + { label: 'MCP URL (SSE)', value: mcpUrlSse, description: mcpUrlSse }, { label: 'Claude Config', value: claudeConfig,