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:
parent
372c24181e
commit
8550545ccb
1 changed files with 31 additions and 20 deletions
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Reference in a new issue