From 6c781c0711ce347454feb36579f53d483f3d150b Mon Sep 17 00:00:00 2001 From: Ajax Davis Date: Tue, 13 Jan 2026 11:14:54 +1000 Subject: [PATCH] fix: use correct MCP URL format /api/mcp/[username]/[slug]/[transport] --- apps/web/src/app/api/collections/[id]/route.ts | 9 +++++++++ .../src/app/dashboard/collections/[id]/page.tsx | 14 ++++++++++---- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/apps/web/src/app/api/collections/[id]/route.ts b/apps/web/src/app/api/collections/[id]/route.ts index 802d544..52b4c65 100644 --- a/apps/web/src/app/api/collections/[id]/route.ts +++ b/apps/web/src/app/api/collections/[id]/route.ts @@ -74,6 +74,11 @@ export async function GET( const collection = await prisma.collection.findUnique({ where: { id }, include: { + user: { + select: { + username: true, + }, + }, tools: { include: { tool: { @@ -127,6 +132,7 @@ export async function GET( success: true, data: { id: collection.id, + slug: collection.slug, name: collection.name, description: collection.description, isPublic: collection.isPublic, @@ -134,6 +140,9 @@ export async function GET( createdAt: collection.createdAt, updatedAt: collection.updatedAt, isOwner: collection.userId === session.user.id, + user: { + username: collection.user.username, + }, tools: paginatedTools.map((ct) => ({ id: ct.id, toolId: ct.toolId, diff --git a/apps/web/src/app/dashboard/collections/[id]/page.tsx b/apps/web/src/app/dashboard/collections/[id]/page.tsx index 244eaca..f9cbc6e 100644 --- a/apps/web/src/app/dashboard/collections/[id]/page.tsx +++ b/apps/web/src/app/dashboard/collections/[id]/page.tsx @@ -14,13 +14,13 @@ import { DashboardLayout } from '~/components/dashboard/DashboardLayout'; import { EnvVarsEditor } from '~/components/EnvVarsEditor'; import { ExecutorConfigPanel } from '~/components/ExecutorConfigPanel'; -function McpUrlSection({ collectionId }: { collectionId: string }) { +function McpUrlSection({ username, slug }: { username: string; slug: string }) { const [copiedUrl, setCopiedUrl] = useState<'http' | 'sse' | null>(null); const [showConfig, setShowConfig] = useState(false); const baseUrl = typeof window !== 'undefined' ? window.location.origin : 'https://tpmjs.com'; - const httpUrl = `${baseUrl}/api/collections/${collectionId}/mcp/http`; - const sseUrl = `${baseUrl}/api/collections/${collectionId}/mcp/sse`; + const httpUrl = `${baseUrl}/api/mcp/${username}/${slug}/http`; + const sseUrl = `${baseUrl}/api/mcp/${username}/${slug}/sse`; const copyToClipboard = async (url: string, type: 'http' | 'sse') => { await navigator.clipboard.writeText(url); @@ -171,6 +171,7 @@ interface CollectionTool { interface Collection { id: string; + slug: string; name: string; description: string | null; isPublic: boolean; @@ -181,6 +182,9 @@ interface Collection { createdAt: string; updatedAt: string; isOwner: boolean; + user: { + username: string; + }; tools: CollectionTool[]; } @@ -516,7 +520,9 @@ export default function CollectionDetailPage(): React.ReactElement { )} {/* MCP URLs - only for public collections */} - {collection.isPublic && } + {collection.isPublic && collection.user.username && ( + + )} {/* Add Tool Search */} {collection.isOwner && (