mcp server authoring
Build and structure MCP servers with correct transport, tool schemas, and host-specific configurations.
Free
Works with the AI Agents you already use
mcp server authoring
Example session with this skill installed
I need to build an MCP server for a local database. I want to use it in Claude Desktop. How should I structure the tools and config?
- Read your context and instructions
- Compiled the mcp server authoring
I will help you structure your MCP server for a local database integration. To ensure it works correctly with Claude Desktop, we will use the stdio transport, route logs to stderr, and define a compact tool surface.
MCP Server Implementation Plan
| Component | Specification |
|---|---|
| Transport | stdio (Local subprocess via Claude Desktop) |
| SDK | @modelcontextprotocol/sdk |
| Logging | console.error (to protect stdout protocol stream) |
| Tool Surface | Consolidated query and inspect_schema tools |
Claude Desktop Configuration
Add this to your claude_desktop_config.json file:
{
"mcpServers": {
"local-db-connector": {
"command": "node",
"args": [
"/absolute/path/to/your-server/dist/index.js"
],
"env": {
"DB_CONNECTION_STRING": "your_connection_string_here"
}
}
}
}
Tool Definition Example
server.tool(
"execute_query",
"Use to run read-only SQL queries against the local database when the user asks for data analysis.",
{
sql: z.string().describe("The SQL query to execute"),
limit: z.number().optional().default(100).describe("Max rows to return")
},
async ({ sql, limit }) => {
// Implementation with error handling
try {
const results = await db.query(sql, limit);
return { content: [{ type: "text", text: JSON.stringify(results) }] };
} catch (err) {
return {
isError: true,
content: [{ type: "text", text: `Database error: ${err.message}` }]
};
}
}
);
Next steps
- Initialize your project using
@modelcontextprotocol/sdk. - Implement the
execute_querytool with strict input validation. - Verify that all debug logging uses
stderrbefore testing in Claude Desktop.
Connects securely to your tools. The creator never sees your data.
About this skill
Building Model Context Protocol (MCP) servers requires strict adherence to transport protocols and schema constraints to avoid context bloat or host crashes. This skill provides the architectural patterns and implementation rules needed to expose local tools and resources to MCP-aware hosts like Claude Desktop, Claude Code, and Cursor.
What it does
- Transport selection guidance for choosing between local stdio subprocesses or remote Streamable HTTP.
- Tool surface design to minimize context window impact by optimizing JSON schemas and descriptions.
- Error handling strategies to differentiate between recoverable tool errors and fatal protocol errors.
- Host configuration generation for Claude Desktop, Claude Code, Cursor, and Augment.
- Logging management to prevent protocol corruption by correctly routing output to stderr.
How it works
- Select transport based on whether the server is local-only or requires remote/multi-user access.
- Define tool schemas by writing "when to use" descriptions and strict JSON input validation.
- Implement lifecycle rules including input validation, idempotency, and non-crashing error returns.
- Export host configs using specific JSON shapes for target IDEs and agents.
Frameworks & tools
This skill uses the @modelcontextprotocol/sdk and targets environments like Claude Desktop, Claude Code, Cursor, Augment, and claude.ai. It focuses on TypeScript/Node.js for server implementation and JSON Schema for tool definitions.
Why this beats prompting it yourself
Generic prompts often lead to servers that crash on bad input or corrupt the stdio stream with console logs. This skill enforces protocol-specific rules like stderr logging and schema consolidation that prevent agent performance degradation.
Use cases
- Convert a local Python script or Node.js library into a tool for Claude.
- Fix protocol corruption errors caused by debug logs writing to stdout.
- Optimize a server with too many tools using tool-search and deferred schemas.
- Set up a remote MCP server for shared team access via Streamable HTTP.
Known limitations
This skill focuses on authoring servers, not consuming them. It does not cover generic REST API design outside of the MCP context.
How to use
Skills on Agensi run inside your AI agent. Copy the prompt, paste it into your agent, and it connects to Agensi and installs this skill for you. If a payment is needed, your agent shows it to you first.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill passes our trust checks below.
Security scanned
Passed our 8-point scan before listing
Fresh listing
Recently published to Agensi
Free forever
No account required to browse
Trust & safety
Security scanned
Verified clean today
- Free to download with an account
Requires