skills/mcp-server/SKILL.md
Build production MCP (Model Context Protocol) servers that let AI clients call your tools and read your data. Covers tool registration with Zod validation, resource handlers, prompt templates, stdio and HTTP transports, session management, error handling, testing, and deployment. Use when building MCP servers or tools for AI integration.
npx skillsauth add RaheesAhmed/SajiCode mcp-serverInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
mkdir my-mcp-server && cd my-mcp-server
npm init -y
npm install @modelcontextprotocol/server zod
npm install -D typescript @types/node
{
"type": "module",
"bin": { "my-mcp-server": "dist/index.js" },
"scripts": { "build": "tsc", "start": "node dist/index.js" }
}
{
"compilerOptions": {
"target": "ES2022", "module": "NodeNext", "moduleResolution": "NodeNext",
"outDir": "dist", "strict": true, "esModuleInterop": true, "skipLibCheck": true
},
"include": ["src"]
}
src/
├── index.ts # Entry point, server + transport setup
├── tools/ # Tool handler files
│ ├── search.ts
│ └── compute.ts
├── resources/ # Resource handlers
│ └── config.ts
└── utils/ # Shared utilities
└── errors.ts
import { McpServer } from "@modelcontextprotocol/server/mcp.js";
import { z } from "zod";
const server = new McpServer({ name: "my-server", version: "1.0.0" });
server.registerTool("calculate-bmi", {
title: "BMI Calculator",
description: "Calculate Body Mass Index from weight and height",
inputSchema: z.object({
weightKg: z.number().positive(),
heightM: z.number().positive(),
}),
outputSchema: z.object({ bmi: z.number(), category: z.string() }),
}, async ({ weightKg, heightM }) => {
const bmi = weightKg / (heightM * heightM);
const category = bmi < 18.5 ? "underweight" : bmi < 25 ? "normal" : bmi < 30 ? "overweight" : "obese";
return {
content: [{ type: "text", text: `BMI: ${bmi.toFixed(1)} (${category})` }],
structuredContent: { bmi: Number(bmi.toFixed(1)), category },
};
});
server.registerTool("fetch-url", {
title: "Fetch URL",
description: "Fetch content from a URL and return as text",
inputSchema: z.object({
url: z.string().url(),
timeout: z.number().optional().default(10000),
}),
}, async ({ url, timeout }) => {
try {
const controller = new AbortController();
const timer = setTimeout(() => controller.abort(), timeout);
const response = await fetch(url, { signal: controller.signal });
clearTimeout(timer);
if (!response.ok) {
return { content: [{ type: "text", text: `HTTP ${response.status}: ${response.statusText}` }], isError: true };
}
const text = await response.text();
return { content: [{ type: "text", text: text.slice(0, 50000) }] };
} catch (error) {
const message = error instanceof Error ? error.message : "Unknown error";
return { content: [{ type: "text", text: `Fetch failed: ${message}` }], isError: true };
}
});
server.registerTool("read-file", {
title: "Read File",
description: "Read a file from disk",
inputSchema: z.object({ path: z.string() }),
annotations: { readOnlyHint: true, openWorldHint: false },
}, async ({ path }) => {
const content = await fs.readFile(path, "utf-8");
return { content: [{ type: "text", text: content }] };
});
server.registerResource("config", "config://app", {
title: "App Configuration",
description: "Current application configuration",
mimeType: "application/json",
}, async (uri) => ({
contents: [{ uri: uri.href, text: JSON.stringify(getConfig(), null, 2) }],
}));
import { ResourceTemplate } from "@modelcontextprotocol/server/mcp.js";
server.registerResource("user-profile",
new ResourceTemplate("user://{userId}/profile", {
list: async () => ({
resources: users.map((u) => ({ uri: `user://${u.id}/profile`, name: u.name })),
}),
}),
{ title: "User Profile", mimeType: "application/json" },
async (uri, { userId }) => ({
contents: [{ uri: uri.href, text: JSON.stringify(await getUser(userId)) }],
})
);
import { StdioServerTransport } from "@modelcontextprotocol/server/stdio.js";
const transport = new StdioServerTransport();
await server.connect(transport);
import express from "express";
import { NodeStreamableHTTPServerTransport } from "@modelcontextprotocol/server/streamableHttp.js";
const app = express();
app.use(express.json());
app.post("/mcp", async (req, res) => {
const transport = new NodeStreamableHTTPServerTransport({ sessionIdGenerator: undefined });
await server.connect(transport);
await transport.handleRequest(req, res, req.body);
});
app.listen(3000, "127.0.0.1");
{
"mcpServers": {
"my-server": {
"command": "node",
"args": ["path/to/dist/index.js"],
"env": { "API_KEY": "..." }
}
}
}
isError: true on failures — never throw unhandledconsole.error) — stdout is used by stdio transport#!/usr/bin/env node shebang for CLI distributionoutputSchema when tools return structured datadevelopment
Deep web research and data extraction skill. Systematically research ANY topic by fetching URLs, reading documentation, crawling API docs, evaluating npm/pypi packages, comparing technologies, and synthesizing findings into actionable recommendations. Use when researching libraries, frameworks, APIs, solutions, or any topic requiring web investigation.
development
Design and implement comprehensive test suites. Covers unit testing, integration testing, E2E testing with Playwright, API testing, mocking strategies, test data factories, TDD workflow, snapshot testing, coverage targets, and CI integration. Use when writing tests, designing test architecture, or debugging test failures.
development
Core engineering workflow that activates on EVERY task. Enforces systematic plan-before-code methodology, multi-file refactoring safety, dependency-aware changes, pre-flight verification, and zero-placeholder quality standards. Use PROACTIVELY on all coding tasks.
tools
Implement production styling systems with Tailwind CSS, vanilla CSS, or CSS-in-JS. Covers CSS architecture (BEM, utility-first, modules), design tokens, responsive patterns, animation systems, dark mode, container queries, print styles, and performance optimization. Use when implementing designs or building CSS architectures.