/iq-mcps:mcp-developmentfrom iq-mcps
Use when building MCP servers, defining MCP tools, or working on @iqai/ MCP packages
Ships in iq-mcps. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
IQ conventions for building MCP (Model Context Protocol) servers, based on patterns from IQ's 19 MCP server packages.
Higher-level, simpler API. Best for: simple API wrappers, data fetchers, single-concern servers.
import { FastMCP } from "fastmcp";
import { z } from "zod";
const server = new FastMCP({ name: "mcp-example", version: "1.0.0" });
server.addTool({
name: "tool_name",
description: "What this tool does",
parameters: z.object({
param: z.string().describe("Description of param"),
}),
execute: async (params) => {
const service = new SomeService();
const result = await service.doThing(params.param);
return JSON.stringify(result, null, 2);
},
});
server.start({ transportType: "stdio" });
@modelcontextprotocol/sdk)Lower-level, more control. Use for: servers needing sampling, resources, complex state, or bi-directional communication.
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
import {
CallToolRequestSchema,
ListToolsRequestSchema,
} from "@modelcontextprotocol/sdk/types.js";
const server = new Server(
{ name: "mcp-example", version: "1.0.0" },
{ capabilities: { tools: {} } }
);
server.setRequestHandler(ListToolsRequestSchema, async () => ({
tools: toolList,
}));
server.setRequestHandler(CallToolRequestSchema, async (req) => {
switch (req.params.name) {
case "tool_name":
return handleTool(req.params.arguments);
default:
throw new Error(`Unknown tool: ${req.params.name}`);
}
});
const transport = new StdioServerTransport();
await server.connect(transport);
mcp-{name}/
├── src/
│ ├── index.ts # Entry point — server init
│ ├── tools/ # Tool definitions
│ │ ├── index.ts # Tool exports
│ │ └── {tool-name}.ts
│ ├── services/ # Business logic
│ ├── config.ts # Configuration
│ └── types.ts # Type definitions
├── package.json
├── tsconfig.json
├── biome.jsonc
└── .changeset/
import { z } from "zod";
const schema = z.object({
param: z.string().describe("Description"),
});
export const toolName = {
name: "tool_name", // snake_case always
description: "What this tool does",
parameters: schema,
execute: async (params: z.infer<typeof schema>) => {
const service = new SomeService();
const result = await service.doThing(params.param);
return JSON.stringify(result, null, 2);
},
} as const;
// tool-list.ts
export const toolList = [
{
name: "tool_name",
description: "Description",
inputSchema: {
type: "object" as const,
properties: {
param: { type: "string", description: "Description" },
},
required: ["param"],
},
},
];
// server.ts — handler
server.setRequestHandler(CallToolRequestSchema, async (req) => {
switch (req.params.name) {
case "tool_name":
return handleTool(req.params.arguments);
}
});
@iqai/mcp-{name}snake_casemcp-{name}"type": "module" in package.jsonAlways validate environment variables with Zod:
import { z } from "zod";
const envSchema = z.object({
API_KEY: z.string().optional(),
TRANSPORT: z.enum(["stdio", "http"]).default("stdio"),
});
export const env = envSchema.parse(process.env);
server.start({ transportType: "stdio" })){
"scripts": {
"build": "tsc && shx chmod +x dist/index.js",
"start": "node dist/index.js",
"format": "biome format . --write",
"lint": "biome check .",
"publish-packages": "pnpm run build && changeset publish"
}
}
services/ — tools should be thin wrappers that delegate to service classes.JSON.stringify(result, null, 2) from tool execute functions.shx chmod +x dist/index.js in the build script to ensure CLI executability."bin" field in package.json for npx usage:
{
"bin": {
"mcp-{name}": "dist/index.js"
}
}
#!/usr/bin/env node at the top of src/index.ts.What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub braindao/iq-claude-config --plugin iq-mcps