Add toast when OAuth succeeds

This commit is contained in:
Justin Spahr-Summers
2025-01-24 15:19:41 +00:00
parent 0648ba44e3
commit 51ea4bc6ac

View File

@@ -1,6 +1,3 @@
import React from "react";
import { useDraggablePane } from "./lib/hooks/useDraggablePane";
import { useConnection } from "./lib/hooks/useConnection";
import { import {
ClientRequest, ClientRequest,
CompatibilityCallToolResult, CompatibilityCallToolResult,
@@ -11,15 +8,17 @@ import {
ListPromptsResultSchema, ListPromptsResultSchema,
ListResourcesResultSchema, ListResourcesResultSchema,
ListResourceTemplatesResultSchema, ListResourceTemplatesResultSchema,
ReadResourceResultSchema,
ListToolsResultSchema, ListToolsResultSchema,
ReadResourceResultSchema,
Resource, Resource,
ResourceTemplate, ResourceTemplate,
Root, Root,
ServerNotification, ServerNotification,
Tool, Tool,
} from "@modelcontextprotocol/sdk/types.js"; } from "@modelcontextprotocol/sdk/types.js";
import { useEffect, useRef, useState, Suspense } from "react"; import React, { Suspense, useEffect, useRef, useState } from "react";
import { useConnection } from "./lib/hooks/useConnection";
import { useDraggablePane } from "./lib/hooks/useDraggablePane";
import { StdErrNotification } from "./lib/notificationTypes"; import { StdErrNotification } from "./lib/notificationTypes";
@@ -33,6 +32,7 @@ import {
MessageSquare, MessageSquare,
} from "lucide-react"; } from "lucide-react";
import { toast } from "react-toastify";
import { z } from "zod"; import { z } from "zod";
import "./App.css"; import "./App.css";
import ConsoleTab from "./components/ConsoleTab"; import ConsoleTab from "./components/ConsoleTab";
@@ -226,6 +226,8 @@ const App = () => {
const newUrl = new URL(window.location.href); const newUrl = new URL(window.location.href);
newUrl.searchParams.delete("serverUrl"); newUrl.searchParams.delete("serverUrl");
window.history.replaceState({}, "", newUrl.toString()); window.history.replaceState({}, "", newUrl.toString());
// Show success toast for OAuth
toast.success('Successfully authenticated with OAuth');
// Connect to the server // Connect to the server
connectMcpServer(); connectMcpServer();
} }
@@ -444,8 +446,8 @@ const App = () => {
<div className="w-full"> <div className="w-full">
{!serverCapabilities?.resources && {!serverCapabilities?.resources &&
!serverCapabilities?.prompts && !serverCapabilities?.prompts &&
!serverCapabilities?.tools ? ( !serverCapabilities?.tools ? (
<div className="flex items-center justify-center p-4"> <div className="flex items-center justify-center p-4">
<p className="text-lg text-gray-500"> <p className="text-lg text-gray-500">
The connected server does not support any MCP capabilities The connected server does not support any MCP capabilities