parseMcpImport (lib/mcp-import.ts)

retinue · apps/desktop/src/lib/mcp-import.ts · typescript · MIT
infra

Paste-anything MCP import: turns whatever a README tells the user to copy — an mcp.json snippet, a bare `npx`/`docker` command, a `claude mcp add` line, a plain server URL, or a Cursor install deeplink — into named mcp.json entries. Pure and side-effect free; the MCP tab merges t

// Source: https://github.com/novique-ai/retinue | License: MIT | Copyright 2025 Nous Research
// Provided via justclaw.it.com; keep this notice with the code.
// Paste-anything MCP import: turns whatever a README tells the user to copy —
// an mcp.json snippet, a bare `npx`/`docker` command, a `claude mcp add` line,
// a plain server URL, or a Cursor install deeplink — into named mcp.json
// entries. Pure and side-effect free; the MCP tab merges the result into the
// editor draft. Returns null when nothing recognizable is in the text.

export interface McpImportEntry {
  config: Record<string, unknown>
  name: string
}

const isRecord = (value: unknown): value is Record<string, unknown> =>
  !!value && typeof value === 'object' && !Array.isArray(value)

const isServerShape = (value: Reco

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key