Below are example templates for MCP servers using Sigyl. Each example includes a server.ts (or server.js) and a matching sigyl.yaml configuration. Use these as starting points for your own projects.
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";export default function createStatelessServer() { const server = new McpServer({ name: "minimal-mcp-server", version: "1.0.0", }); server.tool( "echo", "Echo a string value", { value: { type: "string", description: "String to echo" } }, async ({ value }) => ({ content: [{ type: "text", text: value }] }) ); return server.server;}
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";import { z } from "zod";export default function createStatelessServer({ config }: { config: any }) { const server = new McpServer({ name: "secure-mcp-server", version: "1.0.0", }); server.tool( "reverseString", "Reverse a string value", { value: z.string().describe("String to reverse") }, async ({ value }) => ({ content: [{ type: "text", text: value.split("").reverse().join("") }], }) ); // Use config.apiKey or other secrets as needed // Example: console.log("API Key:", config.apiKey); return server.server;}