xmcp 0.7.0 → 0.7.1

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 (155) hide show
  1. package/dist/cli.js +1 -1
  2. package/dist/index.js +1 -1
  3. package/package.json +2 -3
  4. package/src/auth/api-key.ts +0 -120
  5. package/src/auth/jwt.ts +0 -52
  6. package/src/cli/commands/create/__tests__/create.test.ts +0 -99
  7. package/src/cli/commands/create/index.ts +0 -74
  8. package/src/cli/commands/create/templates/index.ts +0 -4
  9. package/src/cli/commands/create/templates/prompt.ts +0 -30
  10. package/src/cli/commands/create/templates/resource.ts +0 -20
  11. package/src/cli/commands/create/templates/tool.ts +0 -34
  12. package/src/cli/commands/create/templates/widget.ts +0 -33
  13. package/src/cli/utils/naming.ts +0 -39
  14. package/src/cli.ts +0 -125
  15. package/src/client/headers.ts +0 -61
  16. package/src/client/index.ts +0 -180
  17. package/src/client/types.ts +0 -122
  18. package/src/client/utils.ts +0 -133
  19. package/src/cloudflare.ts +0 -6
  20. package/src/compiler/build-telemetry.ts +0 -88
  21. package/src/compiler/client/component-compiler.ts +0 -250
  22. package/src/compiler/client/transpile.ts +0 -21
  23. package/src/compiler/compiler-context.ts +0 -61
  24. package/src/compiler/config/__tests__/config.test.ts +0 -459
  25. package/src/compiler/config/index.ts +0 -62
  26. package/src/compiler/config/injection.ts +0 -210
  27. package/src/compiler/config/schemas/bundler.ts +0 -12
  28. package/src/compiler/config/schemas/experimental/index.ts +0 -22
  29. package/src/compiler/config/schemas/index.ts +0 -20
  30. package/src/compiler/config/schemas/paths.ts +0 -35
  31. package/src/compiler/config/schemas/template.ts +0 -80
  32. package/src/compiler/config/schemas/transport/http.ts +0 -116
  33. package/src/compiler/config/schemas/transport/stdio.ts +0 -31
  34. package/src/compiler/config/schemas/typescript.ts +0 -26
  35. package/src/compiler/config/utils.ts +0 -168
  36. package/src/compiler/generate-env-code.ts +0 -5
  37. package/src/compiler/generate-import-code.ts +0 -187
  38. package/src/compiler/generate-tools-code.ts +0 -174
  39. package/src/compiler/get-bundler-config/get-entries.ts +0 -44
  40. package/src/compiler/get-bundler-config/get-externals.ts +0 -114
  41. package/src/compiler/get-bundler-config/get-injected-variables.ts +0 -46
  42. package/src/compiler/get-bundler-config/index.ts +0 -288
  43. package/src/compiler/get-bundler-config/plugins/index.ts +0 -140
  44. package/src/compiler/get-bundler-config/plugins/types/express.ts +0 -3
  45. package/src/compiler/get-bundler-config/plugins/types/fastify.ts +0 -4
  46. package/src/compiler/get-bundler-config/plugins/types/index.ts +0 -5
  47. package/src/compiler/get-bundler-config/plugins/types/nest.ts +0 -65
  48. package/src/compiler/get-bundler-config/plugins/types/next.ts +0 -52
  49. package/src/compiler/get-bundler-config/resolve-tsconfig-paths.ts +0 -51
  50. package/src/compiler/index.ts +0 -484
  51. package/src/compiler/on-first-build.ts +0 -54
  52. package/src/compiler/parse-xmcp-config.ts +0 -200
  53. package/src/compiler/start-http-server.ts +0 -42
  54. package/src/compiler/utils/__tests__/config-detection.test.ts +0 -307
  55. package/src/compiler/utils/__tests__/path-utils.test.ts +0 -137
  56. package/src/compiler/utils/config-detection.ts +0 -34
  57. package/src/compiler/utils/path-utils.ts +0 -22
  58. package/src/compiler/watcher-recovery.ts +0 -72
  59. package/src/host-bridge.ts +0 -36
  60. package/src/index.ts +0 -94
  61. package/src/platforms/build-cloudflare-output.ts +0 -116
  62. package/src/platforms/build-vercel-output.ts +0 -131
  63. package/src/plugins/index.ts +0 -1
  64. package/src/plugins/x402/index.ts +0 -24
  65. package/src/runtime/adapters/express/index.ts +0 -75
  66. package/src/runtime/adapters/fastify/__tests__/fastify.test.ts +0 -115
  67. package/src/runtime/adapters/fastify/index.ts +0 -78
  68. package/src/runtime/adapters/nestjs/index.ts +0 -16
  69. package/src/runtime/adapters/nestjs/xmcp.controller.ts +0 -34
  70. package/src/runtime/adapters/nestjs/xmcp.guard.ts +0 -101
  71. package/src/runtime/adapters/nestjs/xmcp.oauth.controller.ts +0 -36
  72. package/src/runtime/adapters/nestjs/xmcp.oauth.module.ts +0 -21
  73. package/src/runtime/adapters/nestjs/xmcp.oauth.service.ts +0 -36
  74. package/src/runtime/adapters/nestjs/xmcp.service.ts +0 -96
  75. package/src/runtime/adapters/nestjs/xmcp.utils.ts +0 -11
  76. package/src/runtime/adapters/nextjs/auth.ts +0 -265
  77. package/src/runtime/adapters/nextjs/handler/error-handler.ts +0 -67
  78. package/src/runtime/adapters/nextjs/handler/node-to-web-adapter.ts +0 -143
  79. package/src/runtime/adapters/nextjs/handler/request-converter.ts +0 -74
  80. package/src/runtime/adapters/nextjs/handler/server-lifecycle.ts +0 -69
  81. package/src/runtime/adapters/nextjs/index.ts +0 -121
  82. package/src/runtime/contexts/client-info-context.ts +0 -16
  83. package/src/runtime/contexts/http-request-context.ts +0 -21
  84. package/src/runtime/contexts/http-transport-context.ts +0 -18
  85. package/src/runtime/headers.ts +0 -42
  86. package/src/runtime/middlewares/utils.ts +0 -72
  87. package/src/runtime/platforms/cloudflare/cors.ts +0 -44
  88. package/src/runtime/platforms/cloudflare/middlewares/api-key.ts +0 -102
  89. package/src/runtime/platforms/cloudflare/middlewares/jwt.ts +0 -127
  90. package/src/runtime/platforms/cloudflare/types.ts +0 -23
  91. package/src/runtime/platforms/cloudflare/worker.ts +0 -270
  92. package/src/runtime/templates/home.ts +0 -746
  93. package/src/runtime/transports/http/base-streamable-http.ts +0 -46
  94. package/src/runtime/transports/http/cors/headers.ts +0 -58
  95. package/src/runtime/transports/http/cors/index.ts +0 -34
  96. package/src/runtime/transports/http/index.ts +0 -78
  97. package/src/runtime/transports/http/stateless-streamable-http.ts +0 -353
  98. package/src/runtime/transports/http/web-stateless-http.ts +0 -288
  99. package/src/runtime/transports/stdio/index.ts +0 -109
  100. package/src/runtime/utils/__tests__/client-info.test.ts +0 -146
  101. package/src/runtime/utils/__tests__/tool-extra.test.ts +0 -239
  102. package/src/runtime/utils/client-info.ts +0 -114
  103. package/src/runtime/utils/elicitation.ts +0 -396
  104. package/src/runtime/utils/ext-apps-registry.ts +0 -151
  105. package/src/runtime/utils/mcp-app-protocol.ts +0 -16
  106. package/src/runtime/utils/mcp-app-types.ts +0 -113
  107. package/src/runtime/utils/mcp-host-bridge.ts +0 -473
  108. package/src/runtime/utils/path-to-tool-name.ts +0 -69
  109. package/src/runtime/utils/prompt-loader.ts +0 -151
  110. package/src/runtime/utils/prompts.ts +0 -69
  111. package/src/runtime/utils/react/generate-html.ts +0 -69
  112. package/src/runtime/utils/react/index.ts +0 -6
  113. package/src/runtime/utils/request-tool-names.ts +0 -48
  114. package/src/runtime/utils/resource-loader.ts +0 -151
  115. package/src/runtime/utils/resources.ts +0 -331
  116. package/src/runtime/utils/server.ts +0 -107
  117. package/src/runtime/utils/tool-loader.ts +0 -149
  118. package/src/runtime/utils/tools.ts +0 -183
  119. package/src/runtime/utils/transformers/prompt.ts +0 -120
  120. package/src/runtime/utils/transformers/resource.ts +0 -196
  121. package/src/runtime/utils/transformers/tool.ts +0 -400
  122. package/src/runtime/utils/ui/__tests__/split-meta.test.ts +0 -803
  123. package/src/runtime/utils/ui/flatten-meta.ts +0 -44
  124. package/src/runtime/utils/ui/split-meta.ts +0 -78
  125. package/src/runtime/utils/utils/resource-uri-composer.ts +0 -204
  126. package/src/runtime/utils/validators/index.ts +0 -138
  127. package/src/telemetry/ci-info.ts +0 -6
  128. package/src/telemetry/debug.ts +0 -8
  129. package/src/telemetry/events/definitions.ts +0 -52
  130. package/src/telemetry/events/detached-flush.ts +0 -83
  131. package/src/telemetry/events/post-payload.ts +0 -141
  132. package/src/telemetry/events/tracker.ts +0 -281
  133. package/src/telemetry/index.ts +0 -7
  134. package/src/telemetry/metadata.ts +0 -49
  135. package/src/telemetry/project-id.ts +0 -35
  136. package/src/telemetry/storage.ts +0 -218
  137. package/src/types/adapter.d.ts +0 -5
  138. package/src/types/client-info.ts +0 -20
  139. package/src/types/declarations.ts +0 -37
  140. package/src/types/injected.d.ts +0 -62
  141. package/src/types/middleware.ts +0 -19
  142. package/src/types/prompt.ts +0 -6
  143. package/src/types/resource.ts +0 -15
  144. package/src/types/tool.ts +0 -192
  145. package/src/types/ui-meta.ts +0 -42
  146. package/src/utils/cli-icons.ts +0 -5
  147. package/src/utils/constants.ts +0 -31
  148. package/src/utils/context.ts +0 -105
  149. package/src/utils/detect-package-manager.ts +0 -46
  150. package/src/utils/file-watcher.ts +0 -66
  151. package/src/utils/fs-utils.ts +0 -16
  152. package/src/utils/path-validation.ts +0 -66
  153. package/src/utils/port-utils.ts +0 -43
  154. package/src/utils/spawn-process.ts +0 -49
  155. package/src/utils/subscribable.ts +0 -62
