@samanhappy/mcphub 1.0.10 → 1.0.12

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 (116) hide show
  1. package/README.fr.md +1 -0
  2. package/README.md +3 -0
  3. package/README.zh.md +1 -0
  4. package/dist/cli/commands/tools.js +4 -0
  5. package/dist/cli/commands/tools.js.map +1 -1
  6. package/dist/controllers/contextCostController.js +24 -0
  7. package/dist/controllers/contextCostController.js.map +1 -0
  8. package/dist/controllers/discoveryController.js +203 -0
  9. package/dist/controllers/discoveryController.js.map +1 -0
  10. package/dist/controllers/oauthCallbackController.js +3 -8
  11. package/dist/controllers/oauthCallbackController.js.map +1 -1
  12. package/dist/controllers/serverController.js +51 -1
  13. package/dist/controllers/serverController.js.map +1 -1
  14. package/dist/dao/SystemConfigDaoDbImpl.js +6 -0
  15. package/dist/dao/SystemConfigDaoDbImpl.js.map +1 -1
  16. package/dist/db/entities/SystemConfig.js +8 -0
  17. package/dist/db/entities/SystemConfig.js.map +1 -1
  18. package/dist/db/repositories/SystemConfigRepository.js +2 -0
  19. package/dist/db/repositories/SystemConfigRepository.js.map +1 -1
  20. package/dist/routes/index.js +16 -0
  21. package/dist/routes/index.js.map +1 -1
  22. package/dist/services/contextCostService.js +101 -0
  23. package/dist/services/contextCostService.js.map +1 -0
  24. package/dist/services/groupService.js +1 -1
  25. package/dist/services/groupService.js.map +1 -1
  26. package/dist/services/hostedRuntimeCatalogService.js +2 -1
  27. package/dist/services/hostedRuntimeCatalogService.js.map +1 -1
  28. package/dist/services/mcpService.js +266 -104
  29. package/dist/services/mcpService.js.map +1 -1
  30. package/dist/services/openApiGeneratorService.js +5 -4
  31. package/dist/services/openApiGeneratorService.js.map +1 -1
  32. package/dist/services/smartRoutingService.js +63 -30
  33. package/dist/services/smartRoutingService.js.map +1 -1
  34. package/dist/services/toolResultCompressionService.js +360 -0
  35. package/dist/services/toolResultCompressionService.js.map +1 -0
  36. package/dist/services/vectorSearchService.js +3 -1
  37. package/dist/services/vectorSearchService.js.map +1 -1
  38. package/dist/utils/mcpApps.js +43 -0
  39. package/dist/utils/mcpApps.js.map +1 -0
  40. package/dist/utils/migration.js +2 -0
  41. package/dist/utils/migration.js.map +1 -1
  42. package/dist/utils/serialization.js +17 -1
  43. package/dist/utils/serialization.js.map +1 -1
  44. package/dist/utils/smartRouting.js +6 -0
  45. package/dist/utils/smartRouting.js.map +1 -1
  46. package/dist/utils/tokenCost.js +71 -0
  47. package/dist/utils/tokenCost.js.map +1 -0
  48. package/frontend/dist/assets/{ActivityPage-RTpGLfzM.js → ActivityPage-BPfkCkM3.js} +2 -2
  49. package/frontend/dist/assets/{ActivityPage-RTpGLfzM.js.map → ActivityPage-BPfkCkM3.js.map} +1 -1
  50. package/frontend/dist/assets/{ConfirmDialog-CxlizGia.js → ConfirmDialog-Cag_haxr.js} +2 -2
  51. package/frontend/dist/assets/{ConfirmDialog-CxlizGia.js.map → ConfirmDialog-Cag_haxr.js.map} +1 -1
  52. package/frontend/dist/assets/Dashboard-BvEkS4H1.js +2 -0
  53. package/frontend/dist/assets/Dashboard-BvEkS4H1.js.map +1 -0
  54. package/frontend/dist/assets/{DeleteDialog-DRbWonMu.js → DeleteDialog-BBfJpiiD.js} +2 -2
  55. package/frontend/dist/assets/{DeleteDialog-DRbWonMu.js.map → DeleteDialog-BBfJpiiD.js.map} +1 -1
  56. package/frontend/dist/assets/{EndpointCopy-BtPORuga.js → EndpointCopy-KhSo4Y6F.js} +2 -2
  57. package/frontend/dist/assets/{EndpointCopy-BtPORuga.js.map → EndpointCopy-KhSo4Y6F.js.map} +1 -1
  58. package/frontend/dist/assets/GroupsPage-CLkFTxqd.js +33 -0
  59. package/frontend/dist/assets/GroupsPage-CLkFTxqd.js.map +1 -0
  60. package/frontend/dist/assets/{LoginPage-Nks21Yj0.js → LoginPage-lM-z_O3X.js} +2 -2
  61. package/frontend/dist/assets/{LoginPage-Nks21Yj0.js.map → LoginPage-lM-z_O3X.js.map} +1 -1
  62. package/frontend/dist/assets/{LogsPage-CoupcpK1.js → LogsPage-CS9OFma4.js} +2 -2
  63. package/frontend/dist/assets/LogsPage-CS9OFma4.js.map +1 -0
  64. package/frontend/dist/assets/{MarketPage-PwkvXlle.js → MarketPage-9LSDiVvR.js} +2 -2
  65. package/frontend/dist/assets/{MarketPage-PwkvXlle.js.map → MarketPage-9LSDiVvR.js.map} +1 -1
  66. package/frontend/dist/assets/{Pagination-BFi-X7qY.js → Pagination-DBAu79mv.js} +2 -2
  67. package/frontend/dist/assets/{Pagination-BFi-X7qY.js.map → Pagination-DBAu79mv.js.map} +1 -1
  68. package/frontend/dist/assets/{PromptsPage-DQiX0bAK.js → PromptsPage-CPFRMMgV.js} +2 -2
  69. package/frontend/dist/assets/{PromptsPage-DQiX0bAK.js.map → PromptsPage-CPFRMMgV.js.map} +1 -1
  70. package/frontend/dist/assets/{ResourcesPage-Dltmu_Ze.js → ResourcesPage-DJ_7k1MF.js} +2 -2
  71. package/frontend/dist/assets/{ResourcesPage-Dltmu_Ze.js.map → ResourcesPage-DJ_7k1MF.js.map} +1 -1
  72. package/frontend/dist/assets/ServersPage-BtPOdp4X.js +37 -0
  73. package/frontend/dist/assets/ServersPage-BtPOdp4X.js.map +1 -0
  74. package/frontend/dist/assets/SettingsPage-CyYl7pb8.js +12 -0
  75. package/frontend/dist/assets/SettingsPage-CyYl7pb8.js.map +1 -0
  76. package/frontend/dist/assets/{StatusDot-BRb7WUcz.js → StatusDot-CZZGigtR.js} +2 -2
  77. package/frontend/dist/assets/{StatusDot-BRb7WUcz.js.map → StatusDot-CZZGigtR.js.map} +1 -1
  78. package/frontend/dist/assets/{ToggleGroup-tIqxkae6.js → ToggleGroup-C24CNPSz.js} +2 -2
  79. package/frontend/dist/assets/{ToggleGroup-tIqxkae6.js.map → ToggleGroup-C24CNPSz.js.map} +1 -1
  80. package/frontend/dist/assets/{UsersPage-DNMaUcUn.js → UsersPage-CLXhNpvg.js} +2 -2
  81. package/frontend/dist/assets/{UsersPage-DNMaUcUn.js.map → UsersPage-CLXhNpvg.js.map} +1 -1
  82. package/frontend/dist/assets/contextCost-mvvSAnFv.js +2 -0
  83. package/frontend/dist/assets/contextCost-mvvSAnFv.js.map +1 -0
  84. package/frontend/dist/assets/{framework-vendor-BUhDPOUZ.js → framework-vendor-DeqnZ0v6.js} +5 -5
  85. package/frontend/dist/assets/{framework-vendor-BUhDPOUZ.js.map → framework-vendor-DeqnZ0v6.js.map} +1 -1
  86. package/frontend/dist/assets/i18n-vendor-DP1IRITP.js +10 -0
  87. package/frontend/dist/assets/i18n-vendor-DP1IRITP.js.map +1 -0
  88. package/frontend/dist/assets/{icons-vendor-CKgJB3SC.js → icons-vendor-IYX_ppgH.js} +2 -2
  89. package/frontend/dist/assets/{icons-vendor-CKgJB3SC.js.map → icons-vendor-IYX_ppgH.js.map} +1 -1
  90. package/frontend/dist/assets/{index-B9E3ygVt.css → index-D8V2fxz_.css} +1 -1
  91. package/frontend/dist/assets/index-DRcTlhkb.js +3 -0
  92. package/frontend/dist/assets/index-DRcTlhkb.js.map +1 -0
  93. package/frontend/dist/assets/{resourceService-BuhqcwTn.js → resourceService-jx5dJGUy.js} +2 -2
  94. package/frontend/dist/assets/{resourceService-BuhqcwTn.js.map → resourceService-jx5dJGUy.js.map} +1 -1
  95. package/frontend/dist/assets/useSettingsData-B4hMPWdK.js +2 -0
  96. package/frontend/dist/assets/{useSettingsData-iQpBXEjX.js.map → useSettingsData-B4hMPWdK.js.map} +1 -1
  97. package/frontend/dist/assets/{variableDetection-GTKqOf1F.js → variableDetection-Dnh8qFpO.js} +2 -2
  98. package/frontend/dist/assets/{variableDetection-GTKqOf1F.js.map → variableDetection-Dnh8qFpO.js.map} +1 -1
  99. package/frontend/dist/index.html +5 -5
  100. package/package.json +8 -8
  101. package/frontend/dist/assets/Dashboard-KV-zezVb.js +0 -2
  102. package/frontend/dist/assets/Dashboard-KV-zezVb.js.map +0 -1
  103. package/frontend/dist/assets/GroupsPage-BhNYw74w.js +0 -33
  104. package/frontend/dist/assets/GroupsPage-BhNYw74w.js.map +0 -1
  105. package/frontend/dist/assets/LogsPage-CoupcpK1.js.map +0 -1
  106. package/frontend/dist/assets/ServersPage-CcbF8dGi.js +0 -37
  107. package/frontend/dist/assets/ServersPage-CcbF8dGi.js.map +0 -1
  108. package/frontend/dist/assets/SettingsPage-BbRB2fCw.js +0 -12
  109. package/frontend/dist/assets/SettingsPage-BbRB2fCw.js.map +0 -1
  110. package/frontend/dist/assets/i18n-vendor-Kbr87Ofu.js +0 -2
  111. package/frontend/dist/assets/i18n-vendor-Kbr87Ofu.js.map +0 -1
  112. package/frontend/dist/assets/index-C6LZBP3G.js +0 -3
  113. package/frontend/dist/assets/index-C6LZBP3G.js.map +0 -1
  114. package/frontend/dist/assets/useServerData-C9R1u5V4.js +0 -2
  115. package/frontend/dist/assets/useServerData-C9R1u5V4.js.map +0 -1
  116. package/frontend/dist/assets/useSettingsData-iQpBXEjX.js +0 -2
