Skip to content

Commit 539da2b

Browse files
chelojimenezclaude
andauthored
Remove server sharing feature in favor of chatbox sharing (#2047)
Co-authored-by: Claude <noreply@anthropic.com>
1 parent 465c99b commit 539da2b

45 files changed

Lines changed: 162 additions & 2431 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

mcpjam-inspector/client/src/App.tsx

Lines changed: 5 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,6 @@ import type {
9292
import { useViewQueries, useProjectServers } from "./hooks/useViews";
9393
import { HostedShellGate } from "./components/hosted/HostedShellGate";
9494
import { resolveHostedShellGateState } from "./components/hosted/hosted-shell-gate-state";
95-
import {
96-
SharedServerChatPage,
97-
getSharedPathTokenFromLocation,
98-
} from "./components/hosted/SharedServerChatPage";
9995
import {
10096
ChatboxChatPage,
10197
getChatboxPathTokenFromLocation,
@@ -157,17 +153,9 @@ import {
157153
clearChatboxSignInReturnPath,
158154
readChatboxSession,
159155
readChatboxSignInReturnPath,
156+
slugify,
160157
writeChatboxSignInReturnPath,
161158
} from "./lib/chatbox-session";
162-
import {
163-
clearSharedSignInReturnPath,
164-
readSharedServerSession,
165-
readSharedSignInReturnPath,
166-
slugify,
167-
writeSharedSignInReturnPath,
168-
readPendingServerAdd,
169-
clearPendingServerAdd,
170-
} from "./lib/shared-server-session";
171159
import {
172160
sanitizeHostedOAuthErrorMessage,
173161
clearHostedOAuthResumeMarker,
@@ -428,57 +416,26 @@ export default function App() {
428416
const callbackContext = getHostedOAuthCallbackContext();
429417
return callbackContext != null && callbackContext.surface !== "project";
430418
});
431-
const [exitedSharedChat, setExitedSharedChat] = useState(false);
432419
const [exitedChatboxChat, setExitedChatboxChat] = useState(false);
433-
const sharedPathToken = HOSTED_MODE ? getSharedPathTokenFromLocation() : null;
434420
const chatboxPathToken = HOSTED_MODE
435421
? getChatboxPathTokenFromLocation()
436422
: null;
437-
const sharedSession = HOSTED_MODE ? readSharedServerSession() : null;
438423
const chatboxSession = HOSTED_MODE ? readChatboxSession() : null;
439-
const currentHashSlug = window.location.hash
440-
.replace(/^#/, "")
441-
.replace(/^\/+/, "")
442-
.split("/")[0];
443424
const hostedRouteKind = useMemo(() => {
444425
if (!HOSTED_MODE) {
445426
return null;
446427
}
447428

448-
if (sharedPathToken) {
449-
return "shared" as const;
450-
}
451429
if (chatboxPathToken) {
452430
return "chatbox" as const;
453431
}
454432

455-
if (sharedSession && chatboxSession) {
456-
if (currentHashSlug === slugify(sharedSession.payload.serverName)) {
457-
return "shared" as const;
458-
}
459-
if (currentHashSlug === slugify(chatboxSession.payload.name)) {
460-
return "chatbox" as const;
461-
}
462-
return null;
463-
}
464-
465-
if (sharedSession) {
466-
return "shared" as const;
467-
}
468433
if (chatboxSession) {
469434
return "chatbox" as const;
470435
}
471436

472437
return null;
473-
}, [
474-
currentHashSlug,
475-
chatboxPathToken,
476-
chatboxSession,
477-
sharedPathToken,
478-
sharedSession,
479-
]);
480-
const isSharedChatRoute =
481-
HOSTED_MODE && !exitedSharedChat && hostedRouteKind === "shared";
438+
}, [chatboxPathToken, chatboxSession]);
482439
const isChatboxChatRoute =
483440
HOSTED_MODE && !exitedChatboxChat && hostedRouteKind === "chatbox";
484441

@@ -489,7 +446,7 @@ export default function App() {
489446
setEvaluateRunsFlagsLoaded(posthog.featureFlags?.hasLoadedFlags === true);
490447
});
491448
}, [posthog]);
492-
const isHostedChatRoute = isSharedChatRoute || isChatboxChatRoute;
449+
const isHostedChatRoute = isChatboxChatRoute;
493450
const currentHash = window.location.hash || "#servers";
494451
const currentHashRoute = useMemo(
495452
() => resolveHostedNavigation(currentHash, HOSTED_MODE),
@@ -709,18 +666,16 @@ export default function App() {
709666
// Let AuthKit + Convex auth settle before leaving /callback.
710667
if (!isAuthLoading && isAuthenticated) {
711668
const chatboxReturnPath = readChatboxSignInReturnPath();
712-
const sharedReturnPath = readSharedSignInReturnPath();
713669
const persistedCheckoutIntent = readPersistedCheckoutIntent();
714670
const billingReturnPath = persistedCheckoutIntent
715671
? readBillingSignInReturnPath()
716672
: null;
717673
clearChatboxSignInReturnPath();
718-
clearSharedSignInReturnPath();
719674
clearBillingSignInReturnPath();
720675
window.history.replaceState(
721676
{},
722677
"",
723-
chatboxReturnPath ?? sharedReturnPath ?? billingReturnPath ?? "/"
678+
chatboxReturnPath ?? billingReturnPath ?? "/"
724679
);
725680
setCallbackCompleted(true);
726681
setCallbackRecoveryExpired(false);
@@ -893,40 +848,6 @@ export default function App() {
893848
isHostedDefaultRoute &&
894849
hostedShellGateState === "auth-loading";
895850

896-
// Auto-add a shared server when returning from SharedServerChatPage via "Open MCPJam"
897-
useEffect(() => {
898-
if (isHostedChatRoute) return;
899-
if (isLoadingRemoteProjects) return;
900-
if (isAuthLoading) return;
901-
// In hosted mode, also wait for the project to resolve. handleConnect
902-
// would otherwise build a request with `projectId === "none"` and fail.
903-
if (HOSTED_MODE && (!activeProjectId || activeProjectId === "none")) return;
904-
905-
const pending = readPendingServerAdd();
906-
if (!pending) return;
907-
clearPendingServerAdd();
908-
909-
if (projectServers[pending.serverName] !== undefined) {
910-
return; // Server already exists
911-
}
912-
913-
handleConnect({
914-
name: pending.serverName,
915-
type: "http",
916-
url: pending.serverUrl,
917-
useOAuth: pending.useOAuth,
918-
clientId: pending.clientId ?? undefined,
919-
oauthScopes: pending.oauthScopes ?? undefined,
920-
});
921-
}, [
922-
isHostedChatRoute,
923-
isLoadingRemoteProjects,
924-
isAuthLoading,
925-
activeProjectId,
926-
projectServers,
927-
handleConnect,
928-
]);
929-
930851
const previousConnectedServersRef = useRef<Set<string> | null>(null);
931852
useEffect(() => {
932853
const connectedServers = new Set(
@@ -1209,17 +1130,6 @@ export default function App() {
12091130
preserveCurrentOrganizationOnNonOrgTarget?: boolean;
12101131
}
12111132
) => {
1212-
if (isSharedChatRoute) {
1213-
const storedSession = readSharedServerSession();
1214-
if (storedSession) {
1215-
const expectedHash = slugify(storedSession.payload.serverName);
1216-
if (window.location.hash !== `#${expectedHash}`) {
1217-
window.location.hash = expectedHash;
1218-
}
1219-
}
1220-
return;
1221-
}
1222-
12231133
if (isChatboxChatRoute) {
12241134
const storedSession = readChatboxSession();
12251135
if (storedSession) {
@@ -1287,7 +1197,6 @@ export default function App() {
12871197
[
12881198
effectiveOrganizations,
12891199
isChatboxChatRoute,
1290-
isSharedChatRoute,
12911200
setSelectedMultipleServersToAllServers,
12921201
]
12931202
);
@@ -2449,9 +2358,6 @@ export default function App() {
24492358
: undefined
24502359
}
24512360
onSignIn={() => {
2452-
if (sharedPathToken) {
2453-
writeSharedSignInReturnPath(window.location.pathname);
2454-
}
24552361
if (chatboxPathToken) {
24562362
writeChatboxSignInReturnPath(window.location.pathname);
24572363
}
@@ -2461,12 +2367,7 @@ export default function App() {
24612367
void signOut();
24622368
}}
24632369
>
2464-
{isSharedChatRoute ? (
2465-
<SharedServerChatPage
2466-
pathToken={sharedPathToken}
2467-
onExitSharedChat={() => setExitedSharedChat(true)}
2468-
/>
2469-
) : isChatboxChatRoute ? (
2370+
{isChatboxChatRoute ? (
24702371
<ChatboxChatPage
24712372
pathToken={chatboxPathToken}
24722373
onExitChatboxChat={() => setExitedChatboxChat(true)}

mcpjam-inspector/client/src/__tests__/App.hosted-oauth.test.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -390,10 +390,6 @@ vi.mock("../components/hosted/HostedShellGate", () => ({
390390
vi.mock("../components/hosted/hosted-shell-gate-state", () => ({
391391
resolveHostedShellGateState: () => mockHostedShellGateState.value,
392392
}));
393-
vi.mock("../components/hosted/SharedServerChatPage", () => ({
394-
SharedServerChatPage: () => <button type="button">Authorize</button>,
395-
getSharedPathTokenFromLocation: () => null,
396-
}));
397393
vi.mock("../components/hosted/ChatboxChatPage", () => ({
398394
ChatboxChatPage: () => <button type="button">Authorize</button>,
399395
getChatboxPathTokenFromLocation: () => null,

mcpjam-inspector/client/src/components/ChatTabV2.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,6 @@ export function ChatTabV2({
315315
),
316316
[selectedConnectedServerNames, serversByName, appState.servers]
317317
);
318-
const hostedShareToken = hostedContext?.shareToken;
319318
const hostedChatboxToken = hostedContext?.chatboxToken;
320319
const hostedChatboxSurface = hostedContext?.chatboxSurface;
321320
const effectiveHostedProjectId =
@@ -329,7 +328,6 @@ export function ChatTabV2({
329328
HOSTED_MODE &&
330329
!isConvexAuthenticated &&
331330
!effectiveHostedProjectId &&
332-
!hostedShareToken &&
333331
!hostedChatboxToken;
334332

335333
// Use shared chat session hook
@@ -412,7 +410,6 @@ export function ChatTabV2({
412410
const showHistoryRail =
413411
HOSTED_MODE &&
414412
!minimalMode &&
415-
!hostedShareToken &&
416413
!hostedChatboxToken &&
417414
chatHistoryRailEnabled;
418415
const {
@@ -1090,7 +1087,6 @@ export function ChatTabV2({
10901087
enableMultiModelChat &&
10911088
!minimalMode &&
10921089
!executionConfig?.modelId &&
1093-
!hostedShareToken &&
10941090
!hostedChatboxToken &&
10951091
!hostedChatboxSurface &&
10961092
availableModels.length > 1;

mcpjam-inspector/client/src/components/connection/ServerConnectionCard.tsx

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ import {
3434
Cable,
3535
Trash2,
3636
AlertCircle,
37-
Share2,
3837
FileText,
3938
} from "lucide-react";
4039
import { ServerWithName } from "@/hooks/use-app-state";
@@ -62,7 +61,6 @@ import {
6261
import { useAuth } from "@workos-inc/authkit-react";
6362
import { useConvexAuth } from "convex/react";
6463
import { HOSTED_MODE } from "@/lib/config";
65-
import { ShareServerDialog } from "./ShareServerDialog";
6664
import { useExploreCasesPrefetchOnConnect } from "@/hooks/use-explore-cases-prefetch-on-connect";
6765
import { getOAuthTraceFailureStep } from "@/lib/oauth/oauth-trace";
6866

@@ -78,8 +76,6 @@ function isHostedInsecureHttpServer(server: ServerWithName): boolean {
7876
}
7977
}
8078

81-
// Temporary hide while chatbox sharing replaces server sharing in the main UI.
82-
const SERVER_SHARE_UI_ENABLED = false;
8379
const SERVER_CARD_CONTEXT_MENU_EXEMPT_SELECTOR =
8480
"[data-server-card-context-menu-exempt]";
8581

@@ -139,7 +135,6 @@ export function ServerConnectionCard({
139135
const [isCreatingTunnel, setIsCreatingTunnel] = useState(false);
140136
const [isClosingTunnel, setIsClosingTunnel] = useState(false);
141137
const [showTunnelExplanation, setShowTunnelExplanation] = useState(false);
142-
const [isShareDialogOpen, setIsShareDialogOpen] = useState(false);
143138
const [isActionsMenuOpen, setIsActionsMenuOpen] = useState(false);
144139

145140
const {
@@ -169,25 +164,6 @@ export function ServerConnectionCard({
169164
server.connectionStatus === "connecting" ||
170165
server.connectionStatus === "oauth-flow";
171166
const isReconnectMenuDisabled = isReconnecting || isPendingConnection;
172-
const isStdioServer = "command" in server.config;
173-
const isInsecureHttpServer =
174-
"url" in server.config &&
175-
!!server.config.url &&
176-
(() => {
177-
try {
178-
return new URL(server.config.url.toString()).protocol === "http:";
179-
} catch {
180-
return false;
181-
}
182-
})();
183-
const canShareServer =
184-
SERVER_SHARE_UI_ENABLED &&
185-
HOSTED_MODE &&
186-
!!hostedServerId &&
187-
isAuthenticated &&
188-
!isStdioServer &&
189-
!isInsecureHttpServer;
190-
191167
useEffect(() => {
192168
if (serverTunnelUrl !== undefined) {
193169
setTunnelUrl(serverTunnelUrl);
@@ -697,23 +673,6 @@ export function ServerConnectionCard({
697673
className="flex flex-wrap items-center justify-end gap-2"
698674
onClick={(e) => e.stopPropagation()}
699675
>
700-
{canShareServer && (
701-
<button
702-
data-server-card-context-menu-exempt
703-
onClick={() => {
704-
posthog.capture("share_server_clicked", {
705-
location: "server_connection_card",
706-
platform: detectPlatform(),
707-
environment: detectEnvironment(),
708-
});
709-
setIsShareDialogOpen(true);
710-
}}
711-
className="inline-flex items-center gap-1.5 rounded-full border border-border/70 bg-muted/30 px-2 py-0.5 text-[11px] text-foreground transition-colors hover:bg-accent/60 cursor-pointer"
712-
>
713-
<Share2 className="h-3 w-3" />
714-
<span>Share</span>
715-
</button>
716-
)}
717676
{showTunnelActions && (
718677
<>
719678
{hasTunnel ? (
@@ -836,14 +795,6 @@ export function ServerConnectionCard({
836795
onConfirm={handleConfirmCreateTunnel}
837796
isCreating={isCreatingTunnel}
838797
/>
839-
{canShareServer && hostedServerId && (
840-
<ShareServerDialog
841-
isOpen={isShareDialogOpen}
842-
onClose={() => setIsShareDialogOpen(false)}
843-
serverId={hostedServerId}
844-
serverName={server.name}
845-
/>
846-
)}
847798
</>
848799
);
849800
}

0 commit comments

Comments
 (0)