Before starting any work, please open an Issue to discuss the changes you'd like to make; let's make sure we don't duplicate effort.
Please do all your work on a fork of the repository and open a PR against the main branch.
npm run build
npm run start
- Download the Stability AI OpenAPI schema: https://platform.stability.ai/docs/api-reference
- Run the following command to generate the types:
npx openapi-typescript openapi.json -o /path/to/mcp-server-stability/src/stabilityAiApi/types.ts
npx @modelcontextprotocol/inspector node path/to/mcp-server-stability-ai/build/index.js
tail -n 20 -f ~/Library/Logs/Claude/mcp*.log
Helpful for isolating and trying out pieces of code.
- Create a
src/test.ts
file. - Write something like this in it
import * as dotenv from "dotenv";
import { StabilityAiApiClient } from "./stabilityAi/stabilityAiApiClient.js";
import * as fs from "fs";
dotenv.config();
if (!process.env.STABILITY_AI_API_KEY) {
throw new Error("STABILITY_AI_API_KEY is required in .env file");
}
const API_KEY = process.env.STABILITY_AI_API_KEY;
async function test() {
const client = new StabilityAiApiClient(API_KEY);
const data = await client.generateImageCore(
"A beautiful sunset over mountains"
);
// Create the directory if it doesn't exist
fs.mkdirSync("stabilityAi", { recursive: true });
// Write data to file
fs.writeFileSync("stabilityAi/test.png", data.base64Image, "base64");
console.log("Image saved to stabilityAi/test.png");
}
test().catch(console.error);
npm run build
andnode build/test.js
npm run build
Delete any files that shouldn't be published (e.g. build/test.js
). Then run:
npm run publish
TODO: Automate these steps.