Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,12 +238,21 @@ async function main() {
const splashPath = path.join(srcStaticDir, 'index.html');
let html = fs.readFileSync(splashPath, 'utf8');

// Inject example server endpoints
const exampleServersHtml = AVAILABLE_EXAMPLES.map(slug => `
<div class="endpoint">
<span class="method post">POST</span>
<span>/${slug}/mcp - ${formatServerName(slug)} MCP App Server</span>
</div>`).join('');
// Inject example server endpoints with copy buttons
const exampleServersHtml = AVAILABLE_EXAMPLES.map(slug => {
const fullUrl = `${config.baseUri}/${slug}/mcp`;
return `
<div class="endpoint endpoint-with-copy">
<div class="endpoint-info">
<span class="method post">POST</span>
<span>/${slug}/mcp - ${formatServerName(slug)} MCP App Server</span>
</div>
<button class="copy-btn" onclick="copyUrl(this, '${fullUrl}')">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path></svg>
<span class="btn-text">Copy</span>
</button>
</div>`;
}).join('');
html = html.replace('<!-- EXAMPLE_SERVERS_PLACEHOLDER -->', exampleServersHtml);

res.send(html);
Expand Down
23 changes: 22 additions & 1 deletion src/static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,30 @@ <h2>MCP App Example Servers</h2>

<footer>
<p>
Built by the <a href="https://modelcontextprotocol.io">Model Context Protocol</a> team
Built by the <a href="https://modelcontextprotocol.io">Model Context Protocol</a> team
as a reference implementation for the MCP ecosystem.
</p>
</footer>

<script>
function copyUrl(btn, url) {
// Fallback for non-HTTPS contexts
const textarea = document.createElement('textarea');
textarea.value = url;
textarea.style.position = 'fixed';
textarea.style.opacity = '0';
document.body.appendChild(textarea);
textarea.select();
document.execCommand('copy');
document.body.removeChild(textarea);

btn.classList.add('copied');
btn.querySelector('.btn-text').textContent = 'Copied!';
setTimeout(() => {
btn.classList.remove('copied');
btn.querySelector('.btn-text').textContent = 'Copy';
}, 2000);
}
</script>
</body>
</html>
38 changes: 38 additions & 0 deletions src/static/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,44 @@ h1 {
gap: 1rem;
}

.endpoint-with-copy {
justify-content: space-between;
}

.endpoint-info {
display: flex;
align-items: center;
gap: 1rem;
flex: 1;
}

.copy-btn {
background: #000000;
color: #ffffff;
border: none;
padding: 0.4rem 0.75rem;
font-family: inherit;
font-size: 0.85rem;
cursor: pointer;
transition: all 0.2s ease;
display: flex;
align-items: center;
gap: 0.4rem;
}

.copy-btn:hover {
background: #333333;
}

.copy-btn.copied {
background: #009900;
}

.copy-btn svg {
width: 14px;
height: 14px;
}

.method {
font-weight: bold;
min-width: 80px;
Expand Down