@assistant-ui/react-mcp 0.0.18 → 0.0.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/dist/primitives/addForm/McpAddFormAuthSelect.js.map +1 -1
  2. package/dist/primitives/addForm/McpAddFormCancel.d.ts.map +1 -1
  3. package/dist/primitives/addForm/McpAddFormError.d.ts.map +1 -1
  4. package/dist/primitives/addForm/McpAddFormError.js.map +1 -1
  5. package/dist/primitives/addForm/McpAddFormRoot.d.ts.map +1 -1
  6. package/dist/primitives/addForm/McpAddFormRoot.js.map +1 -1
  7. package/dist/primitives/addForm/McpAddFormSubmit.d.ts.map +1 -1
  8. package/dist/primitives/manager/McpManagerAddCustomTrigger.d.ts.map +1 -1
  9. package/dist/primitives/manager/McpManagerConnectors.js.map +1 -1
  10. package/dist/primitives/manager/McpManagerCustomServers.js.map +1 -1
  11. package/dist/primitives/manager/McpManagerRoot.d.ts.map +1 -1
  12. package/dist/primitives/server/McpServerConnectButton.d.ts.map +1 -1
  13. package/dist/primitives/server/McpServerDisconnectButton.d.ts.map +1 -1
  14. package/dist/primitives/server/McpServerError.d.ts.map +1 -1
  15. package/dist/primitives/server/McpServerError.js.map +1 -1
  16. package/dist/primitives/server/McpServerIcon.d.ts.map +1 -1
  17. package/dist/primitives/server/McpServerName.d.ts.map +1 -1
  18. package/dist/primitives/server/McpServerName.js.map +1 -1
  19. package/dist/primitives/server/McpServerOAuthLink.d.ts.map +1 -1
  20. package/dist/primitives/server/McpServerRemoveButton.d.ts.map +1 -1
  21. package/dist/primitives/server/McpServerRoot.d.ts.map +1 -1
  22. package/dist/primitives/server/McpServerStatus.d.ts.map +1 -1
  23. package/dist/primitives/server/McpServerStatus.js.map +1 -1
  24. package/dist/primitives/server/McpServerToolName.d.ts.map +1 -1
  25. package/dist/primitives/server/McpServerToolName.js.map +1 -1
  26. package/dist/primitives/server/McpServerTools.js.map +1 -1
  27. package/dist/resources/McpServerResource.d.ts.map +1 -1
  28. package/dist/resources/McpServerResource.js +89 -31
  29. package/dist/resources/McpServerResource.js.map +1 -1
  30. package/dist/resources/storage/McpLocalStorage.d.ts.map +1 -1
  31. package/dist/resources/storage/McpLocalStorage.js +13 -2
  32. package/dist/resources/storage/McpLocalStorage.js.map +1 -1
  33. package/package.json +8 -8
  34. package/src/resources/McpServerResource.test.ts +179 -6
  35. package/src/resources/McpServerResource.ts +114 -29
  36. package/src/resources/storage/McpLocalStorage.test.ts +56 -0
  37. package/src/resources/storage/McpLocalStorage.ts +23 -2
