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
27 changes: 16 additions & 11 deletions docs/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,17 +130,22 @@ server.registerTool(
},
);

server.registerResource(resourceUri, resourceUri, {}, async () => {
const html = await fs.readFile(
path.join(import.meta.dirname, "dist", "mcp-app.html"),
"utf-8",
);
return {
contents: [
{ uri: resourceUri, mimeType: "text/html;profile=mcp-app", text: html },
],
};
});
server.registerResource(
resourceUri,
resourceUri,
{ mimeType: "text/html;profile=mcp-app" },
async () => {
const html = await fs.readFile(
path.join(import.meta.dirname, "dist", "mcp-app.html"),
"utf-8",
);
return {
contents: [
{ uri: resourceUri, mimeType: "text/html;profile=mcp-app", text: html },
],
};
},
);

// Express server for MCP endpoint
const app = express();
Expand Down
2 changes: 1 addition & 1 deletion examples/basic-server-react/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function createServer(): McpServer {
server.registerResource(
RESOURCE_URI,
RESOURCE_URI,
{},
{ mimeType: RESOURCE_MIME_TYPE },
async (): Promise<ReadResourceResult> => {
const html = await fs.readFile(path.join(DIST_DIR, "mcp-app.html"), "utf-8");

Expand Down
2 changes: 1 addition & 1 deletion examples/basic-server-vanillajs/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function createServer(): McpServer {
server.registerResource(
RESOURCE_URI,
RESOURCE_URI,
{},
{ mimeType: RESOURCE_MIME_TYPE },
async (): Promise<ReadResourceResult> => {
const html = await fs.readFile(path.join(DIST_DIR, "mcp-app.html"), "utf-8");

Expand Down
5 changes: 4 additions & 1 deletion examples/budget-allocator-server/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,10 @@ function createServer(): McpServer {
server.registerResource(
resourceUri,
resourceUri,
{ description: "Interactive Budget Allocator UI" },
{
mimeType: RESOURCE_MIME_TYPE,
description: "Interactive Budget Allocator UI",
},
async (): Promise<ReadResourceResult> => {
const html = await fs.readFile(
path.join(DIST_DIR, "mcp-app.html"),
Expand Down
2 changes: 1 addition & 1 deletion examples/cohort-heatmap-server/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ function createServer(): McpServer {
server.registerResource(
resourceUri,
resourceUri,
{},
{ mimeType: RESOURCE_MIME_TYPE },
async (): Promise<ReadResourceResult> => {
const html = await fs.readFile(
path.join(DIST_DIR, "mcp-app.html"),
Expand Down
5 changes: 4 additions & 1 deletion examples/customer-segmentation-server/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,10 @@ function createServer(): McpServer {
server.registerResource(
resourceUri,
resourceUri,
{ description: "Customer Segmentation Explorer UI" },
{
mimeType: RESOURCE_MIME_TYPE,
description: "Customer Segmentation Explorer UI",
},
async (): Promise<ReadResourceResult> => {
const html = await fs.readFile(
path.join(DIST_DIR, "mcp-app.html"),
Expand Down
2 changes: 1 addition & 1 deletion examples/scenario-modeler-server/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ function createServer(): McpServer {
server.registerResource(
resourceUri,
resourceUri,
{ description: "SaaS Scenario Modeler UI" },
{ mimeType: RESOURCE_MIME_TYPE, description: "SaaS Scenario Modeler UI" },
async (): Promise<ReadResourceResult> => {
const html = await fs.readFile(
path.join(DIST_DIR, "mcp-app.html"),
Expand Down
2 changes: 1 addition & 1 deletion examples/system-monitor-server/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ function createServer(): McpServer {
server.registerResource(
resourceUri,
resourceUri,
{ description: "System Monitor UI" },
{ mimeType: RESOURCE_MIME_TYPE, description: "System Monitor UI" },
async (): Promise<ReadResourceResult> => {
const html = await fs.readFile(
path.join(DIST_DIR, "mcp-app.html"),
Expand Down
2 changes: 1 addition & 1 deletion examples/threejs-server/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ function createServer(): McpServer {
server.registerResource(
resourceUri,
resourceUri,
{ description: "Three.js Widget UI" },
{ mimeType: RESOURCE_MIME_TYPE, description: "Three.js Widget UI" },
async (): Promise<ReadResourceResult> => {
const html = await fs.readFile(
path.join(DIST_DIR, "mcp-app.html"),
Expand Down
2 changes: 1 addition & 1 deletion examples/wiki-explorer-server/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ function createServer(): McpServer {
server.registerResource(
resourceUri,
resourceUri,
{},
{ mimeType: RESOURCE_MIME_TYPE },
async (): Promise<ReadResourceResult> => {
const html = await fs.readFile(
path.join(DIST_DIR, "mcp-app.html"),
Expand Down
Loading