mcp-server-enhancement

Add MCP tools to the AI Counsel server with Pydantic validation and stdio safety.

1|1|Updated Oct 13, 2025
One-click install
npx skills add https://github.com/blueman82/ai-counsel --skill mcp-server-enhancement
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: mcp-server-enhancement
Source: https://github.com/blueman82/ai-counsel/tree/main/.claude/skills/mcp-server-enhancement
Command: npx skills add https://github.com/blueman82/ai-counsel --skill mcp-server-enhancement

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires mcp-sdk, pydantic.

What problem does it solve?

Safely extending the AI Counsel MCP server with new tools while maintaining protocol compliance, stdio safety, and proper error handling is complex and error-prone. This skill provides a systematic approach to ensure new tools integrate seamlessly without corrupting communication or crashing the server.

Core Features & Use Cases

  • Type-Safe Tool Definition: Define Pydantic models for tool requests and responses, ensuring robust input validation.
  • Stdio Safety Enforcement: Learn critical rules to prevent stdout contamination, ensuring stable MCP communication.
  • Structured Error Handling: Implement graceful error responses for validation and runtime failures, preventing server crashes.
  • Use Case: Add a new MCP tool that allows AI models to interact with a custom internal API. This skill guides you through defining the tool's schema, creating its async handler, and ensuring all interactions are type-safe and protocol-compliant.

Quick Start

To begin, define a new Pydantic request model for your tool in models/schema.py with fields like parameter1: str and parameter2: int, including descriptive Field arguments.

Frequently Asked Questions about mcp-server-enhancement

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add a new tool to an MCP server safely?

Adding a new MCP tool requires defining Pydantic models for request/response validation, creating an async handler, and ensuring stdout remains reserved for protocol JSON only. This skill provides the systematic approach to integrate tools without corrupting communication or crashing the server.

What's the best way to prevent stdout contamination when extending an MCP server?

Stdio safety is enforced by redirecting all logs to file-based logging (mcp_server.log) rather than stdout, which must remain exclusively for MCP protocol JSON. This skill teaches the critical rules and patterns to maintain stable communication.

How do I handle validation and errors when implementing MCP tools?

Implement structured error responses using Pydantic-based validation for type-safe tool requests and responses. This skill guides graceful error handling that prevents server crashes and maintains protocol compliance during runtime failures.

Can I use async handlers with Pydantic for MCP tool development?

Yes. This skill enforces async-first tool handlers paired with Pydantic validation, ensuring both performance and type safety. All handlers integrate with existing engine and storage components while maintaining protocol compliance.

Do I need the mcp-sdk and Pydantic to extend an MCP server?

Yes. The mcp-sdk and Pydantic are required dependencies. This skill assumes familiarity with these tools and focuses on the patterns and safety practices needed to integrate new tools into server.py without errors.

What happens if I log to stdout instead of using file logging in MCP?

Logging to stdout corrupts MCP protocol communication because stdout is reserved for JSON protocol messages. This skill prevents that failure by enforcing file-based logging to mcp_server.log and teaching why stdio safety is non-negotiable.