MCP Server Authoring Guide
Architect and package MCP servers for local tools or hosted services with proper schemas and listing metadata.
$15
MCP Server Authoring Guide
Example session with this skill installed
Scaffold a basic stdio MCP server in Node.js for a weather service with one tool to get current temperature.
- Read your context and instructions
- Compiled the mcp server authoring
I have generated the minimal scaffold for a Node.js MCP weather server using the official SDK and stdio transport.
MCP Weather Server Scaffold
// index.mjs
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
import { ListToolsRequestSchema, CallToolRequestSchema } from "@modelcontextprotocol/sdk/types.js";
import { z } from "zod";
const server = new Server(
{ name: "weather-mcp", version: "0.1.0" },
{ capabilities: { tools: {} } }
);
const GetTemperatureSchema = z.object({
city: z.string().describe("The city name to check weather for"),
unit: z.enum(["celsius", "fahrenheit"]).default("celsius")
});
server.setRequestHandler(ListToolsRequestSchema, async () => ({
tools: [{
name: "weather_get_temperature",
description: "Get the current temperature for a specific city. Use this when the user asks for weather or local conditions.",
inputSchema: {
type: "object",
properties: {
city: { type: "string" },
unit: { type: "string", enum: ["celsius", "fahrenheit"] }
},
required: ["city"]
}
}]
}));
server.setRequestHandler(CallToolRequestSchema, async (req) => {
if (req.params.name !== "weather_get_temperature") {
return { content: [{ type: "text", text: JSON.stringify({ error: "Unknown tool", hint: "Check tools/list for available actions" }) }] };
}
try {
const { city, unit } = GetTemperatureSchema.parse(req.params.arguments);
// Implementation logic here
const temp = 22;
return {
content: [{ type: "text", text: JSON.stringify({ city, temperature: temp, unit }) }]
};
} catch (err) {
return {
content: [{ type: "text", text: JSON.stringify({ error: "Invalid input", hint: err.message }) }]
};
}
});
await server.connect(new StdioServerTransport());
Next steps
- Add
"bin": {"weather-mcp": "index.mjs"}to yourpackage.json. - Create a
LICENSEfile in the root directory to meet Glama listing requirements. - Test locally by adding the absolute path to your Claude Desktop
config.json.
Connects securely to your tools. The creator never sees your data.
About this skill
Building a Model Context Protocol (MCP) server involves navigating transport selection, JSON-RPC schemas, and strict marketplace requirements. This skill provides the architectural constraints and implementation patterns required to build servers that agents can actually use. It focuses on the transition from raw API to structured MCP tools, ensuring your server passes listing requirements for platforms like Glama or npm.
What it does
- Transport selection guides you between stdio for local tools and streamable HTTP for hosted, multi-user services.
- Project scaffolding defines the minimal file structure including
package.jsonbins,index.mjsentries, and required licensing. - Tool design enforces naming conventions, Zod/JSON-schema validation, and agent-centric descriptions.
- Error handling replaces standard stack traces with structured
{error, hint}objects designed for LLM consumption. - Distribution prep formats your README and configuration snippets for Claude Desktop, Cursor, and Glama.
How it works
- Define scope by choosing between stdio for simplicity or HTTP for remote auth and scaling.
- Implement tools using the official SDK to handle JSON-RPC requests for listing and calling capabilities.
- Validate schemas using Zod to ensure the agent receives strict input requirements.
- Audit for listing by verifying the presence of LICENSE files,
glama.jsonmetadata, and copy-paste client configs.
Frameworks & tools
Uses the @modelcontextprotocol/sdk for Node.js. Optimized for distribution via npm, Glama, and mcprush.
Why this beats prompting it yourself
Generic prompts often fail to include the specific ListToolsRequestSchema requirements or the strict LICENSE file necessity for marketplace builders. This skill enforces the exact JSON-RPC patterns and folder structures that prevent silent failures in agent-to-server communication.
Use cases
- Convert an existing REST API into a set of MCP tools for Claude Desktop.
- Build a local filesystem utility available via npx.
- Prepare a TypeScript MCP server for submission to the Glama directory.
- Debug transport-layer issues in JSON-RPC stdio implementations.
Known limitations
Requires Node.js 18 or higher for the official SDK. Does not cover Python-based SDK implementations.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 5 days ago
Requires
Nothing to install.
Permissions
What's inside
Frequently Asked Questions
New in LLM Ops
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for LLM Ops.