@@ -1,2 +1,2 @@
1
- import{f as c,e as t,h as n}from"./index-C6LZBP3G.js";import"./framework-vendor-BUhDPOUZ.js";import"./i18n-vendor-Kbr87Ofu.js";import"./icons-vendor-CKgJB3SC.js";const d=async(r,o,s)=>{try{const e=await t(`/servers/${encodeURIComponent(r)}/resources/${encodeURIComponent(o)}/toggle`,{enabled:s},{headers:{Authorization:`Bearer ${localStorage.getItem("mcphub_token")}`}});return{success:e.success,error:e.success?void 0:e.message}}catch(e){return console.error("Error toggling resource",{serverName:r,resourceUri:o,enabled:s,error:e}),{success:!1,error:e instanceof Error?e.message:"Unknown error occurred"}}},g=async(r,o,s)=>{try{const e=await n(`/servers/${encodeURIComponent(r)}/resources/${encodeURIComponent(o)}/description`,{description:s},{headers:{Authorization:`Bearer ${localStorage.getItem("mcphub_token")}`}});return{success:e.success,error:e.success?void 0:e.message}}catch(e){return console.error("Error updating resource description",{serverName:r,resourceUri:o,error:e}),{success:!1,error:e instanceof Error?e.message:"Unknown error occurred"}}},m=async(r,o)=>{var s;try{const e=await c(`/servers/${encodeURIComponent(r)}/resources/${encodeURIComponent(o)}/description`,{headers:{Authorization:`Bearer ${localStorage.getItem("mcphub_token")}`}});return{success:e.success,error:e.success?void 0:e.message,description:(s=e.data)==null?void 0:s.description}}catch(e){return console.error("Error resetting resource description",{serverName:r,resourceUri:o,error:e}),{success:!1,error:e instanceof Error?e.message:"Unknown error occurred"}}};export{m as resetResourceDescription,d as toggleResource,g as updateResourceDescription};
2
- //# sourceMappingURL=resourceService-BuhqcwTn.js.map
1
+ import{f as c,e as t,h as n}from"./index-DRcTlhkb.js";import"./framework-vendor-DeqnZ0v6.js";import"./i18n-vendor-DP1IRITP.js";import"./icons-vendor-IYX_ppgH.js";const d=async(r,o,s)=>{try{const e=await t(`/servers/${encodeURIComponent(r)}/resources/${encodeURIComponent(o)}/toggle`,{enabled:s},{headers:{Authorization:`Bearer ${localStorage.getItem("mcphub_token")}`}});return{success:e.success,error:e.success?void 0:e.message}}catch(e){return console.error("Error toggling resource",{serverName:r,resourceUri:o,enabled:s,error:e}),{success:!1,error:e instanceof Error?e.message:"Unknown error occurred"}}},g=async(r,o,s)=>{try{const e=await n(`/servers/${encodeURIComponent(r)}/resources/${encodeURIComponent(o)}/description`,{description:s},{headers:{Authorization:`Bearer ${localStorage.getItem("mcphub_token")}`}});return{success:e.success,error:e.success?void 0:e.message}}catch(e){return console.error("Error updating resource description",{serverName:r,resourceUri:o,error:e}),{success:!1,error:e instanceof Error?e.message:"Unknown error occurred"}}},m=async(r,o)=>{var s;try{const e=await c(`/servers/${encodeURIComponent(r)}/resources/${encodeURIComponent(o)}/description`,{headers:{Authorization:`Bearer ${localStorage.getItem("mcphub_token")}`}});return{success:e.success,error:e.success?void 0:e.message,description:(s=e.data)==null?void 0:s.description}}catch(e){return console.error("Error resetting resource description",{serverName:r,resourceUri:o,error:e}),{success:!1,error:e instanceof Error?e.message:"Unknown error occurred"}}};export{m as resetResourceDescription,d as toggleResource,g as updateResourceDescription};
2
+ //# sourceMappingURL=resourceService-jx5dJGUy.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"resourceService-BuhqcwTn.js","sources":["../../src/services/resourceService.ts"],"sourcesContent":["import { apiDelete, apiPost, apiPut } from '../utils/fetchInterceptor';\n\n/**\n * Toggle a resource's enabled state for a specific server\n */\nexport const toggleResource = async (\n serverName: string,\n resourceUri: string,\n enabled: boolean,\n): Promise<{ success: boolean; error?: string }> => {\n try {\n const response = await apiPost<any>(\n `/servers/${encodeURIComponent(serverName)}/resources/${encodeURIComponent(resourceUri)}/toggle`,\n { enabled },\n {\n headers: {\n Authorization: `Bearer ${localStorage.getItem('mcphub_token')}`,\n },\n },\n );\n\n return {\n success: response.success,\n error: response.success ? undefined : response.message,\n };\n } catch (error) {\n console.error('Error toggling resource', { serverName, resourceUri, enabled, error });\n return {\n success: false,\n error: error instanceof Error ? error.message : 'Unknown error occurred',\n };\n }\n};\n\n/**\n * Update a resource's description for a specific server\n */\nexport const updateResourceDescription = async (\n serverName: string,\n resourceUri: string,\n description: string,\n): Promise<{ success: boolean; error?: string }> => {\n try {\n const response = await apiPut<any>(\n `/servers/${encodeURIComponent(serverName)}/resources/${encodeURIComponent(resourceUri)}/description`,\n { description },\n {\n headers: {\n Authorization: `Bearer ${localStorage.getItem('mcphub_token')}`,\n },\n },\n );\n\n return {\n success: response.success,\n error: response.success ? undefined : response.message,\n };\n } catch (error) {\n console.error('Error updating resource description', { serverName, resourceUri, error });\n return {\n success: false,\n error: error instanceof Error ? error.message : 'Unknown error occurred',\n };\n }\n};\n\nexport const resetResourceDescription = async (\n serverName: string,\n resourceUri: string,\n): Promise<{ success: boolean; error?: string; description?: string }> => {\n try {\n const response = await apiDelete<any>(\n `/servers/${encodeURIComponent(serverName)}/resources/${encodeURIComponent(resourceUri)}/description`,\n {\n headers: {\n Authorization: `Bearer ${localStorage.getItem('mcphub_token')}`,\n },\n },\n );\n\n return {\n success: response.success,\n error: response.success ? undefined : response.message,\n description: response.data?.description,\n };\n } catch (error) {\n console.error('Error resetting resource description', { serverName, resourceUri, error });\n return {\n success: false,\n error: error instanceof Error ? error.message : 'Unknown error occurred',\n };\n }\n};\n"],"names":["toggleResource","serverName","resourceUri","enabled","response","apiPost","error","updateResourceDescription","description","apiPut","resetResourceDescription","apiDelete","_a"],"mappings":"kKAKO,MAAMA,EAAiB,MAC5BC,EACAC,EACAC,IACkD,CAClD,GAAI,CACF,MAAMC,EAAW,MAAMC,EACrB,YAAY,mBAAmBJ,CAAU,CAAC,cAAc,mBAAmBC,CAAW,CAAC,UACvF,CAAE,QAAAC,CAAA,EACF,CACE,QAAS,CACP,cAAe,UAAU,aAAa,QAAQ,cAAc,CAAC,EAAA,CAC/D,CACF,EAGF,MAAO,CACL,QAASC,EAAS,QAClB,MAAOA,EAAS,QAAU,OAAYA,EAAS,OAAA,CAEnD,OAASE,EAAO,CACd,eAAQ,MAAM,0BAA2B,CAAE,WAAAL,EAAY,YAAAC,EAAa,QAAAC,EAAS,MAAAG,EAAO,EAC7E,CACL,QAAS,GACT,MAAOA,aAAiB,MAAQA,EAAM,QAAU,wBAAA,CAEpD,CACF,EAKaC,EAA4B,MACvCN,EACAC,EACAM,IACkD,CAClD,GAAI,CACF,MAAMJ,EAAW,MAAMK,EACrB,YAAY,mBAAmBR,CAAU,CAAC,cAAc,mBAAmBC,CAAW,CAAC,eACvF,CAAE,YAAAM,CAAA,EACF,CACE,QAAS,CACP,cAAe,UAAU,aAAa,QAAQ,cAAc,CAAC,EAAA,CAC/D,CACF,EAGF,MAAO,CACL,QAASJ,EAAS,QAClB,MAAOA,EAAS,QAAU,OAAYA,EAAS,OAAA,CAEnD,OAASE,EAAO,CACd,eAAQ,MAAM,sCAAuC,CAAE,WAAAL,EAAY,YAAAC,EAAa,MAAAI,EAAO,EAChF,CACL,QAAS,GACT,MAAOA,aAAiB,MAAQA,EAAM,QAAU,wBAAA,CAEpD,CACF,EAEaI,EAA2B,MACtCT,EACAC,IACwE,OACxE,GAAI,CACF,MAAME,EAAW,MAAMO,EACrB,YAAY,mBAAmBV,CAAU,CAAC,cAAc,mBAAmBC,CAAW,CAAC,eACvF,CACE,QAAS,CACP,cAAe,UAAU,aAAa,QAAQ,cAAc,CAAC,EAAA,CAC/D,CACF,EAGF,MAAO,CACL,QAASE,EAAS,QAClB,MAAOA,EAAS,QAAU,OAAYA,EAAS,QAC/C,aAAaQ,EAAAR,EAAS,OAAT,YAAAQ,EAAe,WAAA,CAEhC,OAASN,EAAO,CACd,eAAQ,MAAM,uCAAwC,CAAE,WAAAL,EAAY,YAAAC,EAAa,MAAAI,EAAO,EACjF,CACL,QAAS,GACT,MAAOA,aAAiB,MAAQA,EAAM,QAAU,wBAAA,CAEpD,CACF"}
1
+ {"version":3,"file":"resourceService-jx5dJGUy.js","sources":["../../src/services/resourceService.ts"],"sourcesContent":["import { apiDelete, apiPost, apiPut } from '../utils/fetchInterceptor';\n\n/**\n * Toggle a resource's enabled state for a specific server\n */\nexport const toggleResource = async (\n serverName: string,\n resourceUri: string,\n enabled: boolean,\n): Promise<{ success: boolean; error?: string }> => {\n try {\n const response = await apiPost<any>(\n `/servers/${encodeURIComponent(serverName)}/resources/${encodeURIComponent(resourceUri)}/toggle`,\n { enabled },\n {\n headers: {\n Authorization: `Bearer ${localStorage.getItem('mcphub_token')}`,\n },\n },\n );\n\n return {\n success: response.success,\n error: response.success ? undefined : response.message,\n };\n } catch (error) {\n console.error('Error toggling resource', { serverName, resourceUri, enabled, error });\n return {\n success: false,\n error: error instanceof Error ? error.message : 'Unknown error occurred',\n };\n }\n};\n\n/**\n * Update a resource's description for a specific server\n */\nexport const updateResourceDescription = async (\n serverName: string,\n resourceUri: string,\n description: string,\n): Promise<{ success: boolean; error?: string }> => {\n try {\n const response = await apiPut<any>(\n `/servers/${encodeURIComponent(serverName)}/resources/${encodeURIComponent(resourceUri)}/description`,\n { description },\n {\n headers: {\n Authorization: `Bearer ${localStorage.getItem('mcphub_token')}`,\n },\n },\n );\n\n return {\n success: response.success,\n error: response.success ? undefined : response.message,\n };\n } catch (error) {\n console.error('Error updating resource description', { serverName, resourceUri, error });\n return {\n success: false,\n error: error instanceof Error ? error.message : 'Unknown error occurred',\n };\n }\n};\n\nexport const resetResourceDescription = async (\n serverName: string,\n resourceUri: string,\n): Promise<{ success: boolean; error?: string; description?: string }> => {\n try {\n const response = await apiDelete<any>(\n `/servers/${encodeURIComponent(serverName)}/resources/${encodeURIComponent(resourceUri)}/description`,\n {\n headers: {\n Authorization: `Bearer ${localStorage.getItem('mcphub_token')}`,\n },\n },\n );\n\n return {\n success: response.success,\n error: response.success ? undefined : response.message,\n description: response.data?.description,\n };\n } catch (error) {\n console.error('Error resetting resource description', { serverName, resourceUri, error });\n return {\n success: false,\n error: error instanceof Error ? error.message : 'Unknown error occurred',\n };\n }\n};\n"],"names":["toggleResource","serverName","resourceUri","enabled","response","apiPost","error","updateResourceDescription","description","apiPut","resetResourceDescription","apiDelete","_a"],"mappings":"kKAKO,MAAMA,EAAiB,MAC5BC,EACAC,EACAC,IACkD,CAClD,GAAI,CACF,MAAMC,EAAW,MAAMC,EACrB,YAAY,mBAAmBJ,CAAU,CAAC,cAAc,mBAAmBC,CAAW,CAAC,UACvF,CAAE,QAAAC,CAAA,EACF,CACE,QAAS,CACP,cAAe,UAAU,aAAa,QAAQ,cAAc,CAAC,EAAA,CAC/D,CACF,EAGF,MAAO,CACL,QAASC,EAAS,QAClB,MAAOA,EAAS,QAAU,OAAYA,EAAS,OAAA,CAEnD,OAASE,EAAO,CACd,eAAQ,MAAM,0BAA2B,CAAE,WAAAL,EAAY,YAAAC,EAAa,QAAAC,EAAS,MAAAG,EAAO,EAC7E,CACL,QAAS,GACT,MAAOA,aAAiB,MAAQA,EAAM,QAAU,wBAAA,CAEpD,CACF,EAKaC,EAA4B,MACvCN,EACAC,EACAM,IACkD,CAClD,GAAI,CACF,MAAMJ,EAAW,MAAMK,EACrB,YAAY,mBAAmBR,CAAU,CAAC,cAAc,mBAAmBC,CAAW,CAAC,eACvF,CAAE,YAAAM,CAAA,EACF,CACE,QAAS,CACP,cAAe,UAAU,aAAa,QAAQ,cAAc,CAAC,EAAA,CAC/D,CACF,EAGF,MAAO,CACL,QAASJ,EAAS,QAClB,MAAOA,EAAS,QAAU,OAAYA,EAAS,OAAA,CAEnD,OAASE,EAAO,CACd,eAAQ,MAAM,sCAAuC,CAAE,WAAAL,EAAY,YAAAC,EAAa,MAAAI,EAAO,EAChF,CACL,QAAS,GACT,MAAOA,aAAiB,MAAQA,EAAM,QAAU,wBAAA,CAEpD,CACF,EAEaI,EAA2B,MACtCT,EACAC,IACwE,OACxE,GAAI,CACF,MAAME,EAAW,MAAMO,EACrB,YAAY,mBAAmBV,CAAU,CAAC,cAAc,mBAAmBC,CAAW,CAAC,eACvF,CACE,QAAS,CACP,cAAe,UAAU,aAAa,QAAQ,cAAc,CAAC,EAAA,CAC/D,CACF,EAGF,MAAO,CACL,QAASE,EAAS,QAClB,MAAOA,EAAS,QAAU,OAAYA,EAAS,QAC/C,aAAaQ,EAAAR,EAAS,OAAT,YAAAQ,EAAe,WAAA,CAEhC,OAASN,EAAO,CACd,eAAQ,MAAM,uCAAwC,CAAE,WAAAL,EAAY,YAAAC,EAAa,MAAAI,EAAO,EACjF,CACL,QAAS,GACT,MAAOA,aAAiB,MAAQA,EAAM,QAAU,wBAAA,CAEpD,CACF"}
@@ -0,0 +1,2 @@
1
+ import{p as t}from"./index-DRcTlhkb.js";const e=()=>t();export{e as u};
2
+ //# sourceMappingURL=useSettingsData-B4hMPWdK.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useSettingsData-iQpBXEjX.js","sources":["../../src/hooks/useSettingsData.ts"],"sourcesContent":["import { useSettings } from '@/contexts/SettingsContext';\n\n/**\n * Hook that provides access to settings data via SettingsContext.\n * This hook is a thin wrapper around useSettings to maintain backward compatibility.\n * The actual data fetching happens once in SettingsProvider, avoiding duplicate API calls.\n */\nexport const useSettingsData = () => {\n return useSettings();\n};\n"],"names":["useSettingsData","useSettings"],"mappings":"wCAOO,MAAMA,EAAkB,IACtBC,EAAA"}
1
+ {"version":3,"file":"useSettingsData-B4hMPWdK.js","sources":["../../src/hooks/useSettingsData.ts"],"sourcesContent":["import { useSettings } from '@/contexts/SettingsContext';\n\n/**\n * Hook that provides access to settings data via SettingsContext.\n * This hook is a thin wrapper around useSettings to maintain backward compatibility.\n * The actual data fetching happens once in SettingsProvider, avoiding duplicate API calls.\n */\nexport const useSettingsData = () => {\n return useSettings();\n};\n"],"names":["useSettingsData","useSettings"],"mappings":"wCAOO,MAAMA,EAAkB,IACtBC,EAAA"}
@@ -1,4 +1,4 @@
1
- import{r as N,j as e}from"./framework-vendor-BUhDPOUZ.js";import{u as ss}from"./i18n-vendor-Kbr87Ofu.js";import{X as rs}from"./icons-vendor-CKgJB3SC.js";const _e=o=>{const i={};return o.forEach(({key:n,value:h})=>{const m=n.trim();m&&(i[m]=h)}),i},We=o=>o?o.split(",").map(i=>i.trim()).filter(i=>i.length>0):[],ts=o=>{const i={};return o!=null&&o.timeout&&o.timeout!==6e4&&(i.timeout=o.timeout),typeof(o==null?void 0:o.resetTimeoutOnProgress)=="boolean"&&(i.resetTimeoutOnProgress=o.resetTimeoutOnProgress),o!=null&&o.maxTotalTimeout&&(i.maxTotalTimeout=o.maxTotalTimeout),i},ns=o=>{var b,l,p,g,f,y,j,k;if(!o)return{};const i={},n=(b=o.clientId)==null?void 0:b.trim(),h=(l=o.clientSecret)==null?void 0:l.trim(),m=(p=o.scopes)==null?void 0:p.trim(),t=(g=o.accessToken)==null?void 0:g.trim(),u=(f=o.refreshToken)==null?void 0:f.trim(),x=(y=o.authorizationEndpoint)==null?void 0:y.trim(),d=(j=o.tokenEndpoint)==null?void 0:j.trim(),c=(k=o.resource)==null?void 0:k.trim();if(n&&(i.clientId=n),h&&(i.clientSecret=h),m){const C=m.split(/[\s,]+/).map(v=>v.trim()).filter(v=>v.length>0);C.length>0&&(i.scopes=C)}return t&&(i.accessToken=t),u&&(i.refreshToken=u),x&&(i.authorizationEndpoint=x),d&&(i.tokenEndpoint=d),c&&(i.resource=c),i},as=o=>{var u,x,d,c,b,l,p,g,f,y,j,k,C,v,w;const i={version:((u=o.openapi)==null?void 0:u.version)||"3.1.0",passthroughHeaders:We((x=o.openapi)==null?void 0:x.passthroughHeaders)},n=(c=(d=o.openapi)==null?void 0:d.oauth2TokenUrl)==null?void 0:c.trim(),h=(l=(b=o.openapi)==null?void 0:b.oauth2ClientId)==null?void 0:l.trim(),m=(g=(p=o.openapi)==null?void 0:p.oauth2ClientSecret)==null?void 0:g.trim(),t=(y=(f=o.openapi)==null?void 0:f.oauth2Token)==null?void 0:y.trim();if(((j=o.openapi)==null?void 0:j.inputMode)==="url")i.url=((k=o.openapi)==null?void 0:k.url)||"";else if(((C=o.openapi)==null?void 0:C.inputMode)==="schema"&&((v=o.openapi)!=null&&v.schema))try{i.schema=JSON.parse(o.openapi.schema)}catch{throw new Error("Invalid JSON schema format")}return(w=o.openapi)!=null&&w.securityType&&o.openapi.securityType!=="none"&&(i.security={type:o.openapi.securityType,...o.openapi.securityType==="apiKey"&&{apiKey:{name:o.openapi.apiKeyName||"",in:o.openapi.apiKeyIn||"header",value:o.openapi.apiKeyValue||""}},...o.openapi.securityType==="http"&&{http:{scheme:o.openapi.httpScheme||"bearer",credentials:o.openapi.httpCredentials||""}},...o.openapi.securityType==="oauth2"&&{oauth2:{...n&&{tokenUrl:n},...h&&{clientId:h},...m&&{clientSecret:m},...t&&{token:t}}},...o.openapi.securityType==="openIdConnect"&&{openIdConnect:{url:o.openapi.openIdConnectUrl||"",token:o.openapi.openIdConnectToken||""}}}),i},os=({formData:o,serverType:i,envVars:n,headerVars:h})=>{var c,b,l;const m=_e(n),t=_e(h),u=ts(o.options),x=((c=o.description)==null?void 0:c.trim())||"",d={type:i,description:x,options:u,visibility:o.visibility??"private"};return i==="openapi"?(d.headers=t,d.openapi=as(o)):i==="sse"||i==="streamable-http"?(d.url=o.url.trim(),d.env=m,d.headers=t,d.passthroughHeaders=We(o.passthroughHeaders),d.oauth=ns(o.oauth),d.enableKeepAlive=((b=o.keepAlive)==null?void 0:b.enabled)||!1,d.keepAliveInterval=(l=o.keepAlive)!=null&&l.enabled?o.keepAlive.interval||6e4:void 0):(d.command=o.command.trim(),d.args=o.args,d.env=m),{name:o.name.trim(),config:d}},cs=({onSubmit:o,onCancel:i,initialData:n=null,modalTitle:h,formError:m=null})=>{var z,$,R,B,X,J,G,L,Q,_,W,Y,Z,D,ee,se,re,te,ne,ae,oe,le,ie,pe,ce,de,me,ue,xe,he,ge,ye,be,ve,fe,je,ke,Ne,Ce,Te,we,Ie,Se,Ae,Ke,Ee,Oe,He,Fe,Ve,Me,Pe,Ue,qe,ze,$e,Re,Be,Xe,Je,Ge,Le,Qe;const{t}=ss(),u=()=>!n||!n.config?"stdio":n.config.type?n.config.type:n.config.url?"sse":"stdio",x=r=>!r||!r.config||!r.config.env?[]:Object.entries(r.config.env).map(([s,a])=>({key:s,value:a,description:""})),d=r=>{var a;const s=(a=r==null?void 0:r.config)==null?void 0:a.oauth;return{clientId:(s==null?void 0:s.clientId)||"",clientSecret:(s==null?void 0:s.clientSecret)||"",scopes:s!=null&&s.scopes?s.scopes.join(" "):"",accessToken:(s==null?void 0:s.accessToken)||"",refreshToken:(s==null?void 0:s.refreshToken)||"",authorizationEndpoint:(s==null?void 0:s.authorizationEndpoint)||"",tokenEndpoint:(s==null?void 0:s.tokenEndpoint)||"",resource:(s==null?void 0:s.resource)||""}},[c,b]=N.useState(u()),[l,p]=N.useState({name:n&&n.name||"",description:n&&n.config&&n.config.description||"",url:n&&n.config&&n.config.url||"",command:n&&n.config&&n.config.command||"",arguments:n&&n.config&&n.config.args?Array.isArray(n.config.args)?n.config.args.join(" "):String(n.config.args):"",args:n&&n.config&&n.config.args||[],type:u(),env:x(n),headers:[],passthroughHeaders:(($=(z=n==null?void 0:n.config)==null?void 0:z.passthroughHeaders)==null?void 0:$.join(", "))||"",visibility:((R=n==null?void 0:n.config)==null?void 0:R.visibility)??"private",options:{timeout:n&&n.config&&n.config.options&&n.config.options.timeout||6e4,resetTimeoutOnProgress:((X=(B=n==null?void 0:n.config)==null?void 0:B.options)==null?void 0:X.resetTimeoutOnProgress)??!0,maxTotalTimeout:n&&n.config&&n.config.options&&n.config.options.maxTotalTimeout||void 0},oauth:d(n),keepAlive:{enabled:((J=n==null?void 0:n.config)==null?void 0:J.enableKeepAlive)||!1,interval:((G=n==null?void 0:n.config)==null?void 0:G.keepAliveInterval)||6e4},openapi:n&&n.config&&n.config.openapi?{url:n.config.openapi.url||"",schema:n.config.openapi.schema?JSON.stringify(n.config.openapi.schema,null,2):"",inputMode:n.config.openapi.url?"url":n.config.openapi.schema?"schema":"url",version:n.config.openapi.version||"3.1.0",securityType:((L=n.config.openapi.security)==null?void 0:L.type)||"none",apiKeyName:((_=(Q=n.config.openapi.security)==null?void 0:Q.apiKey)==null?void 0:_.name)||"",apiKeyIn:((Y=(W=n.config.openapi.security)==null?void 0:W.apiKey)==null?void 0:Y.in)||"header",apiKeyValue:((D=(Z=n.config.openapi.security)==null?void 0:Z.apiKey)==null?void 0:D.value)||"",httpScheme:((se=(ee=n.config.openapi.security)==null?void 0:ee.http)==null?void 0:se.scheme)||"bearer",httpCredentials:((te=(re=n.config.openapi.security)==null?void 0:re.http)==null?void 0:te.credentials)||"",oauth2TokenUrl:((ae=(ne=n.config.openapi.security)==null?void 0:ne.oauth2)==null?void 0:ae.tokenUrl)||"",oauth2ClientId:((le=(oe=n.config.openapi.security)==null?void 0:oe.oauth2)==null?void 0:le.clientId)||"",oauth2ClientSecret:((pe=(ie=n.config.openapi.security)==null?void 0:ie.oauth2)==null?void 0:pe.clientSecret)||"",oauth2Token:((de=(ce=n.config.openapi.security)==null?void 0:ce.oauth2)==null?void 0:de.token)||"",openIdConnectUrl:((ue=(me=n.config.openapi.security)==null?void 0:me.openIdConnect)==null?void 0:ue.url)||"",openIdConnectToken:((he=(xe=n.config.openapi.security)==null?void 0:xe.openIdConnect)==null?void 0:he.token)||"",passthroughHeaders:n.config.openapi.passthroughHeaders?n.config.openapi.passthroughHeaders.join(", "):""}:{inputMode:"url",url:"",schema:"",version:"3.1.0",securityType:"none",passthroughHeaders:""}}),[g,f]=N.useState(n&&n.config&&n.config.env?Object.entries(n.config.env).map(([r,s])=>({key:r,value:s})):[]),[y,j]=N.useState(n&&n.config&&n.config.headers?Object.entries(n.config.headers).map(([r,s])=>({key:r,value:s})):[]),[k,C]=N.useState(!1),[v,w]=N.useState(!1),[E,Ye]=N.useState(!1),[H,F]=N.useState(null),Ze=!!n,I=r=>{const{name:s,value:a}=r.target;p({...l,[s]:a})},De=r=>{const s=r.split(" ").filter(a=>a.trim()!=="");p({...l,arguments:r,args:s})},S=r=>{b(r),p(s=>({...s,type:r}))},A=(r,s,a)=>{const T=[...g];T[r][s]=a,f(T)},V=()=>{f([...g,{key:"",value:""}])},M=r=>{const s=[...g];s.splice(r,1),f(s)},K=(r,s,a)=>{const T=[...y];T[r][s]=a,j(T)},P=()=>{j([...y,{key:"",value:""}])},U=r=>{const s=[...y];s.splice(r,1),j(s)},q=(r,s)=>{p(a=>({...a,oauth:{...a.oauth||{},[r]:s}}))},O=(r,s)=>{p(a=>({...a,options:{...a.options,[r]:s}}))},es=async r=>{r.preventDefault(),F(null);try{const s=os({formData:l,serverType:c,envVars:g,headerVars:y});o(s)}catch(s){F(`Error: ${s instanceof Error?s.message:String(s)}`)}};return e.jsxs("div",{className:"hub-card p-6 w-full max-w-3xl max-h-screen overflow-y-auto",children:[e.jsxs("div",{className:"flex justify-between items-center mb-5",children:[e.jsx("h2",{className:"text-lg font-semibold text-[var(--hub-ink)]",children:h}),e.jsx("button",{onClick:i,className:"hub-icon-btn","aria-label":"Close",children:e.jsx(rs,{size:16})})]}),(H||m)&&e.jsx("div",{className:"bg-red-50 text-red-700 p-3 rounded mb-4",children:m||H}),e.jsxs("form",{onSubmit:es,children:[e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5 text-[var(--hub-ink-2)]",htmlFor:"name",children:t("server.name")}),e.jsx("input",{type:"text",name:"name",id:"name",value:l.name,onChange:I,className:"w-full py-2 px-3 form-input",placeholder:"e.g.: time-mcp",required:!0})]}),e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5 text-[var(--hub-ink-2)]",htmlFor:"description",children:t("server.description")}),e.jsx("input",{type:"text",name:"description",id:"description",value:l.description||"",onChange:I,className:"w-full py-2 px-3 form-input",placeholder:t("server.descriptionPlaceholder")})]}),e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5 text-[var(--hub-ink-2)]",htmlFor:"visibility",children:t("server.visibility","Visibility")}),e.jsxs("select",{id:"visibility",name:"visibility",value:l.visibility||"private",onChange:r=>p(s=>({...s,visibility:r.target.value})),className:"w-full py-2 px-3 form-input",children:[e.jsx("option",{value:"private",children:t("server.visibilityPrivate","Private — only the owner and admins")}),l.visibility==="group"&&e.jsx("option",{value:"group",disabled:!0,children:t("server.visibilityGroup","Group (reserved — not yet implemented)")}),e.jsx("option",{value:"public",children:t("server.visibilityPublic","Public — every authenticated user")})]}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:t("server.visibilityDescription","Controls which non-admin users see this server in tools/list. Admins always see all servers regardless of this setting.")})]}),e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5 text-[var(--hub-ink-2)]",children:t("server.type")}),e.jsxs("div",{className:"flex space-x-4",children:[e.jsxs("div",{children:[e.jsx("input",{type:"radio",id:"command",name:"serverType",value:"command",checked:c==="stdio",onChange:()=>S("stdio"),className:"mr-1"}),e.jsx("label",{htmlFor:"command",className:"text-[var(--hub-ink)]",children:t("server.typeStdio")})]}),e.jsxs("div",{children:[e.jsx("input",{type:"radio",id:"url",name:"serverType",value:"url",checked:c==="sse",onChange:()=>S("sse"),className:"mr-1"}),e.jsx("label",{htmlFor:"url",className:"text-[var(--hub-ink)]",children:t("server.typeSse")})]}),e.jsxs("div",{children:[e.jsx("input",{type:"radio",id:"streamable-http",name:"serverType",value:"streamable-http",checked:c==="streamable-http",onChange:()=>S("streamable-http"),className:"mr-1"}),e.jsx("label",{htmlFor:"streamable-http",className:"text-[var(--hub-ink)]",children:t("server.typeStreamableHttp")})]}),e.jsxs("div",{children:[e.jsx("input",{type:"radio",id:"openapi",name:"serverType",value:"openapi",checked:c==="openapi",onChange:()=>S("openapi"),className:"mr-1"}),e.jsx("label",{htmlFor:"openapi",className:"text-[var(--hub-ink)]",children:t("server.typeOpenapi")})]})]})]}),c==="openapi"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5 text-[var(--hub-ink-2)]",children:t("server.openapi.inputMode")}),e.jsxs("div",{className:"flex space-x-4",children:[e.jsxs("div",{children:[e.jsx("input",{type:"radio",id:"input-mode-url",name:"inputMode",value:"url",checked:((ge=l.openapi)==null?void 0:ge.inputMode)==="url",onChange:()=>p(r=>({...r,openapi:{...r.openapi,inputMode:"url"}})),className:"mr-1"}),e.jsx("label",{htmlFor:"input-mode-url",children:t("server.openapi.inputModeUrl")})]}),e.jsxs("div",{children:[e.jsx("input",{type:"radio",id:"input-mode-schema",name:"inputMode",value:"schema",checked:((ye=l.openapi)==null?void 0:ye.inputMode)==="schema",onChange:()=>p(r=>({...r,openapi:{...r.openapi,inputMode:"schema"}})),className:"mr-1"}),e.jsx("label",{htmlFor:"input-mode-schema",children:t("server.openapi.inputModeSchema")})]})]})]}),((be=l.openapi)==null?void 0:be.inputMode)==="url"&&e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5 text-[var(--hub-ink-2)]",htmlFor:"openapi-url",children:t("server.openapi.specUrl")}),e.jsx("input",{type:"url",name:"openapi-url",id:"openapi-url",value:((ve=l.openapi)==null?void 0:ve.url)||"",onChange:r=>p(s=>({...s,openapi:{...s.openapi,url:r.target.value}})),className:"w-full py-2 px-3 form-input",placeholder:"e.g.: https://api.example.com/openapi.json",required:c==="openapi"&&((fe=l.openapi)==null?void 0:fe.inputMode)==="url"})]}),((je=l.openapi)==null?void 0:je.inputMode)==="schema"&&e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5 text-[var(--hub-ink-2)]",htmlFor:"openapi-schema",children:t("server.openapi.schema")}),e.jsx("textarea",{name:"openapi-schema",id:"openapi-schema",rows:10,value:((ke=l.openapi)==null?void 0:ke.schema)||"",onChange:r=>p(s=>({...s,openapi:{...s.openapi,schema:r.target.value}})),className:"w-full py-2 px-3 form-input font-mono text-sm",placeholder:`{
1
+ import{r as N,j as e}from"./framework-vendor-DeqnZ0v6.js";import{u as ss}from"./i18n-vendor-DP1IRITP.js";import{X as rs}from"./icons-vendor-IYX_ppgH.js";const _e=o=>{const i={};return o.forEach(({key:n,value:h})=>{const m=n.trim();m&&(i[m]=h)}),i},We=o=>o?o.split(",").map(i=>i.trim()).filter(i=>i.length>0):[],ts=o=>{const i={};return o!=null&&o.timeout&&o.timeout!==6e4&&(i.timeout=o.timeout),typeof(o==null?void 0:o.resetTimeoutOnProgress)=="boolean"&&(i.resetTimeoutOnProgress=o.resetTimeoutOnProgress),o!=null&&o.maxTotalTimeout&&(i.maxTotalTimeout=o.maxTotalTimeout),i},ns=o=>{var b,l,p,g,f,y,j,k;if(!o)return{};const i={},n=(b=o.clientId)==null?void 0:b.trim(),h=(l=o.clientSecret)==null?void 0:l.trim(),m=(p=o.scopes)==null?void 0:p.trim(),t=(g=o.accessToken)==null?void 0:g.trim(),u=(f=o.refreshToken)==null?void 0:f.trim(),x=(y=o.authorizationEndpoint)==null?void 0:y.trim(),d=(j=o.tokenEndpoint)==null?void 0:j.trim(),c=(k=o.resource)==null?void 0:k.trim();if(n&&(i.clientId=n),h&&(i.clientSecret=h),m){const C=m.split(/[\s,]+/).map(v=>v.trim()).filter(v=>v.length>0);C.length>0&&(i.scopes=C)}return t&&(i.accessToken=t),u&&(i.refreshToken=u),x&&(i.authorizationEndpoint=x),d&&(i.tokenEndpoint=d),c&&(i.resource=c),i},as=o=>{var u,x,d,c,b,l,p,g,f,y,j,k,C,v,w;const i={version:((u=o.openapi)==null?void 0:u.version)||"3.1.0",passthroughHeaders:We((x=o.openapi)==null?void 0:x.passthroughHeaders)},n=(c=(d=o.openapi)==null?void 0:d.oauth2TokenUrl)==null?void 0:c.trim(),h=(l=(b=o.openapi)==null?void 0:b.oauth2ClientId)==null?void 0:l.trim(),m=(g=(p=o.openapi)==null?void 0:p.oauth2ClientSecret)==null?void 0:g.trim(),t=(y=(f=o.openapi)==null?void 0:f.oauth2Token)==null?void 0:y.trim();if(((j=o.openapi)==null?void 0:j.inputMode)==="url")i.url=((k=o.openapi)==null?void 0:k.url)||"";else if(((C=o.openapi)==null?void 0:C.inputMode)==="schema"&&((v=o.openapi)!=null&&v.schema))try{i.schema=JSON.parse(o.openapi.schema)}catch{throw new Error("Invalid JSON schema format")}return(w=o.openapi)!=null&&w.securityType&&o.openapi.securityType!=="none"&&(i.security={type:o.openapi.securityType,...o.openapi.securityType==="apiKey"&&{apiKey:{name:o.openapi.apiKeyName||"",in:o.openapi.apiKeyIn||"header",value:o.openapi.apiKeyValue||""}},...o.openapi.securityType==="http"&&{http:{scheme:o.openapi.httpScheme||"bearer",credentials:o.openapi.httpCredentials||""}},...o.openapi.securityType==="oauth2"&&{oauth2:{...n&&{tokenUrl:n},...h&&{clientId:h},...m&&{clientSecret:m},...t&&{token:t}}},...o.openapi.securityType==="openIdConnect"&&{openIdConnect:{url:o.openapi.openIdConnectUrl||"",token:o.openapi.openIdConnectToken||""}}}),i},os=({formData:o,serverType:i,envVars:n,headerVars:h})=>{var c,b,l;const m=_e(n),t=_e(h),u=ts(o.options),x=((c=o.description)==null?void 0:c.trim())||"",d={type:i,description:x,options:u,visibility:o.visibility??"private"};return i==="openapi"?(d.headers=t,d.openapi=as(o)):i==="sse"||i==="streamable-http"?(d.url=o.url.trim(),d.env=m,d.headers=t,d.passthroughHeaders=We(o.passthroughHeaders),d.oauth=ns(o.oauth),d.enableKeepAlive=((b=o.keepAlive)==null?void 0:b.enabled)||!1,d.keepAliveInterval=(l=o.keepAlive)!=null&&l.enabled?o.keepAlive.interval||6e4:void 0):(d.command=o.command.trim(),d.args=o.args,d.env=m),{name:o.name.trim(),config:d}},cs=({onSubmit:o,onCancel:i,initialData:n=null,modalTitle:h,formError:m=null})=>{var z,$,R,B,X,J,G,L,Q,_,W,Y,Z,D,ee,se,re,te,ne,ae,oe,le,ie,pe,ce,de,me,ue,xe,he,ge,ye,be,ve,fe,je,ke,Ne,Ce,Te,we,Ie,Se,Ae,Ke,Ee,Oe,He,Fe,Ve,Me,Pe,Ue,qe,ze,$e,Re,Be,Xe,Je,Ge,Le,Qe;const{t}=ss(),u=()=>!n||!n.config?"stdio":n.config.type?n.config.type:n.config.url?"sse":"stdio",x=r=>!r||!r.config||!r.config.env?[]:Object.entries(r.config.env).map(([s,a])=>({key:s,value:a,description:""})),d=r=>{var a;const s=(a=r==null?void 0:r.config)==null?void 0:a.oauth;return{clientId:(s==null?void 0:s.clientId)||"",clientSecret:(s==null?void 0:s.clientSecret)||"",scopes:s!=null&&s.scopes?s.scopes.join(" "):"",accessToken:(s==null?void 0:s.accessToken)||"",refreshToken:(s==null?void 0:s.refreshToken)||"",authorizationEndpoint:(s==null?void 0:s.authorizationEndpoint)||"",tokenEndpoint:(s==null?void 0:s.tokenEndpoint)||"",resource:(s==null?void 0:s.resource)||""}},[c,b]=N.useState(u()),[l,p]=N.useState({name:n&&n.name||"",description:n&&n.config&&n.config.description||"",url:n&&n.config&&n.config.url||"",command:n&&n.config&&n.config.command||"",arguments:n&&n.config&&n.config.args?Array.isArray(n.config.args)?n.config.args.join(" "):String(n.config.args):"",args:n&&n.config&&n.config.args||[],type:u(),env:x(n),headers:[],passthroughHeaders:(($=(z=n==null?void 0:n.config)==null?void 0:z.passthroughHeaders)==null?void 0:$.join(", "))||"",visibility:((R=n==null?void 0:n.config)==null?void 0:R.visibility)??"private",options:{timeout:n&&n.config&&n.config.options&&n.config.options.timeout||6e4,resetTimeoutOnProgress:((X=(B=n==null?void 0:n.config)==null?void 0:B.options)==null?void 0:X.resetTimeoutOnProgress)??!0,maxTotalTimeout:n&&n.config&&n.config.options&&n.config.options.maxTotalTimeout||void 0},oauth:d(n),keepAlive:{enabled:((J=n==null?void 0:n.config)==null?void 0:J.enableKeepAlive)||!1,interval:((G=n==null?void 0:n.config)==null?void 0:G.keepAliveInterval)||6e4},openapi:n&&n.config&&n.config.openapi?{url:n.config.openapi.url||"",schema:n.config.openapi.schema?JSON.stringify(n.config.openapi.schema,null,2):"",inputMode:n.config.openapi.url?"url":n.config.openapi.schema?"schema":"url",version:n.config.openapi.version||"3.1.0",securityType:((L=n.config.openapi.security)==null?void 0:L.type)||"none",apiKeyName:((_=(Q=n.config.openapi.security)==null?void 0:Q.apiKey)==null?void 0:_.name)||"",apiKeyIn:((Y=(W=n.config.openapi.security)==null?void 0:W.apiKey)==null?void 0:Y.in)||"header",apiKeyValue:((D=(Z=n.config.openapi.security)==null?void 0:Z.apiKey)==null?void 0:D.value)||"",httpScheme:((se=(ee=n.config.openapi.security)==null?void 0:ee.http)==null?void 0:se.scheme)||"bearer",httpCredentials:((te=(re=n.config.openapi.security)==null?void 0:re.http)==null?void 0:te.credentials)||"",oauth2TokenUrl:((ae=(ne=n.config.openapi.security)==null?void 0:ne.oauth2)==null?void 0:ae.tokenUrl)||"",oauth2ClientId:((le=(oe=n.config.openapi.security)==null?void 0:oe.oauth2)==null?void 0:le.clientId)||"",oauth2ClientSecret:((pe=(ie=n.config.openapi.security)==null?void 0:ie.oauth2)==null?void 0:pe.clientSecret)||"",oauth2Token:((de=(ce=n.config.openapi.security)==null?void 0:ce.oauth2)==null?void 0:de.token)||"",openIdConnectUrl:((ue=(me=n.config.openapi.security)==null?void 0:me.openIdConnect)==null?void 0:ue.url)||"",openIdConnectToken:((he=(xe=n.config.openapi.security)==null?void 0:xe.openIdConnect)==null?void 0:he.token)||"",passthroughHeaders:n.config.openapi.passthroughHeaders?n.config.openapi.passthroughHeaders.join(", "):""}:{inputMode:"url",url:"",schema:"",version:"3.1.0",securityType:"none",passthroughHeaders:""}}),[g,f]=N.useState(n&&n.config&&n.config.env?Object.entries(n.config.env).map(([r,s])=>({key:r,value:s})):[]),[y,j]=N.useState(n&&n.config&&n.config.headers?Object.entries(n.config.headers).map(([r,s])=>({key:r,value:s})):[]),[k,C]=N.useState(!1),[v,w]=N.useState(!1),[E,Ye]=N.useState(!1),[H,F]=N.useState(null),Ze=!!n,I=r=>{const{name:s,value:a}=r.target;p({...l,[s]:a})},De=r=>{const s=r.split(" ").filter(a=>a.trim()!=="");p({...l,arguments:r,args:s})},S=r=>{b(r),p(s=>({...s,type:r}))},A=(r,s,a)=>{const T=[...g];T[r][s]=a,f(T)},V=()=>{f([...g,{key:"",value:""}])},M=r=>{const s=[...g];s.splice(r,1),f(s)},K=(r,s,a)=>{const T=[...y];T[r][s]=a,j(T)},P=()=>{j([...y,{key:"",value:""}])},U=r=>{const s=[...y];s.splice(r,1),j(s)},q=(r,s)=>{p(a=>({...a,oauth:{...a.oauth||{},[r]:s}}))},O=(r,s)=>{p(a=>({...a,options:{...a.options,[r]:s}}))},es=async r=>{r.preventDefault(),F(null);try{const s=os({formData:l,serverType:c,envVars:g,headerVars:y});o(s)}catch(s){F(`Error: ${s instanceof Error?s.message:String(s)}`)}};return e.jsxs("div",{className:"hub-card p-6 w-full max-w-3xl max-h-screen overflow-y-auto",children:[e.jsxs("div",{className:"flex justify-between items-center mb-5",children:[e.jsx("h2",{className:"text-lg font-semibold text-[var(--hub-ink)]",children:h}),e.jsx("button",{onClick:i,className:"hub-icon-btn","aria-label":"Close",children:e.jsx(rs,{size:16})})]}),(H||m)&&e.jsx("div",{className:"bg-red-50 text-red-700 p-3 rounded mb-4",children:m||H}),e.jsxs("form",{onSubmit:es,children:[e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5 text-[var(--hub-ink-2)]",htmlFor:"name",children:t("server.name")}),e.jsx("input",{type:"text",name:"name",id:"name",value:l.name,onChange:I,className:"w-full py-2 px-3 form-input",placeholder:"e.g.: time-mcp",required:!0})]}),e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5 text-[var(--hub-ink-2)]",htmlFor:"description",children:t("server.description")}),e.jsx("input",{type:"text",name:"description",id:"description",value:l.description||"",onChange:I,className:"w-full py-2 px-3 form-input",placeholder:t("server.descriptionPlaceholder")})]}),e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5 text-[var(--hub-ink-2)]",htmlFor:"visibility",children:t("server.visibility","Visibility")}),e.jsxs("select",{id:"visibility",name:"visibility",value:l.visibility||"private",onChange:r=>p(s=>({...s,visibility:r.target.value})),className:"w-full py-2 px-3 form-input",children:[e.jsx("option",{value:"private",children:t("server.visibilityPrivate","Private — only the owner and admins")}),l.visibility==="group"&&e.jsx("option",{value:"group",disabled:!0,children:t("server.visibilityGroup","Group (reserved — not yet implemented)")}),e.jsx("option",{value:"public",children:t("server.visibilityPublic","Public — every authenticated user")})]}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:t("server.visibilityDescription","Controls which non-admin users see this server in tools/list. Admins always see all servers regardless of this setting.")})]}),e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5 text-[var(--hub-ink-2)]",children:t("server.type")}),e.jsxs("div",{className:"flex space-x-4",children:[e.jsxs("div",{children:[e.jsx("input",{type:"radio",id:"command",name:"serverType",value:"command",checked:c==="stdio",onChange:()=>S("stdio"),className:"mr-1"}),e.jsx("label",{htmlFor:"command",className:"text-[var(--hub-ink)]",children:t("server.typeStdio")})]}),e.jsxs("div",{children:[e.jsx("input",{type:"radio",id:"url",name:"serverType",value:"url",checked:c==="sse",onChange:()=>S("sse"),className:"mr-1"}),e.jsx("label",{htmlFor:"url",className:"text-[var(--hub-ink)]",children:t("server.typeSse")})]}),e.jsxs("div",{children:[e.jsx("input",{type:"radio",id:"streamable-http",name:"serverType",value:"streamable-http",checked:c==="streamable-http",onChange:()=>S("streamable-http"),className:"mr-1"}),e.jsx("label",{htmlFor:"streamable-http",className:"text-[var(--hub-ink)]",children:t("server.typeStreamableHttp")})]}),e.jsxs("div",{children:[e.jsx("input",{type:"radio",id:"openapi",name:"serverType",value:"openapi",checked:c==="openapi",onChange:()=>S("openapi"),className:"mr-1"}),e.jsx("label",{htmlFor:"openapi",className:"text-[var(--hub-ink)]",children:t("server.typeOpenapi")})]})]})]}),c==="openapi"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5 text-[var(--hub-ink-2)]",children:t("server.openapi.inputMode")}),e.jsxs("div",{className:"flex space-x-4",children:[e.jsxs("div",{children:[e.jsx("input",{type:"radio",id:"input-mode-url",name:"inputMode",value:"url",checked:((ge=l.openapi)==null?void 0:ge.inputMode)==="url",onChange:()=>p(r=>({...r,openapi:{...r.openapi,inputMode:"url"}})),className:"mr-1"}),e.jsx("label",{htmlFor:"input-mode-url",children:t("server.openapi.inputModeUrl")})]}),e.jsxs("div",{children:[e.jsx("input",{type:"radio",id:"input-mode-schema",name:"inputMode",value:"schema",checked:((ye=l.openapi)==null?void 0:ye.inputMode)==="schema",onChange:()=>p(r=>({...r,openapi:{...r.openapi,inputMode:"schema"}})),className:"mr-1"}),e.jsx("label",{htmlFor:"input-mode-schema",children:t("server.openapi.inputModeSchema")})]})]})]}),((be=l.openapi)==null?void 0:be.inputMode)==="url"&&e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5 text-[var(--hub-ink-2)]",htmlFor:"openapi-url",children:t("server.openapi.specUrl")}),e.jsx("input",{type:"url",name:"openapi-url",id:"openapi-url",value:((ve=l.openapi)==null?void 0:ve.url)||"",onChange:r=>p(s=>({...s,openapi:{...s.openapi,url:r.target.value}})),className:"w-full py-2 px-3 form-input",placeholder:"e.g.: https://api.example.com/openapi.json",required:c==="openapi"&&((fe=l.openapi)==null?void 0:fe.inputMode)==="url"})]}),((je=l.openapi)==null?void 0:je.inputMode)==="schema"&&e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5 text-[var(--hub-ink-2)]",htmlFor:"openapi-schema",children:t("server.openapi.schema")}),e.jsx("textarea",{name:"openapi-schema",id:"openapi-schema",rows:10,value:((ke=l.openapi)==null?void 0:ke.schema)||"",onChange:r=>p(s=>({...s,openapi:{...s.openapi,schema:r.target.value}})),className:"w-full py-2 px-3 form-input font-mono text-sm",placeholder:`{
2
2
  "openapi": "3.1.0",
