__main__.cpython-310.pyc•4.42 kB
o
�{�g� � @ s� d Z ddlZddlZddlZddlZddlmZmZ ddlm Z ddl
m
Z deeef fdd �Z
ddeded
eddfdd�Zdd� Zddd�ZedkrQe� dS dS )z>
Main entry point for running the persistent-code MCP server.
� N)�Dict�Any� )�PersistentCodeMCP)�config�returnc C s: t jdd�} | jddd�}|jddd�}|jd d
ddd
� |jddddd
� |jddddd� |jddd�}|jd d
ddd
� |jddddd
� |jdddddgdd� |jdtd d!d"� |jd#d$d�}|jd%d&d'd(gd)d*� |jd+d,d-d� |jd.d/td0d1� |jd2ddd3d� | �� }|js�| �� t �
d4� t|�S )5zSParse command line arguments.
Returns:
args: Parsed arguments
zPersistent-Code MCP Server)�description�commandzCommand to run)�dest�help�initzInitialize a new project)r z--project-namez-p�defaultzName of the project)r
r z
--storage-dirz-sNz"Directory to store persistent dataz--disable-llama-indexz-d�
store_truezDisable LlamaIndex integration)�actionr �servezStart the MCP serverz--transportz-t�stdio�httpzTransport protocol to use)r
�choicesr z--porti@ zPort to use for HTTP transport)�typer
r r zConfigure settingsz
--llama-indexz-l�enable�disablez(Enable or disable LlamaIndex integration)r r z--embedding-modelz-ez&Set the embedding model for LlamaIndexz--similarity-top-kz-kz0Set the number of similar components to retrieve)r r z
--show-configzShow current configurationr )�argparse�ArgumentParser�add_subparsers�
add_parser�add_argument�int�
parse_argsr �
print_help�sys�exit�vars)�parser�
subparsersZinit_parserZserve_parserZ
config_parser�args� r% �S/Users/sparshdrolia/Sparsh personal/persistent-code-mcp/persistent_code/__main__.pyr s� ������������
r F�project_name�storage_dir�disable_llama_indexc C sr |p
t j�t �� d�}t j|dd� t j�|| �}t j|dd� |r-t�ddd� td� td| � d |� �� d
S )z�Initialize a new project.
Args:
project_name: Name of the project
storage_dir: Directory to store persistent data
disable_llama_index: Whether to disable LlamaIndex integration
�storageT)�exist_ok�llama_index�enabledFzLlamaIndex integration disabledzInitialized project 'z' in N)�os�path�join�getcwd�makedirs�config_instance�set�print)r'