fix: add mimeType to resource declarations in examples (#149)

According to spec, mimeType should be present in both the resource
declaration and the resource content. This adds the missing mimeType
to the registerResource() declaration (third parameter) in all example
servers and the quickstart documentation.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: ochafik <olivier.chafik@gmail.com>
This commit is contained in:
Anton Pidkuiko 2025-12-15 19:09:47 +07:00 • committed by GitHub
commit 8550545ccb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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();