UNPKG

@tsavo/printify-mcp

Version:

A Model Context Protocol (MCP) server for integrating AI assistants with Printify's print-on-demand platform

52 lines 2.01 kB
// Export the main classes and types for use as a library export { PrintifyAPI } from './printify-api.js'; export { ReplicateClient } from './replicate-client.js'; // Export a function to create and configure the MCP server import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; import { PrintifyAPI } from "./printify-api.js"; import { ReplicateClient } from "./replicate-client.js"; import dotenv from "dotenv"; /** * Creates and configures a Printify MCP server * @param options Configuration options * @returns The configured MCP server */ export function createPrintifyMcpServer(options) { // Load environment variables if not explicitly provided if (!options?.printifyApiKey || !options?.replicateApiToken) { dotenv.config(); } // Create the MCP server const server = new McpServer({ name: options?.serverName || "Printify-MCP", version: options?.serverVersion || "1.0.0" }); // Initialize API clients const printifyApiKey = options?.printifyApiKey || process.env.PRINTIFY_API_KEY; const printifyShopId = options?.printifyShopId || process.env.PRINTIFY_SHOP_ID; const replicateApiToken = options?.replicateApiToken || process.env.REPLICATE_API_TOKEN; // Create the Printify API client if API key is provided let printifyClient = null; if (printifyApiKey) { printifyClient = new PrintifyAPI(printifyApiKey, printifyShopId); } // Create the Replicate API client if API token is provided let replicateClient = null; if (replicateApiToken) { replicateClient = new ReplicateClient(replicateApiToken); } return { server, printifyClient, replicateClient, async initialize() { if (printifyClient) { await printifyClient.initialize(); } return { printifyClient, replicateClient }; } }; } // Default export export default createPrintifyMcpServer; //# sourceMappingURL=exports.js.map