UNPKG

mcp-framework

Version:

Framework for building Model Context Protocol (MCP) servers in Typescript

26 lines (25 loc) 700 B
export class MCPResource { description; mimeType; get resourceDefinition() { return { uri: this.uri, name: this.name, description: this.description, mimeType: this.mimeType, }; } async subscribe() { throw new Error("Subscription not implemented for this resource"); } async unsubscribe() { throw new Error("Unsubscription not implemented for this resource"); } async fetch(url, init) { const response = await fetch(url, init); if (!response.ok) { throw new Error(`HTTP error! status: ${response.status}`); } return response.json(); } }