// notify-mcp.ts
import { Server } from "@modelcontextprotocol/sdk/server";
const server = new Server({
name: "notify",
version: "1.0.0"
});
server.setRequestHandler("tools/list", async () => ({
tools: [
{
name: "send",
description: "Send a notification",
inputSchema: {
type: "object",
properties: {
channel: { type: "string", description: "Channel to notify" },
message: { type: "string", description: "Message content" }
},
required: ["channel", "message"]
}
}
]
}));
server.setRequestHandler("tools/call", async (request) => {
const { name, arguments: args } = request.params;
if (name === "send") {
// Send notification via webhook
await fetch(process.env.WEBHOOK_URL, {
method: "POST",
body: JSON.stringify(args)
});
return { content: [{ type: "text", text: "Notification sent" }] };
}
});
server.connect(process.stdin, process.stdout);