> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mcp-use.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Cli

> CLI tool to scaffold a new MCP server project using mcp-use API Documentation

export const RandomGradientBackground = ({className, color, children, grayscaled = false}) => {
  const saturation = useMemo(() => {
    if (color) {
      const values = color.split("(")[1].split(")")[0].trim().split(/\s+/);
      return parseFloat(values[1] || "0");
    }
    return grayscaled ? 0 : 0.2;
  }, [color, grayscaled]);
  const lightness = useMemo(() => {
    if (color) {
      const values = color.split("(")[1].split(")")[0].trim().split(/\s+/);
      return parseFloat(values[0] || "0.5");
    }
    return grayscaled ? 0.3 : 0.4;
  }, [color, grayscaled]);
  const randomHue = useMemo(() => {
    if (color) {
      const values = color.split("(")[1].split(")")[0].trim().split(/\s+/);
      return parseFloat(values[2] || "0");
    }
    return Math.floor(Math.random() * 360);
  }, [color]);
  const randomColor = useMemo(() => {
    if (color) {
      return color;
    }
    return `oklch(${Math.min(lightness, 1)} ${saturation} ${randomHue})`;
  }, [randomHue, saturation, lightness]);
  const lightColor = useMemo(() => {
    return `oklch(${Math.min(lightness * 2, 1)} ${saturation} ${randomHue})`;
  }, [randomHue, saturation, lightness, color]);
  const direction = useMemo(() => {
    return Math.floor(Math.random() * 360);
  }, [randomHue]);
  const brightnessFilter = useMemo(() => {
    return "1000%";
  }, []);
  return <div className={`relative overflow-hidden ${className || ""}`} style={{
    background: `${lightColor}`,
    minHeight: '100%',
    width: '100%'
  }}>
      <div className="absolute inset-0 w-full h-full" style={{
    background: `linear-gradient(${direction}deg, ${randomColor}, transparent), url(https://grainy-gradients.vercel.app/noise.svg)`,
    filter: `contrast(120%) brightness(${brightnessFilter})`,
    backgroundSize: 'cover',
    backgroundRepeat: 'no-repeat'
  }} />
      {children && <div className="relative z-10 w-full h-full">{children}</div>}
    </div>;
};

<Callout type="info" title="Source Code">
  View the source code for this module on GitHub: <a href="https://github.com/mcp-use/mcp-use/blob/main/libraries/python/mcp_use/server/templates/cli.py" target="_blank" rel="noopener noreferrer">[https://github.com/mcp-use/mcp-use/blob/main/libraries/python/mcp\_use/server/templates/cli.py](https://github.com/mcp-use/mcp-use/blob/main/libraries/python/mcp_use/server/templates/cli.py)</a>
</Callout>

CLI tool to scaffold a new MCP server project using mcp-use.

## copy\_template

<Card type="info">
  ### `function` copy\_template

  Copy the template to the target folder after replacing placeholders.

  ```python theme={null}
  from mcp_use.server.templates.cli import copy_template
  ```

  **Parameters**

  > <ParamField body="template_dir" type="pathlib.Path" required="True">   Parameter value </ParamField>
  > <ParamField body="target_dir" type="pathlib.Path" required="True">   Parameter value </ParamField>
  > <ParamField body="context" type="dict[str, str]" required="True">   Dictionary of key-value pairs </ParamField>

  **Signature**

  ```python wrap theme={null}
  def copy_template(template_dir: pathlib.Path, target_dir: pathlib.Path, context: dict[str, str]):
  ```
</Card>

## detect\_installer

<Card type="info">
  ### `function` detect\_installer

  Detect the best available package installer. Returns (name, install\_command).

  ```python theme={null}
  from mcp_use.server.templates.cli import detect_installer
  ```

  **Returns**

  >   <ResponseField name="returns" type="tuple[str, list[str]]" />

  **Signature**

  ```python wrap theme={null}
  def detect_installer():
  ```
</Card>

## get\_available\_templates

<Card type="info">
  ### `function` get\_available\_templates

  Returns the list of available templates.

  ```python theme={null}
  from mcp_use.server.templates.cli import get_available_templates
  ```

  **Returns**

  >   <ResponseField name="returns" type="list[str]" />

  **Signature**

  ```python wrap theme={null}
  def get_available_templates():
  ```
</Card>

## install\_dependencies

<Card type="info">
  ### `function` install\_dependencies

  Prompt user to install dependencies and run the installer. Returns True if installed.

  ```python theme={null}
  from mcp_use.server.templates.cli import install_dependencies
  ```

  **Parameters**

  > <ParamField body="target_dir" type="pathlib.Path" required="True">   Parameter value </ParamField>

  **Returns**

  >   <ResponseField name="returns" type="bool" />

  **Signature**

  ```python wrap theme={null}
  def install_dependencies(target_dir: pathlib.Path):
  ```
</Card>

## main

<Card type="info">
  ### `function` main

  ```python theme={null}
  from mcp_use.server.templates.cli import main
  ```

  **Signature**

  ```python wrap theme={null}
  def main():
  ```
</Card>

## render\_template

<Card type="info">
  ### `function` render\_template

  Replace \{\{KEY}} placeholders with context values.

  ```python theme={null}
  from mcp_use.server.templates.cli import render_template
  ```

  **Parameters**

  > <ParamField body="content" type="str" required="True">   String value </ParamField>
  > <ParamField body="context" type="dict[str, str]" required="True">   Dictionary of key-value pairs </ParamField>

  **Returns**

  >   <ResponseField name="returns" type="str" />

  **Signature**

  ```python wrap theme={null}
  def render_template(content: str, context: dict[str, str]):
  ```
</Card>

## run\_install

<Card type="info">
  ### `function` run\_install

  Run the installer, capturing output. Returns True on success.

  ```python theme={null}
  from mcp_use.server.templates.cli import run_install
  ```

  **Parameters**

  > <ParamField body="name" type="str" required="True">   Name identifier </ParamField>
  > <ParamField body="cmd" type="list[str]" required="True">   List of items </ParamField>
  > <ParamField body="target_dir" type="pathlib.Path" required="True">   Parameter value </ParamField>

  **Returns**

  >   <ResponseField name="returns" type="bool" />

  **Signature**

  ```python wrap theme={null}
  def run_install(name: str, cmd: list[str], target_dir: pathlib.Path):
  ```
</Card>

## validate\_project\_name

<Card type="info">
  ### `function` validate\_project\_name

  Check if the inserted name is a valid project name.

  ```python theme={null}
  from mcp_use.server.templates.cli import validate_project_name
  ```

  **Parameters**

  > <ParamField body="name" type="str" required="True">   Name identifier </ParamField>

  **Returns**

  >   <ResponseField name="returns" type="str" />

  **Signature**

  ```python wrap theme={null}
  def validate_project_name(name: str):
  ```
</Card>
