mcp-server-ddd-sample
Version:
A sample of MCP implementation using DDD structure with some APIs call.
23 lines (22 loc) • 725 B
JavaScript
export class UmbrelApiClientService {
API_BASE = "http://umbrel.local:3006/api";
API_VERSION = "v1";
// Helper function for making NWS API requests
async makeRequest(endpoint) {
const url = `${this.API_BASE}/${this.API_VERSION}/${endpoint}`;
const headers = {
Accept: "application/json",
};
try {
const response = await fetch(url, { headers });
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
return (await response.json());
}
catch (error) {
console.error("Error making umbrel request:", error);
return null;
}
}
}