feat: add mcp server, reorganize repo

This commit is contained in:
2026-09-03 17:20:08 +05:00
parent c1dda4d257
commit 1fd8ad6b50
48 changed files with 1691 additions and 12467 deletions
+38
View File
@@ -0,0 +1,38 @@
import type { McpServer } from "@modelcontextprotocol/server";
import { z } from "zod";
const QUACKS = {
happy: ["QUACK! 🎉", "Quack quack! 😄", "QUAAACK! 🦆✨"],
confused: ["Qu...ack?", "Quack? 🤔", "Quaaack...?"],
excited: ["QUACK QUACK QUACK!", "QUAAACK!! 🔥", "Quack! Quack! Quack!"],
sleepy: ["quack... 😴", "quaack... 💤", "quack. *yawn*"],
default: ["Quack!", "Quack quack!", "QUACK!", "Quaaack!", "Quack. 🦆"],
} as const;
const MOODS = ["happy", "confused", "excited", "sleepy"] as const;
function randomFrom<T>(arr: readonly T[]): T {
return arr[Math.floor(Math.random() * arr.length)];
}
export function registerDuckTools(server: McpServer): void {
server.registerTool(
"quack",
{
title: "Quack",
description:
"Rubber duck quacks. Use when you're stuck, looping, or hallucinating. " +
"The act of calling forces you to articulate your current thinking out loud.",
inputSchema: z.object({
mood: z
.enum(MOODS)
.optional()
.describe("Mood of the duck. Omit for a random quack."),
}),
},
async ({ mood }) => {
const text = mood ? randomFrom(QUACKS[mood]) : randomFrom(QUACKS.default);
return { content: [{ type: "text", text }] };
},
);
}