API Reference#
This section provides detailed API documentation for the Dev-Kit MCP Server.
Server Module#
- dev_kit_mcp_server.fastmcp_server.start_server() FastMCP[source]#
Start the FastMCP server.
This function initializes and configures the FastMCP server with the necessary tools. It parses command-line arguments to determine the root directory for file operations.
- Returns:
A configured FastMCP server instance
- Return type:
FastMCP
- Raises:
ValueError – If the root directory does not exist or is not a directory
File Operations#
Base File Operation#
- class dev_kit_mcp_server.tools.code_editing.file_ops.FileOperation#
Base class for file operations.
- Parameters:
root_dir (str) – The root directory for file operations
- Raises:
Exception – If the root directory does not exist or is not a directory
- _validate_path_in_root(path: str) bool#
Check if the given path is within the root directory.
- Parameters:
path (str) – The path to check
- Returns:
True if the path is within the root directory, False otherwise
- Return type:
bool
Create Directory Operation#
- class dev_kit_mcp_server.tools.code_editing.create.CreateDirOperation#
Class to create a folder in the workspace.
- Parameters:
root_dir (str) – The root directory for file operations
- _create_folder(path: str) None#
Create a folder at the specified path.
- Parameters:
path (str) – Path to the folder to create
- Raises:
ValueError – If the path is not within the root directory
FileExistsError – If the path already exists
OSError – If there’s an error creating the folder
- __call__(path: str) Dict[str, Any]#
Create a file or folder in the workspace.
- Parameters:
path (str) – Path to the folder to create
- Returns:
A dictionary containing the status and path of the created file or folder
- Return type:
Dict[str, Any]
Move Directory Operation#
- class dev_kit_mcp_server.tools.code_editing.move.MoveDirOperation#
Class to move a file or folder in the workspace.
- Parameters:
root_dir (str) – The root directory for file operations
- _move_folder(path1: str, path2: str) None#
Move a file or folder from path1 to path2.
- Parameters:
path1 (str) – Source path
path2 (str) – Destination path
- Raises:
ValueError – If either path is not within the root directory
FileNotFoundError – If the source path does not exist
FileExistsError – If the destination path already exists
OSError – If there’s an error moving the file or folder
- __call__(path1: str, path2: str) Dict[str, Any]#
Move a file or folder from path1 to path2.
- Parameters:
path1 (str) – Source path
path2 (str) – Destination path
- Returns:
A dictionary containing the status and paths of the moved file or folder
- Return type:
Dict[str, Any]
Remove File Operation#
- class dev_kit_mcp_server.tools.code_editing.remove.RemoveFileOperation#
Class to remove a file or folder.
- Parameters:
root_dir (str) – The root directory for file operations
- _remove_folder(path: str) None#
Remove a file or folder at the specified path.
- Parameters:
path (str) – Path to the file or folder to remove
- Raises:
ValueError – If the path is not within the root directory
FileNotFoundError – If the path does not exist
OSError – If there’s an error removing the file or folder
- __call__(path: str) Dict[str, Any]#
Remove a file or folder.
- Parameters:
path (str) – Path to the file or folder to remove
- Returns:
A dictionary containing the status and path of the removed file or folder
- Return type:
Dict[str, Any]
Rename Operation#
- class dev_kit_mcp_server.tools.rename.RenameOperation#
Class to rename a file or folder in the workspace.
- Parameters:
root_dir (str) – The root directory for file operations
- _rename_file_or_folder(path: str, new_name: str) None#
Rename a file or folder.
- Parameters:
path (str) – Path to the file or folder to rename
new_name (str) – New name for the file or folder (not a full path, just the name)
- Raises:
ValueError – If the path is not within the root directory
FileNotFoundError – If the path does not exist
FileExistsError – If a file or folder with the new name already exists
OSError – If there’s an error renaming the file or folder
- __call__(path: str, new_name: str) Dict[str, Any]#
Rename a file or folder.
- Parameters:
path (str) – Path to the file or folder to rename
new_name (str) – New name for the file or folder (not a full path, just the name)
- Returns:
A dictionary containing the status and paths of the renamed file or folder
- Return type:
Dict[str, Any]