Skip to main content
Glama
models.ts3.58 kB
/** * HUMMBL Resources * MCP resources for direct URI-based access to models and transformations */ import { McpServer, ResourceTemplate } from "@modelcontextprotocol/sdk/server/mcp.js"; import { getAllModels, getModelByCode, getTransformationByKey } from "../framework/base120.js"; import { isOk, isTransformationType } from "../types/domain.js"; /** * Register HUMMBL resources with the MCP server. */ export function registerModelResources(server: McpServer): void { // Resource: Individual model by code server.registerResource( "model-by-code", new ResourceTemplate("hummbl://model/{code}", { list: undefined }), { title: "HUMMBL Mental Model", description: "Access individual mental model by code (e.g., hummbl://model/P1)", mimeType: "application/json", }, async (uri: URL, variables: Record<string, string | string[]>) => { const rawCode = variables.code; const code = Array.isArray(rawCode) ? rawCode[0] : rawCode; const normalizedCode = code.toUpperCase(); const result = getModelByCode(normalizedCode); if (!isOk(result)) { throw new Error( `Model code '${code}' not found. Use valid HUMMBL Base120 codes like P1, IN3, CO5.` ); } const model = result.value; return { contents: [ { uri: uri.href, mimeType: "application/json", text: JSON.stringify(model, null, 2), }, ], }; } ); // Resource: All models in a transformation server.registerResource( "transformation-models", new ResourceTemplate("hummbl://transformation/{type}", { list: undefined }), { title: "HUMMBL Transformation Models", description: "Access all models in a transformation (e.g., hummbl://transformation/P)", mimeType: "application/json", }, async (uri: URL, variables: Record<string, string | string[]>) => { const rawType = variables.type; const type = Array.isArray(rawType) ? rawType[0] : rawType; if (!type) { throw new Error("Transformation type is required (P, IN, CO, DE, RE, SY)."); } const upperType = type.toUpperCase(); if (!isTransformationType(upperType)) { throw new Error( `Transformation '${type}' not found. Valid transformations are: P, IN, CO, DE, RE, SY.` ); } const result = getTransformationByKey(upperType); if (!isOk(result)) { throw new Error( `Transformation '${type}' not found. Valid transformations are: P, IN, CO, DE, RE, SY.` ); } const transformation = result.value; return { contents: [ { uri: uri.href, mimeType: "application/json", text: JSON.stringify(transformation, null, 2), }, ], }; } ); // Resource: All models (complete framework) server.registerResource( "all-models", "hummbl://models", { title: "All HUMMBL Models", description: "Complete Base120 framework with all 120 mental models.", mimeType: "application/json", }, async (uri: URL) => { const allModels = getAllModels(); const payload = { version: "1.0.0-beta.1", model_count: allModels.length, models: allModels, }; return { contents: [ { uri: uri.href, mimeType: "application/json", text: JSON.stringify(payload, null, 2), }, ], }; } ); }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/hummbl-dev/mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server