Edit mcpview

This commit is contained in:
Saoud Rizwan
2024-12-01 15:08:50 -08:00
parent bee3df5319
commit fa62548b01

View File

@@ -125,8 +125,8 @@ const McpView = ({ onDone }: McpViewProps) => {
bottom: 0, bottom: 0,
display: "flex", display: "flex",
flexDirection: "column", flexDirection: "column",
overflow: "hidden",
}}> }}>
{/* Fixed Header */}
<div <div
style={{ style={{
display: "flex", display: "flex",
@@ -137,44 +137,66 @@ const McpView = ({ onDone }: McpViewProps) => {
<h3 style={{ color: "var(--vscode-foreground)", margin: 0 }}>MCP Servers</h3> <h3 style={{ color: "var(--vscode-foreground)", margin: 0 }}>MCP Servers</h3>
<VSCodeButton onClick={onDone}>Done</VSCodeButton> <VSCodeButton onClick={onDone}>Done</VSCodeButton>
</div> </div>
<p style={{ padding: "0 20px", color: "var(--vscode-foreground)", fontSize: "13px" }}>
MCP (Model Context Protocol) enables AI models to access external tools and data through standardized
interfaces. Add MCP servers to extend Claude's capabilities with custom functionality and real-time data
access.
</p>
{/* Server List */} {/* Scrollable Content */}
<div style={{ flex: 1, overflow: "auto", padding: "0 20px" }}> <div style={{ flex: 1, overflow: "auto", padding: "0 20px" }}>
{servers.map((server) => ( <p style={{ color: "var(--vscode-foreground)", fontSize: "13px" }}>
<ServerRow key={server.name} server={server} /> MCP (Model Context Protocol) enables AI models to access external tools and data through
))} standardized interfaces. Add MCP servers to extend Claude's capabilities with custom functionality
</div> and real-time data access.
</p>
{/* Add Server UI */} {/* Server List */}
<div style={{ padding: "20px" }}> <div style={{ display: "flex", flexDirection: "column", gap: "10px" }}>
{isAdding ? ( {servers.map((server) => (
<div style={{ display: "flex", flexDirection: "column", gap: "10px" }}> <ServerRow key={server.name} server={server} />
<VSCodeTextArea ))}
rows={4}
placeholder='{"mcpServers": {"server-name": {"command": "...", "args": [...]}}}' {/* Add Server UI as a row */}
value={configInput} {isAdding ? (
onChange={(e) => setConfigInput((e.target as HTMLTextAreaElement).value)} <div
/> style={{
<div style={{ display: "flex", gap: "10px" }}> padding: "12px",
<VSCodeButton style={{ flex: 1 }} onClick={handleAddServer}> background: "var(--vscode-list-hoverBackground)",
Add Server borderRadius: "4px",
</VSCodeButton> display: "flex",
<VSCodeButton style={{ flex: 1 }} appearance="secondary" onClick={() => setIsAdding(false)}> flexDirection: "column",
Cancel gap: "10px",
</VSCodeButton> }}>
<b style={{ color: "var(--vscode-foreground)" }}>New MCP Server</b>
<p style={{ color: "var(--vscode-descriptionForeground)", fontSize: "13px", margin: "0" }}>
Enter the MCP server configuration in JSON format. You can find this configuration in
the setup instructions for your MCP server. The config defines how to start and connect
to the server, typically specifying a command and arguments.
</p>
<VSCodeTextArea
rows={4}
placeholder='{"mcpServers": {"server-name": {"command": "...", "args": [...]}}}'
value={configInput}
onChange={(e) => setConfigInput((e.target as HTMLTextAreaElement).value)}
/>
<div style={{ display: "flex", gap: "10px" }}>
<VSCodeButton style={{ flex: 1 }} onClick={handleAddServer}>
Save
</VSCodeButton>
<VSCodeButton
style={{ flex: 1 }}
appearance="secondary"
onClick={() => setIsAdding(false)}>
Cancel
</VSCodeButton>
</div>
</div> </div>
</div> ) : (
) : ( <VSCodeButton style={{ width: "100%" }} onClick={() => setIsAdding(true)}>
<VSCodeButton style={{ width: "100%" }} onClick={() => setIsAdding(true)}> <span className="codicon codicon-add" style={{ marginRight: "6px" }}></span>
<span className="codicon codicon-add" style={{ marginRight: "6px" }}></span> Add MCP Server
Add MCP Server </VSCodeButton>
</VSCodeButton> )}
)} </div>
{/* Add bottom padding for scrolling */}
<div style={{ height: "20px" }} />
</div> </div>
</div> </div>
) )
@@ -345,6 +367,7 @@ const ServerRow = ({ server }: { server: McpServer }) => {
{isEditing ? ( {isEditing ? (
<> <>
<VSCodeTextArea <VSCodeTextArea
rows={4}
value={editConfig} value={editConfig}
onChange={(e) => setEditConfig((e.target as HTMLTextAreaElement).value)} onChange={(e) => setEditConfig((e.target as HTMLTextAreaElement).value)}
style={{ width: "100%" }} style={{ width: "100%" }}