@@ -1,746 +0,0 @@
1
- const FALLBACK_DESCRIPTION = "This MCP server was bootstrapped with xmcp.";
2
-
3
- const ICONS = {
4
- cursor: `
5
- <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
6
- <g clip-path="url(#cursor)">
7
- <path d="M18.1937 4.73376L10.1872 0.111231C9.93007 -0.0372398 9.61283 -0.0372398 9.35573 0.111231L1.34956 4.73376C1.13344 4.85855 1 5.08934 1 5.33929V14.6606C1 14.9106 1.13344 15.1414 1.34956 15.2662L9.3561 19.8887C9.6132 20.0372 9.93044 20.0372 10.1875 19.8887L18.1941 15.2662C18.4102 15.1414 18.5436 14.9106 18.5436 14.6606V5.33929C18.5436 5.08934 18.4102 4.85855 18.1941 4.73376H18.1937ZM17.6908 5.71291L9.96164 19.1001C9.90939 19.1903 9.77145 19.1535 9.77145 19.049V10.2832C9.77145 10.108 9.67785 9.94603 9.526 9.85808L1.9348 5.47536C1.84459 5.42311 1.88143 5.28517 1.98592 5.28517H17.4442C17.6637 5.28517 17.8009 5.5231 17.6912 5.71329H17.6908V5.71291Z" fill="currentColor" />
8
- </g>
9
- <defs>
10
- <clipPath id="cursor">
11
- <rect width="20" height="20" fill="white" />
12
- </clipPath>
13
- </defs>
14
- </svg>
15
- `,
16
- claude: `
17
- <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
18
- <g clip-path="url(#claude)">
19
- <path d="M3.92841 13.2962L7.85957 11.0903L7.92541 10.8981L7.85957 10.7918H7.66732L7.00957 10.7513L4.76324 10.6906L2.81532 10.6097L0.928158 10.5085L0.452574 10.4072L0.00732422 9.82042L0.0528242 9.52692L0.452574 9.25875L1.02424 9.30942L2.28916 9.39542L4.18641 9.52692L5.56257 9.60792L7.60157 9.82042H7.92541L7.97091 9.68883L7.85957 9.60792L7.77357 9.52692L5.81057 8.19633L3.68557 6.78975L2.57257 5.98025L1.97049 5.57042L1.66691 5.18592L1.53541 4.34608L2.08182 3.744L2.81541 3.79458L3.00257 3.84517L3.74632 4.41683L5.33499 5.64633L7.40941 7.17433L7.71299 7.42725L7.83441 7.34125L7.84957 7.28058L7.71291 7.05283L6.58466 5.01392L5.38049 2.9395L4.84424 2.0795L4.70257 1.56333C4.65199 1.35083 4.61657 1.17383 4.61657 0.95625L5.23891 0.11125L5.58282 0L6.41257 0.111333L6.76174 0.414833L7.27774 1.59375L8.11257 3.45058L9.40782 5.97525L9.78724 6.724L9.98966 7.41717L10.0655 7.62967H10.1971V7.50825L10.3033 6.08658L10.5007 4.341L10.6929 2.09458L10.7587 1.46217L11.0723 0.70325L11.6947 0.293417L12.1803 0.526167L12.5801 1.09783L12.5244 1.46725L12.2867 3.01033L11.8212 5.42875L11.5176 7.04783H11.6947L11.8971 6.84542L12.7167 5.75767L14.0928 4.03742L14.7 3.35442L15.4083 2.60058L15.8637 2.24133H16.7237L17.3562 3.18242L17.0729 4.15383L16.1875 5.277L15.4538 6.22817L14.4015 7.64483L13.7437 8.77817L13.8045 8.86925L13.9613 8.854L16.3392 8.34817L17.6243 8.11533L19.1573 7.85225L19.8505 8.17608L19.9263 8.50492L19.6532 9.17783L18.014 9.58258L16.0913 9.96708L13.2277 10.6451L13.1922 10.6704L13.2327 10.721L14.5229 10.8424L15.0744 10.8728H16.4252L18.9398 11.06L19.5975 11.495L19.9922 12.0263L19.9263 12.4311L18.9145 12.9472L17.5484 12.6233L14.3609 11.8644L13.2682 11.5912H13.1163V11.6822L14.0271 12.5728L15.6967 14.0804L17.7862 16.0232L17.8925 16.5039L17.6243 16.8834L17.341 16.8429L15.5044 15.4617L14.7961 14.8393L13.1922 13.4885H13.086V13.6302L13.4553 14.1715L15.4083 17.106L15.5095 18.0066L15.3678 18.3L14.8619 18.4771L14.3053 18.3759L13.1619 16.7721L11.9831 14.9658L11.0319 13.3468L10.9155 13.4127L10.3538 19.4587L10.0908 19.7672L9.48366 20L8.97774 19.6155L8.70957 18.9932L8.97774 17.7638L9.30157 16.1599L9.56466 14.8849L9.80241 13.3012L9.94407 12.7751L9.93399 12.7397L9.81757 12.7548L8.62357 14.3942L6.80724 16.848L5.37032 18.386L5.02632 18.5227L4.42932 18.214L4.48491 17.6625L4.81891 17.1717L6.80724 14.642L8.00632 13.0737L8.78049 12.168L8.77532 12.0364H8.72982L3.44774 15.4668L2.50666 15.5882L2.10191 15.2087L2.15257 14.5864L2.34482 14.384L3.93349 13.2912L3.92841 13.2962Z" fill="currentColor" />
20
- </g>
21
- <defs>
22
- <clipPath id="claude">
23
- <rect width="20" height="20" fill="white" />
24
- </clipPath>
25
- </defs>
26
- </svg>
27
- `,
28
- windsurf: `
29
- <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
30
- <g clip-path="url(#windsurf)">
31
- <path d="M19.625 4.2225C18.6218 4.22084 17.8078 5.03334 17.8078 6.03625V10.0926C17.8078 10.9026 17.1382 11.5588 16.3414 11.5588C15.8681 11.5588 15.3954 11.3204 15.1149 10.9205L10.9722 5.00359C10.6284 4.51225 10.0691 4.21942 9.46358 4.21942C8.51908 4.21942 7.66917 5.02234 7.66917 6.01359V10.0933C7.66917 10.9033 7.00508 11.5595 6.20283 11.5595C5.72783 11.5595 5.25592 11.3212 4.9755 10.9213L0.339667 4.29984C0.235167 4.14984 0 4.224 0 4.40684V7.9445C0 8.12342 0.0546667 8.29684 0.157 8.44367L4.71933 14.9589C4.98883 15.3439 5.3865 15.6299 5.84508 15.7338C6.99267 15.9946 8.04892 15.1113 8.04892 13.9857V9.90817C8.04892 9.09817 8.70517 8.44209 9.51525 8.44209H9.51775C9.75841 8.44214 9.99552 8.50016 10.209 8.61125C10.4225 8.72233 10.6061 8.8832 10.7442 9.08025L14.8878 14.9964C15.2324 15.4885 15.7628 15.7806 16.3956 15.7806C17.3612 15.7806 18.1885 14.9768 18.1885 13.9864V9.90742C18.1885 9.09742 18.8447 8.44125 19.6548 8.44125H19.8165C19.8406 8.4413 19.8645 8.43658 19.8868 8.42738C19.9091 8.41817 19.9293 8.40466 19.9464 8.38762C19.9635 8.37057 19.977 8.35033 19.9862 8.32804C19.9955 8.30576 20.0002 8.28187 20.0002 8.25775V4.40609C20.0002 4.38197 19.9955 4.35808 19.9863 4.33579C19.977 4.31351 19.9635 4.29326 19.9465 4.2762C19.9294 4.25915 19.9092 4.24563 19.8869 4.23641C19.8646 4.2272 19.8407 4.22247 19.8166 4.2225H19.625Z" fill="currentColor" />
32
- </g>
33
- <defs>
34
- <clipPath id="windsurf">
35
- <rect width="20" height="20" fill="white" />
36
- </clipPath>
37
- </defs>
38
- </svg>
39
- `,
40
- gemini: `
41
- <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
42
- <g clip-path="url(#gemini)">
43
- <path d="M20 10.0195C14.6289 10.3477 10.3477 14.6289 10.0195 20H9.98047C9.65234 14.6289 5.37109 10.3477 0 10.0195V9.98047C5.37109 9.65234 9.65234 5.37109 9.98047 0H10.0195C10.3477 5.37109 14.6289 9.65234 20 9.98047V10.0195Z" fill="currentColor" />
44
- </g>
45
- <defs>
46
- <clipPath id="gemini">
47
- <rect width="20" height="20" fill="white" />
48
- </clipPath>
49
- </defs>
50
- </svg>
51
- `,
52
- codex: `
53
- <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
54
- <g clip-path="url(#codex)">
55
- <path d="M18.5681 8.18423C18.7917 7.51079 18.8691 6.79739 18.795 6.09168C18.7209 5.38596 18.497 4.70419 18.1384 4.0919C17.6067 3.16642 16.7948 2.43369 15.8199 1.99936C14.8449 1.56503 13.7572 1.45153 12.7135 1.67523C12.1206 1.0157 11.3646 0.523789 10.5214 0.248906C9.67823 -0.0259764 8.77756 -0.0741542 7.90986 0.109212C7.04216 0.292578 6.23798 0.701031 5.57809 1.29355C4.91821 1.88607 4.42584 2.64179 4.15046 3.48481C3.45518 3.62739 2.79834 3.91672 2.22384 4.33347C1.64933 4.75023 1.1704 5.28481 0.81904 5.90148C0.281569 6.82542 0.0518576 7.89634 0.163116 8.95943C0.274374 10.0225 0.720837 11.0227 1.43796 11.8153C1.21351 12.4884 1.13539 13.2017 1.20883 13.9074C1.28227 14.6132 1.50557 15.2951 1.86379 15.9076C2.39616 16.8334 3.20872 17.5663 4.18438 18.0006C5.16004 18.4349 6.2484 18.5483 7.29262 18.3243C7.76367 18.8548 8.34248 19.2786 8.99038 19.5676C9.63828 19.8566 10.3404 20.004 11.0498 20C12.1195 20.001 13.1618 19.662 14.0263 19.0321C14.8909 18.4021 15.5329 17.5137 15.8596 16.4951C16.5548 16.3523 17.2116 16.0629 17.786 15.6461C18.3605 15.2294 18.8395 14.6949 19.191 14.0784C19.7222 13.1558 19.9479 12.0889 19.836 11.0303C19.7242 9.97163 19.2804 8.9754 18.5681 8.18423ZM11.0498 18.691C10.1737 18.6924 9.32512 18.3853 8.65279 17.8236L8.77104 17.7566L12.753 15.4581C12.8521 15.4 12.9343 15.3171 12.9917 15.2176C13.0491 15.118 13.0796 15.0053 13.0802 14.8904V9.27631L14.7635 10.2501C14.7719 10.2544 14.7791 10.2605 14.7846 10.268C14.7901 10.2755 14.7937 10.2843 14.7952 10.2935V14.9456C14.7931 15.9383 14.3978 16.8898 13.6959 17.5917C12.9939 18.2936 12.0425 18.6889 11.0498 18.691ZM2.99921 15.2531C2.55985 14.4945 2.4021 13.6052 2.55371 12.7417L2.67204 12.8127L6.65787 15.1112C6.7565 15.1691 6.86877 15.1996 6.98312 15.1996C7.09747 15.1996 7.20975 15.1691 7.30837 15.1112L12.1774 12.3041V14.2478C12.1769 14.2579 12.1742 14.2677 12.1694 14.2766C12.1646 14.2855 12.1579 14.2932 12.1497 14.2991L8.11654 16.6251C7.25581 17.121 6.2335 17.255 5.27405 16.9978C4.3146 16.7405 3.49644 16.1131 2.99921 15.2531ZM1.95054 6.57965C2.39294 5.81612 3.09123 5.23375 3.92179 4.93565V9.66665C3.92029 9.78094 3.94949 9.89355 4.00635 9.99271C4.06321 10.0919 4.14564 10.174 4.24504 10.2304L9.09037 13.0256L7.40696 13.9994C7.39785 14.0042 7.38769 14.0068 7.37737 14.0068C7.36706 14.0068 7.3569 14.0042 7.34779 13.9994L3.32254 11.6773C2.46343 11.1793 1.83666 10.3612 1.57951 9.40204C1.32236 8.44291 1.45577 7.42095 1.95054 6.55998V6.57965ZM15.7808 9.79281L10.9197 6.96998L12.5992 5.99998C12.6083 5.99514 12.6185 5.99261 12.6288 5.99261C12.6391 5.99261 12.6493 5.99514 12.6584 5.99998L16.6836 8.32606C17.2991 8.68119 17.8008 9.20407 18.1303 9.83365C18.4597 10.4632 18.6032 11.1735 18.5441 11.8816C18.485 12.5898 18.2257 13.2664 17.7964 13.8327C17.3672 14.3989 16.7857 14.8314 16.1199 15.0796V10.3486C16.1164 10.2345 16.0833 10.1232 16.0238 10.0258C15.9644 9.92833 15.8807 9.8481 15.7808 9.79281ZM17.4564 7.27356L17.338 7.20256L13.3601 4.8844C13.2609 4.82617 13.1479 4.79547 13.0329 4.79547C12.9178 4.79547 12.8049 4.82617 12.7056 4.8844L7.84071 7.6914V5.74781C7.83967 5.73793 7.84132 5.72795 7.84549 5.71893C7.84965 5.70991 7.85618 5.70218 7.86437 5.69656L11.8896 3.3744C12.5065 3.01899 13.2119 2.84659 13.9232 2.87736C14.6345 2.90813 15.3224 3.14079 15.9063 3.54813C16.4903 3.95548 16.9461 4.52066 17.2206 5.17759C17.4952 5.83452 17.577 6.55602 17.4565 7.25773L17.4564 7.27356ZM6.92196 10.7191L5.23862 9.74931C5.2302 9.74424 5.223 9.73738 5.21753 9.72921C5.21205 9.72105 5.20845 9.71178 5.20696 9.70206V5.06181C5.20788 4.34996 5.41144 3.65308 5.79383 3.05265C6.17622 2.45222 6.72164 1.97305 7.36632 1.67118C8.011 1.3693 8.7283 1.2572 9.43434 1.34796C10.1404 1.43873 10.806 1.72861 11.3534 2.18373L11.235 2.25081L7.25321 4.54915C7.1541 4.60727 7.07182 4.69017 7.01445 4.78971C6.95707 4.88925 6.92658 5.00201 6.92596 5.1169L6.92196 10.7191ZM7.83662 8.74798L10.005 7.49815L12.1774 8.74798V11.2475L10.0129 12.4972L7.84062 11.2475L7.83662 8.74798Z" fill="currentColor" />
56
- </g>
57
- <defs>
58
- <clipPath id="codex">
59
- <rect width="20" height="20" fill="white" />
60
- </clipPath>
61
- </defs>
62
- </svg>
63
- `,
64
- };
65
-
66
- const styles = String.raw`
67
- :root {
68
- color-scheme: dark;
69
- --brand-white: #f7f7f7;
70
- --brand-neutral-50: #dbdbdb;
71
- --brand-neutral-100: #a8a8a8;
72
- --brand-neutral-200: #757575;
73
- --brand-neutral-300: #595959;
74
- --brand-neutral-400: #424242;
75
- --brand-neutral-500: #262626;
76
- --brand-neutral-600: #171717;
77
- --brand-black: #000000;
78
- }
79
-
80
- *,
81
- *::before,
82
- *::after {
83
- box-sizing: border-box;
84
- }
85
-
86
- body {
87
- margin: 0;
88
- min-height: 100vh;
89
- background: #050505;
90
- color: var(--brand-white);
91
- font-family: "Geist Sans", "Inter", "SF Pro Display", "Segoe UI", -apple-system, BlinkMacSystemFont, sans-serif;
92
- -webkit-font-smoothing: antialiased;
93
- }
94
-
95
- a {
96
- color: inherit;
97
- text-decoration: none;
98
- }
99
-
100
- main {
101
- max-width: 1200px;
102
- margin: 0 auto;
103
- padding: 0 1.5rem;
104
- display: grid;
105
- grid-template-columns: repeat(12, minmax(0, 1fr));
106
- gap: 20px;
107
- }
108
-
109
- .section {
110
- grid-column: 1 / -1;
111
- padding: 2rem 0;
112
- display: grid;
113
- grid-template-columns: repeat(12, minmax(0, 1fr));
114
- gap: 20px;
115
- }
116
-
117
- .section-content {
118
- grid-column: 1 / -1;
119
- display: flex;
120
- flex-direction: column;
121
- gap: 1.5rem;
122
- }
123
-
124
- @media (min-width: 1024px) {
125
- .section-content {
126
- grid-column: 2 / span 9;
127
- }
128
- }
129
-
130
- .section-header {
131
- display: grid;
132
- grid-template-columns: repeat(12, minmax(0, 1fr));
133
- gap: 1rem;
134
- width: 100%;
135
- }
136
-
137
- .display {
138
- grid-column: span 12;
139
- font-size: clamp(2rem, 3.5vw, 3rem);
140
- line-height: 1.1;
141
- letter-spacing: -0.05em;
142
- font-weight: 500;
143
- margin: 0;
144
- }
145
-
146
- .heading-2 {
147
- grid-column: span 12;
148
- font-size: clamp(1.75rem, 3vw, 2.5rem);
149
- line-height: 1.2;
150
- letter-spacing: -0.03em;
151
- font-weight: 500;
152
- margin: 0;
153
- }
154
-
155
- .text-gradient {
156
- background: linear-gradient(
157
- 270deg,
158
- rgba(247, 247, 247, 0.8) 0%,
159
- #f7f7f7 50%,
160
- rgba(247, 247, 247, 0.8) 100%
161
- );
162
- -webkit-background-clip: text;
163
- background-clip: text;
164
- color: transparent;
165
- }
166
-
167
- .lead {
168
- grid-column: span 12;
169
- font-size: 1.125rem;
170
- color: var(--brand-white);
171
- max-width: 650px;
172
- margin: 0;
173
- line-height: 1.6;
174
- }
175
-
176
- .body-text {
177
- grid-column: span 12;
178
- color: var(--brand-neutral-100);
179
- font-size: 1rem;
180
- line-height: 1.7;
181
- margin: 0;
182
- max-width: 650px;
183
- }
184
-
185
- .connection-grid {
186
- display: grid;
187
- grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
188
- gap: 12px;
189
- width: 100%;
190
- margin-top: 1rem;
191
- }
192
-
193
- .connection-card {
194
- position: relative;
195
- display: flex;
196
- align-items: center;
197
- gap: 1rem;
198
- min-height: 60px;
199
- border: 1px solid var(--brand-neutral-600);
200
- background: rgba(5, 5, 5, 0.85);
201
- padding: 1.25rem 1.5rem;
202
- border-radius: 2px;
203
- color: var(--brand-white);
204
- font-size: 1rem;
205
- font-weight: 500;
206
- overflow: hidden;
207
- cursor: pointer;
208
- transition: border-color 0.2s ease, background 0.2s ease;
209
- }
210
-
211
- .connection-card:hover,
212
- .connection-card:focus-visible {
213
- border-color: var(--brand-neutral-400);
214
- background: rgba(15, 15, 15, 0.85);
215
- }
216
-
217
- .connection-card:focus-visible {
218
- outline: 2px solid var(--brand-white);
219
- outline-offset: 3px;
220
- }
221
-
222
- .icon-badge {
223
- width: 48px;
224
- height: 48px;
225
- border: 1px dashed var(--brand-neutral-400);
226
- border-radius: 0;
227
- display: flex;
228
- align-items: center;
229
- justify-content: center;
230
- background: var(--brand-neutral-600);
231
- flex-shrink: 0;
232
- }
233
-
234
- .icon-badge svg {
235
- width: 24px;
236
- height: 24px;
237
- color: var(--brand-white);
238
- }
239
-
240
- .background-icon {
241
- position: absolute;
242
- inset: 0;
243
- pointer-events: none;
244
- color: var(--brand-neutral-600);
245
- }
246
-
247
- .background-icon svg {
248
- position: absolute;
249
- width: 120px;
250
- height: auto;
251
- right: 16px;
252
- top: 50%;
253
- transform: translateY(-50%);
254
- color: currentColor;
255
- }
256
-
257
- .card-label {
258
- position: relative;
259
- z-index: 2;
260
- color: var(--brand-white);
261
- }
262
-
263
- .code-block {
264
- position: relative;
265
- width: 100%;
266
- margin-top: 1.25rem;
267
- }
268
-
269
- .code-block pre {
270
- margin: 0;
271
- border-radius: 0;
272
- border: 1px solid var(--brand-neutral-500);
273
- background: rgba(8, 8, 8, 0.9);
274
- padding: 1.5rem;
275
- overflow-x: auto;
276
- }
277
-
278
- .code-block code {
279
- font-family: "Geist Mono", "SFMono-Regular", "Consolas", monospace;
280
- color: var(--brand-white);
281
- font-size: 0.85rem;
282
- line-height: 1.6;
283
- display: block;
284
- white-space: pre;
285
- }
286
-
287
- .copy-snippet-btn {
288
- position: absolute;
289
- top: 14px;
290
- right: 14px;
291
- width: 32px;
292
- height: 32px;
293
- display: grid;
294
- place-items: center;
295
- border: none;
296
- background: rgba(0, 0, 0, 0.8);
297
- color: var(--brand-neutral-50);
298
- border-radius: 0;
299
- cursor: pointer;
300
- transition: color 0.2s ease, background 0.2s ease;
301
- z-index: 10;
302
- }
303
-
304
- .copy-snippet-btn:hover,
305
- .copy-snippet-btn:focus-visible {
306
- color: var(--brand-white);
307
- background: rgba(0, 0, 0, 0.95);
308
- outline: none;
309
- }
310
-
311
- .copy-snippet-btn svg {
312
- width: 16px;
313
- height: 16px;
314
- transition: opacity 0.2s ease, transform 0.2s ease;
315
- }
316
-
317
- .copy-snippet-btn svg.hidden {
318
- opacity: 0;
319
- transform: scale(0.8);
320
- }
321
-
322
- .copy-snippet-btn svg.visible {
323
- opacity: 1;
324
- transform: scale(1);
325
- }
326
-
327
- .card-inner {
328
- display: flex;
329
- align-items: center;
330
- gap: 1rem;
331
- width: 100%;
332
- }
333
-
334
- .toast {
335
- position: fixed;
336
- bottom: 24px;
337
- right: 24px;
338
- background: rgba(8, 8, 8, 0.95);
339
- border: 1px solid var(--brand-neutral-500);
340
- border-radius: 0;
341
- padding: 0.75rem 1.25rem;
342
- font-size: 0.9rem;
343
- color: var(--brand-white);
344
- opacity: 0;
345
- transform: translateY(12px) scale(0.98);
346
- transition: opacity 0.3s ease, transform 0.3s ease;
347
- pointer-events: none;
348
- }
349
-
350
- .toast.show {
351
- opacity: 1;
352
- transform: translateY(0) scale(1);
353
- }
354
-
355
- .sr-only {
356
- position: absolute;
357
- width: 1px;
358
- height: 1px;
359
- padding: 0;
360
- margin: -1px;
361
- overflow: hidden;
362
- clip: rect(0, 0, 0, 0);
363
- border: 0;
364
- }
365
- `;
366
-
367
- const createClientScript = (
368
- endpoint: string,
369
- serverName: string | undefined,
370
- serverDescription: string | undefined
371
- ) => `
372
- (() => {
373
- const templateConfig = ${JSON.stringify({
374
- endpoint,
375
- serverName: serverName ?? null,
376
- serverDescription: serverDescription ?? null,
377
- })};
378
-
379
- const elements = {
380
- name: document.getElementById("server-name"),
381
- description: document.getElementById("server-description"),
382
- grid: document.getElementById("connection-grid"),
383
- remoteSnippet: document.getElementById("remote-snippet"),
384
- copyRemoteButton: document.getElementById("copy-remote-snippet"),
385
- copyIcon: document.getElementById("copy-icon"),
386
- checkIcon: document.getElementById("check-icon"),
387
- toast: document.getElementById("toast"),
388
- };
389
-
390
- const resolvedName =
391
- (templateConfig.serverName && templateConfig.serverName.trim()) || "xmcp server";
392
- const resolvedDescription =
393
- (templateConfig.serverDescription && templateConfig.serverDescription.trim()) ||
394
- "${FALLBACK_DESCRIPTION}";
395
- const endpointPath =
396
- (templateConfig.endpoint && templateConfig.endpoint.trim()) || "/";
397
- const normalizedEndpoint = endpointPath.startsWith("/")
398
- ? endpointPath
399
- : \`/\${endpointPath}\`;
400
- const origin = window.location.origin.replace(/\\/$/, "");
401
- const serverUrl = origin + normalizedEndpoint;
402
- const identifier =
403
- resolvedName
404
- .toLowerCase()
405
- .replace(/[^a-z0-9]+/g, "-")
406
- .replace(/(^-|-$)/g, "") || "xmcp-server";
407
-
408
- if (elements.name) {
409
- elements.name.textContent = resolvedName;
410
- }
411
-
412
- if (elements.description) {
413
- elements.description.textContent = resolvedDescription;
414
- }
415
-
416
- const icons = ${JSON.stringify(ICONS)};
417
-
418
- const connectionOptions = [
419
- {
420
- label: "Cursor",
421
- type: "copy",
422
- snippet: \`{
423
- "\${identifier}": {
424
- "url": "\${serverUrl}"
425
- }
426
- }\`,
427
- description: "Copy Cursor connection config",
428
- icon: "cursor",
429
- },
430
- {
431
- label: "Claude Code",
432
- type: "copy",
433
- snippet: \`claude mcp add --transport http "\${identifier}" \\\\\\n "\${serverUrl}"\`,
434
- description: "Copy CLI snippet for Claude Code",
435
- icon: "claude",
436
- },
437
- {
438
- label: "Claude Desktop",
439
- type: "copy",
440
- snippet: \`{
441
- "\${identifier}": {
442
- "command": "npx",
443
- "args": ["-y", "mcp-remote", "\${serverUrl}"]
444
- }
445
- }\`,
446
- description: "Copy Claude Desktop setup command",
447
- icon: "claude",
448
- },
449
- {
450
- label: "Windsurf",
451
- type: "copy",
452
- snippet: \`"\${identifier}": {
453
- "command": "npx",
454
- "args": [
455
- "mcp-remote",
456
- "\${serverUrl}"
457
- ]
458
- }\`,
459
- description: "Copy Windsurf attach command",
460
- icon: "windsurf",
461
- },
462
- {
463
- label: "Gemini CLI",
464
- type: "copy",
465
- snippet: \`gemini mcp add --transport http "\${identifier}" "\${serverUrl}"\`,
466
- description: "Copy Gemini CLI link command",
467
- icon: "gemini",
468
- },
469
- {
470
- label: "Codex",
471
- type: "copy",
472
- snippet: \`[mcp_servers.\${identifier}]
473
- command = "npx"
474
- args = ["-y", "mcp-remote", "\${serverUrl}"]\`,
475
- description: "Copy Codex connect command",
476
- icon: "codex",
477
- },
478
- ];
479
-
480
- if (elements.remoteSnippet) {
481
- const remoteSnippet = JSON.stringify(
482
- {
483
- command: "npx",
484
- args: ["mcp-remote", serverUrl],
485
- },
486
- null,
487
- 2
488
- );
489
- elements.remoteSnippet.textContent = remoteSnippet;
490
- }
491
-
492
- if (elements.copyRemoteButton) {
493
- elements.copyRemoteButton.addEventListener("click", () => {
494
- const snippet = elements.remoteSnippet?.textContent || "";
495
- copyText(snippet)
496
- .then((success) => {
497
- if (success) {
498
- // Animate icon change
499
- if (elements.copyIcon && elements.checkIcon) {
500
- elements.copyIcon.classList.remove("visible");
501
- elements.copyIcon.classList.add("hidden");
502
- elements.checkIcon.classList.remove("hidden");
503
- elements.checkIcon.classList.add("visible");
504
-
505
- // Reset after 2 seconds
506
- setTimeout(() => {
507
- elements.copyIcon?.classList.remove("hidden");
508
- elements.copyIcon?.classList.add("visible");
509
- elements.checkIcon?.classList.remove("visible");
510
- elements.checkIcon?.classList.add("hidden");
511
- }, 2000);
512
- }
513
- } else {
514
- showToast("Unable to copy. Please copy manually.");
515
- }
516
- })
517
- .catch(() => {
518
- showToast("Unable to copy. Please copy manually.");
519
- });
520
- });
521
- }
522
-
523
- if (elements.grid) {
524
- elements.grid.innerHTML = "";
525
- connectionOptions.forEach((option) => {
526
- const isCopy = option.type === "copy";
527
- const card = document.createElement(isCopy ? "button" : "a");
528
- card.className = "connection-card";
529
- if (isCopy) {
530
- card.type = "button";
531
- } else {
532
- card.href = option.href;
533
- card.target = "_blank";
534
- card.rel = "noreferrer";
535
- }
536
-
537
- const inner = document.createElement("span");
538
- inner.className = "card-inner";
539
-
540
- const iconBadge = document.createElement("span");
541
- iconBadge.className = "icon-badge";
542
- iconBadge.innerHTML = icons[option.icon] || "";
543
-
544
- const label = document.createElement("span");
545
- label.className = "card-label";
546
- label.textContent = option.label;
547
-
548
- inner.appendChild(iconBadge);
549
- inner.appendChild(label);
550
- card.appendChild(inner);
551
-
552
- const backgroundIcon = document.createElement("span");
553
- backgroundIcon.className = "background-icon";
554
- backgroundIcon.innerHTML = icons[option.icon] || "";
555
- card.appendChild(backgroundIcon);
556
-
557
- if (isCopy) {
558
- card.addEventListener("click", () => {
559
- copyText(option.snippet)
560
- .then((success) => {
561
- showToast(
562
- success
563
- ? \`\${option.label} connection method copied to clipboard.\`
564
- : "Unable to copy. Please copy manually."
565
- );
566
- })
567
- .catch(() => {
568
- showToast("Unable to copy. Please copy manually.");
569
- });
570
- });
571
- }
572
-
573
- elements.grid?.appendChild(card);
574
- });
575
- }
576
-
577
- function showToast(message) {
578
- if (!elements.toast) return;
579
- elements.toast.textContent = message;
580
- elements.toast.classList.add("show");
581
- setTimeout(() => {
582
- elements.toast && elements.toast.classList.remove("show");
583
- }, 2400);
584
- }
585
-
586
- async function copyText(text) {
587
- if (navigator.clipboard && window.isSecureContext) {
588
- try {
589
- await navigator.clipboard.writeText(text);
590
- return true;
591
- } catch (error) {
592
- return fallbackCopy(text);
593
- }
594
- }
595
- return fallbackCopy(text);
596
- }
597
-
598
- function fallbackCopy(text) {
599
- try {
600
- const textarea = document.createElement("textarea");
601
- textarea.value = text;
602
- textarea.setAttribute("readonly", "");
603
- textarea.style.position = "absolute";
604
- textarea.style.left = "-9999px";
605
- document.body.appendChild(textarea);
606
- textarea.select();
607
- const successful = document.execCommand("copy");
608
- document.body.removeChild(textarea);
609
- return successful;
610
- } catch {
611
- return false;
612
- }
613
- }
614
- })();
615
- `;
616
-
617
- const homeTemplate = (
618
- endpoint: string,
619
- serverName: string | undefined,
620
- serverDescription: string | undefined
621
- ) => `
622
- <!DOCTYPE html>
623
- <html lang="en">
624
- <head>
625
- <meta charset="UTF-8" />
626
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
627
- <title>${serverName || "xmcp server"}</title>
628
- <link
629
- rel="preconnect"
630
- href="https://fonts.googleapis.com"
631
- />
632
- <link
633
- rel="preconnect"
634
- href="https://fonts.gstatic.com"
635
- crossorigin
636
- />
637
- <link
638
- href="https://fonts.googleapis.com/css2?family=Geist+Sans:wght@400;500;600&family=Geist+Mono:wght@400;500&display=swap"
639
- rel="stylesheet"
640
- />
641
- <style>
642
- ${styles}
643
- </style>
644
- </head>
645
- <body>
646
- <main class="template-layout">
647
- <section class="section">
648
- <div class="section-content">
649
- <div class="section-header">
650
- <h2 id="server-name" class="display text-gradient">xmcp server</h2>
651
- <p id="server-description" class="lead">
652
- ${serverDescription || FALLBACK_DESCRIPTION}
653
- </p>
654
- </div>
655
- </div>
656
- </section>
657
-
658
- <section class="section">
659
- <div class="section-content">
660
- <div class="section-header">
661
- <h2 class="heading-2 text-gradient">Connect to a client</h2>
662
- <p class="body-text">
663
- Select your preferred way to connect to your MCP server.
664
- </p>
665
- </div>
666
- <div id="connection-grid" class="connection-grid" aria-live="polite"></div>
667
- </div>
668
- </section>
669
-
670
- <section class="section">
671
- <div class="section-content">
672
- <div class="section-header">
673
- <h2 class="heading-2 text-gradient">Standard connection</h2>
674
- <p class="body-text">
675
- For clients not listed above, you can use the following connection method.
676
- </p>
677
- </div>
678
- <div class="code-block">
679
- <button
680
- type="button"
681
- class="copy-snippet-btn"
682
- id="copy-remote-snippet"
683
- aria-label="Copy standard connection method"
684
- >
685
- <span class="sr-only">Copy standard connection method</span>
686
- <svg
687
- id="copy-icon"
688
- class="visible"
689
- width="16"
690
- height="16"
691
- viewBox="0 0 16 16"
692
- fill="none"
693
- xmlns="http://www.w3.org/2000/svg"
694
- aria-hidden="true"
695
- >
696
- <rect
697
- x="5.25"
698
- y="3"
699
- width="7.5"
700
- height="9.5"
701
- rx="1"
702
- stroke="currentColor"
703
- stroke-width="1.25"
704
- />
705
- <path
706
- d="M3.25 10.75V2.75H9.75"
707
- stroke="currentColor"
708
- stroke-width="1.25"
709
- stroke-linecap="round"
710
- stroke-linejoin="round"
711
- />
712
- </svg>
713
- <svg
714
- id="check-icon"
715
- class="hidden"
716
- width="16"
717
- height="16"
718
- viewBox="0 0 16 16"
719
- fill="none"
720
- xmlns="http://www.w3.org/2000/svg"
721
- aria-hidden="true"
722
- style="position: absolute;"
723
- >
724
- <path
725
- d="M13.5 4L6 11.5L2.5 8"
726
- stroke="currentColor"
727
- stroke-width="1.5"
728
- stroke-linecap="round"
729
- stroke-linejoin="round"
730
- />
731
- </svg>
732
- </button>
733
- <pre><code id="remote-snippet"></code></pre>
734
- </div>
735
- </div>
736
- </section>
737
- </main>
738
- <div id="toast" class="toast" role="status" aria-live="polite"></div>
739
- <script>
740
- ${createClientScript(endpoint, serverName, serverDescription)}
741
- </script>
742
- </body>
743
- </html>
744
- `;
745
-
746
- export default homeTemplate;