modality-mcp-kit 1.4.0 → 1.4.2

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.
@@ -11,7 +11,7 @@ const connectAIShowcase = (serverName, serverUrl, mcpPath = "/mcp") => ({
11
11
  claudeCode: {
12
12
  name: "Claude Code",
13
13
  description: "Official Claude IDE tool for seamless development workflow",
14
- connectionCode: `claude mcp add -s user --transport http ${serverName} ${serverUrl}${mcpPath}`,
14
+ connectionCode: `claude mcp add -s user --transport http ${serverName} {serverUrl}${mcpPath}`,
15
15
  type: "editor",
16
16
  },
17
17
  githubCli: {
@@ -23,7 +23,7 @@ const connectAIShowcase = (serverName, serverUrl, mcpPath = "/mcp") => ({
23
23
  "mcpServers": {
24
24
  "${serverName}": {
25
25
  "type": "http",
26
- "url": "${serverUrl}${mcpPath}",
26
+ "url": "{serverUrl}${mcpPath}",
27
27
  "headers": {},
28
28
  "tools": ["*"]
29
29
  }
@@ -34,7 +34,7 @@ const connectAIShowcase = (serverName, serverUrl, mcpPath = "/mcp") => ({
34
34
  vscode: {
35
35
  name: "VS Code",
36
36
  description: "Popular code editor with MCP extension support",
37
- connectionCode: `code --add-mcp '{"name":"${serverName}", "url": "${serverUrl}${mcpPath}", "type": "http"}'`,
37
+ connectionCode: `code --add-mcp '{"name":"${serverName}", "url": "{serverUrl}${mcpPath}", "type": "http"}'`,
38
38
  type: "editor",
39
39
  },
40
40
  mytyAi: {
@@ -46,7 +46,7 @@ const connectAIShowcase = (serverName, serverUrl, mcpPath = "/mcp") => ({
46
46
  "command": "npx",
47
47
  "args": [
48
48
  "mcp-remote",
49
- "${serverUrl}${mcpPath}"
49
+ "{serverUrl}${mcpPath}"
50
50
  ]
51
51
  }
52
52
  }
@@ -58,7 +58,7 @@ const connectAIShowcase = (serverName, serverUrl, mcpPath = "/mcp") => ({
58
58
  // DEMO CONTENT - MARKDOWN-BASED
59
59
  // ============================================
60
60
  const generateDemoDocumentation = (serverName, serverUrl, mcpPath = "/mcp", helloWorld) => {
61
- const tools = connectAIShowcase(serverName, serverUrl, mcpPath);
61
+ const tools = connectAIShowcase(serverName, "{serverUrl}", mcpPath);
62
62
  return `# MCP Connection Guide
63
63
 
64
64
  ${helloWorld ? `## Hello Prompt\n\n${helloWorld}\n` : ""}## How to Connect
@@ -101,20 +101,8 @@ export const mcpConnectionDemoHandler = async (c, config) => {
101
101
  const format = c.req.query("format") || config?.defaultFormat || defaultOutputFormat;
102
102
  const serverName = config?.serverName || "mcp-server";
103
103
  const mcpPath = config?.mcpPath || "/mcp";
104
- // Get server URL: from config first, then extract from request
105
- let serverUrl = "";
106
- if (!config?.serverUrl && c.req.url) {
107
- try {
108
- const url = new URL(c.req.url);
109
- serverUrl = `${url.protocol}//${url.host}`;
110
- }
111
- catch {
112
- // Fallback to default if URL parsing fails
113
- }
114
- }
115
- else if (config?.serverUrl) {
116
- serverUrl = config?.serverUrl;
117
- }
104
+ // Get server URL: from config only (client-side will detect actual protocol)
105
+ let serverUrl = config?.serverUrl || "";
118
106
  const tools = connectAIShowcase(serverName, serverUrl, mcpPath);
119
107
  const documentation = generateDemoDocumentation(serverName, serverUrl, mcpPath, config?.helloWorld);
120
108
  // Handle different format requests
@@ -428,16 +416,14 @@ function generateHtmlPage(serverUrl, config, tools, mcpPath = "/mcp") {
428
416
  <header>
429
417
  <h1>🌐 ${config?.serverName || "MCP Connection Demo"}</h1>
430
418
  <p>Interactive guide for connecting AI tools and development utilities</p>
431
- ${config
432
- ? `<p style="font-size: 0.95rem; margin-top: 1rem; opacity: 0.8;">Server: <strong>${config.serverName}</strong> v${config.serverVersion || "unknown"}</p>`
433
- : ""}
419
+ <p style="font-size: 0.95rem; margin-top: 1rem; opacity: 0.9;">Server URL: <strong id="server-url-display" style="color: #ffd700; background: rgba(255, 215, 0, 0.2); padding: 0.25rem 0.5rem; border-radius: 4px; font-weight: 700;">${serverUrl ? serverUrl + mcpPath : "Detecting..."}</strong></p>
434
420
  </header>
435
421
 
436
422
  <div class="content">
437
423
  ${config?.helloWorld
438
424
  ? `<div class="intro-section">
439
425
  <h2>Hello Prompt</h2>
440
- <p>${config.helloWorld}</p>
426
+ <code>${config.helloWorld}</code>
441
427
  </div>`
442
428
  : `<div class="intro-section">
443
429
  <h2>Welcome to MCP</h2>
@@ -462,12 +448,33 @@ function generateHtmlPage(serverUrl, config, tools, mcpPath = "/mcp") {
462
448
  <footer>
463
449
  <p>${config?.serverName || "MCP Connection Demo"} &copy; 2026 | Last updated: ${new Date().toLocaleDateString()}</p>
464
450
  ${config
465
- ? `<p>Server: <strong>${config.serverName}</strong> | URL: <code>${serverUrl}</code></p>`
451
+ ? `<p>Server: <strong>${config.serverName} ${config.serverVersion ? `v${config.serverVersion}` : ""}</strong></p>`
466
452
  : ""}
467
453
  </footer>
468
454
  </div>
469
455
 
470
456
  <script>
457
+ // Detect client-side protocol and replace placeholders
458
+ function initializeServerUrl() {
459
+ const protocol = window.location.protocol.replace(':', '');
460
+ const host = window.location.host;
461
+ const serverUrl = protocol + '://' + host;
462
+ const mcpPath = '${mcpPath}';
463
+
464
+ // Update server URL display
465
+ const displayElement = document.getElementById('server-url-display');
466
+ if (displayElement) {
467
+ displayElement.textContent = serverUrl + mcpPath;
468
+ }
469
+
470
+ // Replace {serverUrl} placeholders in all code blocks
471
+ document.querySelectorAll('pre code').forEach(codeBlock => {
472
+ let code = codeBlock.textContent;
473
+ code = code.replace(/{serverUrl}/g, serverUrl);
474
+ codeBlock.textContent = code;
475
+ });
476
+ }
477
+
471
478
  function copyToClipboard(text) {
472
479
  navigator.clipboard.writeText(text).then(() => {
473
480
  const btn = event.target;
@@ -482,6 +489,13 @@ function generateHtmlPage(serverUrl, config, tools, mcpPath = "/mcp") {
482
489
  });
483
490
  }
484
491
 
492
+ // Initialize on DOM ready
493
+ if (document.readyState === 'loading') {
494
+ document.addEventListener('DOMContentLoaded', initializeServerUrl);
495
+ } else {
496
+ initializeServerUrl();
497
+ }
498
+
485
499
  // Log page load performance
486
500
  window.addEventListener('load', () => {
487
501
  const perfData = performance.getEntriesByType('navigation')[0];
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.4.0",
2
+ "version": "1.4.2",
3
3
  "name": "modality-mcp-kit",
4
4
  "repository": {
5
5
  "type": "git",