Merge branch 'main' into main

This commit is contained in:
Jeetul Samaiya 2025-09-15 19:30:18 +05:30 • committed by GitHub
commit f36c649bb9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 118 additions and 66 deletions

View file

@ -1,6 +1,6 @@
{ {
"name": "@modelcontextprotocol/inspector-cli", "name": "@modelcontextprotocol/inspector-cli",
"version": "0.16.6", "version": "0.16.7",
"description": "CLI for the Model Context Protocol inspector", "description": "CLI for the Model Context Protocol inspector",
"license": "MIT", "license": "MIT",
"author": "Anthropic, PBC (https://anthropic.com)", "author": "Anthropic, PBC (https://anthropic.com)",
@ -24,7 +24,7 @@
}, },
"devDependencies": {}, "devDependencies": {},
"dependencies": { "dependencies": {
"@modelcontextprotocol/sdk": "^1.17.5", "@modelcontextprotocol/sdk": "^1.18.0",
"commander": "^13.1.0", "commander": "^13.1.0",
"spawn-rx": "^5.1.2" "spawn-rx": "^5.1.2"
} }

View file

@ -1,6 +1,6 @@
{ {
"name": "@modelcontextprotocol/inspector-client", "name": "@modelcontextprotocol/inspector-client",
"version": "0.16.6", "version": "0.16.7",
"description": "Client-side application for the Model Context Protocol inspector", "description": "Client-side application for the Model Context Protocol inspector",
"license": "MIT", "license": "MIT",
"author": "Anthropic, PBC (https://anthropic.com)", "author": "Anthropic, PBC (https://anthropic.com)",
@ -25,7 +25,7 @@
"cleanup:e2e": "node e2e/global-teardown.js" "cleanup:e2e": "node e2e/global-teardown.js"
}, },
"dependencies": { "dependencies": {
"@modelcontextprotocol/sdk": "^1.17.5", "@modelcontextprotocol/sdk": "^1.18.0",
"@radix-ui/react-checkbox": "^1.1.4", "@radix-ui/react-checkbox": "^1.1.4",
"@radix-ui/react-dialog": "^1.1.3", "@radix-ui/react-dialog": "^1.1.3",
"@radix-ui/react-icons": "^1.3.0", "@radix-ui/react-icons": "^1.3.0",

View file

@ -1,10 +1,11 @@
import { useState, memo, useMemo, useCallback, useEffect } from "react"; import { useState, memo, useMemo, useCallback } from "react";
import type { JsonValue } from "@/utils/jsonUtils"; import type { JsonValue } from "@/utils/jsonUtils";
import clsx from "clsx"; import clsx from "clsx";
import { Copy, CheckCheck } from "lucide-react"; import { Copy, CheckCheck } from "lucide-react";
import { Button } from "@/components/ui/button"; import { Button } from "@/components/ui/button";
import { useToast } from "@/lib/hooks/useToast"; import { useToast } from "@/lib/hooks/useToast";
import { getDataType, tryParseJson } from "@/utils/jsonUtils"; import { getDataType, tryParseJson } from "@/utils/jsonUtils";
import useCopy from "@/lib/hooks/useCopy";
interface JsonViewProps { interface JsonViewProps {
data: unknown; data: unknown;
@ -25,21 +26,7 @@ const JsonView = memo(
isError = false, isError = false,
}: JsonViewProps) => { }: JsonViewProps) => {
const { toast } = useToast(); const { toast } = useToast();
const [copied, setCopied] = useState(false); const { copied, setCopied } = useCopy();
useEffect(() => {
let timeoutId: NodeJS.Timeout;
if (copied) {
timeoutId = setTimeout(() => {
setCopied(false);
}, 500);
}
return () => {
if (timeoutId) {
clearTimeout(timeoutId);
}
};
}, [copied]);
const normalizedData = useMemo(() => { const normalizedData = useMemo(() => {
return typeof data === "string" return typeof data === "string"

View file

@ -17,11 +17,20 @@ import {
ListToolsResult, ListToolsResult,
Tool, Tool,
} from "@modelcontextprotocol/sdk/types.js"; } from "@modelcontextprotocol/sdk/types.js";
import { Loader2, Send, ChevronDown, ChevronUp } from "lucide-react"; import {
Loader2,
Send,
ChevronDown,
ChevronUp,
Copy,
CheckCheck,
} from "lucide-react";
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import ListPane from "./ListPane"; import ListPane from "./ListPane";
import JsonView from "./JsonView"; import JsonView from "./JsonView";
import ToolResults from "./ToolResults"; import ToolResults from "./ToolResults";
import { useToast } from "@/lib/hooks/useToast";
import useCopy from "@/lib/hooks/useCopy";
// Type guard to safely detect the optional _meta field without using `any` // Type guard to safely detect the optional _meta field without using `any`
const hasMeta = (tool: Tool): tool is Tool & { _meta: unknown } => const hasMeta = (tool: Tool): tool is Tool & { _meta: unknown } =>
@ -55,6 +64,8 @@ const ToolsTab = ({
const [isToolRunning, setIsToolRunning] = useState(false); const [isToolRunning, setIsToolRunning] = useState(false);
const [isOutputSchemaExpanded, setIsOutputSchemaExpanded] = useState(false); const [isOutputSchemaExpanded, setIsOutputSchemaExpanded] = useState(false);
const [isMetaExpanded, setIsMetaExpanded] = useState(false); const [isMetaExpanded, setIsMetaExpanded] = useState(false);
const { toast } = useToast();
const { copied, setCopied } = useCopy();
useEffect(() => { useEffect(() => {
const params = Object.entries( const params = Object.entries(
@ -291,29 +302,54 @@ const ToolsTab = ({
</div> </div>
</div> </div>
)} )}
<Button <div className="flex gap-2">
onClick={async () => { <Button
try { onClick={async () => {
setIsToolRunning(true); try {
await callTool(selectedTool.name, params); setIsToolRunning(true);
} finally { await callTool(selectedTool.name, params);
setIsToolRunning(false); } finally {
} setIsToolRunning(false);
}} }
disabled={isToolRunning} }}
> disabled={isToolRunning}
{isToolRunning ? ( >
<> {isToolRunning ? (
<Loader2 className="w-4 h-4 mr-2 animate-spin" /> <>
Running... <Loader2 className="w-4 h-4 mr-2 animate-spin" />
</> Running...
) : ( </>
<> ) : (
<Send className="w-4 h-4 mr-2" /> <>
Run Tool <Send className="w-4 h-4 mr-2" />
</> Run Tool
)} </>
</Button> )}
</Button>
<Button
onClick={async () => {
try {
navigator.clipboard.writeText(
JSON.stringify(params, null, 2),
);
setCopied(true);
} catch (error) {
toast({
title: "Error",
description: `There was an error copying input to the clipboard: ${error instanceof Error ? error.message : String(error)}`,
variant: "destructive",
});
}
}}
>
{copied ? (
<CheckCheck className="h-4 w-4 mr-2 dark:text-green-700 text-green-600" />
) : (
<Copy className="h-4 w-4 mr-2" />
)}
Copy Input
</Button>
</div>
<ToolResults <ToolResults
toolResult={toolResult} toolResult={toolResult}
selectedTool={selectedTool} selectedTool={selectedTool}

View file

@ -0,0 +1,29 @@
"use client";
import { useEffect, useState } from "react";
type UseCopyProps = {
timeout?: number;
};
function useCopy({ timeout = 500 }: UseCopyProps = {}) {
const [copied, setCopied] = useState(false);
useEffect(() => {
let timeoutId: NodeJS.Timeout;
if (copied) {
timeoutId = setTimeout(() => {
setCopied(false);
}, timeout);
}
return () => {
if (timeoutId) {
clearTimeout(timeoutId);
}
};
}, [copied]);
return { copied, setCopied };
}
export default useCopy;

30
package-lock.json generated
View file

@ -1,12 +1,12 @@
{ {
"name": "@modelcontextprotocol/inspector", "name": "@modelcontextprotocol/inspector",
"version": "0.16.6", "version": "0.16.7",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "@modelcontextprotocol/inspector", "name": "@modelcontextprotocol/inspector",
"version": "0.16.6", "version": "0.16.7",
"license": "MIT", "license": "MIT",
"workspaces": [ "workspaces": [
"client", "client",
@ -14,10 +14,10 @@
"cli" "cli"
], ],
"dependencies": { "dependencies": {
"@modelcontextprotocol/inspector-cli": "^0.16.6", "@modelcontextprotocol/inspector-cli": "^0.16.7",
"@modelcontextprotocol/inspector-client": "^0.16.6", "@modelcontextprotocol/inspector-client": "^0.16.7",
"@modelcontextprotocol/inspector-server": "^0.16.6", "@modelcontextprotocol/inspector-server": "^0.16.7",
"@modelcontextprotocol/sdk": "^1.17.5", "@modelcontextprotocol/sdk": "^1.18.0",
"concurrently": "^9.2.0", "concurrently": "^9.2.0",
"open": "^10.2.0", "open": "^10.2.0",
"shell-quote": "^1.8.3", "shell-quote": "^1.8.3",
@ -46,10 +46,10 @@
}, },
"cli": { "cli": {
"name": "@modelcontextprotocol/inspector-cli", "name": "@modelcontextprotocol/inspector-cli",
"version": "0.16.6", "version": "0.16.7",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@modelcontextprotocol/sdk": "^1.17.5", "@modelcontextprotocol/sdk": "^1.18.0",
"commander": "^13.1.0", "commander": "^13.1.0",
"spawn-rx": "^5.1.2" "spawn-rx": "^5.1.2"
}, },
@ -69,10 +69,10 @@
}, },
"client": { "client": {
"name": "@modelcontextprotocol/inspector-client", "name": "@modelcontextprotocol/inspector-client",
"version": "0.16.6", "version": "0.16.7",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@modelcontextprotocol/sdk": "^1.17.5", "@modelcontextprotocol/sdk": "^1.18.0",
"@radix-ui/react-checkbox": "^1.1.4", "@radix-ui/react-checkbox": "^1.1.4",
"@radix-ui/react-dialog": "^1.1.3", "@radix-ui/react-dialog": "^1.1.3",
"@radix-ui/react-icons": "^1.3.0", "@radix-ui/react-icons": "^1.3.0",
@ -2013,9 +2013,9 @@
"link": true "link": true
}, },
"node_modules/@modelcontextprotocol/sdk": { "node_modules/@modelcontextprotocol/sdk": {
"version": "1.17.5", "version": "1.18.0",
"resolved": "https://registry.npmjs.org/@modelcontextprotocol/sdk/-/sdk-1.17.5.tgz", "resolved": "https://registry.npmjs.org/@modelcontextprotocol/sdk/-/sdk-1.18.0.tgz",
"integrity": "sha512-QakrKIGniGuRVfWBdMsDea/dx1PNE739QJ7gCM41s9q+qaCYTHCdsIBXQVVXry3mfWAiaM9kT22Hyz53Uw8mfg==", "integrity": "sha512-JvKyB6YwS3quM+88JPR0axeRgvdDu3Pv6mdZUy+w4qVkCzGgumb9bXG/TmtDRQv+671yaofVfXSQmFLlWU5qPQ==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"ajv": "^6.12.6", "ajv": "^6.12.6",
@ -11783,10 +11783,10 @@
}, },
"server": { "server": {
"name": "@modelcontextprotocol/inspector-server", "name": "@modelcontextprotocol/inspector-server",
"version": "0.16.6", "version": "0.16.7",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@modelcontextprotocol/sdk": "^1.17.5", "@modelcontextprotocol/sdk": "^1.18.0",
"cors": "^2.8.5", "cors": "^2.8.5",
"express": "^5.1.0", "express": "^5.1.0",
"shell-quote": "^1.8.3", "shell-quote": "^1.8.3",

View file

@ -1,6 +1,6 @@
{ {
"name": "@modelcontextprotocol/inspector", "name": "@modelcontextprotocol/inspector",
"version": "0.16.6", "version": "0.16.7",
"description": "Model Context Protocol inspector", "description": "Model Context Protocol inspector",
"license": "MIT", "license": "MIT",
"author": "Anthropic, PBC (https://anthropic.com)", "author": "Anthropic, PBC (https://anthropic.com)",
@ -47,10 +47,10 @@
"check-version": "node scripts/check-version-consistency.js" "check-version": "node scripts/check-version-consistency.js"
}, },
"dependencies": { "dependencies": {
"@modelcontextprotocol/inspector-cli": "^0.16.6", "@modelcontextprotocol/inspector-cli": "^0.16.7",
"@modelcontextprotocol/inspector-client": "^0.16.6", "@modelcontextprotocol/inspector-client": "^0.16.7",
"@modelcontextprotocol/inspector-server": "^0.16.6", "@modelcontextprotocol/inspector-server": "^0.16.7",
"@modelcontextprotocol/sdk": "^1.17.5", "@modelcontextprotocol/sdk": "^1.18.0",
"concurrently": "^9.2.0", "concurrently": "^9.2.0",
"open": "^10.2.0", "open": "^10.2.0",
"shell-quote": "^1.8.3", "shell-quote": "^1.8.3",

View file

@ -1,6 +1,6 @@
{ {
"name": "@modelcontextprotocol/inspector-server", "name": "@modelcontextprotocol/inspector-server",
"version": "0.16.6", "version": "0.16.7",
"description": "Server-side application for the Model Context Protocol inspector", "description": "Server-side application for the Model Context Protocol inspector",
"license": "MIT", "license": "MIT",
"author": "Anthropic, PBC (https://anthropic.com)", "author": "Anthropic, PBC (https://anthropic.com)",
@ -28,7 +28,7 @@
"typescript": "^5.6.2" "typescript": "^5.6.2"
}, },
"dependencies": { "dependencies": {
"@modelcontextprotocol/sdk": "^1.17.5", "@modelcontextprotocol/sdk": "^1.18.0",
"cors": "^2.8.5", "cors": "^2.8.5",
"express": "^5.1.0", "express": "^5.1.0",
"shell-quote": "^1.8.3", "shell-quote": "^1.8.3",