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)}"
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It does well by including an 'IMPORTANT NOTES' section that covers platform limitations (AI sampling not supported), coding standards, and implementation details (process cleanup, error handling, SDK patterns). However, it doesn't mention potential side effects like file system changes or whether this is a one-time creation vs. incremental update.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with clear sections (purpose, important notes, args, returns) and front-loads the core functionality. However, some sentences in the 'IMPORTANT NOTES' section could be more concise, and the parameter explanations vary in detail level, making it slightly uneven.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 6-parameter creation tool with no annotations and no output schema, the description provides adequate coverage of what the tool does and its parameters. The 'Returns' section helps compensate for the missing output schema. However, it lacks information about error conditions, validation rules, or what happens when creation fails, which would be important for a tool that modifies the environment.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate. The 'Args' section provides meaningful explanations for all 6 parameters, adding value beyond the bare schema. However, some explanations are minimal (e.g., 'Description of what the server does') and don't clarify constraints like what makes a 'valid Python identifier' or the implications of different 'language' choices.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Create a new MCP server based on specifications.' It specifies the verb ('create') and resource ('MCP server'), making the action clear. However, it doesn't explicitly differentiate from sibling tools like 'list_templates' or 'save_workflow', which would be needed for a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. While it mentions 'template_type' and 'features' parameters, it doesn't explain when to choose 'basic' vs 'fastmcp_server' templates or what 'tools, resources, prompts' features entail. There's no mention of prerequisites or comparison with sibling tools like 'list_templates'.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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