@@ -1 +1 @@
1
- {"version":3,"file":"McpAddFormAuthSelect.js","names":["ComponentPropsWithoutRef","ComponentRef","forwardRef","Primitive","useAddForm","AddFormAuthType","AUTH_TYPES","ReadonlySet","Set","asAuthType","value","has","McpAddFormPrimitiveAuthSelect","Element","select","Props","Omit","props","ref","$","_c","state","setField","t0","e","next","target","t1","children","t2","authType","displayName"],"sources":["../../../src/primitives/addForm/McpAddFormAuthSelect.tsx"],"sourcesContent":["import {\n type ComponentPropsWithoutRef,\n type ComponentRef,\n forwardRef,\n} from \"react\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport { useAddForm, type AddFormAuthType } from \"./context\";\n\nconst AUTH_TYPES: ReadonlySet<AddFormAuthType> = new Set([\n \"none\",\n \"bearer\",\n \"oauth\",\n]);\n\nfunction asAuthType(value: string): AddFormAuthType | null {\n return (AUTH_TYPES as ReadonlySet<string>).has(value)\n ? (value as AddFormAuthType)\n : null;\n}\n\nexport namespace McpAddFormPrimitiveAuthSelect {\n export type Element = ComponentRef<typeof Primitive.select>;\n export type Props = Omit<\n ComponentPropsWithoutRef<typeof Primitive.select>,\n \"value\" | \"onChange\"\n >;\n}\n\nexport const McpAddFormPrimitiveAuthSelect = forwardRef<\n McpAddFormPrimitiveAuthSelect.Element,\n McpAddFormPrimitiveAuthSelect.Props\n>((props, ref) => {\n const { state, setField } = useAddForm();\n return (\n <Primitive.select\n {...props}\n ref={ref}\n value={state.authType}\n onChange={(e) => {\n const next = asAuthType(e.target.value);\n if (next) setField(\"authType\", next);\n }}\n >\n {props.children ?? (\n <>\n <option value=\"oauth\">OAuth</option>\n <option value=\"bearer\">Bearer token</option>\n <option value=\"none\">None</option>\n </>\n )}\n </Primitive.select>\n );\n});\n\nMcpAddFormPrimitiveAuthSelect.displayName = \"McpAddFormPrimitive.AuthSelect\";\n"],"mappings":";;;;;;AAQA,MAAMM,6BAA2C,IAAIE,IAAI;CACvD;CACA;CACA;AAAO,CACR;AAED,SAASC,WAAWC,OAAuC;CACzD,OAAQJ,WAAmCK,IAAID,KAAK,IAC/CA,QACD;AACN;AAUA,MAAaE,gCAAgCV,YAG3Ce,OAAAC,QAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CACA,MAAA,EAAAC,OAAAC,aAA4BlB,WAAW;CAAE,IAAAmB;CAAA,IAAAJ,EAAA,OAAAG,UAAA;EAM3BC,MAAAC,MAAA;GACR,MAAAC,OAAahB,WAAWe,EAACE,OAAOhB,KAAM;GACtC,IAAIe,MAAMH,SAAS,YAAYG,IAAI;EAAE;EACtCN,EAAA,KAAAG;EAAAH,EAAA,KAAAI;CAAA,OAAAA,KAAAJ,EAAA;CAAA,IAAAQ;CAAA,IAAAR,EAAA,OAAAF,MAAAW,UAAA;EAEAD,KAAAV,MAAKW,YAAL,qBAAA,UAAA,EAAA,UAAA;GAEG,oBAAA,UAAA;IAAc,OAAA;cAAQ;GAAc,CAAA;GACpC,oBAAA,UAAA;IAAc,OAAA;cAAS;GAAqB,CAAA;GAC5C,oBAAA,UAAA;IAAc,OAAA;cAAO;GAAa,CAAA;EAAA,EAAA,CAAA;EAErCT,EAAA,KAAAF,MAAAW;EAAAT,EAAA,KAAAQ;CAAA,OAAAA,KAAAR,EAAA;CAAA,IAAAU;CAAA,IAAAV,EAAA,OAAAF,SAAAE,EAAA,OAAAD,OAAAC,EAAA,OAAAE,MAAAS,YAAAX,EAAA,OAAAI,MAAAJ,EAAA,OAAAQ,IAAA;EAfHE,KAAA,oBAAA,UAAA,QAAA;GAAA,GACMZ;GACCC;GACE,OAAAG,MAAKS;GACF,UAAAP;aAKTI;EAOH,CAAA;EAAmBR,EAAA,KAAAF;EAAAE,EAAA,KAAAD;EAAAC,EAAA,KAAAE,MAAAS;EAAAX,EAAA,KAAAI;EAAAJ,EAAA,KAAAQ;EAAAR,EAAA,KAAAU;CAAA,OAAAA,KAAAV,EAAA;CAAA,OAhBnBU;AAgBmB,CAEtB;AAEDjB,8BAA8BmB,cAAc"}
1
+ {"version":3,"file":"McpAddFormAuthSelect.js","names":["ComponentPropsWithoutRef","ComponentRef","forwardRef","Primitive","useAddForm","AddFormAuthType","AUTH_TYPES","ReadonlySet","Set","asAuthType","value","has","McpAddFormPrimitiveAuthSelect","Element","select","Props","Omit","props","ref","$","_c","state","setField","t0","e","next","target","t1","children","t2","authType","displayName"],"sources":["../../../src/primitives/addForm/McpAddFormAuthSelect.tsx"],"sourcesContent":["import {\n type ComponentPropsWithoutRef,\n type ComponentRef,\n forwardRef,\n} from \"react\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport { useAddForm, type AddFormAuthType } from \"./context\";\n\nconst AUTH_TYPES: ReadonlySet<AddFormAuthType> = new Set([\n \"none\",\n \"bearer\",\n \"oauth\",\n]);\n\nfunction asAuthType(value: string): AddFormAuthType | null {\n return (AUTH_TYPES as ReadonlySet<string>).has(value)\n ? (value as AddFormAuthType)\n : null;\n}\n\nexport namespace McpAddFormPrimitiveAuthSelect {\n export type Element = ComponentRef<typeof Primitive.select>;\n export type Props = Omit<\n ComponentPropsWithoutRef<typeof Primitive.select>,\n \"value\" | \"onChange\"\n >;\n}\n\nexport const McpAddFormPrimitiveAuthSelect = forwardRef<\n McpAddFormPrimitiveAuthSelect.Element,\n McpAddFormPrimitiveAuthSelect.Props\n>((props, ref) => {\n const { state, setField } = useAddForm();\n return (\n <Primitive.select\n {...props}\n ref={ref}\n value={state.authType}\n onChange={(e) => {\n const next = asAuthType(e.target.value);\n if (next) setField(\"authType\", next);\n }}\n >\n {props.children ?? (\n <>\n <option value=\"oauth\">OAuth</option>\n <option value=\"bearer\">Bearer token</option>\n <option value=\"none\">None</option>\n </>\n )}\n </Primitive.select>\n );\n});\n\nMcpAddFormPrimitiveAuthSelect.displayName = \"McpAddFormPrimitive.AuthSelect\";\n"],"mappings":";;;;;;AAQA,MAAMM,6BAA2C,IAAIE,IAAI;CACvD;CACA;CACA;AAAO,CACR;AAED,SAASC,WAAWC,OAAuC;CACzD,OAAQJ,WAAmCK,IAAID,KAAK,IAC/CA,QACD;AACN;AAUA,MAAaE,gCAAgCV,YAG3Ce,OAAAC,QAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CACA,MAAA,EAAAC,OAAAC,aAA4BlB,WAAW;CAAE,IAAAmB;CAAA,IAAAJ,EAAA,OAAAG,UAAA;EAM3BC,MAAAC,MAAA;GACR,MAAAC,OAAahB,WAAWe,EAACE,OAAOhB,KAAM;GACtC,IAAIe,MAAMH,SAAS,YAAYG,IAAI;EAAE;EACtCN,EAAA,KAAAG;EAAAH,EAAA,KAAAI;CAAA,OAAAA,KAAAJ,EAAA;CAAA,IAAAQ;CAAA,IAAAR,EAAA,OAAAF,MAAAW,UAAA;EAEAD,KAAAV,MAAKW,YAAL,qBAAA,UAAA,EAAA,UAAA;GAEG,oBAAA,UAAA;IAAc,OAAA;IAAQ,UAAA;GAAc,CAAA;GACpC,oBAAA,UAAA;IAAc,OAAA;IAAS,UAAA;GAAqB,CAAA;GAC5C,oBAAA,UAAA;IAAc,OAAA;IAAO,UAAA;GAAa,CAAA;EAAA,EAAA,CAAA;EAErCT,EAAA,KAAAF,MAAAW;EAAAT,EAAA,KAAAQ;CAAA,OAAAA,KAAAR,EAAA;CAAA,IAAAU;CAAA,IAAAV,EAAA,OAAAF,SAAAE,EAAA,OAAAD,OAAAC,EAAA,OAAAE,MAAAS,YAAAX,EAAA,OAAAI,MAAAJ,EAAA,OAAAQ,IAAA;EAfHE,KAAA,oBAAA,UAAA,QAAA;GAAA,GACMZ;GACCC;GACE,OAAAG,MAAKS;GACF,UAAAP;GAKTI,UAAAA;EAOH,CAAA;EAAmBR,EAAA,KAAAF;EAAAE,EAAA,KAAAD;EAAAC,EAAA,KAAAE,MAAAS;EAAAX,EAAA,KAAAI;EAAAJ,EAAA,KAAAQ;EAAAR,EAAA,KAAAU;CAAA,OAAAA,KAAAV,EAAA;CAAA,OAhBnBU;AAgBmB,CAEtB;AAEDjB,8BAA8BmB,cAAc"}
@@ -1 +1 @@
1
- {"version":3,"file":"McpAddFormCancel.d.ts","names":[],"sources":["../../../src/primitives/addForm/McpAddFormCancel.tsx"],"mappings":";;;kBAQiB;OACH,UAAU,oBAAoB,UAAU;OACxC,QAAQ,gCAAgC,UAAU;;cAGnD,2CAAyB,0BAAA,qBAAA,gBAAA,qCAAA,qBAAA"}
1
+ {"version":3,"file":"McpAddFormCancel.d.ts","names":[],"sources":["../../../src/primitives/addForm/McpAddFormCancel.tsx"],"mappings":";;;kBAQiB;OACH,UAAU,oBAAoB,UAAU;OACxC,QAAQ,gCAAgC,UAAU;;cAGnD,2CAAyB,0BAAA,qBAAA,gBAAA,qCAAA,qBAAA;;4BAiBpC,cAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"McpAddFormError.d.ts","names":[],"sources":["../../../src/primitives/addForm/McpAddFormError.tsx"],"mappings":";;;kBAQiB;OACH,UAAU,oBAAoB,UAAU;OACxC,QAAQ,gCAAgC,UAAU;;cAGnD,0CAAwB,0BAAA,qBAAA,gBAAA,kCAAA,eAAA"}
1
+ {"version":3,"file":"McpAddFormError.d.ts","names":[],"sources":["../../../src/primitives/addForm/McpAddFormError.tsx"],"mappings":";;;kBAQiB;OACH,UAAU,oBAAoB,UAAU;OACxC,QAAQ,gCAAgC,UAAU;;cAGnD,0CAAwB,0BAAA,qBAAA,gBAAA,kCAAA,eAAA;;4BAWnC,cAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"McpAddFormError.js","names":["ComponentPropsWithoutRef","ComponentRef","forwardRef","Primitive","useAddForm","McpAddFormPrimitiveError","Element","div","Props","props","ref","$","_c","state","error","t0","children","t1","displayName"],"sources":["../../../src/primitives/addForm/McpAddFormError.tsx"],"sourcesContent":["import {\n type ComponentPropsWithoutRef,\n type ComponentRef,\n forwardRef,\n} from \"react\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport { useAddForm } from \"./context\";\n\nexport namespace McpAddFormPrimitiveError {\n export type Element = ComponentRef<typeof Primitive.div>;\n export type Props = ComponentPropsWithoutRef<typeof Primitive.div>;\n}\n\nexport const McpAddFormPrimitiveError = forwardRef<\n McpAddFormPrimitiveError.Element,\n McpAddFormPrimitiveError.Props\n>((props, ref) => {\n const { state } = useAddForm();\n if (!state.error) return null;\n return (\n <Primitive.div {...props} ref={ref}>\n {props.children ?? state.error}\n </Primitive.div>\n );\n});\n\nMcpAddFormPrimitiveError.displayName = \"McpAddFormPrimitive.Error\";\n"],"mappings":";;;;;;AAaA,MAAaK,2BAA2BH,YAGtCO,OAAAC,QAAA;CAAA,MAAAC,IAAAC,EAAA,CAAA;CACA,MAAA,EAAAC,UAAkBT,WAAW;CAC7B,IAAI,CAACS,MAAKC,OAAM,OAAS;CAGpB,MAAAC,KAAAN,MAAKO,YAAaH,MAAKC;CAAM,IAAAG;CAAA,IAAAN,EAAA,OAAAF,SAAAE,EAAA,OAAAD,OAAAC,EAAA,OAAAI,IAAA;EADhCE,KAAA,oBAAA,UAAA,KAAA;GAAA,GAAmBR;GAAYC;aAC5BK;EACH,CAAA;EAAgBJ,EAAA,KAAAF;EAAAE,EAAA,KAAAD;EAAAC,EAAA,KAAAI;EAAAJ,EAAA,KAAAM;CAAA,OAAAA,KAAAN,EAAA;CAAA,OAFhBM;AAEgB,CAEnB;AAEDZ,yBAAyBa,cAAc"}
1
+ {"version":3,"file":"McpAddFormError.js","names":["ComponentPropsWithoutRef","ComponentRef","forwardRef","Primitive","useAddForm","McpAddFormPrimitiveError","Element","div","Props","props","ref","$","_c","state","error","t0","children","t1","displayName"],"sources":["../../../src/primitives/addForm/McpAddFormError.tsx"],"sourcesContent":["import {\n type ComponentPropsWithoutRef,\n type ComponentRef,\n forwardRef,\n} from \"react\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport { useAddForm } from \"./context\";\n\nexport namespace McpAddFormPrimitiveError {\n export type Element = ComponentRef<typeof Primitive.div>;\n export type Props = ComponentPropsWithoutRef<typeof Primitive.div>;\n}\n\nexport const McpAddFormPrimitiveError = forwardRef<\n McpAddFormPrimitiveError.Element,\n McpAddFormPrimitiveError.Props\n>((props, ref) => {\n const { state } = useAddForm();\n if (!state.error) return null;\n return (\n <Primitive.div {...props} ref={ref}>\n {props.children ?? state.error}\n </Primitive.div>\n );\n});\n\nMcpAddFormPrimitiveError.displayName = \"McpAddFormPrimitive.Error\";\n"],"mappings":";;;;;;AAaA,MAAaK,2BAA2BH,YAGtCO,OAAAC,QAAA;CAAA,MAAAC,IAAAC,EAAA,CAAA;CACA,MAAA,EAAAC,UAAkBT,WAAW;CAC7B,IAAI,CAACS,MAAKC,OAAM,OAAS;CAGpB,MAAAC,KAAAN,MAAKO,YAAaH,MAAKC;CAAM,IAAAG;CAAA,IAAAN,EAAA,OAAAF,SAAAE,EAAA,OAAAD,OAAAC,EAAA,OAAAI,IAAA;EADhCE,KAAA,oBAAA,UAAA,KAAA;GAAA,GAAmBR;GAAYC;GAC5BK,UAAAA;EACH,CAAA;EAAgBJ,EAAA,KAAAF;EAAAE,EAAA,KAAAD;EAAAC,EAAA,KAAAI;EAAAJ,EAAA,KAAAM;CAAA,OAAAA,KAAAN,EAAA;CAAA,OAFhBM;AAEgB,CAEnB;AAEDZ,yBAAyBa,cAAc"}
@@ -1 +1 @@
1
- {"version":3,"file":"McpAddFormRoot.d.ts","names":[],"sources":["../../../src/primitives/addForm/McpAddFormRoot.tsx"],"mappings":";;;kBAuCiB;OACH,UAAU,oBAAoB,UAAU;OACxC,QAAQ,KAClB,gCAAgC,UAAU;IAG1C,eAAe;IACf;;;cAIS,yCAAuB,0BAAA,KAAA,qBAAA,gBAAA,mCAAA,mBAAA;;;iBALjB"}
1
+ {"version":3,"file":"McpAddFormRoot.d.ts","names":[],"sources":["../../../src/primitives/addForm/McpAddFormRoot.tsx"],"mappings":";;;kBAuCiB;OACH,UAAU,oBAAoB,UAAU;OACxC,QAAQ,KAClB,gCAAgC,UAAU;IAG1C,eAAe;IACf;;;cAIS,yCAAuB,0BAAA,KAAA,qBAAA,gBAAA,mCAAA,mBAAA;;;EALlB,eAAC;EACJ;oBA4Fb,cAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"McpAddFormRoot.js","names":["ComponentPropsWithoutRef","ComponentRef","FormEventHandler","forwardRef","useCallback","useMemo","useState","Primitive","useAui","AddFormContext","AddFormState","MCPAuthConfig","INITIAL","name","url","authType","bearerToken","scopes","submitting","error","validateUrl","raw","trimmed","trim","parsed","URL","protocol","McpAddFormPrimitiveRoot","Element","form","Props","Omit","onSubmitted","id","onCancel","props","ref","aui","state","setState","setField","key","K","value","prev","reset","buildAuth","type","token","undefined","scopeList","split","map","s","filter","Boolean","length","submit","p","urlResult","mcp","addCustomServer","auth","err","Error","message","String","cancel","onFormSubmit","HTMLFormElement","e","preventDefault","displayName"],"sources":["../../../src/primitives/addForm/McpAddFormRoot.tsx"],"sourcesContent":["import {\n type ComponentPropsWithoutRef,\n type ComponentRef,\n type FormEventHandler,\n forwardRef,\n useCallback,\n useMemo,\n useState,\n} from \"react\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport { useAui } from \"@assistant-ui/store\";\nimport { AddFormContext, type AddFormState } from \"./context\";\nimport type { MCPAuthConfig } from \"../../mcp-scope\";\n\nconst INITIAL: AddFormState = {\n name: \"\",\n url: \"\",\n authType: \"oauth\",\n bearerToken: \"\",\n scopes: \"\",\n submitting: false,\n error: null,\n};\n\nfunction validateUrl(raw: string): { url: string } | { error: string } {\n const trimmed = raw.trim();\n if (!trimmed) return { error: \"URL is required\" };\n let parsed: URL;\n try {\n parsed = new URL(trimmed);\n } catch {\n return { error: \"Invalid URL\" };\n }\n if (parsed.protocol !== \"http:\" && parsed.protocol !== \"https:\") {\n return { error: \"URL must be http(s)\" };\n }\n return { url: trimmed };\n}\n\nexport namespace McpAddFormPrimitiveRoot {\n export type Element = ComponentRef<typeof Primitive.form>;\n export type Props = Omit<\n ComponentPropsWithoutRef<typeof Primitive.form>,\n \"onSubmit\"\n > & {\n onSubmitted?: (id: string) => void;\n onCancel?: () => void;\n };\n}\n\nexport const McpAddFormPrimitiveRoot = forwardRef<\n McpAddFormPrimitiveRoot.Element,\n McpAddFormPrimitiveRoot.Props\n>(({ onSubmitted, onCancel, ...props }, ref) => {\n const aui = useAui();\n const [state, setState] = useState<AddFormState>(INITIAL);\n\n const setField = useCallback(\n <K extends keyof AddFormState>(key: K, value: AddFormState[K]) => {\n setState((prev) => ({ ...prev, [key]: value }));\n },\n [],\n );\n\n const reset = useCallback(() => setState(INITIAL), []);\n\n const buildAuth = useCallback((): MCPAuthConfig => {\n switch (state.authType) {\n case \"none\":\n return { type: \"none\" };\n case \"bearer\":\n return { type: \"bearer\", token: state.bearerToken || undefined };\n case \"oauth\": {\n const scopeList = state.scopes\n .split(/[\\s,]+/)\n .map((s) => s.trim())\n .filter(Boolean);\n return {\n type: \"oauth\",\n scopes: scopeList.length > 0 ? scopeList : undefined,\n };\n }\n }\n }, [state.authType, state.bearerToken, state.scopes]);\n\n const submit = useCallback(async () => {\n if (state.submitting) return;\n if (!state.name.trim()) {\n setState((p) => ({ ...p, error: \"Name is required\" }));\n return;\n }\n if (state.authType === \"bearer\" && !state.bearerToken.trim()) {\n setState((p) => ({ ...p, error: \"Bearer token is required\" }));\n return;\n }\n const urlResult = validateUrl(state.url);\n if (\"error\" in urlResult) {\n setState((p) => ({ ...p, error: urlResult.error }));\n return;\n }\n setState((p) => ({ ...p, submitting: true, error: null }));\n try {\n const id = await aui.mcp().addCustomServer({\n name: state.name.trim(),\n url: urlResult.url,\n auth: buildAuth(),\n });\n setState(INITIAL);\n onSubmitted?.(id);\n } catch (err) {\n setState((p) => ({\n ...p,\n submitting: false,\n error: err instanceof Error ? err.message : String(err),\n }));\n }\n }, [aui, buildAuth, onSubmitted, state]);\n\n const cancel = useCallback(() => {\n setState(INITIAL);\n onCancel?.();\n }, [onCancel]);\n\n const value = useMemo(\n () => ({ state, setField, reset, submit, cancel }),\n [state, setField, reset, submit, cancel],\n );\n\n const onFormSubmit: FormEventHandler<HTMLFormElement> = (e) => {\n e.preventDefault();\n void submit();\n };\n\n return (\n <AddFormContext.Provider value={value}>\n <Primitive.form {...props} ref={ref} onSubmit={onFormSubmit} />\n </AddFormContext.Provider>\n );\n});\n\nMcpAddFormPrimitiveRoot.displayName = \"McpAddFormPrimitive.Root\";\n"],"mappings":";;;;;;AAcA,MAAMY,UAAwB;CAC5BC,MAAM;CACNC,KAAK;CACLC,UAAU;CACVC,aAAa;CACbC,QAAQ;CACRC,YAAY;CACZC,OAAO;AACT;AAEA,SAASC,YAAYC,KAAkD;CACrE,MAAMC,UAAUD,IAAIE,KAAK;CACzB,IAAI,CAACD,SAAS,OAAO,EAAEH,OAAO,kBAAkB;CAChD,IAAIK;CACJ,IAAI;EACFA,SAAS,IAAIC,IAAIH,OAAO;CAC1B,QAAQ;EACN,OAAO,EAAEH,OAAO,cAAc;CAChC;CACA,IAAIK,OAAOE,aAAa,WAAWF,OAAOE,aAAa,UACrD,OAAO,EAAEP,OAAO,sBAAsB;CAExC,OAAO,EAAEL,KAAKQ,QAAQ;AACxB;AAaA,MAAaK,0BAA0BxB,YAGpC,EAAE6B,aAAaE,UAAU,GAAGC,SAASC,QAAQ;CAC9C,MAAMC,MAAM7B,OAAO;CACnB,MAAM,CAAC8B,OAAOC,YAAYjC,SAAuBM,OAAO;CAExD,MAAM4B,WAAWpC,aACgBqC,KAAQE,UAA2B;EAChEJ,UAAUK,UAAU;GAAE,GAAGA;IAAOH,MAAME;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,MAAMzB,KAAKU,KAAK;IACtBT,KAAK6C,UAAU7C;IACfgD,MAAMhB,UAAU;GAClB,CAAC;GACDP,SAAS3B,OAAO;GAChBoB,cAAcC,EAAE;EAClB,SAAS8B,KAAK;GACZxB,UAAUmB,SAAO;IACf,GAAGA;IACHxC,YAAY;IACZC,OAAO4C,eAAeC,QAAQD,IAAIE,UAAUC,OAAOH,GAAG;GACxD,EAAE;EACJ;CACF,GAAG;EAAC1B;EAAKS;EAAWd;EAAaM;CAAK,CAAC;CAEvC,MAAM6B,SAAS/D,kBAAkB;EAC/BmC,SAAS3B,OAAO;EAChBsB,WAAW;CACb,GAAG,CAACA,QAAQ,CAAC;CAEb,MAAMS,UAAQtC,eACL;EAAEiC;EAAOE;EAAUK;EAAOY;EAAQU;CAAO,IAChD;EAAC7B;EAAOE;EAAUK;EAAOY;EAAQU;CAAM,CACzC;CAEA,MAAMC,gBAAmDE,MAAM;EAC7DA,EAAEC,eAAe;EACjB,OAAY;CACd;CAEA,OACE,oBAAC,eAAe,UAAhB;EAAyB,OAAO5B;YAC9B,oBAAC,UAAU,MAAX;GAAgB,GAAIR;GAAYC;GAAK,UAAUgC;EAAa,CAAA;CACrC,CAAA;AAE7B,CAAC;AAEDzC,wBAAwB6C,cAAc"}
1
+ {"version":3,"file":"McpAddFormRoot.js","names":["ComponentPropsWithoutRef","ComponentRef","FormEventHandler","forwardRef","useCallback","useMemo","useState","Primitive","useAui","AddFormContext","AddFormState","MCPAuthConfig","INITIAL","name","url","authType","bearerToken","scopes","submitting","error","validateUrl","raw","trimmed","trim","parsed","URL","protocol","McpAddFormPrimitiveRoot","Element","form","Props","Omit","onSubmitted","id","onCancel","props","ref","aui","state","setState","setField","key","K","value","prev","reset","buildAuth","type","token","undefined","scopeList","split","map","s","filter","Boolean","length","submit","p","urlResult","mcp","addCustomServer","auth","err","Error","message","String","cancel","onFormSubmit","HTMLFormElement","e","preventDefault","displayName"],"sources":["../../../src/primitives/addForm/McpAddFormRoot.tsx"],"sourcesContent":["import {\n type ComponentPropsWithoutRef,\n type ComponentRef,\n type FormEventHandler,\n forwardRef,\n useCallback,\n useMemo,\n useState,\n} from \"react\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport { useAui } from \"@assistant-ui/store\";\nimport { AddFormContext, type AddFormState } from \"./context\";\nimport type { MCPAuthConfig } from \"../../mcp-scope\";\n\nconst INITIAL: AddFormState = {\n name: \"\",\n url: \"\",\n authType: \"oauth\",\n bearerToken: \"\",\n scopes: \"\",\n submitting: false,\n error: null,\n};\n\nfunction validateUrl(raw: string): { url: string } | { error: string } {\n const trimmed = raw.trim();\n if (!trimmed) return { error: \"URL is required\" };\n let parsed: URL;\n try {\n parsed = new URL(trimmed);\n } catch {\n return { error: \"Invalid URL\" };\n }\n if (parsed.protocol !== \"http:\" && parsed.protocol !== \"https:\") {\n return { error: \"URL must be http(s)\" };\n }\n return { url: trimmed };\n}\n\nexport namespace McpAddFormPrimitiveRoot {\n export type Element = ComponentRef<typeof Primitive.form>;\n export type Props = Omit<\n ComponentPropsWithoutRef<typeof Primitive.form>,\n \"onSubmit\"\n > & {\n onSubmitted?: (id: string) => void;\n onCancel?: () => void;\n };\n}\n\nexport const McpAddFormPrimitiveRoot = forwardRef<\n McpAddFormPrimitiveRoot.Element,\n McpAddFormPrimitiveRoot.Props\n>(({ onSubmitted, onCancel, ...props }, ref) => {\n const aui = useAui();\n const [state, setState] = useState<AddFormState>(INITIAL);\n\n const setField = useCallback(\n <K extends keyof AddFormState>(key: K, value: AddFormState[K]) => {\n setState((prev) => ({ ...prev, [key]: value }));\n },\n [],\n );\n\n const reset = useCallback(() => setState(INITIAL), []);\n\n const buildAuth = useCallback((): MCPAuthConfig => {\n switch (state.authType) {\n case \"none\":\n return { type: \"none\" };\n case \"bearer\":\n return { type: \"bearer\", token: state.bearerToken || undefined };\n case \"oauth\": {\n const scopeList = state.scopes\n .split(/[\\s,]+/)\n .map((s) => s.trim())\n .filter(Boolean);\n return {\n type: \"oauth\",\n scopes: scopeList.length > 0 ? scopeList : undefined,\n };\n }\n }\n }, [state.authType, state.bearerToken, state.scopes]);\n\n const submit = useCallback(async () => {\n if (state.submitting) return;\n if (!state.name.trim()) {\n setState((p) => ({ ...p, error: \"Name is required\" }));\n return;\n }\n if (state.authType === \"bearer\" && !state.bearerToken.trim()) {\n setState((p) => ({ ...p, error: \"Bearer token is required\" }));\n return;\n }\n const urlResult = validateUrl(state.url);\n if (\"error\" in urlResult) {\n setState((p) => ({ ...p, error: urlResult.error }));\n return;\n }\n setState((p) => ({ ...p, submitting: true, error: null }));\n try {\n const id = await aui.mcp().addCustomServer({\n name: state.name.trim(),\n url: urlResult.url,\n auth: buildAuth(),\n });\n setState(INITIAL);\n onSubmitted?.(id);\n } catch (err) {\n setState((p) => ({\n ...p,\n submitting: false,\n error: err instanceof Error ? err.message : String(err),\n }));\n }\n }, [aui, buildAuth, onSubmitted, state]);\n\n const cancel = useCallback(() => {\n setState(INITIAL);\n onCancel?.();\n }, [onCancel]);\n\n const value = useMemo(\n () => ({ state, setField, reset, submit, cancel }),\n [state, setField, reset, submit, cancel],\n );\n\n const onFormSubmit: FormEventHandler<HTMLFormElement> = (e) => {\n e.preventDefault();\n void submit();\n };\n\n return (\n <AddFormContext.Provider value={value}>\n <Primitive.form {...props} ref={ref} onSubmit={onFormSubmit} />\n </AddFormContext.Provider>\n );\n});\n\nMcpAddFormPrimitiveRoot.displayName = \"McpAddFormPrimitive.Root\";\n"],"mappings":";;;;;;AAcA,MAAMY,UAAwB;CAC5BC,MAAM;CACNC,KAAK;CACLC,UAAU;CACVC,aAAa;CACbC,QAAQ;CACRC,YAAY;CACZC,OAAO;AACT;AAEA,SAASC,YAAYC,KAAkD;CACrE,MAAMC,UAAUD,IAAIE,KAAK;CACzB,IAAI,CAACD,SAAS,OAAO,EAAEH,OAAO,kBAAkB;CAChD,IAAIK;CACJ,IAAI;EACFA,SAAS,IAAIC,IAAIH,OAAO;CAC1B,QAAQ;EACN,OAAO,EAAE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],"sources":["../../../src/primitives/addForm/McpAddFormSubmit.tsx"],"mappings":";;;kBAQiB;OACH,UAAU,oBAAoB,UAAU;OACxC,QAAQ,gCAAgC,UAAU;;cAGnD,2CAAyB,0BAAA,qBAAA,gBAAA,qCAAA,qBAAA"}
1
+ {"version":3,"file":"McpAddFormSubmit.d.ts","names":[],"sources":["../../../src/primitives/addForm/McpAddFormSubmit.tsx"],"mappings":";;;kBAQiB;OACH,UAAU,oBAAoB,UAAU;OACxC,QAAQ,gCAAgC,UAAU;;cAGnD,2CAAyB,0BAAA,qBAAA,gBAAA,qCAAA,qBAAA;;4BAcpC,cAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"McpManagerAddCustomTrigger.d.ts","names":[],"sources":["../../../src/primitives/manager/McpManagerAddCustomTrigger.tsx"],"mappings":";;;kBAOiB;OACH,UAAU,oBAAoB,UAAU;OACxC,QAAQ,gCAAgC,UAAU;;cAGnD,qDAAmC,0BAAA,qBAAA,gBAAA,qCAAA,qBAAA"}
1
+ {"version":3,"file":"McpManagerAddCustomTrigger.d.ts","names":[],"sources":["../../../src/primitives/manager/McpManagerAddCustomTrigger.tsx"],"mappings":";;;kBAOiB;OACH,UAAU,oBAAoB,UAAU;OACxC,QAAQ,gCAAgC,UAAU;;cAGnD,qDAAmC,0BAAA,qBAAA,gBAAA,qCAAA,qBAAA;;4BAK9C,cAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"McpManagerConnectors.js","names":["FC","ReactNode","memo","useMemo","RenderChildrenWithAccessor","useAuiState","McpConnectorByIndexProvider","MCPServerState","SEP","McpManagerPrimitiveConnectors","Props","children","value","server","McpManagerPrimitiveConnectorsInner","idsJoined","s","mcp","connectors","map","c","id","join","ids","split","length","index","aui","connector","getState","getItem","prev","next","displayName"],"sources":["../../../src/primitives/manager/McpManagerConnectors.tsx"],"sourcesContent":["import { type FC, type ReactNode, memo, useMemo } from \"react\";\nimport { RenderChildrenWithAccessor, useAuiState } from \"@assistant-ui/store\";\nimport { McpConnectorByIndexProvider } from \"../../context/McpConnectorByIndexProvider\";\nimport type { MCPServerState } from \"../../mcp-scope\";\n\n// ASCII Unit Separator — never appears in MCP connector ids (uuids, urls,\n// app-provided strings).\nconst SEP = \"\\x1f\";\n\nexport namespace McpManagerPrimitiveConnectors {\n export type Props = {\n /**\n * Render function called once per connector. Receives a lazy `server`\n * accessor — reading it inside the render function subscribes to that\n * connector's state.\n */\n children: (value: { server: MCPServerState }) => ReactNode;\n };\n}\n\nconst McpManagerPrimitiveConnectorsInner: FC<{\n children: (value: { server: MCPServerState }) => ReactNode;\n}> = ({ children }) => {\n // Subscribe to the connector id list, joined to a primitive so identity\n // is stable when the list hasn't changed. Re-renders on add/remove/reorder\n // but not on per-item state changes.\n const idsJoined = useAuiState((s) =>\n s.mcp.connectors.map((c) => c.id).join(SEP),\n );\n const ids = useMemo(\n () => (idsJoined ? idsJoined.split(SEP) : []),\n [idsJoined],\n );\n\n return useMemo(() => {\n if (ids.length === 0) return null;\n return ids.map((id, index) => (\n <McpConnectorByIndexProvider key={id} index={index}>\n <RenderChildrenWithAccessor\n getItemState={(aui) => aui.mcp().connector({ index }).getState()}\n >\n {(getItem) =>\n children({\n get server() {\n return getItem();\n },\n })\n }\n </RenderChildrenWithAccessor>\n </McpConnectorByIndexProvider>\n ));\n }, [ids, children]);\n};\n\n/**\n * Renders all connectors declared on `McpManagerResource`.\n *\n * @example\n * ```tsx\n * <McpManagerPrimitive.Connectors>\n * {({ server }) => (\n * <McpServerPrimitive.Root>\n * <McpServerPrimitive.Name />\n * {server.connectionState === \"error\" && <p>{server.lastError?.message}</p>}\n * </McpServerPrimitive.Root>\n * )}\n * </McpManagerPrimitive.Connectors>\n * ```\n */\nexport const McpManagerPrimitiveConnectors: FC<McpManagerPrimitiveConnectors.Props> =\n memo(\n McpManagerPrimitiveConnectorsInner,\n (prev, next) => prev.children === next.children,\n );\n\nMcpManagerPrimitiveConnectors.displayName = \"McpManagerPrimitive.Connectors\";\n"],"mappings":";;;;;AAOA,MAAMQ,MAAM;AAaZ,MAAMM,sCAEA,EAAEH,eAAe;CAIrB,MAAMI,YAAYV,aAAaW,MAC7BA,EAAEC,IAAIC,WAAWC,KAAKC,MAAMA,EAAEC,EAAE,CAAC,CAACC,KAAKd,GAAG,CAC5C;CACA,MAAMe,MAAMpB,cACHY,YAAYA,UAAUS,MAAMhB,GAAG,IAAI,CAAA,GAC1C,CAACO,SAAS,CACZ;CAEA,OAAOZ,cAAc;EACnB,IAAIoB,IAAIE,WAAW,GAAG,OAAO;EAC7B,OAAOF,IAAIJ,KAAKE,IAAIK,UAClB,oBAAC,6BAAD;GAA6CA;aAC3C,oBAAC,4BAAD;IACE,eAAeC,QAAQA,IAAIV,IAAI,CAAC,CAACW,UAAU,EAAEF,MAAM,CAAC,CAAC,CAACG,SAAS;eAE7DC,YACAnB,SAAS,EACP,IAAIE,SAAS;KACX,OAAOiB,QAAQ;IACjB,EACF,CAAC;GAEuB,CAAA;EACD,GAZKT,EAYL,CAC9B;CACH,GAAG,CAACE,KAAKZ,QAAQ,CAAC;AACpB;;;;;;;;;;;;;;;;AAiBA,MAAaF,gCACXP,KACEY,qCACCiB,MAAMC,SAASD,KAAKpB,aAAaqB,KAAKrB,QACzC;AAEFF,8BAA8BwB,cAAc"}
1
+ {"version":3,"file":"McpManagerConnectors.js","names":["FC","ReactNode","memo","useMemo","RenderChildrenWithAccessor","useAuiState","McpConnectorByIndexProvider","MCPServerState","SEP","McpManagerPrimitiveConnectors","Props","children","value","server","McpManagerPrimitiveConnectorsInner","idsJoined","s","mcp","connectors","map","c","id","join","ids","split","length","index","aui","connector","getState","getItem","prev","next","displayName"],"sources":["../../../src/primitives/manager/McpManagerConnectors.tsx"],"sourcesContent":["import { type FC, type ReactNode, memo, useMemo } from \"react\";\nimport { RenderChildrenWithAccessor, useAuiState } from \"@assistant-ui/store\";\nimport { McpConnectorByIndexProvider } from \"../../context/McpConnectorByIndexProvider\";\nimport type { MCPServerState } from \"../../mcp-scope\";\n\n// ASCII Unit Separator — never appears in MCP connector ids (uuids, urls,\n// app-provided strings).\nconst SEP = \"\\x1f\";\n\nexport namespace McpManagerPrimitiveConnectors {\n export type Props = {\n /**\n * Render function called once per connector. Receives a lazy `server`\n * accessor — reading it inside the render function subscribes to that\n * connector's state.\n */\n children: (value: { server: MCPServerState }) => ReactNode;\n };\n}\n\nconst McpManagerPrimitiveConnectorsInner: FC<{\n children: (value: { server: MCPServerState }) => ReactNode;\n}> = ({ children }) => {\n // Subscribe to the connector id list, joined to a primitive so identity\n // is stable when the list hasn't changed. Re-renders on add/remove/reorder\n // but not on per-item state changes.\n const idsJoined = useAuiState((s) =>\n s.mcp.connectors.map((c) => c.id).join(SEP),\n );\n const ids = useMemo(\n () => (idsJoined ? idsJoined.split(SEP) : []),\n [idsJoined],\n );\n\n return useMemo(() => {\n if (ids.length === 0) return null;\n return ids.map((id, index) => (\n <McpConnectorByIndexProvider key={id} index={index}>\n <RenderChildrenWithAccessor\n getItemState={(aui) => aui.mcp().connector({ index }).getState()}\n >\n {(getItem) =>\n children({\n get server() {\n return getItem();\n },\n })\n }\n </RenderChildrenWithAccessor>\n </McpConnectorByIndexProvider>\n ));\n }, [ids, children]);\n};\n\n/**\n * Renders all connectors declared on `McpManagerResource`.\n *\n * @example\n * ```tsx\n * <McpManagerPrimitive.Connectors>\n * {({ server }) => (\n * <McpServerPrimitive.Root>\n * <McpServerPrimitive.Name />\n * {server.connectionState === \"error\" && <p>{server.lastError?.message}</p>}\n * </McpServerPrimitive.Root>\n * )}\n * </McpManagerPrimitive.Connectors>\n * ```\n */\nexport const McpManagerPrimitiveConnectors: FC<McpManagerPrimitiveConnectors.Props> =\n memo(\n McpManagerPrimitiveConnectorsInner,\n (prev, next) => prev.children === next.children,\n );\n\nMcpManagerPrimitiveConnectors.displayName = \"McpManagerPrimitive.Connectors\";\n"],"mappings":";;;;;AAOA,MAAMQ,MAAM;AAaZ,MAAMM,sCAEA,EAAEH,eAAe;CAIrB,MAAMI,YAAYV,aAAaW,MAC7BA,EAAEC,IAAIC,WAAWC,KAAKC,MAAMA,EAAEC,EAAE,CAAC,CAACC,KAAKd,GAAG,CAC5C;CACA,MAAMe,MAAMpB,cACHY,YAAYA,UAAUS,MAAMhB,GAAG,IAAI,CAAA,GAC1C,CAACO,SAAS,CACZ;CAEA,OAAOZ,cAAc;EACnB,IAAIoB,IAAIE,WAAW,GAAG,OAAO;EAC7B,OAAOF,IAAIJ,KAAKE,IAAIK,UAClB,oBAAC,6BAAD;GAA6CA;GAC3C,UAAA,oBAAC,4BAAD;IACE,eAAeC,QAAQA,IAAIV,IAAI,CAAC,CAACW,UAAU,EAAEF,MAAM,CAAC,CAAC,CAACG,SAAS;IAE7DC,WAAAA,YACAnB,SAAS,EACP,IAAIE,SAAS;KACX,OAAOiB,QAAQ;IACjB,EACF,CAAC;GAEuB,CAAA;EACD,GAZKT,EAYL,CAC9B;CACH,GAAG,CAACE,KAAKZ,QAAQ,CAAC;AACpB;;;;;;;;;;;;;;;;AAiBA,MAAaF,gCACXP,KACEY,qCACCiB,MAAMC,SAASD,KAAKpB,aAAaqB,KAAKrB,QACzC;AAEFF,8BAA8BwB,cAAc"}
@@ -1 +1 @@
1
- {"version":3,"file":"McpManagerCustomServers.js","names":["FC","ReactNode","memo","useMemo","RenderChildrenWithAccessor","useAuiState","McpCustomServerByIndexProvider","MCPServerState","SEP","McpManagerPrimitiveCustomServers","Props","children","value","server","McpManagerPrimitiveCustomServersInner","idsJoined","s","mcp","customServers","map","c","id","join","ids","split","length","index","aui","customServer","getState","getItem","prev","next","displayName"],"sources":["../../../src/primitives/manager/McpManagerCustomServers.tsx"],"sourcesContent":["import { type FC, type ReactNode, memo, useMemo } from \"react\";\nimport { RenderChildrenWithAccessor, useAuiState } from \"@assistant-ui/store\";\nimport { McpCustomServerByIndexProvider } from \"../../context/McpCustomServerByIndexProvider\";\nimport type { MCPServerState } from \"../../mcp-scope\";\n\nconst SEP = \"\\x1f\";\n\nexport namespace McpManagerPrimitiveCustomServers {\n export type Props = {\n /**\n * Render function called once per custom server. Receives a lazy\n * `server` accessor — reading it inside the render function subscribes\n * to that server's state.\n */\n children: (value: { server: MCPServerState }) => ReactNode;\n };\n}\n\nconst McpManagerPrimitiveCustomServersInner: FC<{\n children: (value: { server: MCPServerState }) => ReactNode;\n}> = ({ children }) => {\n const idsJoined = useAuiState((s) =>\n s.mcp.customServers.map((c) => c.id).join(SEP),\n );\n const ids = useMemo(\n () => (idsJoined ? idsJoined.split(SEP) : []),\n [idsJoined],\n );\n\n return useMemo(() => {\n if (ids.length === 0) return null;\n return ids.map((id, index) => (\n <McpCustomServerByIndexProvider key={id} index={index}>\n <RenderChildrenWithAccessor\n getItemState={(aui) => aui.mcp().customServer({ index }).getState()}\n >\n {(getItem) =>\n children({\n get server() {\n return getItem();\n },\n })\n }\n </RenderChildrenWithAccessor>\n </McpCustomServerByIndexProvider>\n ));\n }, [ids, children]);\n};\n\n/**\n * Renders all user-added custom servers persisted in storage.\n *\n * @example\n * ```tsx\n * <McpManagerPrimitive.CustomServers>\n * {() => (\n * <McpServerPrimitive.Root>\n * <McpServerPrimitive.Name />\n * <McpServerPrimitive.RemoveButton>Remove</McpServerPrimitive.RemoveButton>\n * </McpServerPrimitive.Root>\n * )}\n * </McpManagerPrimitive.CustomServers>\n * ```\n */\nexport const McpManagerPrimitiveCustomServers: FC<McpManagerPrimitiveCustomServers.Props> =\n memo(\n McpManagerPrimitiveCustomServersInner,\n (prev, next) => prev.children === next.children,\n );\n\nMcpManagerPrimitiveCustomServers.displayName =\n \"McpManagerPrimitive.CustomServers\";\n"],"mappings":";;;;;AAKA,MAAMQ,MAAM;AAaZ,MAAMM,yCAEA,EAAEH,eAAe;CACrB,MAAMI,YAAYV,aAAaW,MAC7BA,EAAEC,IAAIC,cAAcC,KAAKC,MAAMA,EAAEC,EAAE,CAAC,CAACC,KAAKd,GAAG,CAC/C;CACA,MAAMe,MAAMpB,cACHY,YAAYA,UAAUS,MAAMhB,GAAG,IAAI,CAAA,GAC1C,CAACO,SAAS,CACZ;CAEA,OAAOZ,cAAc;EACnB,IAAIoB,IAAIE,WAAW,GAAG,OAAO;EAC7B,OAAOF,IAAIJ,KAAKE,IAAIK,UAClB,oBAAC,gCAAD;GAAgDA;aAC9C,oBAAC,4BAAD;IACE,eAAeC,QAAQA,IAAIV,IAAI,CAAC,CAACW,aAAa,EAAEF,MAAM,CAAC,CAAC,CAACG,SAAS;eAEhEC,YACAnB,SAAS,EACP,IAAIE,SAAS;KACX,OAAOiB,QAAQ;IACjB,EACF,CAAC;GAEuB,CAAA;EACE,GAZKT,EAYL,CACjC;CACH,GAAG,CAACE,KAAKZ,QAAQ,CAAC;AACpB;;;;;;;;;;;;;;;;AAiBA,MAAaF,mCACXP,KACEY,wCACCiB,MAAMC,SAASD,KAAKpB,aAAaqB,KAAKrB,QACzC;AAEFF,iCAAiCwB,cAC/B"}
1
+ {"version":3,"file":"McpManagerCustomServers.js","names":["FC","ReactNode","memo","useMemo","RenderChildrenWithAccessor","useAuiState","McpCustomServerByIndexProvider","MCPServerState","SEP","McpManagerPrimitiveCustomServers","Props","children","value","server","McpManagerPrimitiveCustomServersInner","idsJoined","s","mcp","customServers","map","c","id","join","ids","split","length","index","aui","customServer","getState","getItem","prev","next","displayName"],"sources":["../../../src/primitives/manager/McpManagerCustomServers.tsx"],"sourcesContent":["import { type FC, type ReactNode, memo, useMemo } from \"react\";\nimport { RenderChildrenWithAccessor, useAuiState } from \"@assistant-ui/store\";\nimport { McpCustomServerByIndexProvider } from \"../../context/McpCustomServerByIndexProvider\";\nimport type { MCPServerState } from \"../../mcp-scope\";\n\nconst SEP = \"\\x1f\";\n\nexport namespace McpManagerPrimitiveCustomServers {\n export type Props = {\n /**\n * Render function called once per custom server. Receives a lazy\n * `server` accessor — reading it inside the render function subscribes\n * to that server's state.\n */\n children: (value: { server: MCPServerState }) => ReactNode;\n };\n}\n\nconst McpManagerPrimitiveCustomServersInner: FC<{\n children: (value: { server: MCPServerState }) => ReactNode;\n}> = ({ children }) => {\n const idsJoined = useAuiState((s) =>\n s.mcp.customServers.map((c) => c.id).join(SEP),\n );\n const ids = useMemo(\n () => (idsJoined ? idsJoined.split(SEP) : []),\n [idsJoined],\n );\n\n return useMemo(() => {\n if (ids.length === 0) return null;\n return ids.map((id, index) => (\n <McpCustomServerByIndexProvider key={id} index={index}>\n <RenderChildrenWithAccessor\n getItemState={(aui) => aui.mcp().customServer({ index }).getState()}\n >\n {(getItem) =>\n children({\n get server() {\n return getItem();\n },\n })\n }\n </RenderChildrenWithAccessor>\n </McpCustomServerByIndexProvider>\n ));\n }, [ids, children]);\n};\n\n/**\n * Renders all user-added custom servers persisted in storage.\n *\n * @example\n * ```tsx\n * <McpManagerPrimitive.CustomServers>\n * {() => (\n * <McpServerPrimitive.Root>\n * <McpServerPrimitive.Name />\n * <McpServerPrimitive.RemoveButton>Remove</McpServerPrimitive.RemoveButton>\n * </McpServerPrimitive.Root>\n * )}\n * </McpManagerPrimitive.CustomServers>\n * ```\n */\nexport const McpManagerPrimitiveCustomServers: FC<McpManagerPrimitiveCustomServers.Props> =\n memo(\n McpManagerPrimitiveCustomServersInner,\n (prev, next) => prev.children === next.children,\n );\n\nMcpManagerPrimitiveCustomServers.displayName =\n \"McpManagerPrimitive.CustomServers\";\n"],"mappings":";;;;;AAKA,MAAMQ,MAAM;AAaZ,MAAMM,yCAEA,EAAEH,eAAe;CACrB,MAAMI,YAAYV,aAAaW,MAC7BA,EAAEC,IAAIC,cAAcC,KAAKC,MAAMA,EAAEC,EAAE,CAAC,CAACC,KAAKd,GAAG,CAC/C;CACA,MAAMe,MAAMpB,cACHY,YAAYA,UAAUS,MAAMhB,GAAG,IAAI,CAAA,GAC1C,CAACO,SAAS,CACZ;CAEA,OAAOZ,cAAc;EACnB,IAAIoB,IAAIE,WAAW,GAAG,OAAO;EAC7B,OAAOF,IAAIJ,KAAKE,IAAIK,UAClB,oBAAC,gCAAD;GAAgDA;GAC9C,UAAA,oBAAC,4BAAD;IACE,eAAeC,QAAQA,IAAIV,IAAI,CAAC,CAACW,aAAa,EAAEF,MAAM,CAAC,CAAC,CAACG,SAAS;IAEhEC,WAAAA,YACAnB,SAAS,EACP,IAAIE,SAAS;KACX,OAAOiB,QAAQ;IACjB,EACF,CAAC;GAEuB,CAAA;EACE,GAZKT,EAYL,CACjC;CACH,GAAG,CAACE,KAAKZ,QAAQ,CAAC;AACpB;;;;;;;;;;;;;;;;AAiBA,MAAaF,mCACXP,KACEY,wCACCiB,MAAMC,SAASD,KAAKpB,aAAaqB,KAAKrB,QACzC;AAEFF,iCAAiCwB,cAC/B"}
@@ -1 +1 @@
1
- {"version":3,"file":"McpManagerRoot.d.ts","names":[],"sources":["../../../src/primitives/manager/McpManagerRoot.tsx"],"mappings":";;;kBAQiB;OACH,UAAU,oBAAoB,UAAU;OACxC,QAAQ,gCAAgC,UAAU;;cAGnD,yCAAuB,0BAAA,qBAAA,gBAAA,kCAAA,eAAA"}
1
+ {"version":3,"file":"McpManagerRoot.d.ts","names":[],"sources":["../../../src/primitives/manager/McpManagerRoot.tsx"],"mappings":";;;kBAQiB;OACH,UAAU,oBAAoB,UAAU;OACxC,QAAQ,gCAAgC,UAAU;;cAGnD,yCAAuB,0BAAA,qBAAA,gBAAA,kCAAA,eAAA;;4BAYlC,cAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"McpServerConnectButton.d.ts","names":[],"sources":["../../../src/primitives/server/McpServerConnectButton.tsx"],"mappings":";;;kBAQiB;OACH,UAAU,oBAAoB,UAAU;OACxC,QAAQ,gCAAgC,UAAU;;cAKnD,iDAA+B,0BAAA,qBAAA,gBAAA,qCAAA,qBAAA"}
1
+ {"version":3,"file":"McpServerConnectButton.d.ts","names":[],"sources":["../../../src/primitives/server/McpServerConnectButton.tsx"],"mappings":";;;kBAQiB;OACH,UAAU,oBAAoB,UAAU;OACxC,QAAQ,gCAAgC,UAAU;;cAKnD,iDAA+B,0BAAA,qBAAA,gBAAA,qCAAA,qBAAA;;4BAoB1C,cAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"McpServerDisconnectButton.d.ts","names":[],"sources":["../../../src/primitives/server/McpServerDisconnectButton.tsx"],"mappings":";;;kBAQiB;OACH,UAAU,oBAAoB,UAAU;OACxC,QAAQ,gCAAgC,UAAU;;cAKnD,oDAAkC,0BAAA,qBAAA,gBAAA,qCAAA,qBAAA"}
1
+ {"version":3,"file":"McpServerDisconnectButton.d.ts","names":[],"sources":["../../../src/primitives/server/McpServerDisconnectButton.tsx"],"mappings":";;;kBAQiB;OACH,UAAU,oBAAoB,UAAU;OACxC,QAAQ,gCAAgC,UAAU;;cAKnD,oDAAkC,0BAAA,qBAAA,gBAAA,qCAAA,qBAAA;;4BAmB7C,cAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"McpServerError.d.ts","names":[],"sources":["../../../src/primitives/server/McpServerError.tsx"],"mappings":";;;kBAQiB;OACH,UAAU,oBAAoB,UAAU;OACxC,QAAQ,gCAAgC,UAAU;;cAGnD,yCAAuB,0BAAA,qBAAA,gBAAA,kCAAA,eAAA"}
1
+ {"version":3,"file":"McpServerError.d.ts","names":[],"sources":["../../../src/primitives/server/McpServerError.tsx"],"mappings":";;;kBAQiB;OACH,UAAU,oBAAoB,UAAU;OACxC,QAAQ,gCAAgC,UAAU;;cAGnD,yCAAuB,0BAAA,qBAAA,gBAAA,kCAAA,eAAA;;4BAWlC,cAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"McpServerError.js","names":["ComponentPropsWithoutRef","ComponentRef","forwardRef","Primitive","useAuiState","McpServerPrimitiveError","Element","div","Props","props","ref","$","_c","message","_temp","t0","children","t1","displayName","s","mcpServer","lastError"],"sources":["../../../src/primitives/server/McpServerError.tsx"],"sourcesContent":["import {\n type ComponentPropsWithoutRef,\n type ComponentRef,\n forwardRef,\n} from \"react\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport { useAuiState } from \"@assistant-ui/store\";\n\nexport namespace McpServerPrimitiveError {\n export type Element = ComponentRef<typeof Primitive.div>;\n export type Props = ComponentPropsWithoutRef<typeof Primitive.div>;\n}\n\nexport const McpServerPrimitiveError = forwardRef<\n McpServerPrimitiveError.Element,\n McpServerPrimitiveError.Props\n>((props, ref) => {\n const message = useAuiState((s) => s.mcpServer.lastError?.message ?? null);\n if (message === null) return null;\n return (\n <Primitive.div {...props} ref={ref}>\n {props.children ?? message}\n </Primitive.div>\n );\n});\n\nMcpServerPrimitiveError.displayName = \"McpServerPrimitive.Error\";\n"],"mappings":";;;;;;AAaA,MAAaK,0BAA0BH,YAGrCO,OAAAC,QAAA;CAAA,MAAAC,IAAAC,EAAA,CAAA;CACA,MAAAC,UAAgBT,YAAYU,KAA6C;CACzE,IAAID,YAAY,MAAI,OAAS;CAGxB,MAAAE,KAAAN,MAAKO,YAALH;CAAyB,IAAAI;CAAA,IAAAN,EAAA,OAAAF,SAAAE,EAAA,OAAAD,OAAAC,EAAA,OAAAI,IAAA;EAD5BE,KAAA,oBAAA,UAAA,KAAA;GAAA,GAAmBR;GAAYC;aAC5BK;EACH,CAAA;EAAgBJ,EAAA,KAAAF;EAAAE,EAAA,KAAAD;EAAAC,EAAA,KAAAI;EAAAJ,EAAA,KAAAM;CAAA,OAAAA,KAAAN,EAAA;CAAA,OAFhBM;AAEgB,CAEnB;AAEDZ,wBAAwBa,cAAc;AAVpC,SAAAJ,MAAAK,GAAA;CAAA,OACmCA,EAACC,UAAUC,WAAmBR,WAA9B;AAAsC"}
1
+ {"version":3,"file":"McpServerError.js","names":["ComponentPropsWithoutRef","ComponentRef","forwardRef","Primitive","useAuiState","McpServerPrimitiveError","Element","div","Props","props","ref","$","_c","message","_temp","t0","children","t1","displayName","s","mcpServer","lastError"],"sources":["../../../src/primitives/server/McpServerError.tsx"],"sourcesContent":["import {\n type ComponentPropsWithoutRef,\n type ComponentRef,\n forwardRef,\n} from \"react\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport { useAuiState } from \"@assistant-ui/store\";\n\nexport namespace McpServerPrimitiveError {\n export type Element = ComponentRef<typeof Primitive.div>;\n export type Props = ComponentPropsWithoutRef<typeof Primitive.div>;\n}\n\nexport const McpServerPrimitiveError = forwardRef<\n McpServerPrimitiveError.Element,\n McpServerPrimitiveError.Props\n>((props, ref) => {\n const message = useAuiState((s) => s.mcpServer.lastError?.message ?? null);\n if (message === null) return null;\n return (\n <Primitive.div {...props} ref={ref}>\n {props.children ?? message}\n </Primitive.div>\n );\n});\n\nMcpServerPrimitiveError.displayName = \"McpServerPrimitive.Error\";\n"],"mappings":";;;;;;AAaA,MAAaK,0BAA0BH,YAGrCO,OAAAC,QAAA;CAAA,MAAAC,IAAAC,EAAA,CAAA;CACA,MAAAC,UAAgBT,YAAYU,KAA6C;CACzE,IAAID,YAAY,MAAI,OAAS;CAGxB,MAAAE,KAAAN,MAAKO,YAALH;CAAyB,IAAAI;CAAA,IAAAN,EAAA,OAAAF,SAAAE,EAAA,OAAAD,OAAAC,EAAA,OAAAI,IAAA;EAD5BE,KAAA,oBAAA,UAAA,KAAA;GAAA,GAAmBR;GAAYC;GAC5BK,UAAAA;EACH,CAAA;EAAgBJ,EAAA,KAAAF;EAAAE,EAAA,KAAAD;EAAAC,EAAA,KAAAI;EAAAJ,EAAA,KAAAM;CAAA,OAAAA,KAAAN,EAAA;CAAA,OAFhBM;AAEgB,CAEnB;AAEDZ,wBAAwBa,cAAc;AAVpC,SAAAJ,MAAAK,GAAA;CAAA,OACmCA,EAACC,UAAUC,WAAmBR,WAA9B;AAAsC"}
@@ -1 +1 @@
1
- {"version":3,"file":"McpServerIcon.d.ts","names":[],"sources":["../../../src/primitives/server/McpServerIcon.tsx"],"mappings":";;;kBAQiB;OACH,UAAU,oBAAoB,UAAU;OACxC,QAAQ,KAClB,gCAAgC,UAAU;;IAI1C;IACA;;;cAIS,wCAAsB,0BAAA,KAAA,qBAAA,gBAAA,oCAAA,kBAAA"}
1
+ {"version":3,"file":"McpServerIcon.d.ts","names":[],"sources":["../../../src/primitives/server/McpServerIcon.tsx"],"mappings":";;;kBAQiB;OACH,UAAU,oBAAoB,UAAU;OACxC,QAAQ,KAClB,gCAAgC,UAAU;;IAI1C;IACA;;;cAIS,wCAAsB,0BAAA,KAAA,qBAAA,gBAAA,oCAAA,kBAAA;;;;EALzB;EACA;oBAeR,cAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"McpServerName.d.ts","names":[],"sources":["../../../src/primitives/server/McpServerName.tsx"],"mappings":";;;kBAQiB;OACH,UAAU,oBAAoB,UAAU;OACxC,QAAQ,gCAAgC,UAAU;;cAGnD,wCAAsB,0BAAA,qBAAA,gBAAA,mCAAA,eAAA"}
1
+ {"version":3,"file":"McpServerName.d.ts","names":[],"sources":["../../../src/primitives/server/McpServerName.tsx"],"mappings":";;;kBAQiB;OACH,UAAU,oBAAoB,UAAU;OACxC,QAAQ,gCAAgC,UAAU;;cAGnD,wCAAsB,0BAAA,qBAAA,gBAAA,mCAAA,eAAA;;4BAUjC,cAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"McpServerName.js","names":["ComponentPropsWithoutRef","ComponentRef","forwardRef","Primitive","useAuiState","McpServerPrimitiveName","Element","span","Props","props","ref","$","_c","name","_temp","t0","children","t1","displayName","s","mcpServer"],"sources":["../../../src/primitives/server/McpServerName.tsx"],"sourcesContent":["import {\n type ComponentPropsWithoutRef,\n type ComponentRef,\n forwardRef,\n} from \"react\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport { useAuiState } from \"@assistant-ui/store\";\n\nexport namespace McpServerPrimitiveName {\n export type Element = ComponentRef<typeof Primitive.span>;\n export type Props = ComponentPropsWithoutRef<typeof Primitive.span>;\n}\n\nexport const McpServerPrimitiveName = forwardRef<\n McpServerPrimitiveName.Element,\n McpServerPrimitiveName.Props\n>((props, ref) => {\n const name = useAuiState((s) => s.mcpServer.name);\n return (\n <Primitive.span {...props} ref={ref}>\n {props.children ?? name}\n </Primitive.span>\n );\n});\n\nMcpServerPrimitiveName.displayName = \"McpServerPrimitive.Name\";\n"],"mappings":";;;;;;AAaA,MAAaK,yBAAyBH,YAGpCO,OAAAC,QAAA;CAAA,MAAAC,IAAAC,EAAA,CAAA;CACA,MAAAC,OAAaT,YAAYU,KAAuB;CAG3C,MAAAC,KAAAN,MAAKO,YAALH;CAAsB,IAAAI;CAAA,IAAAN,EAAA,OAAAF,SAAAE,EAAA,OAAAD,OAAAC,EAAA,OAAAI,IAAA;EADzBE,KAAA,oBAAA,UAAA,MAAA;GAAA,GAAoBR;GAAYC;aAC7BK;EACH,CAAA;EAAiBJ,EAAA,KAAAF;EAAAE,EAAA,KAAAD;EAAAC,EAAA,KAAAI;EAAAJ,EAAA,KAAAM;CAAA,OAAAA,KAAAN,EAAA;CAAA,OAFjBM;AAEiB,CAEpB;AAEDZ,uBAAuBa,cAAc;AATnC,SAAAJ,MAAAK,GAAA;CAAA,OACgCA,EAACC,UAAUP;AAAK"}
1
+ {"version":3,"file":"McpServerName.js","names":["ComponentPropsWithoutRef","ComponentRef","forwardRef","Primitive","useAuiState","McpServerPrimitiveName","Element","span","Props","props","ref","$","_c","name","_temp","t0","children","t1","displayName","s","mcpServer"],"sources":["../../../src/primitives/server/McpServerName.tsx"],"sourcesContent":["import {\n type ComponentPropsWithoutRef,\n type ComponentRef,\n forwardRef,\n} from \"react\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport { useAuiState } from \"@assistant-ui/store\";\n\nexport namespace McpServerPrimitiveName {\n export type Element = ComponentRef<typeof Primitive.span>;\n export type Props = ComponentPropsWithoutRef<typeof Primitive.span>;\n}\n\nexport const McpServerPrimitiveName = forwardRef<\n McpServerPrimitiveName.Element,\n McpServerPrimitiveName.Props\n>((props, ref) => {\n const name = useAuiState((s) => s.mcpServer.name);\n return (\n <Primitive.span {...props} ref={ref}>\n {props.children ?? name}\n </Primitive.span>\n );\n});\n\nMcpServerPrimitiveName.displayName = \"McpServerPrimitive.Name\";\n"],"mappings":";;;;;;AAaA,MAAaK,yBAAyBH,YAGpCO,OAAAC,QAAA;CAAA,MAAAC,IAAAC,EAAA,CAAA;CACA,MAAAC,OAAaT,YAAYU,KAAuB;CAG3C,MAAAC,KAAAN,MAAKO,YAALH;CAAsB,IAAAI;CAAA,IAAAN,EAAA,OAAAF,SAAAE,EAAA,OAAAD,OAAAC,EAAA,OAAAI,IAAA;EADzBE,KAAA,oBAAA,UAAA,MAAA;GAAA,GAAoBR;GAAYC;GAC7BK,UAAAA;EACH,CAAA;EAAiBJ,EAAA,KAAAF;EAAAE,EAAA,KAAAD;EAAAC,EAAA,KAAAI;EAAAJ,EAAA,KAAAM;CAAA,OAAAA,KAAAN,EAAA;CAAA,OAFjBM;AAEiB,CAEpB;AAEDZ,uBAAuBa,cAAc;AATnC,SAAAJ,MAAAK,GAAA;CAAA,OACgCA,EAACC,UAAUP;AAAK"}
@@ -1 +1 @@
1
- {"version":3,"file":"McpServerOAuthLink.d.ts","names":[],"sources":["../../../src/primitives/server/McpServerOAuthLink.tsx"],"mappings":";;;kBAQiB;OACH,UAAU,oBAAoB,UAAU;OACxC,QAAQ,KAClB,gCAAgC,UAAU;;IAI1C;;;cAIS,6CAA2B,0BAAA,KAAA,qBAAA,gBAAA,qCAAA,qBAAA"}
1
+ {"version":3,"file":"McpServerOAuthLink.d.ts","names":[],"sources":["../../../src/primitives/server/McpServerOAuthLink.tsx"],"mappings":";;;kBAQiB;OACH,UAAU,oBAAoB,UAAU;OACxC,QAAQ,KAClB,gCAAgC,UAAU;;IAI1C;;;cAIS,6CAA2B,0BAAA,KAAA,qBAAA,gBAAA,qCAAA,qBAAA;;;;EAJ7B;oBAoBT,cAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"McpServerRemoveButton.d.ts","names":[],"sources":["../../../src/primitives/server/McpServerRemoveButton.tsx"],"mappings":";;;kBAQiB;OACH,UAAU,oBAAoB,UAAU;OACxC,QAAQ,gCAAgC,UAAU;;cAGnD,gDAA8B,0BAAA,qBAAA,gBAAA,qCAAA,qBAAA"}
1
+ {"version":3,"file":"McpServerRemoveButton.d.ts","names":[],"sources":["../../../src/primitives/server/McpServerRemoveButton.tsx"],"mappings":";;;kBAQiB;OACH,UAAU,oBAAoB,UAAU;OACxC,QAAQ,gCAAgC,UAAU;;cAGnD,gDAA8B,0BAAA,qBAAA,gBAAA,qCAAA,qBAAA;;4BAmBzC,cAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"McpServerRoot.d.ts","names":[],"sources":["../../../src/primitives/server/McpServerRoot.tsx"],"mappings":";;;kBAQiB;OACH,UAAU,oBAAoB,UAAU;OACxC,QAAQ,gCAAgC,UAAU;;cAGnD,wCAAsB,0BAAA,qBAAA,gBAAA,kCAAA,eAAA"}
1
+ {"version":3,"file":"McpServerRoot.d.ts","names":[],"sources":["../../../src/primitives/server/McpServerRoot.tsx"],"mappings":";;;kBAQiB;OACH,UAAU,oBAAoB,UAAU;OACxC,QAAQ,gCAAgC,UAAU;;cAGnD,wCAAsB,0BAAA,qBAAA,gBAAA,kCAAA,eAAA;;4BAmBjC,cAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"McpServerStatus.d.ts","names":[],"sources":["../../../src/primitives/server/McpServerStatus.tsx"],"mappings":";;;kBAQiB;OACH,UAAU,oBAAoB,UAAU;OACxC,QAAQ,gCAAgC,UAAU;;cAGnD,0CAAwB,0BAAA,qBAAA,gBAAA,mCAAA,eAAA"}
1
+ {"version":3,"file":"McpServerStatus.d.ts","names":[],"sources":["../../../src/primitives/server/McpServerStatus.tsx"],"mappings":";;;kBAQiB;OACH,UAAU,oBAAoB,UAAU;OACxC,QAAQ,gCAAgC,UAAU;;cAGnD,0CAAwB,0BAAA,qBAAA,gBAAA,mCAAA,eAAA;;4BAUnC,cAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"McpServerStatus.js","names":["ComponentPropsWithoutRef","ComponentRef","forwardRef","Primitive","useAuiState","McpServerPrimitiveStatus","Element","span","Props","props","ref","$","_c","state","_temp","t0","children","t1","displayName","s","mcpServer","connectionState"],"sources":["../../../src/primitives/server/McpServerStatus.tsx"],"sourcesContent":["import {\n type ComponentPropsWithoutRef,\n type ComponentRef,\n forwardRef,\n} from \"react\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport { useAuiState } from \"@assistant-ui/store\";\n\nexport namespace McpServerPrimitiveStatus {\n export type Element = ComponentRef<typeof Primitive.span>;\n export type Props = ComponentPropsWithoutRef<typeof Primitive.span>;\n}\n\nexport const McpServerPrimitiveStatus = forwardRef<\n McpServerPrimitiveStatus.Element,\n McpServerPrimitiveStatus.Props\n>((props, ref) => {\n const state = useAuiState((s) => s.mcpServer.connectionState);\n return (\n <Primitive.span {...props} ref={ref} data-state={state}>\n {props.children ?? state}\n </Primitive.span>\n );\n});\n\nMcpServerPrimitiveStatus.displayName = \"McpServerPrimitive.Status\";\n"],"mappings":";;;;;;AAaA,MAAaK,2BAA2BH,YAGtCO,OAAAC,QAAA;CAAA,MAAAC,IAAAC,EAAA,CAAA;CACA,MAAAC,QAAcT,YAAYU,KAAkC;CAGvD,MAAAC,KAAAN,MAAKO,YAALH;CAAuB,IAAAI;CAAA,IAAAN,EAAA,OAAAF,SAAAE,EAAA,OAAAD,OAAAC,EAAA,OAAAE,SAAAF,EAAA,OAAAI,IAAA;EAD1BE,KAAA,oBAAA,UAAA,MAAA;GAAA,GAAoBR;GAAYC;GAAiBG,cAAAA;aAC9CE;EACH,CAAA;EAAiBJ,EAAA,KAAAF;EAAAE,EAAA,KAAAD;EAAAC,EAAA,KAAAE;EAAAF,EAAA,KAAAI;EAAAJ,EAAA,KAAAM;CAAA,OAAAA,KAAAN,EAAA;CAAA,OAFjBM;AAEiB,CAEpB;AAEDZ,yBAAyBa,cAAc;AATrC,SAAAJ,MAAAK,GAAA;CAAA,OACiCA,EAACC,UAAUC;AAAgB"}
1
+ {"version":3,"file":"McpServerStatus.js","names":["ComponentPropsWithoutRef","ComponentRef","forwardRef","Primitive","useAuiState","McpServerPrimitiveStatus","Element","span","Props","props","ref","$","_c","state","_temp","t0","children","t1","displayName","s","mcpServer","connectionState"],"sources":["../../../src/primitives/server/McpServerStatus.tsx"],"sourcesContent":["import {\n type ComponentPropsWithoutRef,\n type ComponentRef,\n forwardRef,\n} from \"react\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport { useAuiState } from \"@assistant-ui/store\";\n\nexport namespace McpServerPrimitiveStatus {\n export type Element = ComponentRef<typeof Primitive.span>;\n export type Props = ComponentPropsWithoutRef<typeof Primitive.span>;\n}\n\nexport const McpServerPrimitiveStatus = forwardRef<\n McpServerPrimitiveStatus.Element,\n McpServerPrimitiveStatus.Props\n>((props, ref) => {\n const state = useAuiState((s) => s.mcpServer.connectionState);\n return (\n <Primitive.span {...props} ref={ref} data-state={state}>\n {props.children ?? state}\n </Primitive.span>\n );\n});\n\nMcpServerPrimitiveStatus.displayName = \"McpServerPrimitive.Status\";\n"],"mappings":";;;;;;AAaA,MAAaK,2BAA2BH,YAGtCO,OAAAC,QAAA;CAAA,MAAAC,IAAAC,EAAA,CAAA;CACA,MAAAC,QAAcT,YAAYU,KAAkC;CAGvD,MAAAC,KAAAN,MAAKO,YAALH;CAAuB,IAAAI;CAAA,IAAAN,EAAA,OAAAF,SAAAE,EAAA,OAAAD,OAAAC,EAAA,OAAAE,SAAAF,EAAA,OAAAI,IAAA;EAD1BE,KAAA,oBAAA,UAAA,MAAA;GAAA,GAAoBR;GAAYC;GAAiBG,cAAAA;GAC9CE,UAAAA;EACH,CAAA;EAAiBJ,EAAA,KAAAF;EAAAE,EAAA,KAAAD;EAAAC,EAAA,KAAAE;EAAAF,EAAA,KAAAI;EAAAJ,EAAA,KAAAM;CAAA,OAAAA,KAAAN,EAAA;CAAA,OAFjBM;AAEiB,CAEpB;AAEDZ,yBAAyBa,cAAc;AATrC,SAAAJ,MAAAK,GAAA;CAAA,OACiCA,EAACC,UAAUC;AAAgB"}
@@ -1 +1 @@
1
- {"version":3,"file":"McpServerToolName.d.ts","names":[],"sources":["../../../src/primitives/server/McpServerToolName.tsx"],"mappings":";;;kBAQiB;OACH,UAAU,oBAAoB,UAAU;OACxC,QAAQ,gCAAgC,UAAU;;cAGnD,4CAA0B,0BAAA,qBAAA,gBAAA,mCAAA,eAAA"}
1
+ {"version":3,"file":"McpServerToolName.d.ts","names":[],"sources":["../../../src/primitives/server/McpServerToolName.tsx"],"mappings":";;;kBAQiB;OACH,UAAU,oBAAoB,UAAU;OACxC,QAAQ,gCAAgC,UAAU;;cAGnD,4CAA0B,0BAAA,qBAAA,gBAAA,mCAAA,eAAA;;4BAUrC,cAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"McpServerToolName.js","names":["ComponentPropsWithoutRef","ComponentRef","forwardRef","Primitive","useMcpServerTool","McpServerPrimitiveToolName","Element","span","Props","props","ref","$","_c","tool","t0","children","name","t1","displayName"],"sources":["../../../src/primitives/server/McpServerToolName.tsx"],"sourcesContent":["import {\n type ComponentPropsWithoutRef,\n type ComponentRef,\n forwardRef,\n} from \"react\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport { useMcpServerTool } from \"./McpServerTools\";\n\nexport namespace McpServerPrimitiveToolName {\n export type Element = ComponentRef<typeof Primitive.span>;\n export type Props = ComponentPropsWithoutRef<typeof Primitive.span>;\n}\n\nexport const McpServerPrimitiveToolName = forwardRef<\n McpServerPrimitiveToolName.Element,\n McpServerPrimitiveToolName.Props\n>((props, ref) => {\n const tool = useMcpServerTool();\n return (\n <Primitive.span {...props} ref={ref} data-tool-name={tool.name}>\n {props.children ?? tool.name}\n </Primitive.span>\n );\n});\n\nMcpServerPrimitiveToolName.displayName = \"McpServerPrimitive.ToolName\";\n"],"mappings":";;;;;;AAaA,MAAaK,6BAA6BH,YAGxCO,OAAAC,QAAA;CAAA,MAAAC,IAAAC,EAAA,CAAA;CACA,MAAAC,OAAaT,iBAAiB;CAGzB,MAAAU,KAAAL,MAAKM,YAAaF,KAAIG;CAAK,IAAAC;CAAA,IAAAN,EAAA,OAAAF,SAAAE,EAAA,OAAAD,OAAAC,EAAA,OAAAG,MAAAH,EAAA,OAAAE,KAAAG,MAAA;EAD9BC,KAAA,oBAAA,UAAA,MAAA;GAAA,GAAoBR;GAAYC;GAAqB,kBAAAG,KAAIG;aACtDF;EACH,CAAA;EAAiBH,EAAA,KAAAF;EAAAE,EAAA,KAAAD;EAAAC,EAAA,KAAAG;EAAAH,EAAA,KAAAE,KAAAG;EAAAL,EAAA,KAAAM;CAAA,OAAAA,KAAAN,EAAA;CAAA,OAFjBM;AAEiB,CAEpB;AAEDZ,2BAA2Ba,cAAc"}
1
+ {"version":3,"file":"McpServerToolName.js","names":["ComponentPropsWithoutRef","ComponentRef","forwardRef","Primitive","useMcpServerTool","McpServerPrimitiveToolName","Element","span","Props","props","ref","$","_c","tool","t0","children","name","t1","displayName"],"sources":["../../../src/primitives/server/McpServerToolName.tsx"],"sourcesContent":["import {\n type ComponentPropsWithoutRef,\n type ComponentRef,\n forwardRef,\n} from \"react\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport { useMcpServerTool } from \"./McpServerTools\";\n\nexport namespace McpServerPrimitiveToolName {\n export type Element = ComponentRef<typeof Primitive.span>;\n export type Props = ComponentPropsWithoutRef<typeof Primitive.span>;\n}\n\nexport const McpServerPrimitiveToolName = forwardRef<\n McpServerPrimitiveToolName.Element,\n McpServerPrimitiveToolName.Props\n>((props, ref) => {\n const tool = useMcpServerTool();\n return (\n <Primitive.span {...props} ref={ref} data-tool-name={tool.name}>\n {props.children ?? tool.name}\n </Primitive.span>\n );\n});\n\nMcpServerPrimitiveToolName.displayName = \"McpServerPrimitive.ToolName\";\n"],"mappings":";;;;;;AAaA,MAAaK,6BAA6BH,YAGxCO,OAAAC,QAAA;CAAA,MAAAC,IAAAC,EAAA,CAAA;CACA,MAAAC,OAAaT,iBAAiB;CAGzB,MAAAU,KAAAL,MAAKM,YAAaF,KAAIG;CAAK,IAAAC;CAAA,IAAAN,EAAA,OAAAF,SAAAE,EAAA,OAAAD,OAAAC,EAAA,OAAAG,MAAAH,EAAA,OAAAE,KAAAG,MAAA;EAD9BC,KAAA,oBAAA,UAAA,MAAA;GAAA,GAAoBR;GAAYC;GAAqB,kBAAAG,KAAIG;GACtDF,UAAAA;EACH,CAAA;EAAiBH,EAAA,KAAAF;EAAAE,EAAA,KAAAD;EAAAC,EAAA,KAAAG;EAAAH,EAAA,KAAAE,KAAAG;EAAAL,EAAA,KAAAM;CAAA,OAAAA,KAAAN,EAAA;CAAA,OAFjBM;AAEiB,CAEpB;AAEDZ,2BAA2Ba,cAAc"}
@@ -1 +1 @@
1
- {"version":3,"file":"McpServerTools.js","names":["FC","ReactNode","createContext","useContext","useAuiState","MCPToolInfo","ToolContext","useMcpServerTool","tool","Error","McpServerPrimitiveTools","Props","children","t0","$","_c","tools","_temp","length","t1","t2","name","map","displayName","s","mcpServer"],"sources":["../../../src/primitives/server/McpServerTools.tsx"],"sourcesContent":["import { type FC, type ReactNode, createContext, useContext } from \"react\";\nimport { useAuiState } from \"@assistant-ui/store\";\nimport type { MCPToolInfo } from \"../../mcp-scope\";\n\nconst ToolContext = createContext<MCPToolInfo | null>(null);\n\nexport const useMcpServerTool = (): MCPToolInfo => {\n const tool = useContext(ToolContext);\n if (!tool) {\n throw new Error(\n \"useMcpServerTool must be used inside <McpServerPrimitive.Tools>\",\n );\n }\n return tool;\n};\n\nexport namespace McpServerPrimitiveTools {\n export type Props = {\n children: ReactNode | ((tool: MCPToolInfo) => ReactNode);\n };\n}\n\nexport const McpServerPrimitiveTools: FC<McpServerPrimitiveTools.Props> = ({\n children,\n}) => {\n const tools = useAuiState((s) => s.mcpServer.tools);\n if (tools.length === 0) return null;\n return (\n <>\n {tools.map((tool) => (\n <ToolContext.Provider key={tool.name} value={tool}>\n {typeof children === \"function\" ? children(tool) : children}\n </ToolContext.Provider>\n ))}\n </>\n );\n};\n\nMcpServerPrimitiveTools.displayName = \"McpServerPrimitive.Tools\";\n"],"mappings":";;;;;AAIA,MAAMM,cAAcJ,cAAkC,IAAI;AAE1D,MAAaK,yBAAmB;CAC9B,MAAAC,OAAaL,WAAWG,WAAW;CACnC,IAAI,CAACE,MACH,MAAM,IAAIC,MACR,iEACF;CACD,OACMD;AAAI;AASb,MAAaE,2BAA6DG,OAAA;CAAA,MAAAC,IAAAC,EAAA,CAAA;CAAC,MAAA,EAAAH,aAAAC;CAGzE,MAAAG,QAAcZ,YAAYa,KAAwB;CAClD,IAAID,MAAKE,WAAY,GAAC,OAAS;CAAK,IAAAC;CAAA,IAAAL,EAAA,OAAAF,YAAAE,EAAA,OAAAE,OAAA;EAAA,IAAAI;EAAA,IAAAN,EAAA,OAAAF,UAAA;GAGrBQ,MAAAZ,SACT,oBAAA,YAAA,UAAA;IAA6CA,OAAAA;cAC1C,OAAOI,aAAa,aAAaA,SAASJ,IAAe,IAAzDI;GACH,GAF2BJ,KAAIa,IAE/B;GACDP,EAAA,KAAAF;GAAAE,EAAA,KAAAM;EAAA,OAAAA,KAAAN,EAAA;EAJAK,KAAAH,MAAKM,IAAKF,EAIV;EAACN,EAAA,KAAAF;EAAAE,EAAA,KAAAE;EAAAF,EAAA,KAAAK;CAAA,OAAAA,KAAAL,EAAA;CAAA,IAAAM;CAAA,IAAAN,EAAA,OAAAK,IAAA;EALJC,KAAA,oBAAA,UAAA,EAAA,UACGD,GAIC,CAAA;EACDL,EAAA,KAAAK;EAAAL,EAAA,KAAAM;CAAA,OAAAA,KAAAN,EAAA;CAAA,OANHM;AAMG;AAIPV,wBAAwBa,cAAc;AAhBoC,SAAAN,MAAAO,GAAA;CAAA,OAGvCA,EAACC,UAAUT;AAAM"}
1
+ {"version":3,"file":"McpServerTools.js","names":["FC","ReactNode","createContext","useContext","useAuiState","MCPToolInfo","ToolContext","useMcpServerTool","tool","Error","McpServerPrimitiveTools","Props","children","t0","$","_c","tools","_temp","length","t1","t2","name","map","displayName","s","mcpServer"],"sources":["../../../src/primitives/server/McpServerTools.tsx"],"sourcesContent":["import { type FC, type ReactNode, createContext, useContext } from \"react\";\nimport { useAuiState } from \"@assistant-ui/store\";\nimport type { MCPToolInfo } from \"../../mcp-scope\";\n\nconst ToolContext = createContext<MCPToolInfo | null>(null);\n\nexport const useMcpServerTool = (): MCPToolInfo => {\n const tool = useContext(ToolContext);\n if (!tool) {\n throw new Error(\n \"useMcpServerTool must be used inside <McpServerPrimitive.Tools>\",\n );\n }\n return tool;\n};\n\nexport namespace McpServerPrimitiveTools {\n export type Props = {\n children: ReactNode | ((tool: MCPToolInfo) => ReactNode);\n };\n}\n\nexport const McpServerPrimitiveTools: FC<McpServerPrimitiveTools.Props> = ({\n children,\n}) => {\n const tools = useAuiState((s) => s.mcpServer.tools);\n if (tools.length === 0) return null;\n return (\n <>\n {tools.map((tool) => (\n <ToolContext.Provider key={tool.name} value={tool}>\n {typeof children === \"function\" ? children(tool) : children}\n </ToolContext.Provider>\n ))}\n </>\n );\n};\n\nMcpServerPrimitiveTools.displayName = \"McpServerPrimitive.Tools\";\n"],"mappings":";;;;;AAIA,MAAMM,cAAcJ,cAAkC,IAAI;AAE1D,MAAaK,yBAAmB;CAC9B,MAAAC,OAAaL,WAAWG,WAAW;CACnC,IAAI,CAACE,MACH,MAAM,IAAIC,MACR,iEACF;CACD,OACMD;AAAI;AASb,MAAaE,2BAA6DG,OAAA;CAAA,MAAAC,IAAAC,EAAA,CAAA;CAAC,MAAA,EAAAH,aAAAC;CAGzE,MAAAG,QAAcZ,YAAYa,KAAwB;CAClD,IAAID,MAAKE,WAAY,GAAC,OAAS;CAAK,IAAAC;CAAA,IAAAL,EAAA,OAAAF,YAAAE,EAAA,OAAAE,OAAA;EAAA,IAAAI;EAAA,IAAAN,EAAA,OAAAF,UAAA;GAGrBQ,MAAAZ,SACT,oBAAA,YAAA,UAAA;IAA6CA,OAAAA;IAC1C,UAAA,OAAOI,aAAa,aAAaA,SAASJ,IAAe,IAAzDI;GACH,GAF2BJ,KAAIa,IAE/B;GACDP,EAAA,KAAAF;GAAAE,EAAA,KAAAM;EAAA,OAAAA,KAAAN,EAAA;EAJAK,KAAAH,MAAKM,IAAKF,EAIV;EAACN,EAAA,KAAAF;EAAAE,EAAA,KAAAE;EAAAF,EAAA,KAAAK;CAAA,OAAAA,KAAAL,EAAA;CAAA,IAAAM;CAAA,IAAAN,EAAA,OAAAK,IAAA;EALJC,KAAA,oBAAA,UAAA,EAAA,UACGD,GAIC,CAAA;EACDL,EAAA,KAAAK;EAAAL,EAAA,KAAAM;CAAA,OAAAA,KAAAN,EAAA;CAAA,OANHM;AAMG;AAIPV,wBAAwBa,cAAc;AAhBoC,SAAAN,MAAAO,GAAA;CAAA,OAGvCA,EAACC,UAAUT;AAAM"}
@@ -1 +1 @@
1
- {"version":3,"file":"McpServerResource.d.ts","names":[],"sources":["../../src/resources/McpServerResource.ts"],"mappings":";;;;KAsBY;EACV;EACA,MAAM;EACN;EACA;EACA;EACA,MAAM;EACN,SAAS;EACT;EACA;EACA;EACA,gBAAgB;;cAySL,+CAAiB,SAAA,4BAAA,OAAA"}
1
+ {"version":3,"file":"McpServerResource.d.ts","names":[],"sources":["../../src/resources/McpServerResource.ts"],"mappings":";;;;KAsBY;EACV;EACA,MAAM;EACN;EACA;EACA;EACA,MAAM;EACN,SAAS;EACT;EACA;EACA;EACA,gBAAgB;;cA8XL,+CAAiB,SAAA,4BAAA,OAAA"}
@@ -15,6 +15,39 @@ const useMcpServerResource = (props) => {
15
15
  const [authorizationUrl, setAuthorizationUrl] = useState(null);
16
16
  const clientRef = useRef(null);
17
17
  const transportRef = useRef(null);
18
+ const pendingTransportRef = useRef(null);
19
+ const transportCloseQueueRef = useRef(Promise.resolve());
20
+ const connectionGenerationRef = useRef(0);
21
+ const pendingDisposalRef = useRef(null);
22
+ const mountedRef = useRef(true);
23
+ const closeTransportSafely = async (transport) => {
24
+ try {
25
+ await transport.close();
26
+ } catch {}
27
+ };
28
+ const closeQueuedTransports = (transports) => {
29
+ const task = transportCloseQueueRef.current.then(async () => {
30
+ await Promise.all(transports.map(closeTransportSafely));
31
+ });
32
+ transportCloseQueueRef.current = task;
33
+ return task;
34
+ };
35
+ const closePendingTransport = async () => {
36
+ const transport_0 = pendingTransportRef.current;
37
+ pendingTransportRef.current = null;
38
+ await closeQueuedTransports(transport_0 ? [transport_0] : []);
39
+ };
40
+ const closeTransports = async () => {
41
+ const pendingTransport = pendingTransportRef.current;
42
+ const activeTransport = transportRef.current;
43
+ pendingTransportRef.current = null;
44
+ transportRef.current = null;
45
+ clientRef.current = null;
46
+ const transports_0 = new Set([pendingTransport, activeTransport].filter((transport_1) => transport_1 !== null));
47
+ await closeQueuedTransports([...transports_0]);
48
+ };
49
+ const isCurrentConnection = (generation) => mountedRef.current && generation === connectionGenerationRef.current;
50
+ const createInterruptedAuthError = (cause) => new Error(`MCP server "${props.id}" authorization was interrupted before completion.`, cause === void 0 ? void 0 : { cause });
18
51
  const withConnectionTimeout = useEffectEvent(async (promise, phase, startedAt) => {
19
52
  const timeoutMs = props.connectionTimeout;
20
53
  if (timeoutMs === void 0) return await promise;
@@ -50,16 +83,19 @@ const useMcpServerResource = (props) => {
50
83
  }
51
84
  return new StreamableHTTPClientTransport(new URL(props.url));
52
85
  });
53
- const finalizeConnect = useEffectEvent(async (transport) => {
86
+ const finalizeConnect = useEffectEvent(async (transport_2, generation_0) => {
54
87
  const client = new Client({
55
88
  name: "assistant-ui-mcp",
56
89
  version: "0.0.0"
57
90
  });
58
91
  const startedAt_0 = Date.now();
59
- await withConnectionTimeout(client.connect(transport), "connecting", startedAt_0);
92
+ await withConnectionTimeout(client.connect(transport_2), "connecting", startedAt_0);
93
+ if (!isCurrentConnection(generation_0)) return false;
60
94
  const list = await withConnectionTimeout(client.listTools(), "listing tools", startedAt_0);
95
+ if (!isCurrentConnection(generation_0)) return false;
96
+ pendingTransportRef.current = null;
61
97
  clientRef.current = client;
62
- transportRef.current = transport;
98
+ transportRef.current = transport_2;
63
99
  setTools(list.tools.map((t) => {
64
100
  const info = {
65
101
  name: t.name,
@@ -69,61 +105,76 @@ const useMcpServerResource = (props) => {
69
105
  return info;
70
106
  }));
71
107
  setConnectionState("connected");
108
+ return true;
72
109
  });
73
- const closeTransport = async () => {
74
- const t_0 = transportRef.current;
75
- transportRef.current = null;
76
- clientRef.current = null;
77
- if (t_0) try {
78
- await t_0.close();
79
- } catch {}
80
- };
81
110
  const doConnect = useEffectEvent(async () => {
82
- await closeTransport();
111
+ const generation_1 = ++connectionGenerationRef.current;
112
+ await closeTransports();
113
+ if (!isCurrentConnection(generation_1)) return;
83
114
  setConnectionState("connecting");
84
115
  setLastError(null);
85
116
  setAuthorizationUrl(null);
86
117
  setTools([]);
87
- let transport_0 = null;
118
+ let transport_3 = null;
88
119
  try {
89
- transport_0 = await buildTransport();
90
- await finalizeConnect(transport_0);
120
+ transport_3 = await buildTransport();
121
+ if (!isCurrentConnection(generation_1)) {
122
+ await closeQueuedTransports([transport_3]);
123
+ return;
124
+ }
125
+ pendingTransportRef.current = transport_3;
126
+ await finalizeConnect(transport_3, generation_1);
91
127
  } catch (err) {
128
+ if (!isCurrentConnection(generation_1)) return;
92
129
  if (err instanceof UnauthorizedError) {
93
- transportRef.current = transport_0;
130
+ pendingTransportRef.current = null;
131
+ transportRef.current = transport_3;
94
132
  setConnectionState("authRequired");
95
133
  } else {
96
- if (transport_0) try {
97
- await transport_0.close();
98
- } catch {}
134
+ if (transport_3) {
135
+ pendingTransportRef.current = null;
136
+ await closeQueuedTransports([transport_3]);
137
+ }
99
138
  setLastError({ message: err instanceof Error ? err.message : String(err) });
100
139
  setConnectionState("error");
101
140
  }
102
141
  }
103
142
  });
104
143
  const doDisconnect = useEffectEvent(async () => {
144
+ connectionGenerationRef.current += 1;
105
145
  setTools([]);
106
146
  setAuthorizationUrl(null);
107
147
  setConnectionState("disconnected");
108
- await closeTransport();
148
+ await closeTransports();
109
149
  });
110
150
  const doCompleteAuth = useEffectEvent(async (callbackUrl) => {
151
+ const generation_2 = ++connectionGenerationRef.current;
152
+ await closePendingTransport();
153
+ if (!isCurrentConnection(generation_2)) throw createInterruptedAuthError();
111
154
  setConnectionState("authPending");
112
155
  setLastError(null);
113
156
  try {
114
157
  const code = new URL(callbackUrl).searchParams.get("code");
115
158
  if (!code) throw new Error("missing authorization code in callback URL");
116
- let transport_1 = transportRef.current;
117
- if (!transport_1) {
118
- transport_1 = await buildTransport();
119
- transportRef.current = transport_1;
159
+ let transport_4 = transportRef.current;
160
+ if (!transport_4) {
161
+ transport_4 = await buildTransport();
162
+ if (!isCurrentConnection(generation_2)) {
163
+ await closeQueuedTransports([transport_4]);
164
+ throw createInterruptedAuthError();
165
+ }
120
166
  }
121
- await transport_1.finishAuth(code);
167
+ transportRef.current = null;
168
+ clientRef.current = null;
169
+ pendingTransportRef.current = transport_4;
170
+ await transport_4.finishAuth(code);
171
+ if (!isCurrentConnection(generation_2)) throw createInterruptedAuthError();
122
172
  setAuthorizationUrl(null);
123
- await finalizeConnect(transport_1);
173
+ if (!await finalizeConnect(transport_4, generation_2)) throw createInterruptedAuthError();
124
174
  } catch (err_0) {
125
- await closeTransport();
126
175
  const error = err_0 instanceof Error ? err_0 : new Error(String(err_0));
176
+ if (!isCurrentConnection(generation_2)) throw createInterruptedAuthError(error);
177
+ await closeTransports();
127
178
  setLastError({ message: error.message });
128
179
  setConnectionState("error");
129
180
  throw error;
@@ -147,14 +198,21 @@ const useMcpServerResource = (props) => {
147
198
  doConnect();
148
199
  });
149
200
  useEffect(() => {
201
+ const previousDisposal = pendingDisposalRef.current;
202
+ if (previousDisposal) previousDisposal.cancelled = true;
203
+ const pendingDisposal = { cancelled: false };
204
+ pendingDisposalRef.current = pendingDisposal;
205
+ mountedRef.current = true;
150
206
  const signal_0 = { cancelled: false };
151
207
  tryAutoConnect(signal_0);
152
208
  return () => {
209
+ mountedRef.current = false;
153
210
  signal_0.cancelled = true;
154
- const t_1 = transportRef.current;
155
- transportRef.current = null;
156
- clientRef.current = null;
157
- if (t_1) t_1.close().catch(() => {});
211
+ queueMicrotask(() => {
212
+ if (pendingDisposal.cancelled) return;
213
+ connectionGenerationRef.current += 1;
214
+ closeTransports();
215
+ });
158
216
  };
159
217
  }, []);
160
218
  const state = useMemo(() => ({
@@ -1 +1 @@
1
- {"version":3,"file":"McpServerResource.js","names":["useState","useRef","useEffect","useMemo","useEffectEvent","resource","ClientOutput","Client","StreamableHTTPClientTransport","StreamableHTTPClientTransportOptions","UnauthorizedError","Transport","createOAuthProvider","buildHeaders","assertValidServerId","MCPStorage","MCPAuthConfig","MCPConnectionState","MCPServerKind","MCPServerState","MCPToolInfo","McpServerResourceProps","id","kind","name","url","icon","auth","storage","redirectUri","autoConnect","connectionTimeout","onRemove","Promise","useMcpServerResource","props","connectionState","setConnectionState","tools","setTools","lastError","setLastError","message","authorizationUrl","setAuthorizationUrl","clientRef","transportRef","withConnectionTimeout","promise","T","phase","startedAt","timeoutMs","undefined","remainingMs","Date","now","timeoutError","Error","timeout","ReturnType","setTimeout","race","_","reject","clearTimeout","buildTransport","type","authProvider","serverId","config","onAuthorizationUrl","toString","URL","persisted","loadAuthState","headers","transportOpts","requestInit","finalizeConnect","transport","client","version","connect","list","listTools","current","map","t","info","inputSchema","description","closeTransport","close","doConnect","err","String","doDisconnect","doCompleteAuth","callbackUrl","code","searchParams","get","finishAuth","error","tryAutoConnect","signal","cancelled","token","tokens","catch","state","getState","disconnect","remove","clearAuthState","callTool","args","arguments","Record","listResources","params","readResource","uri","completeAuth","McpServerResource"],"sources":["../../src/resources/McpServerResource.ts"],"sourcesContent":["import { useState, useRef, useEffect, useMemo, useEffectEvent } from \"react\";\nimport { resource } from \"@assistant-ui/tap\";\nimport type { ClientOutput } from \"@assistant-ui/store\";\nimport { Client } from \"@modelcontextprotocol/sdk/client/index.js\";\nimport {\n StreamableHTTPClientTransport,\n type StreamableHTTPClientTransportOptions,\n} from \"@modelcontextprotocol/sdk/client/streamableHttp.js\";\nimport { UnauthorizedError } from \"@modelcontextprotocol/sdk/client/auth.js\";\nimport type { Transport } from \"@modelcontextprotocol/sdk/shared/transport.js\";\nimport { createOAuthProvider } from \"../auth/createOAuthProvider\";\nimport { buildHeaders } from \"../auth/buildHeaders\";\nimport { assertValidServerId } from \"../utils/serverId\";\nimport type { MCPStorage } from \"./storage/types\";\nimport type {\n MCPAuthConfig,\n MCPConnectionState,\n MCPServerKind,\n MCPServerState,\n MCPToolInfo,\n} from \"../mcp-scope\";\n\nexport type McpServerResourceProps = {\n id: string;\n kind: MCPServerKind;\n name: string;\n url: string;\n icon?: string | undefined;\n auth: MCPAuthConfig;\n storage: MCPStorage;\n redirectUri: string;\n autoConnect: boolean;\n connectionTimeout?: number | undefined;\n onRemove: () => Promise<void>;\n};\n\nconst useMcpServerResource = (\n props: McpServerResourceProps,\n): ClientOutput<\"mcpServer\"> => {\n assertValidServerId(props.id);\n const [connectionState, setConnectionState] =\n useState<MCPConnectionState>(\"disconnected\");\n const [tools, setTools] = useState<MCPToolInfo[]>([]);\n const [lastError, setLastError] = useState<{ message: string } | null>(null);\n const [authorizationUrl, setAuthorizationUrl] = useState<string | null>(null);\n\n const clientRef = useRef<Client | null>(null);\n const transportRef = useRef<StreamableHTTPClientTransport | null>(null);\n\n const withConnectionTimeout = useEffectEvent(\n async <T>(\n promise: Promise<T>,\n phase: \"connecting\" | \"listing tools\",\n startedAt: number,\n ): Promise<T> => {\n const timeoutMs = props.connectionTimeout;\n if (timeoutMs === undefined) return await promise;\n const remainingMs = timeoutMs - (Date.now() - startedAt);\n const timeoutError = () =>\n new Error(\n `MCP server \"${props.id}\" timed out while ${phase} after ${timeoutMs}ms.`,\n );\n if (remainingMs <= 0) throw timeoutError();\n\n let timeout: ReturnType<typeof setTimeout> | undefined;\n try {\n return await Promise.race([\n promise,\n new Promise<never>((_, reject) => {\n timeout = setTimeout(() => reject(timeoutError()), remainingMs);\n }),\n ]);\n } finally {\n if (timeout !== undefined) clearTimeout(timeout);\n }\n },\n );\n\n const buildTransport = useEffectEvent(\n async (): Promise<StreamableHTTPClientTransport> => {\n if (props.auth.type === \"oauth\") {\n const authProvider = createOAuthProvider({\n serverId: props.id,\n config: props.auth,\n storage: props.storage,\n redirectUri: props.redirectUri,\n onAuthorizationUrl: (url) => setAuthorizationUrl(url.toString()),\n });\n return new StreamableHTTPClientTransport(new URL(props.url), {\n authProvider,\n });\n }\n if (props.auth.type === \"bearer\") {\n const persisted = await props.storage.loadAuthState(props.id);\n const headers = buildHeaders(props.auth, persisted);\n const transportOpts: StreamableHTTPClientTransportOptions = {};\n if (headers) transportOpts.requestInit = { headers };\n return new StreamableHTTPClientTransport(\n new URL(props.url),\n transportOpts,\n );\n }\n return new StreamableHTTPClientTransport(new URL(props.url));\n },\n );\n\n const finalizeConnect = useEffectEvent(\n async (transport: StreamableHTTPClientTransport) => {\n const client = new Client({\n name: \"assistant-ui-mcp\",\n version: \"0.0.0\",\n });\n const startedAt = Date.now();\n // SDK's StreamableHTTPClientTransport.sessionId is `string | undefined`\n // but Transport.sessionId is declared `string?` — under\n // exactOptionalPropertyTypes the SDK's own classes don't satisfy its\n // Transport interface. Cast to bridge the gap.\n await withConnectionTimeout(\n client.connect(transport as unknown as Transport),\n \"connecting\",\n startedAt,\n );\n // Defer ref assignment until listTools() also succeeds — otherwise a\n // post-connect failure leaves stale refs that `callTool()` would\n // happily walk into, producing confusing SDK errors instead of\n // \"not connected\".\n const list = await withConnectionTimeout(\n client.listTools(),\n \"listing tools\",\n startedAt,\n );\n clientRef.current = client;\n transportRef.current = transport;\n setTools(\n list.tools.map((t) => {\n const info: MCPToolInfo = {\n name: t.name,\n inputSchema: t.inputSchema,\n };\n if (t.description !== undefined) info.description = t.description;\n return info;\n }),\n );\n setConnectionState(\"connected\");\n },\n );\n\n const closeTransport = async () => {\n const t = transportRef.current;\n transportRef.current = null;\n clientRef.current = null;\n if (t) {\n try {\n await t.close();\n } catch {\n // ignore close errors\n }\n }\n };\n\n const doConnect = useEffectEvent(async () => {\n // Close any prior transport/client so a re-connect doesn't leak.\n await closeTransport();\n setConnectionState(\"connecting\");\n setLastError(null);\n setAuthorizationUrl(null);\n // Clear tools so a reconnect (error → connect, or authRequired\n // → connect) doesn't expose the previous attempt's tool list.\n setTools([]);\n let transport: StreamableHTTPClientTransport | null = null;\n try {\n transport = await buildTransport();\n // Don't assign to transportRef until connect succeeds — otherwise a\n // failed `listTools()` leaves an orphaned transport that future\n // doConnect / doDisconnect calls treat as live.\n await finalizeConnect(transport);\n } catch (err) {\n if (err instanceof UnauthorizedError) {\n // OAuth: keep the transport alive so completeAuth can call\n // finishAuth on it. Closing it before storing would leave a\n // closed transport on transportRef.\n transportRef.current = transport;\n setConnectionState(\"authRequired\");\n } else {\n if (transport) {\n try {\n await transport.close();\n } catch {\n // ignore close errors\n }\n }\n setLastError({\n message: err instanceof Error ? err.message : String(err),\n });\n setConnectionState(\"error\");\n }\n }\n });\n\n const doDisconnect = useEffectEvent(async () => {\n setTools([]);\n setAuthorizationUrl(null);\n setConnectionState(\"disconnected\");\n await closeTransport();\n });\n\n const doCompleteAuth = useEffectEvent(async (callbackUrl: string) => {\n setConnectionState(\"authPending\");\n setLastError(null);\n try {\n const url = new URL(callbackUrl);\n const code = url.searchParams.get(\"code\");\n if (!code) throw new Error(\"missing authorization code in callback URL\");\n let transport = transportRef.current;\n if (!transport) {\n transport = await buildTransport();\n transportRef.current = transport;\n }\n await transport.finishAuth(code);\n setAuthorizationUrl(null);\n await finalizeConnect(transport);\n } catch (err) {\n await closeTransport();\n const error = err instanceof Error ? err : new Error(String(err));\n setLastError({\n message: error.message,\n });\n setConnectionState(\"error\");\n throw error;\n }\n });\n\n const tryAutoConnect = useEffectEvent(\n async (signal: { cancelled: boolean }) => {\n if (!props.autoConnect) return;\n if (props.auth.type === \"none\") {\n void doConnect();\n return;\n }\n // Static connector token short-circuits the storage read.\n if (props.auth.type === \"bearer\" && props.auth.token) {\n void doConnect();\n return;\n }\n const persisted = await props.storage.loadAuthState(props.id);\n if (signal.cancelled) return;\n if (props.auth.type === \"oauth\") {\n if (!persisted?.tokens) return;\n } else if (!persisted?.token) {\n return;\n }\n void doConnect();\n },\n );\n\n // Auto-connect on mount when usable auth exists.\n useEffect(() => {\n const signal = { cancelled: false };\n void tryAutoConnect(signal);\n return () => {\n signal.cancelled = true;\n const t = transportRef.current;\n transportRef.current = null;\n clientRef.current = null;\n if (t) t.close().catch(() => {});\n };\n }, []);\n\n const state = useMemo<MCPServerState>(\n () => ({\n id: props.id,\n kind: props.kind,\n name: props.name,\n url: props.url,\n icon: props.icon,\n connectionState,\n lastError,\n tools,\n authorizationUrl,\n }),\n [\n props.id,\n props.kind,\n props.name,\n props.url,\n props.icon,\n connectionState,\n lastError,\n tools,\n authorizationUrl,\n ],\n );\n\n return {\n getState: () => state,\n connect: doConnect,\n disconnect: doDisconnect,\n remove: async () => {\n await doDisconnect();\n await props.storage.clearAuthState(props.id);\n await props.onRemove();\n },\n callTool: async (name, args) => {\n const client = clientRef.current;\n if (!client) {\n throw new Error(`MCP server \"${props.id}\" is not connected`);\n }\n return await client.callTool({\n name,\n arguments: args as Record<string, unknown> | undefined,\n });\n },\n listResources: async (params) => {\n const client = clientRef.current;\n if (!client) {\n throw new Error(`MCP server \"${props.id}\" is not connected`);\n }\n return await client.listResources(params);\n },\n readResource: async (uri) => {\n const client = clientRef.current;\n if (!client) {\n throw new Error(`MCP server \"${props.id}\" is not connected`);\n }\n return await client.readResource({ uri });\n },\n completeAuth: doCompleteAuth,\n };\n};\n\nexport const McpServerResource = resource(useMcpServerResource);\n"],"mappings":";;;;;;;;;AAoCA,MAAMkC,wBACJC,UAC8B;CAC9BrB,oBAAoBqB,MAAMb,EAAE;CAC5B,MAAM,CAACc,iBAAiBC,sBACtBrC,SAA6B,cAAc;CAC7C,MAAM,CAACsC,OAAOC,YAAYvC,SAAwB,CAAA,CAAE;CACpD,MAAM,CAACwC,WAAWC,gBAAgBzC,SAAqC,IAAI;CAC3E,MAAM,CAAC2C,kBAAkBC,uBAAuB5C,SAAwB,IAAI;CAE5E,MAAM6C,YAAY5C,OAAsB,IAAI;CAC5C,MAAM6C,eAAe7C,OAA6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,MAAM2D,SAAOuC,cAAcC,MAAM;EAC1C;EACAC,cAAc,OAAOC,QAAQ;GAC3B,MAAM1C,WAASpC,UAAUyC;GACzB,IAAI,CAACL,UACH,MAAM,IAAIvB,MAAM,eAAevB,MAAMb,GAAE,mBAAoB;GAE7D,OAAO,MAAM2D,SAAOyC,aAAa,EAAEC,IAAI,CAAC;EAC1C;EACAC,cAAc1B;CAChB;AACF;AAEA,MAAa2B,oBAAoBxH,SAAS6B,oBAAoB"}
1
+ {"version":3,"file":"McpServerResource.js","names":["useState","useRef","useEffect","useMemo","useEffectEvent","resource","ClientOutput","Client","StreamableHTTPClientTransport","StreamableHTTPClientTransportOptions","UnauthorizedError","Transport","createOAuthProvider","buildHeaders","assertValidServerId","MCPStorage","MCPAuthConfig","MCPConnectionState","MCPServerKind","MCPServerState","MCPToolInfo","McpServerResourceProps","id","kind","name","url","icon","auth","storage","redirectUri","autoConnect","connectionTimeout","onRemove","Promise","useMcpServerResource","props","connectionState","setConnectionState","tools","setTools","lastError","setLastError","message","authorizationUrl","setAuthorizationUrl","clientRef","transportRef","pendingTransportRef","transportCloseQueueRef","resolve","connectionGenerationRef","pendingDisposalRef","cancelled","mountedRef","closeTransportSafely","transport","close","closeQueuedTransports","transports","task","current","then","all","map","closePendingTransport","closeTransports","pendingTransport","activeTransport","Set","filter","isCurrentConnection","generation","createInterruptedAuthError","cause","Error","undefined","withConnectionTimeout","promise","T","phase","startedAt","timeoutMs","remainingMs","Date","now","timeoutError","timeout","ReturnType","setTimeout","race","_","reject","clearTimeout","buildTransport","type","authProvider","serverId","config","onAuthorizationUrl","toString","URL","persisted","loadAuthState","headers","transportOpts","requestInit","finalizeConnect","client","version","connect","list","listTools","t","info","inputSchema","description","doConnect","err","String","doDisconnect","doCompleteAuth","callbackUrl","code","searchParams","get","finishAuth","connected","error","tryAutoConnect","signal","token","tokens","previousDisposal","pendingDisposal","queueMicrotask","state","getState","disconnect","remove","clearAuthState","callTool","args","arguments","Record","listResources","params","readResource","uri","completeAuth","McpServerResource"],"sources":["../../src/resources/McpServerResource.ts"],"sourcesContent":["import { useState, useRef, useEffect, useMemo, useEffectEvent } from \"react\";\nimport { resource } from \"@assistant-ui/tap\";\nimport type { ClientOutput } from \"@assistant-ui/store\";\nimport { Client } from \"@modelcontextprotocol/sdk/client/index.js\";\nimport {\n StreamableHTTPClientTransport,\n type StreamableHTTPClientTransportOptions,\n} from \"@modelcontextprotocol/sdk/client/streamableHttp.js\";\nimport { UnauthorizedError } from \"@modelcontextprotocol/sdk/client/auth.js\";\nimport type { Transport } from \"@modelcontextprotocol/sdk/shared/transport.js\";\nimport { createOAuthProvider } from \"../auth/createOAuthProvider\";\nimport { buildHeaders } from \"../auth/buildHeaders\";\nimport { assertValidServerId } from \"../utils/serverId\";\nimport type { MCPStorage } from \"./storage/types\";\nimport type {\n MCPAuthConfig,\n MCPConnectionState,\n MCPServerKind,\n MCPServerState,\n MCPToolInfo,\n} from \"../mcp-scope\";\n\nexport type McpServerResourceProps = {\n id: string;\n kind: MCPServerKind;\n name: string;\n url: string;\n icon?: string | undefined;\n auth: MCPAuthConfig;\n storage: MCPStorage;\n redirectUri: string;\n autoConnect: boolean;\n connectionTimeout?: number | undefined;\n onRemove: () => Promise<void>;\n};\n\nconst useMcpServerResource = (\n props: McpServerResourceProps,\n): ClientOutput<\"mcpServer\"> => {\n assertValidServerId(props.id);\n const [connectionState, setConnectionState] =\n useState<MCPConnectionState>(\"disconnected\");\n const [tools, setTools] = useState<MCPToolInfo[]>([]);\n const [lastError, setLastError] = useState<{ message: string } | null>(null);\n const [authorizationUrl, setAuthorizationUrl] = useState<string | null>(null);\n\n const clientRef = useRef<Client | null>(null);\n const transportRef = useRef<StreamableHTTPClientTransport | null>(null);\n const pendingTransportRef = useRef<StreamableHTTPClientTransport | null>(\n null,\n );\n const transportCloseQueueRef = useRef(Promise.resolve());\n const connectionGenerationRef = useRef(0);\n const pendingDisposalRef = useRef<{ cancelled: boolean } | null>(null);\n const mountedRef = useRef(true);\n\n const closeTransportSafely = async (\n transport: StreamableHTTPClientTransport,\n ): Promise<void> => {\n try {\n await transport.close();\n } catch {\n // ignore close errors\n }\n };\n\n const closeQueuedTransports = (\n transports: StreamableHTTPClientTransport[],\n ): Promise<void> => {\n const task = transportCloseQueueRef.current.then(async () => {\n await Promise.all(transports.map(closeTransportSafely));\n });\n transportCloseQueueRef.current = task;\n return task;\n };\n\n const closePendingTransport = async () => {\n const transport = pendingTransportRef.current;\n pendingTransportRef.current = null;\n await closeQueuedTransports(transport ? [transport] : []);\n };\n\n const closeTransports = async () => {\n const pendingTransport = pendingTransportRef.current;\n const activeTransport = transportRef.current;\n pendingTransportRef.current = null;\n transportRef.current = null;\n clientRef.current = null;\n\n const transports = new Set(\n [pendingTransport, activeTransport].filter(\n (transport): transport is StreamableHTTPClientTransport =>\n transport !== null,\n ),\n );\n await closeQueuedTransports([...transports]);\n };\n\n const isCurrentConnection = (generation: number) =>\n mountedRef.current && generation === connectionGenerationRef.current;\n\n const createInterruptedAuthError = (cause?: unknown) =>\n new Error(\n `MCP server \"${props.id}\" authorization was interrupted before completion.`,\n cause === undefined ? undefined : { cause },\n );\n\n const withConnectionTimeout = useEffectEvent(\n async <T>(\n promise: Promise<T>,\n phase: \"connecting\" | \"listing tools\",\n startedAt: number,\n ): Promise<T> => {\n const timeoutMs = props.connectionTimeout;\n if (timeoutMs === undefined) return await promise;\n const remainingMs = timeoutMs - (Date.now() - startedAt);\n const timeoutError = () =>\n new Error(\n `MCP server \"${props.id}\" timed out while ${phase} after ${timeoutMs}ms.`,\n );\n if (remainingMs <= 0) throw timeoutError();\n\n let timeout: ReturnType<typeof setTimeout> | undefined;\n try {\n return await Promise.race([\n promise,\n new Promise<never>((_, reject) => {\n timeout = setTimeout(() => reject(timeoutError()), remainingMs);\n }),\n ]);\n } finally {\n if (timeout !== undefined) clearTimeout(timeout);\n }\n },\n );\n\n const buildTransport = useEffectEvent(\n async (): Promise<StreamableHTTPClientTransport> => {\n if (props.auth.type === \"oauth\") {\n const authProvider = createOAuthProvider({\n serverId: props.id,\n config: props.auth,\n storage: props.storage,\n redirectUri: props.redirectUri,\n onAuthorizationUrl: (url) => setAuthorizationUrl(url.toString()),\n });\n return new StreamableHTTPClientTransport(new URL(props.url), {\n authProvider,\n });\n }\n if (props.auth.type === \"bearer\") {\n const persisted = await props.storage.loadAuthState(props.id);\n const headers = buildHeaders(props.auth, persisted);\n const transportOpts: StreamableHTTPClientTransportOptions = {};\n if (headers) transportOpts.requestInit = { headers };\n return new StreamableHTTPClientTransport(\n new URL(props.url),\n transportOpts,\n );\n }\n return new StreamableHTTPClientTransport(new URL(props.url));\n },\n );\n\n const finalizeConnect = useEffectEvent(\n async (\n transport: StreamableHTTPClientTransport,\n generation: number,\n ): Promise<boolean> => {\n const client = new Client({\n name: \"assistant-ui-mcp\",\n version: \"0.0.0\",\n });\n const startedAt = Date.now();\n // SDK's StreamableHTTPClientTransport.sessionId is `string | undefined`\n // but Transport.sessionId is declared `string?` — under\n // exactOptionalPropertyTypes the SDK's own classes don't satisfy its\n // Transport interface. Cast to bridge the gap.\n await withConnectionTimeout(\n client.connect(transport as unknown as Transport),\n \"connecting\",\n startedAt,\n );\n if (!isCurrentConnection(generation)) return false;\n // Defer ref assignment until listTools() also succeeds — otherwise a\n // post-connect failure leaves stale refs that `callTool()` would\n // happily walk into, producing confusing SDK errors instead of\n // \"not connected\".\n const list = await withConnectionTimeout(\n client.listTools(),\n \"listing tools\",\n startedAt,\n );\n if (!isCurrentConnection(generation)) return false;\n\n pendingTransportRef.current = null;\n clientRef.current = client;\n transportRef.current = transport;\n setTools(\n list.tools.map((t) => {\n const info: MCPToolInfo = {\n name: t.name,\n inputSchema: t.inputSchema,\n };\n if (t.description !== undefined) info.description = t.description;\n return info;\n }),\n );\n setConnectionState(\"connected\");\n return true;\n },\n );\n\n const doConnect = useEffectEvent(async () => {\n const generation = ++connectionGenerationRef.current;\n // Close any prior transport/client so a re-connect doesn't leak.\n await closeTransports();\n if (!isCurrentConnection(generation)) return;\n\n setConnectionState(\"connecting\");\n setLastError(null);\n setAuthorizationUrl(null);\n // Clear tools so a reconnect (error → connect, or authRequired\n // → connect) doesn't expose the previous attempt's tool list.\n setTools([]);\n let transport: StreamableHTTPClientTransport | null = null;\n try {\n transport = await buildTransport();\n if (!isCurrentConnection(generation)) {\n await closeQueuedTransports([transport]);\n return;\n }\n pendingTransportRef.current = transport;\n // Don't assign to transportRef until connect succeeds — otherwise a\n // failed `listTools()` leaves an orphaned transport that future\n // doConnect / doDisconnect calls treat as live.\n await finalizeConnect(transport, generation);\n } catch (err) {\n if (!isCurrentConnection(generation)) return;\n\n if (err instanceof UnauthorizedError) {\n // OAuth: keep the transport alive so completeAuth can call\n // finishAuth on it. Closing it before storing would leave a\n // closed transport on transportRef.\n pendingTransportRef.current = null;\n transportRef.current = transport;\n setConnectionState(\"authRequired\");\n } else {\n if (transport) {\n pendingTransportRef.current = null;\n await closeQueuedTransports([transport]);\n }\n setLastError({\n message: err instanceof Error ? err.message : String(err),\n });\n setConnectionState(\"error\");\n }\n }\n });\n\n const doDisconnect = useEffectEvent(async () => {\n connectionGenerationRef.current += 1;\n setTools([]);\n setAuthorizationUrl(null);\n setConnectionState(\"disconnected\");\n await closeTransports();\n });\n\n const doCompleteAuth = useEffectEvent(async (callbackUrl: string) => {\n const generation = ++connectionGenerationRef.current;\n await closePendingTransport();\n if (!isCurrentConnection(generation)) throw createInterruptedAuthError();\n\n setConnectionState(\"authPending\");\n setLastError(null);\n try {\n const url = new URL(callbackUrl);\n const code = url.searchParams.get(\"code\");\n if (!code) throw new Error(\"missing authorization code in callback URL\");\n let transport = transportRef.current;\n if (!transport) {\n transport = await buildTransport();\n if (!isCurrentConnection(generation)) {\n await closeQueuedTransports([transport]);\n throw createInterruptedAuthError();\n }\n }\n transportRef.current = null;\n clientRef.current = null;\n pendingTransportRef.current = transport;\n await transport.finishAuth(code);\n if (!isCurrentConnection(generation)) throw createInterruptedAuthError();\n setAuthorizationUrl(null);\n const connected = await finalizeConnect(transport, generation);\n if (!connected) throw createInterruptedAuthError();\n } catch (err) {\n const error = err instanceof Error ? err : new Error(String(err));\n if (!isCurrentConnection(generation))\n throw createInterruptedAuthError(error);\n\n await closeTransports();\n setLastError({\n message: error.message,\n });\n setConnectionState(\"error\");\n throw error;\n }\n });\n\n const tryAutoConnect = useEffectEvent(\n async (signal: { cancelled: boolean }) => {\n if (!props.autoConnect) return;\n if (props.auth.type === \"none\") {\n void doConnect();\n return;\n }\n // Static connector token short-circuits the storage read.\n if (props.auth.type === \"bearer\" && props.auth.token) {\n void doConnect();\n return;\n }\n const persisted = await props.storage.loadAuthState(props.id);\n if (signal.cancelled) return;\n if (props.auth.type === \"oauth\") {\n if (!persisted?.tokens) return;\n } else if (!persisted?.token) {\n return;\n }\n void doConnect();\n },\n );\n\n // Auto-connect on mount when usable auth exists.\n useEffect(() => {\n const previousDisposal = pendingDisposalRef.current;\n if (previousDisposal) previousDisposal.cancelled = true;\n const pendingDisposal = { cancelled: false };\n pendingDisposalRef.current = pendingDisposal;\n mountedRef.current = true;\n const signal = { cancelled: false };\n void tryAutoConnect(signal);\n return () => {\n mountedRef.current = false;\n signal.cancelled = true;\n // Defer disposal so StrictMode can replay setup before closing the transport.\n queueMicrotask(() => {\n if (pendingDisposal.cancelled) return;\n connectionGenerationRef.current += 1;\n void closeTransports();\n });\n };\n }, []);\n\n const state = useMemo<MCPServerState>(\n () => ({\n id: props.id,\n kind: props.kind,\n name: props.name,\n url: props.url,\n icon: props.icon,\n connectionState,\n lastError,\n tools,\n authorizationUrl,\n }),\n [\n props.id,\n props.kind,\n props.name,\n props.url,\n props.icon,\n connectionState,\n lastError,\n tools,\n authorizationUrl,\n ],\n );\n\n return {\n getState: () => state,\n connect: doConnect,\n disconnect: doDisconnect,\n remove: async () => {\n await doDisconnect();\n await props.storage.clearAuthState(props.id);\n await props.onRemove();\n },\n callTool: async (name, args) => {\n const client = clientRef.current;\n if (!client) {\n throw new Error(`MCP server \"${props.id}\" is not connected`);\n }\n return await client.callTool({\n name,\n arguments: args as Record<string, unknown> | undefined,\n });\n },\n listResources: async (params) => {\n const client = clientRef.current;\n if (!client) {\n throw new Error(`MCP server \"${props.id}\" is not connected`);\n }\n return await client.listResources(params);\n },\n readResource: async (uri) => {\n const client = clientRef.current;\n if (!client) {\n throw new Error(`MCP server \"${props.id}\" is not connected`);\n }\n return await client.readResource({ uri });\n },\n completeAuth: doCompleteAuth,\n };\n};\n\nexport const McpServerResource = resource(useMcpServerResource);\n"],"mappings":";;;;;;;;;AAoCA,MAAMkC,wBACJC,UAC8B;CAC9BrB,oBAAoBqB,MAAMb,EAAE;CAC5B,MAAM,CAACc,iBAAiBC,sBACtBrC,SAA6B,cAAc;CAC7C,MAAM,CAACsC,OAAOC,YAAYvC,SAAwB,CAAA,CAAE;CACpD,MAAM,CAACwC,WAAWC,gBAAgBzC,SAAqC,IAAI;CAC3E,MAAM,CAAC2C,kBAAkBC,uBAAuB5C,SAAwB,IAAI;CAE5E,MAAM6C,YAAY5C,OAAsB,IAAI;CAC5C,MAAM6C,eAAe7C,OAA6C,IAAI;CACtE,MAAM8C,sBAAsB9C,OAC1B,IACF;CACA,MAAM+C,yBAAyB/C,OAAOgC,QAAQgB,QAAQ,CAAC;CACvD,MAAMC,0BAA0BjD,OAAO,CAAC;CACxC,MAAMkD,qBAAqBlD,OAAsC,IAAI;CACrE,MAAMoD,aAAapD,OAAO,IAAI;CAE9B,MAAMqD,uBAAuB,OAC3BC,cACkB;EAClB,IAAI;GACF,MAAMA,UAAUC,MAAM;EACxB,QAAQ,CACN;CAEJ;CAEA,MAAMC,yBACJC,eACkB;EAClB,MAAMC,OAAOX,uBAAuBY,QAAQC,KAAK,YAAY;GAC3D,MAAM5B,QAAQ6B,IAAIJ,WAAWK,IAAIT,oBAAoB,CAAC;EACxD,CAAC;EACDN,uBAAuBY,UAAUD;EACjC,OAAOA;CACT;CAEA,MAAMK,wBAAwB,YAAY;EACxC,MAAMT,cAAY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AM,IAAIjC,MAAM,eAAevC,MAAMb,GAAE,mBAAoB;GAE7D,OAAO,MAAMqF,SAAOiC,SAAS;IAC3BpH;IACAsH,WAAWD;GACb,CAAC;EACH;EACAG,eAAe,OAAOC,WAAW;GAC/B,MAAMtC,WAAS9D,UAAUe;GACzB,IAAI,CAAC+C,UACH,MAAM,IAAIjC,MAAM,eAAevC,MAAMb,GAAE,mBAAoB;GAE7D,OAAO,MAAMqF,SAAOqC,cAAcC,MAAM;EAC1C;EACAC,cAAc,OAAOC,QAAQ;GAC3B,MAAMxC,WAAS9D,UAAUe;GACzB,IAAI,CAAC+C,UACH,MAAM,IAAIjC,MAAM,eAAevC,MAAMb,GAAE,mBAAoB;GAE7D,OAAO,MAAMqF,SAAOuC,aAAa,EAAEC,IAAI,CAAC;EAC1C;EACAC,cAAc5B;CAChB;AACF;AAEA,MAAa6B,oBAAoBhJ,SAAS6B,oBAAoB"}
@@ -1 +1 @@
1
- {"version":3,"file":"McpLocalStorage.d.ts","names":[],"sources":["../../../src/resources/storage/McpLocalStorage.ts"],"mappings":";;;;KAUY;;EAEV;;EAEA,UAAU;;cA+EC,+BACX,mBACC;cAmBU,8BACX,mBACC;cAsEU,6CAAe,SAAA,aAAA,OAAA"}
1
+ {"version":3,"file":"McpLocalStorage.d.ts","names":[],"sources":["../../../src/resources/storage/McpLocalStorage.ts"],"mappings":";;;;KAUY;;EAEV;;EAEA,UAAU;;cAiGC,+BACX,mBACC;cAsBU,8BACX,mBACC;cAsEU,6CAAe,SAAA,aAAA,OAAA"}