3
3
  "info": {
4
4
  "title": "API",
@@ -13,4 +13,4 @@ import{r as N,j as e}from"./framework-vendor-BUhDPOUZ.js";import{u as ss}from"./
13
13
  ...
14
14
  }
15
15
  }`,required:c==="openapi"&&((Ne=l.openapi)==null?void 0:Ne.inputMode)==="schema"}),e.jsx("p",{className:"text-xs text-[var(--hub-ink-3)] mt-1",children:t("server.openapi.schemaHelp")})]}),e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5 text-[var(--hub-ink-2)]",children:t("server.openapi.security")}),e.jsxs("select",{value:((Ce=l.openapi)==null?void 0:Ce.securityType)||"none",onChange:r=>p(s=>{var a;return{...s,openapi:{...s.openapi,securityType:r.target.value,url:((a=s.openapi)==null?void 0:a.url)||""}}}),className:"w-full py-2 px-3 form-input",children:[e.jsx("option",{value:"none",children:t("server.openapi.securityNone")}),e.jsx("option",{value:"apiKey",children:t("server.openapi.securityApiKey")}),e.jsx("option",{value:"http",children:t("server.openapi.securityHttp")}),e.jsx("option",{value:"oauth2",children:t("server.openapi.securityOAuth2")}),e.jsx("option",{value:"openIdConnect",children:t("server.openapi.securityOpenIdConnect")})]})]}),((Te=l.openapi)==null?void 0:Te.securityType)==="apiKey"&&e.jsxs("div",{className:"mb-4 p-4 border border-gray-200 dark:border-gray-700 rounded bg-gray-50 dark:bg-gray-800",children:[e.jsx("h4",{className:"text-sm font-medium mb-3 text-[var(--hub-ink-2)]",children:t("server.openapi.apiKeyConfig")}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-[var(--hub-ink-2)] mb-1",children:t("server.openapi.apiKeyName")}),e.jsx("input",{type:"text",value:((we=l.openapi)==null?void 0:we.apiKeyName)||"",onChange:r=>p(s=>{var a;return{...s,openapi:{...s.openapi,apiKeyName:r.target.value,url:((a=s.openapi)==null?void 0:a.url)||""}}}),className:"w-full border rounded px-2 py-1 text-sm form-input focus:outline-none",placeholder:"Authorization"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-[var(--hub-ink-2)] mb-1",children:t("server.openapi.apiKeyIn")}),e.jsxs("select",{value:((Ie=l.openapi)==null?void 0:Ie.apiKeyIn)||"header",onChange:r=>p(s=>{var a;return{...s,openapi:{...s.openapi,apiKeyIn:r.target.value,url:((a=s.openapi)==null?void 0:a.url)||""}}}),className:"w-full border rounded px-2 py-1 text-sm focus:outline-none form-input",children:[e.jsx("option",{value:"header",children:t("server.openapi.apiKeyInHeader")}),e.jsx("option",{value:"query",children:t("server.openapi.apiKeyInQuery")}),e.jsx("option",{value:"cookie",children:t("server.openapi.apiKeyInCookie")})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-gray-600 mb-1",children:t("server.openapi.apiKeyValue")}),e.jsx("input",{type:"password",value:((Se=l.openapi)==null?void 0:Se.apiKeyValue)||"",onChange:r=>p(s=>{var a;return{...s,openapi:{...s.openapi,apiKeyValue:r.target.value,url:((a=s.openapi)==null?void 0:a.url)||""}}}),className:"w-full border rounded px-2 py-1 text-sm focus:outline-none form-input",placeholder:"your-api-key"})]})]})]}),((Ae=l.openapi)==null?void 0:Ae.securityType)==="http"&&e.jsxs("div",{className:"mb-4 p-4 border border-gray-200 dark:border-gray-700 rounded bg-gray-50 dark:bg-gray-800",children:[e.jsx("h4",{className:"text-sm font-medium mb-3 text-gray-700 dark:text-gray-300",children:t("server.openapi.httpAuthConfig")}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-gray-600 mb-1",children:t("server.openapi.httpScheme")}),e.jsxs("select",{value:((Ke=l.openapi)==null?void 0:Ke.httpScheme)||"bearer",onChange:r=>p(s=>{var a;return{...s,openapi:{...s.openapi,httpScheme:r.target.value,url:((a=s.openapi)==null?void 0:a.url)||""}}}),className:"w-full border rounded px-2 py-1 text-sm focus:outline-none form-input",children:[e.jsx("option",{value:"basic",children:t("server.openapi.httpSchemeBasic")}),e.jsx("option",{value:"bearer",children:t("server.openapi.httpSchemeBearer")}),e.jsx("option",{value:"digest",children:t("server.openapi.httpSchemeDigest")})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-gray-600 mb-1",children:t("server.openapi.httpCredentials")}),e.jsx("input",{type:"password",value:((Ee=l.openapi)==null?void 0:Ee.httpCredentials)||"",onChange:r=>p(s=>{var a;return{...s,openapi:{...s.openapi,httpCredentials:r.target.value,url:((a=s.openapi)==null?void 0:a.url)||""}}}),className:"w-full border rounded px-2 py-1 text-sm focus:outline-none form-input",placeholder:((Oe=l.openapi)==null?void 0:Oe.httpScheme)==="basic"?"base64-encoded-credentials":"bearer-token"})]})]})]}),((He=l.openapi)==null?void 0:He.securityType)==="oauth2"&&e.jsxs("div",{className:"mb-4 p-4 border border-gray-200 dark:border-gray-700 rounded bg-gray-50 dark:bg-gray-800",children:[e.jsx("h4",{className:"text-sm font-medium mb-3 text-gray-700 dark:text-gray-300",children:t("server.openapi.oauth2Config")}),e.jsxs("div",{className:"grid grid-cols-1 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-gray-600 mb-1",children:t("server.oauth.tokenEndpoint")}),e.jsx("input",{type:"url",value:((Fe=l.openapi)==null?void 0:Fe.oauth2TokenUrl)||"",onChange:r=>p(s=>{var a;return{...s,openapi:{...s.openapi,oauth2TokenUrl:r.target.value,url:((a=s.openapi)==null?void 0:a.url)||""}}}),className:"w-full border rounded px-2 py-1 text-sm focus:outline-none form-input",placeholder:"https://example.com/oauth/token"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-gray-600 mb-1",children:t("server.oauth.clientId")}),e.jsx("input",{type:"text",value:((Ve=l.openapi)==null?void 0:Ve.oauth2ClientId)||"",onChange:r=>p(s=>{var a;return{...s,openapi:{...s.openapi,oauth2ClientId:r.target.value,url:((a=s.openapi)==null?void 0:a.url)||""}}}),className:"w-full border rounded px-2 py-1 text-sm focus:outline-none form-input",placeholder:"client-id"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-gray-600 mb-1",children:t("server.oauth.clientSecret")}),e.jsx("input",{type:"password",value:((Me=l.openapi)==null?void 0:Me.oauth2ClientSecret)||"",onChange:r=>p(s=>{var a;return{...s,openapi:{...s.openapi,oauth2ClientSecret:r.target.value,url:((a=s.openapi)==null?void 0:a.url)||""}}}),className:"w-full border rounded px-2 py-1 text-sm focus:outline-none form-input",placeholder:"client-secret"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-gray-600 mb-1",children:t("server.openapi.oauth2Token")}),e.jsx("input",{type:"password",value:((Pe=l.openapi)==null?void 0:Pe.oauth2Token)||"",onChange:r=>p(s=>{var a;return{...s,openapi:{...s.openapi,oauth2Token:r.target.value,url:((a=s.openapi)==null?void 0:a.url)||""}}}),className:"w-full border rounded px-2 py-1 text-sm focus:outline-none form-input",placeholder:"access-token"})]})]})]}),((Ue=l.openapi)==null?void 0:Ue.securityType)==="openIdConnect"&&e.jsxs("div",{className:"mb-4 p-4 border border-gray-200 dark:border-gray-700 rounded bg-gray-50 dark:bg-gray-800",children:[e.jsx("h4",{className:"text-sm font-medium mb-3 text-gray-700 dark:text-gray-300",children:t("server.openapi.openIdConnectConfig")}),e.jsxs("div",{className:"grid grid-cols-1 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-gray-600 mb-1",children:t("server.openapi.openIdConnectUrl")}),e.jsx("input",{type:"url",value:((qe=l.openapi)==null?void 0:qe.openIdConnectUrl)||"",onChange:r=>p(s=>{var a;return{...s,openapi:{...s.openapi,openIdConnectUrl:r.target.value,url:((a=s.openapi)==null?void 0:a.url)||""}}}),className:"w-full border rounded px-2 py-1 text-sm focus:outline-none form-input",placeholder:"https://example.com/.well-known/openid_configuration"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-gray-600 mb-1",children:t("server.openapi.openIdConnectToken")}),e.jsx("input",{type:"password",value:((ze=l.openapi)==null?void 0:ze.openIdConnectToken)||"",onChange:r=>p(s=>{var a;return{...s,openapi:{...s.openapi,openIdConnectToken:r.target.value,url:((a=s.openapi)==null?void 0:a.url)||""}}}),className:"w-full border rounded px-2 py-1 text-sm focus:outline-none form-input",placeholder:"id-token"})]})]})]}),e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5 text-gray-700 dark:text-gray-300",children:t("server.openapi.passthroughHeaders")}),e.jsx("input",{type:"text",value:(($e=l.openapi)==null?void 0:$e.passthroughHeaders)||"",onChange:r=>p(s=>{var a;return{...s,openapi:{...s.openapi,passthroughHeaders:r.target.value,url:((a=s.openapi)==null?void 0:a.url)||""}}}),className:"w-full py-2 px-3 form-input",placeholder:"Authorization, X-API-Key, X-Custom-Header"}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:t("server.openapi.passthroughHeadersHelp")})]}),e.jsxs("div",{className:"mb-4",children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:t("server.headers")}),e.jsx("button",{type:"button",onClick:P,className:"bg-gray-200 hover:bg-gray-300 text-gray-700 font-medium py-1 px-2 rounded text-sm flex items-center justify-center min-w-[30px] min-h-[30px] btn-primary",children:"+"})]}),y.map((r,s)=>e.jsxs("div",{className:"flex items-center mb-2",children:[e.jsxs("div",{className:"flex items-center space-x-2 flex-grow",children:[e.jsx("input",{type:"text",value:r.key,onChange:a=>K(s,"key",a.target.value),className:"w-1/2 py-2 px-3 form-input",placeholder:"Authorization"}),e.jsx("span",{className:"flex items-center",children:":"}),e.jsx("input",{type:"text",value:r.value,onChange:a=>K(s,"value",a.target.value),className:"w-1/2 py-2 px-3 form-input",placeholder:"Bearer token..."})]}),e.jsx("button",{type:"button",onClick:()=>U(s),className:"bg-gray-200 hover:bg-gray-300 text-gray-700 font-medium py-1 px-2 rounded text-sm flex items-center justify-center min-w-[30px] min-h-[30px] ml-2 btn-danger",children:"-"})]},s))]})]}):c==="sse"||c==="streamable-http"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5 text-gray-700 dark:text-gray-300",htmlFor:"url",children:t("server.url")}),e.jsx("input",{type:"url",name:"url",id:"url",value:l.url,onChange:I,className:"w-full py-2 px-3 form-input",placeholder:c==="streamable-http"?"e.g.: http://localhost:3000/mcp":"e.g.: http://localhost:3000/sse",required:c==="sse"||c==="streamable-http"})]}),e.jsxs("div",{className:"mb-4",children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:t("server.headers")}),e.jsx("button",{type:"button",onClick:P,className:"bg-gray-200 hover:bg-gray-300 text-gray-700 font-medium py-1 px-2 rounded text-sm flex items-center justify-center min-w-[30px] min-h-[30px] btn-primary",children:"+"})]}),y.map((r,s)=>e.jsxs("div",{className:"flex items-center mb-2",children:[e.jsxs("div",{className:"flex items-center space-x-2 flex-grow",children:[e.jsx("input",{type:"text",value:r.key,onChange:a=>K(s,"key",a.target.value),className:"w-1/2 py-2 px-3 form-input",placeholder:"Authorization"}),e.jsx("span",{className:"flex items-center",children:":"}),e.jsx("input",{type:"text",value:r.value,onChange:a=>K(s,"value",a.target.value),className:"w-1/2 py-2 px-3 form-input",placeholder:"Bearer token..."})]}),e.jsx("button",{type:"button",onClick:()=>U(s),className:"bg-gray-200 hover:bg-gray-300 text-gray-700 font-medium py-1 px-2 rounded text-sm flex items-center justify-center min-w-[30px] min-h-[30px] ml-2 btn-danger",children:"-"})]},s))]}),e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5 text-gray-700 dark:text-gray-300",children:t("server.openapi.passthroughHeaders")}),e.jsx("input",{type:"text",value:l.passthroughHeaders||"",onChange:r=>p(s=>({...s,passthroughHeaders:r.target.value})),className:"w-full py-2 px-3 form-input",placeholder:"Authorization, X-Custom-User-Id"}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:t("server.openapi.passthroughHeadersHelp")})]}),e.jsxs("div",{className:"mb-4",children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:t("server.envVars")}),e.jsx("button",{type:"button",onClick:V,className:"bg-gray-200 hover:bg-gray-300 text-gray-700 font-medium py-1 px-2 rounded text-sm flex items-center justify-center min-w-[30px] min-h-[30px] btn-primary",children:"+"})]}),g.map((r,s)=>e.jsxs("div",{className:"flex items-center mb-2",children:[e.jsxs("div",{className:"flex items-center space-x-2 flex-grow",children:[e.jsx("input",{type:"text",value:r.key,onChange:a=>A(s,"key",a.target.value),className:"w-1/2 py-2 px-3 form-input",placeholder:t("server.key")}),e.jsx("span",{className:"flex items-center",children:":"}),e.jsx("input",{type:"text",value:r.value,onChange:a=>A(s,"value",a.target.value),className:"w-1/2 py-2 px-3 form-input",placeholder:t("server.value")})]}),e.jsx("button",{type:"button",onClick:()=>M(s),className:"bg-gray-200 hover:bg-gray-300 text-gray-700 font-medium py-1 px-2 rounded text-sm flex items-center justify-center min-w-[30px] min-h-[30px] ml-2 btn-danger",children:"-"})]},s))]}),e.jsxs("div",{className:"mb-4",children:[e.jsxs("div",{className:"flex items-center justify-between cursor-pointer bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 p-3 rounded border border-gray-200 dark:border-gray-700",onClick:()=>w(!v),children:[e.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:t("server.oauth.sectionTitle")}),e.jsx("span",{className:"text-gray-500 text-sm",children:v?"▼":"▶"})]}),v&&e.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-b p-4 bg-gray-50 dark:bg-gray-800 border-t-0",children:[e.jsx("p",{className:"text-xs text-gray-500 mb-3",children:t("server.oauth.sectionDescription")}),e.jsxs("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-gray-600 mb-1",children:t("server.oauth.clientId")}),e.jsx("input",{type:"text",value:((Re=l.oauth)==null?void 0:Re.clientId)||"",onChange:r=>q("clientId",r.target.value),className:"w-full py-2 px-3 form-input",placeholder:"client id",autoComplete:"off"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-gray-600 mb-1",children:t("server.oauth.clientSecret")}),e.jsx("input",{type:"password",value:((Be=l.oauth)==null?void 0:Be.clientSecret)||"",onChange:r=>q("clientSecret",r.target.value),className:"w-full py-2 px-3 form-input",placeholder:"client secret",autoComplete:"off"})]})]})]})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5 text-gray-700 dark:text-gray-300",htmlFor:"command",children:t("server.command")}),e.jsx("input",{type:"text",name:"command",id:"command",value:l.command,onChange:I,className:"w-full py-2 px-3 form-input",placeholder:"e.g.: npx",required:c==="stdio"})]}),e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5 text-gray-700 dark:text-gray-300",htmlFor:"arguments",children:t("server.arguments")}),e.jsx("input",{type:"text",name:"arguments",id:"arguments",value:l.arguments,onChange:r=>De(r.target.value),className:"w-full py-2 px-3 form-input",placeholder:"e.g.: -y time-mcp",required:c==="stdio"})]}),e.jsxs("div",{className:"mb-4",children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:t("server.envVars")}),e.jsx("button",{type:"button",onClick:V,className:"bg-gray-200 hover:bg-gray-300 text-gray-700 font-medium py-1 px-2 rounded text-sm flex items-center justify-center min-w-[30px] min-h-[30px] btn-primary",children:"+"})]}),g.map((r,s)=>e.jsxs("div",{className:"flex items-center mb-2",children:[e.jsxs("div",{className:"flex items-center space-x-2 flex-grow",children:[e.jsx("input",{type:"text",value:r.key,onChange:a=>A(s,"key",a.target.value),className:"w-1/2 py-2 px-3 form-input",placeholder:t("server.key")}),e.jsx("span",{className:"flex items-center",children:":"}),e.jsx("input",{type:"text",value:r.value,onChange:a=>A(s,"value",a.target.value),className:"w-1/2 py-2 px-3 form-input",placeholder:t("server.value")})]}),e.jsx("button",{type:"button",onClick:()=>M(s),className:"bg-gray-200 hover:bg-gray-300 text-gray-700 font-medium py-1 px-2 rounded text-sm flex items-center justify-center min-w-[30px] min-h-[30px] ml-2 btn-danger",children:"-"})]},s))]})]}),c!=="openapi"&&e.jsxs("div",{className:"mb-4",children:[e.jsxs("div",{className:"flex items-center justify-between cursor-pointer bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 p-3 rounded border border-gray-200 dark:border-gray-700",onClick:()=>C(!k),children:[e.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:t("server.requestOptions")}),e.jsx("span",{className:"text-gray-500 text-sm",children:k?"▼":"▶"})]}),k&&e.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-b p-4 bg-gray-50 dark:bg-gray-800 border-t-0",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-gray-600 text-sm font-medium mb-1",htmlFor:"timeout",children:t("server.timeout")}),e.jsx("input",{type:"number",id:"timeout",value:((Xe=l.options)==null?void 0:Xe.timeout)||6e4,onChange:r=>O("timeout",parseInt(r.target.value)||6e4),className:"w-full py-2 px-3 form-input",placeholder:"30000",min:"1000",max:"300000"}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:t("server.timeoutDescription")})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-gray-600 text-sm font-medium mb-1",htmlFor:"maxTotalTimeout",children:t("server.maxTotalTimeout")}),e.jsx("input",{type:"number",id:"maxTotalTimeout",value:((Je=l.options)==null?void 0:Je.maxTotalTimeout)||"",onChange:r=>O("maxTotalTimeout",r.target.value?parseInt(r.target.value):void 0),className:"w-full py-2 px-3 form-input",placeholder:"Optional",min:"1000"}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:t("server.maxTotalTimeoutDescription")})]})]}),e.jsxs("div",{className:"mt-3",children:[e.jsxs("label",{className:"flex items-center",children:[e.jsx("input",{type:"checkbox",checked:((Ge=l.options)==null?void 0:Ge.resetTimeoutOnProgress)??!0,onChange:r=>O("resetTimeoutOnProgress",r.target.checked),className:"mr-2"}),e.jsx("span",{className:"text-gray-600 text-sm",children:t("server.resetTimeoutOnProgress")})]}),e.jsx("p",{className:"text-xs text-gray-500 mt-1 ml-6",children:t("server.resetTimeoutOnProgressDescription")})]})]})]}),(c==="sse"||c==="streamable-http")&&e.jsxs("div",{className:"mb-4",children:[e.jsxs("div",{className:"flex items-center justify-between cursor-pointer bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 p-3 rounded border border-gray-200 dark:border-gray-700",onClick:()=>Ye(!E),children:[e.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:t("server.keepAlive","Keep-Alive")}),e.jsx("span",{className:"text-gray-500 text-sm",children:E?"▼":"▶"})]}),E&&e.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-b p-4 bg-gray-50 dark:bg-gray-800 border-t-0",children:[e.jsxs("div",{className:"flex items-center mb-3",children:[e.jsx("input",{type:"checkbox",id:"enableKeepAlive",checked:((Le=l.keepAlive)==null?void 0:Le.enabled)||!1,onChange:r=>p(s=>({...s,keepAlive:{...s.keepAlive,enabled:r.target.checked}})),className:"mr-2"}),e.jsx("label",{htmlFor:"enableKeepAlive",className:"text-gray-600 text-sm",children:t("server.enableKeepAlive","Enable Keep-Alive")})]}),e.jsx("p",{className:"text-xs text-gray-500 mb-3",children:t("server.keepAliveDescription","Send periodic ping requests to maintain the connection. Useful for long-running connections that may timeout.")}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-gray-600 text-sm font-medium mb-1",htmlFor:"keepAliveInterval",children:t("server.keepAliveInterval","Interval (ms)")}),e.jsx("input",{type:"number",id:"keepAliveInterval",value:((Qe=l.keepAlive)==null?void 0:Qe.interval)||6e4,onChange:r=>p(s=>({...s,keepAlive:{...s.keepAlive,interval:parseInt(r.target.value)||6e4}})),className:"w-full py-2 px-3 form-input",placeholder:"60000",min:"5000",max:"300000"}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:t("server.keepAliveIntervalDescription","Time between keep-alive pings in milliseconds (default: 60000ms = 1 minute)")})]})]})]}),e.jsxs("div",{className:"flex justify-end mt-6",children:[e.jsx("button",{type:"button",onClick:i,className:"hub-btn mr-2",children:t("server.cancel")}),e.jsx("button",{type:"submit",className:"hub-btn primary",children:t(Ze?"server.save":"server.add")})]})]})]})},ds=o=>{const i=new Set,n=/\$\{([^}]+)\}/g,h=t=>{let u;for(;(u=n.exec(t))!==null;)i.add(u[1])},m=(t,u="")=>{typeof t=="string"?h(t):Array.isArray(t)?t.forEach((x,d)=>m(x,`${u}[${d}]`)):t&&typeof t=="object"&&Object.entries(t).forEach(([x,d])=>{m(d,u?`${u}.${x}`:x)})};return m(o),Array.from(i)};export{cs as S,ds as d};
16
- //# sourceMappingURL=variableDetection-GTKqOf1F.js.map
16
+ //# sourceMappingURL=variableDetection-Dnh8qFpO.js.map