Skip to main content
Glama

create_mcp_server

Generate a new MCP server by specifying name, description, language, template type, and features. Includes process cleanup, error handling, and MCP SDK patterns for production-ready implementations.

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
descriptionYes
featuresNo
languageNopython
nameYes
output_dirNo
template_typeNobasic

Implementation Reference

  • main.py:82-131 (handler)
    The main handler function for the 'create_mcp_server' MCP tool. It is registered via the @mcp.tool() decorator. The function accepts parameters defining the new MCP server and delegates the creation logic to a ServerGenerator instance, providing input validation via type hints and comprehensive error handling.
    @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)}"

Other Tools

Related Tools

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