Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/components/mcp/MCPAgentServerMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { useKeybinding } from '../../keybindings/useKeybinding.js';
import { AuthenticationCancelledError, performMCPOAuthFlow } from '../../services/mcp/auth.js';
import { capitalize } from '../../utils/stringUtils.js';
import { ConfigurableShortcutHint } from '../ConfigurableShortcutHint.js';
import { Select } from '../CustomSelect/index.js';
import { Select, type OptionWithDescription } from '../CustomSelect/index.js';
import { Byline } from '../design-system/Byline.js';
import { Dialog } from '../design-system/Dialog.js';
import { KeyboardShortcutHint } from '../design-system/KeyboardShortcutHint.js';
Expand Down Expand Up @@ -102,7 +102,7 @@ export function MCPAgentServerMenu({
</Box>
</Box>;
}
const menuOptions = [];
const menuOptions: OptionWithDescription<string>[] = [];

// Only show authenticate option for HTTP/SSE servers
if (agentServer.needsAuth) {
Expand Down
6 changes: 3 additions & 3 deletions src/components/mcp/MCPListPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ function groupServersByScope(serverList: ServerInfo[]): Map<ConfigScope, ServerI
}
return groups;
}
export function MCPListPanel(t0) {
export function MCPListPanel(t0: Props): React.ReactNode {
const $ = _c(78);
const {
servers,
Expand All @@ -106,7 +106,7 @@ export function MCPListPanel(t0) {
} else {
t2 = $[1];
}
const agentServers = t2;
const agentServers = t2 as AgentMcpServerInfo[];
const [theme] = useTheme();
const [selectedIndex, setSelectedIndex] = useState(0);
let t3;
Expand Down Expand Up @@ -483,7 +483,7 @@ export function MCPListPanel(t0) {
}
return t32;
}
function _temp6(s_2) {
function _temp6(s_2: AgentMcpServerInfo) {
return s_2.sourceAgents;
}
function _temp5(s_1) {
Expand Down
4 changes: 2 additions & 2 deletions src/components/mcp/MCPRemoteServerMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { errorMessage } from '../../utils/errors.js';
import { logMCPDebug } from '../../utils/log.js';
import { capitalize } from '../../utils/stringUtils.js';
import { ConfigurableShortcutHint } from '../ConfigurableShortcutHint.js';
import { Select } from '../CustomSelect/index.js';
import { Select, type OptionWithDescription } from '../CustomSelect/index.js';
import { Byline } from '../design-system/Byline.js';
import { KeyboardShortcutHint } from '../design-system/KeyboardShortcutHint.js';
import { Spinner } from '../Spinner.js';
Expand Down Expand Up @@ -467,7 +467,7 @@ export function MCPRemoteServerMenu({
<Text dimColor>This may take a few moments.</Text>
</Box>;
}
const menuOptions = [];
const menuOptions: OptionWithDescription<string>[] = [];

// If server is disabled, show Enable first as the primary action
if (server.client.type === 'disabled') {
Expand Down
14 changes: 7 additions & 7 deletions src/components/mcp/MCPSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type Props = {
display?: CommandResultDisplay;
}) => void;
};
export function MCPSettings(t0) {
export function MCPSettings(t0: Props): React.ReactNode {
const $ = _c(66);
const {
onComplete
Expand All @@ -35,15 +35,15 @@ export function MCPSettings(t0) {
} else {
t1 = $[0];
}
const [viewState, setViewState] = React.useState(t1);
const [viewState, setViewState] = React.useState<MCPViewState>(t1);
let t2;
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
t2 = [];
$[1] = t2;
} else {
t2 = $[1];
}
const [servers, setServers] = React.useState(t2);
const [servers, setServers] = React.useState<ServerInfo[]>(t2);
let t3;
if ($[2] !== agentDefinitions.allAgents) {
t3 = extractAgentMcpServers(agentDefinitions.allAgents);
Expand All @@ -68,12 +68,12 @@ export function MCPSettings(t0) {
t5 = () => {
let cancelled = false;
const prepareServers = async function prepareServers() {
const serverInfos = await Promise.all(filteredClients.map(async client_0 => {
const serverInfos: ServerInfo[] = await Promise.all(filteredClients.map(async client_0 => {
const scope = client_0.config.scope;
const isSSE = client_0.config.type === "sse";
const isHTTP = client_0.config.type === "http";
const isClaudeAIProxy = client_0.config.type === "claudeai-proxy";
let isAuthenticated = undefined;
let isAuthenticated: boolean | undefined = undefined;
if (isSSE || isHTTP) {
const authProvider = new ClaudeAuthProvider(client_0.name, client_0.config as McpSSEServerConfig | McpHTTPServerConfig);
const tokens = await authProvider.tokens();
Expand All @@ -98,15 +98,15 @@ export function MCPSettings(t0) {
return {
...baseInfo,
transport: "sse" as const,
isAuthenticated,
isAuthenticated: isAuthenticated ?? false,
config: client_0.config as McpSSEServerConfig
};
} else {
if (isHTTP) {
return {
...baseInfo,
transport: "http" as const,
isAuthenticated,
isAuthenticated: isAuthenticated ?? false,
config: client_0.config as McpHTTPServerConfig
};
} else {
Expand Down
4 changes: 2 additions & 2 deletions src/components/mcp/MCPStdioServerMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { useAppState } from '../../state/AppState.js';
import { errorMessage } from '../../utils/errors.js';
import { capitalize } from '../../utils/stringUtils.js';
import { ConfigurableShortcutHint } from '../ConfigurableShortcutHint.js';
import { Select } from '../CustomSelect/index.js';
import { Select, type OptionWithDescription } from '../CustomSelect/index.js';
import { Byline } from '../design-system/Byline.js';
import { KeyboardShortcutHint } from '../design-system/KeyboardShortcutHint.js';
import { Spinner } from '../Spinner.js';
Expand Down Expand Up @@ -56,7 +56,7 @@ export function MCPStdioServerMenu({

// Count MCP prompts for this server (skills are shown in /skills, not here)
const serverCommandsCount = filterMcpPromptsByServer(mcp.commands, server.name).length;
const menuOptions = [];
const menuOptions: OptionWithDescription<string>[] = [];

// Only show "View tools" if server is not disabled and has tools
if (server.client.type !== 'disabled' && serverToolsCount > 0) {
Expand Down
2 changes: 1 addition & 1 deletion src/components/mcp/MCPToolDetailView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ type Props = {
server: ServerInfo;
onBack: () => void;
};
export function MCPToolDetailView(t0) {
export function MCPToolDetailView(t0: Props): React.ReactNode {
const $ = _c(44);
const {
tool,
Expand Down
4 changes: 2 additions & 2 deletions src/components/mcp/MCPToolListView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type Props = {
onSelectTool: (tool: Tool, index: number) => void;
onBack: () => void;
};
export function MCPToolListView(t0) {
export function MCPToolListView(t0: Props): React.ReactNode {
const $ = _c(21);
const {
server,
Expand Down Expand Up @@ -61,7 +61,7 @@ export function MCPToolListView(t0) {
const isReadOnly = tool.isReadOnly?.({}) ?? false;
const isDestructive = tool.isDestructive?.({}) ?? false;
const isOpenWorld = tool.isOpenWorld?.({}) ?? false;
const annotations = [];
const annotations: string[] = [];
if (isReadOnly) {
annotations.push("read-only");
}
Expand Down
76 changes: 76 additions & 0 deletions src/components/mcp/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import type {
ConfigScope,
MCPServerConnection,
McpClaudeAIProxyServerConfig,
McpHTTPServerConfig,
McpSSEServerConfig,
McpStdioServerConfig,
} from '../../services/mcp/types.js'

type BaseServerInfo = {
name: string
client: MCPServerConnection
scope: ConfigScope
}

export type StdioServerInfo = BaseServerInfo & {
transport: 'stdio'
config: McpStdioServerConfig
}

export type SSEServerInfo = BaseServerInfo & {
transport: 'sse'
config: McpSSEServerConfig
isAuthenticated?: boolean
}

export type HTTPServerInfo = BaseServerInfo & {
transport: 'http'
config: McpHTTPServerConfig
isAuthenticated?: boolean
}

export type ClaudeAIServerInfo = BaseServerInfo & {
transport: 'claudeai-proxy'
config: McpClaudeAIProxyServerConfig
isAuthenticated?: boolean
}

export type ServerInfo =
| StdioServerInfo
| SSEServerInfo
| HTTPServerInfo
| ClaudeAIServerInfo

export type AgentMcpServerInfo = {
name: string
sourceAgents: string[]
transport: 'stdio' | 'sse' | 'http' | 'ws'
command?: string
url?: string
needsAuth: boolean
isAuthenticated?: boolean
}

export type MCPViewState =
| {
type: 'list'
defaultTab?: string
}
| {
type: 'server-menu'
server: ServerInfo
}
| {
type: 'server-tools'
server: ServerInfo
}
| {
type: 'server-tool-detail'
server: ServerInfo
toolIndex: number
}
| {
type: 'agent-server-menu'
agentServer: AgentMcpServerInfo
}