003-skills/.claude/skills/nixtla-mcp-server-builder/SKILL.md
Generate production-ready MCP server implementations from PRD tool specifications with schema validation, error handling, and testing infrastructure. Use when building MCP servers for Nixtla plugins, implementing tool handlers, or scaffolding server infrastructure. Trigger with 'build MCP server', 'generate MCP implementation', or 'scaffold MCP tools'.
npx skillsauth add intent-solutions-io/plugins-nixtla nixtla-mcp-server-builderInstall 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.
Generate complete, production-ready MCP (Model Context Protocol) server implementations from PRD tool specifications, enabling rapid development of Claude Code plugin backends.
This skill automates MCP server development by:
Key Benefits:
pip install mcp)pip install pydantic)Expected PRD Structure:
## Functional Requirements
### FR-X: MCP Server Tools
Expose N tools to Claude Code:
1. `tool_name` - Tool description
2. `another_tool` - Another description
...
The script automatically:
Usage:
python {baseDir}/scripts/build_mcp_server.py \
--prd /path/to/PRD.md \
--output /path/to/mcp_server/ \
--plugin-name nixtla-plugin-name
Creates complete MCP server with:
mcp_server.py - Main server implementation:
from mcp.server import Server
from mcp.server.stdio import stdio_server
from pydantic import BaseModel
# Tool schemas
class ToolNameInput(BaseModel):
param1: str
param2: int = 14
class ToolNameOutput(BaseModel):
status: str
result: dict
# Server initialization
app = Server("plugin-name")
@app.call_tool()
async def tool_name(arguments: dict) -> dict:
"""Tool description from PRD"""
# Validate input
input_data = ToolNameInput(**arguments)
# TODO: Implement tool logic
result = {"data": "placeholder"}
# Return validated output
return ToolNameOutput(
status="success",
result=result
).dict()
Key Features:
For each tool, creates handler stub with:
Example Handler:
@app.call_tool()
async def calculate_roi(arguments: dict) -> dict:
"""Calculate ROI comparing TimeGPT vs. build-in-house."""
try:
# Validate input
input_data = CalculateRoiInput(**arguments)
# TODO: Implement ROI calculation logic
# 1. Parse input parameters
# 2. Calculate 5-year TCO
# 3. Generate comparison metrics
# Placeholder result
result = {
"roi": 245.0,
"payback_months": 6,
"total_savings": 500000
}
# Return validated output
return CalculateRoiOutput(
status="success",
roi_percentage=result["roi"],
details=result
).dict()
except ValidationError as e:
return {"status": "error", "message": str(e)}
except Exception as e:
logging.error(f"calculate_roi failed: {e}")
return {"status": "error", "message": "Internal server error"}
Generates Pydantic models for all tools:
schemas.py:
from pydantic import BaseModel, Field
from typing import Optional, List, Dict
class CalculateRoiInput(BaseModel):
"""Input schema for calculate_roi tool."""
current_infrastructure_cost: float = Field(..., description="Annual cost in USD")
forecast_volume: int = Field(..., description="Number of series to forecast")
team_size: int = Field(default=0, description="Current data science team size")
class CalculateRoiOutput(BaseModel):
"""Output schema for calculate_roi tool."""
status: str
roi_percentage: float
payback_months: int
details: Dict
Creates comprehensive test suite:
test_mcp_server.py:
import pytest
from mcp_server import app, calculate_roi
class TestCalculateRoiTool:
"""Test calculate_roi MCP tool."""
@pytest.mark.asyncio
async def test_valid_input(self):
"""Test with valid ROI calculation inputs."""
result = await calculate_roi({
"current_infrastructure_cost": 100000,
"forecast_volume": 1000,
"team_size": 5
})
assert result["status"] == "success"
assert "roi_percentage" in result
@pytest.mark.asyncio
async def test_invalid_input(self):
"""Test with missing required fields."""
result = await calculate_roi({})
assert result["status"] == "error"
@pytest.mark.asyncio
async def test_edge_cases(self):
"""Test edge cases (zero cost, large volumes)."""
result = await calculate_roi({
"current_infrastructure_cost": 0,
"forecast_volume": 1000000
})
assert result["status"] == "success"
Creates plugin.json for server metadata:
{
"name": "nixtla-plugin-name",
"version": "0.1.0",
"description": "Plugin description from PRD",
"mcp_server": {
"command": "python",
"args": ["mcp_server.py"],
"env": {
"NIXTLA_API_KEY": "${NIXTLA_API_KEY}"
}
},
"tools": [
{
"name": "calculate_roi",
"description": "Calculate ROI comparing TimeGPT vs. build-in-house",
"inputSchema": {
"type": "object",
"properties": {
"current_infrastructure_cost": {"type": "number"},
"forecast_volume": {"type": "integer"}
},
"required": ["current_infrastructure_cost", "forecast_volume"]
}
}
]
}
Generates supporting files:
requirements.txt:
mcp>=1.0.0
pydantic>=2.0.0
python-dotenv>=1.0.0
README.md:
# Plugin MCP Server
## Installation
pip install -r requirements.txt
## Running
python mcp_server.py
## Testing
pytest test_mcp_server.py -v
.env.example:
NIXTLA_API_KEY=nixak-your-api-key-here
The script generates:
Directory Structure:
mcp_server/
├── mcp_server.py # Main server
├── schemas.py # Validation schemas
├── test_mcp_server.py # Tests
├── plugin.json # Configuration
├── requirements.txt # Dependencies
├── README.md # Documentation
└── .env.example # Environment template
Missing PRD File:
Error: PRD not found at /path/to/PRD.md
Solution: Verify PRD path and ensure file exists
No MCP Tools Found:
Warning: No MCP tools section found in PRD
Solution: Ensure PRD has "### FR-X: MCP Server Tools" section
Invalid Tool Definition:
Error: Tool 'calculate_roi' missing description
Solution: Ensure all tools have format: `tool_name` - Description
Server Startup Failure:
Error: MCP server failed to start on port 3000
Solution: Check port availability, verify dependencies installed
python {baseDir}/scripts/build_mcp_server.py \
--prd 000-docs/000a-planned-plugins/implemented/nixtla-roi-calculator/02-PRD.md \
--output 005-plugins/nixtla-roi-calculator/mcp_server \
--plugin-name nixtla-roi-calculator \
--verbose
Output:
✓ Parsed PRD: Found 4 MCP tools
- calculate_roi
- generate_report
- compare_scenarios
- export_salesforce
✓ Generated mcp_server.py (412 lines)
✓ Generated schemas.py (8 Pydantic models)
✓ Generated test_mcp_server.py (16 test functions)
✓ Generated plugin.json
✓ Generated supporting files (README, requirements.txt, .env.example)
Server ready! Start with: python mcp_server.py
python {baseDir}/scripts/build_mcp_server.py \
--prd PRD.md \
--output mcp_server/ \
--dry-run
Output:
[DRY RUN] Would generate:
- mcp_server/mcp_server.py (estimate: 350 lines)
- mcp_server/schemas.py (4 tools, 8 models)
- mcp_server/test_mcp_server.py (12 test functions)
- mcp_server/plugin.json
- mcp_server/README.md
- mcp_server/requirements.txt
- mcp_server/.env.example
python {baseDir}/scripts/build_mcp_server.py \
--prd PRD.md \
--output mcp_server/ \
--no-tests
python {baseDir}/scripts/build_mcp_server.py \
--prd updated_PRD.md \
--output existing_mcp_server/ \
--update \
--backup
Output:
⚠️ Existing server detected. Creating backup...
✓ Backup created: existing_mcp_server.backup.20251221_223000/
✓ Updated mcp_server.py (added 2 new tools)
✓ Updated schemas.py (added 4 new models)
✓ Updated test_mcp_server.py (added 8 new tests)
{baseDir}/scripts/build_mcp_server.py{baseDir}/assets/templates/mcp_server_template.py{baseDir}/references/EXAMPLE_MCP_SERVER.pytesting
This skill enables Claude to manage isolated test environments using Docker Compose, Testcontainers, and environment variables. It is used to create consistent, reproducible testing environments for software projects. Claude should use this skill when the user needs to set up a test environment with specific configurations, manage Docker Compose files for test infrastructure, set up programmatic container management with Testcontainers, manage environment variables for tests, or ensure cleanup after tests. Trigger terms include "test environment", "docker compose", "testcontainers", "environment variables", "isolated environment", "env-setup", and "test setup".
tools
This skill uses the test-doubles-generator plugin to automatically create mocks, stubs, spies, and fakes for unit testing. It analyzes dependencies in the code and generates appropriate test doubles based on the chosen testing framework, such as Jest, Sinon, or others. Use this skill when you need to generate test doubles, mocks, stubs, spies, or fakes to isolate units of code during testing. Trigger this skill by requesting test double generation or using the `/gen-doubles` or `/gd` command.
tools
This skill enables Claude to generate realistic test data for software development. It uses the test-data-generator plugin to create users, products, orders, and custom schemas for comprehensive testing. Use this skill when you need to populate databases, simulate user behavior, or create fixtures for automated tests. Trigger phrases include "generate test data", "create fake users", "populate database", "generate product data", "create test orders", or "generate data based on schema". This skill is especially useful for populating testing environments or creating sample data for demonstrations.
development
This skill analyzes code coverage metrics to identify untested code and generate comprehensive coverage reports. It is triggered when the user requests analysis of code coverage, identification of coverage gaps, or generation of coverage reports. The skill is best used to improve code quality by ensuring adequate test coverage and identifying areas for improvement. Use trigger terms like "analyze coverage", "code coverage report", "untested code", or the shortcut "cov".