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

copy_template

function copy_template

Copy the template to the target folder after replacing placeholders.
from mcp_use.server.templates.cli import copy_template
Parameters
template_dir
pathlib.Path
required
Parameter value
target_dir
pathlib.Path
required
Parameter value
context
dict[str, str]
required
Dictionary of key-value pairs
Signature
def copy_template(template_dir: pathlib.Path, target_dir: pathlib.Path, context: dict[str, str]):

detect_installer

function detect_installer

Detect the best available package installer. Returns (name, install_command).
from mcp_use.server.templates.cli import detect_installer
Returns
returns
tuple[str, list[str]]
Signature
def detect_installer():

get_available_templates

function get_available_templates

Returns the list of available templates.
from mcp_use.server.templates.cli import get_available_templates
Returns
returns
list[str]
Signature
def get_available_templates():

install_dependencies

function install_dependencies

Prompt user to install dependencies and run the installer. Returns True if installed.
from mcp_use.server.templates.cli import install_dependencies
Parameters
target_dir
pathlib.Path
required
Parameter value
Returns
returns
bool
Signature
def install_dependencies(target_dir: pathlib.Path):

main

function main

from mcp_use.server.templates.cli import main
Signature
def main():

render_template

function render_template

Replace {{KEY}} placeholders with context values.
from mcp_use.server.templates.cli import render_template
Parameters
content
str
required
String value
context
dict[str, str]
required
Dictionary of key-value pairs
Returns
returns
str
Signature
def render_template(content: str, context: dict[str, str]):

run_install

function run_install

Run the installer, capturing output. Returns True on success.
from mcp_use.server.templates.cli import run_install
Parameters
name
str
required
Name identifier
cmd
list[str]
required
List of items
target_dir
pathlib.Path
required
Parameter value
Returns
returns
bool
Signature
def run_install(name: str, cmd: list[str], target_dir: pathlib.Path):

validate_project_name

function validate_project_name

Check if the inserted name is a valid project name.
from mcp_use.server.templates.cli import validate_project_name
Parameters
name
str
required
Name identifier
Returns
returns
str
Signature
def validate_project_name(name: str):