Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/commands/mcp/add-impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
finalizeAddedConnection,
} from "./add-flow"
import { ConnectSession } from "./api"
import { isInputRequiredStatus } from "./connection-status"
import { normalizeMcpUrl } from "./normalize-url"
import { outputConnectionDetail } from "./output-connection"
import { parseJsonObject } from "./parse-json"
Expand Down Expand Up @@ -43,9 +44,16 @@ export async function addServer(
`Connection already exists for this URL: ${match.name} (${match.connectionId}, status: ${status})`,
),
)
if (status === "auth_required") {
if (isInputRequiredStatus(match.status)) {
match = await finalizeAddedConnection(session, match, {
name: options.name,
metadata: parsedMetadata,
headers: parsedHeaders,
})
}
if (match.status?.state === "auth_required") {
match = await completeConnectionAuthorization(session, match)
} else if (status === "connected") {
} else if (match.status?.state === "connected") {
console.error(
pc.yellow(
`Use "smithery tool list ${match.connectionId}" to interact with it.`,
Expand Down
Loading