Skip to main content
Glama

create_mcp_server

Generate new MCP servers from specifications using templates for Python, Gradio, or TypeScript with built-in error handling and proper SDK patterns.

Instructions

Create a new MCP server based on specifications. IMPORTANT NOTES: - AI sampling (ctx.sample) is not currently supported in Claude Desktop - Use modern typing: dict, list, str | None instead of Dict, List, Optional - Generated servers include proper process cleanup and error handling - All generated code uses working MCP SDK patterns Args: name: Name of the MCP server (must be valid Python identifier) description: Description of what the server does language: Programming language (python, gradio, typescript) template_type: Type of template (basic, fastmcp_server) features: list of features to include (tools, resources, prompts) output_dir: Output directory (defaults to configured default) Returns: Status message with creation details and next steps

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYes
descriptionYes
languageNopython
template_typeNobasic
featuresNo
output_dirNo

Implementation Reference

  • main.py:82-131 (handler)
    The primary handler function for the 'create_mcp_server' tool. It is registered via the @mcp.tool() decorator and delegates the server creation to the ServerGenerator instance from the application lifespan context. Includes input parameters with type hints serving as the schema, comprehensive docstring, error handling, and logging.
    @mcp.tool() async def create_mcp_server( ctx: Context, name: str, description: str, language: str = "python", template_type: str = "basic", features: list[str] | None = None, output_dir: str | None = None, ) -> str: """ Create a new MCP server based on specifications. IMPORTANT NOTES: - AI sampling (ctx.sample) is not currently supported in Claude Desktop - Use modern typing: dict, list, str | None instead of Dict, List, Optional - Generated servers include proper process cleanup and error handling - All generated code uses working MCP SDK patterns Args: name: Name of the MCP server (must be valid Python identifier) description: Description of what the server does language: Programming language (python, gradio, typescript) template_type: Type of template (basic, fastmcp_server) features: list of features to include (tools, resources, prompts) output_dir: Output directory (defaults to configured default) Returns: Status message with creation details and next steps """ try: generator = ctx.request_context.lifespan_context["server_generator"] result = await generator.create_server( name=name, description=description, language=language, template_type=template_type, features=features or [], output_dir=output_dir, context=ctx, ) logger.info(f"Successfully created MCP server: {name}") return result except Exception as e: logger.error(f"Failed to create MCP server {name}: {e}") return f"āŒ Error creating server: {str(e)}"

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/angrysky56/mcp-creator-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server