@kinetixarts/server-craft-it
Version:
Craft IT - Model Context Protocol (MCP) compliant Server for AI-Powered Asset Generation using Gemini
51 lines • 1.54 kB
JavaScript
import { assetStore } from "./assetStore.js";
/**
* Register all resources with the MCP server
* @param server The FastMCP server instance
*/
export function registerResources(server) {
// Example resource
server.addResourceTemplate({
uriTemplate: "asset://{asset_id}",
name: "Generated Asset",
mimeType: "image/png", // or "image/*" if you want to support multiple formats
arguments: [
{
name: "asset_id",
description: "Unique identifier for the generated asset",
required: true,
},
],
async load({ asset_id }) {
const asset = assetStore[asset_id];
if (asset) {
return {
data: asset.base64,
mimeType: asset.mimeType,
text: "",
};
}
else {
return {
text: `Asset with ID ${asset_id} not found (placeholder)`
};
}
}
});
// Health check resource
server.addResource({
name: "Health Check",
mimeType: "application/json",
uri: "health://check",
async load() {
return {
text: JSON.stringify({
status: "ok",
timestamp: new Date().toISOString(),
service: "craft-it-mcp-asset-generator"
})
};
}
});
}
//# sourceMappingURL=resources.js.map