Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ describe('StreamableHttpTransport', () => {
st.loadLogo();

st.setServerConfig({
name: 'DocTest',
name: 'Documentation<Server> Test',
version: '1.0.0',
description: 'A test server'
description: 'This is a test <b>Server</b>'
});

st.setToolsCallback(async () => [
Expand All @@ -45,7 +45,8 @@ describe('StreamableHttpTransport', () => {
'http://localhost:3060/mcp'
);

expect(html).toContain('DocTest');
expect(html).toContain('Documentation&lt;Server&gt; Test');
expect(html).toContain('This is a test &lt;b&gt;Server&lt;/b&gt;');
expect(html).toContain('1.0.0');
expect(html).toContain('tool1');
expect(html).toContain('Has UI Widget');
Expand Down
18 changes: 14 additions & 4 deletions typescript/packages/core/src/core/transports/streamable-http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -985,9 +985,19 @@ export class StreamableHttpTransport implements Transport {
* Generate HTML documentation page
*/
private generateDocumentationPage(tools: McpTool[], mcpEndpoint: string): string {
const serverName = this.serverConfig?.name || 'NitroStack MCP Server';
const serverVersion = this.serverConfig?.version || '1.0.0';
const serverDescription = this.serverConfig?.description || 'A powerful MCP server built with NitroStack';
const serverName = this.escapeHtml(
this.serverConfig?.name || 'NitroStack MCP Server'
);

const serverVersion = this.escapeHtml(
this.serverConfig?.version || '1.0.0'
);

const serverDescription = this.escapeHtml(
this.serverConfig?.description || 'A powerful MCP server built with NitroStack'
);

const safeMcpEndpoint = this.escapeHtml(mcpEndpoint);

return `<!DOCTYPE html>
<html lang="en">
Expand Down Expand Up @@ -1394,7 +1404,7 @@ export class StreamableHttpTransport implements Transport {
<h2>🔌 Connection Information</h2>
<div class="connection-info">
<p>MCP Endpoint</p>
<code>${mcpEndpoint}</code>
<code>${safeMcpEndpoint}</code>
<p class="description">
Connect to this MCP server using the endpoint above. The server supports Server-Sent Events (SSE) for real-time bidirectional communication following the Model Context Protocol specification.
</p>
Expand Down