一键导入
mcp-scaffold
Scaffold FastMCP tool implementations with database integration, error handling, and test session support. Generates production-ready MCP tools.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Scaffold FastMCP tool implementations with database integration, error handling, and test session support. Generates production-ready MCP tools.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | mcp-scaffold |
| description | Scaffold FastMCP tool implementations with database integration, error handling, and test session support. Generates production-ready MCP tools. |
Generate FastMCP tool implementations following project conventions with proper error handling, logging, JSON serialization, and test session support.
@mcp.tool() with descriptive docstrings for LLM_test_session parameter for pytest integrationjson.dumps() with success/error structureIdentify Operation: Understand CRUD operation (create/read/update/delete/search)
Read Existing Tools: Check src/mcp_server/tools/ for patterns
Generate Tool:
import json
import logging
from typing import Optional
from sqlmodel import Session, select
from ..database import engine
from ..models import Todo, TodoStatus
logger = logging.getLogger(__name__)
@mcp.tool()
def operation_name(
required_param: str,
optional_param: str | None = None,
_test_session: Optional[Session] = None
) -> str:
"""
Clear description of what this tool does for the LLM.
Args:
required_param: Description
optional_param: Description
"""
session = _test_session or Session(engine)
try:
# Database operation
result = session.exec(select(Todo).where(...)).first()
if not result:
return json.dumps({
"success": False,
"error": "Resource not found"
})
session.commit()
return json.dumps({
"success": True,
"data": {
"id": result.id,
"title": result.title
}
})
except Exception as e:
logger.error(f"Error in operation_name: {e}")
if not _test_session:
session.rollback()
return json.dumps({
"success": False,
"error": str(e)
})
finally:
if not _test_session:
session.close()
Register in server.py: Add import and ensure tool is loaded
User: "Scaffold update_todo MCP tool" Action: Read existing tools → Generate update_todo.py with validation, error handling, test support → Return complete implementation
Generate production-ready FastAPI CRUD endpoints with SQLModel. Creates complete Create, Read, Update, Delete operations following project patterns.
Generate comprehensive pytest integration tests for MCP tools and FastAPI endpoints. Includes fixtures, edge cases, and validation tests.
Manage Todo operations (Create, Read, Update, Delete) using SQLModel and Postgres. Use when the user wants to organize tasks.