Skip to main content
Glama
index_move_files.cpython-313.pyc5.63 kB
� ���g#����SrSSKrSSKrSSKrSSKrSSKJr SSKJ r \R"\RSS9 \R"\ 5rS SjrSr\ S :Xa\"5 gg) zD Script to index Move files that are already in the docs directory. �N)�DocumentProcessor)�FAISSVectorStorez4%(asctime)s - %(name)s - %(levelname)s - %(message)s)�level�formatc��[RRU5(d[R SU35 g[R S5 [ 5nURS5nURSn[R SU35 [US9n[RRU5(aV[R SU35 URU5 [R S[UR5S 35 [R S U35 URU5nU(d[R!S5 gU(a�["R$"USS5n[R SUR35 UV s/sHo�SRSPM n n [['U 55S:�a![R!S['U 535 [R S[U5S35 UR)U5 [R*"[RR-U5SS9 UR/U5 [R SUS[UR5S35 [U5$![aAn[R S [U535 [R S 5 S nAGN�S nAff=fs sn f)z� Index Move files from a local directory. Args: docs_dir: Directory containing Move files index_file: Path to save the FAISS index Returns: Number of documents indexed zDirectory not found: rz0Initializing document processor and vector storezThis is a testz"Embedding dimension of the model: )� dimensionzLoading existing index from zLoaded existing index with z documentszError loading existing index: zWill create a new index insteadNzProcessing documents from z;No documents processed. Check the file formats and content.� embeddingz%Sample document embedding dimension: �z&Different embedding dimensions found: z Indexing z document chunksT��exist_okzIndex saved to z with z total documents)�os�path�exists�logger�error�infor� get_embedding�shaper�load�len� documents� Exception�str�process_documents�warning�np�array�set�index_documents�makedirs�dirname�save) �docs_dir� index_file� doc_processor�test_embedding� embed_dim� vector_store�er�sample_embedding�doc�dimss �3/Users/kz/vcs/sui-ai/mcp_server/index_move_files.py�index_move_filesr.sm�� �7�7�>�>�(� #� #�� � �,�X�J�7�8�� �K�K�B�D�%�'�M�#�0�0�1A�B�N��$�$�Q�'�I� �K�K�4�Y�K�@�A�$�i�8�L� �w�w�~�~�j�!�!�� � �2�:�,�?�@� ;� � � �j� )� �K�K�5�c�,�:P�:P�6Q�5R�R\�]� ^�  �K�K�,�X�J�7�8��/�/��9�I� ����T�U����8�8�I�a�L��$=�>��� � �;�<L�<R�<R�;S�T�U�6?�?�Y�c�K� �&�&�q�)�Y��?� �s�4�y�>�A� � �N�N�C�C��I�;�O� P� �K�K�)�C� �N�+�+;�<�=�� � ��+��K�K������ �+�d�;����j�!� �K�K�/�*��V�C� �8N�8N�4O�3P�P`�a�b� �y�>���A� ;� �L�L�9�#�a�&��B� C� �K�K�9� :� :�� ;��$@s�=J-�'K;�- K8�76K3�3K8c�J�[R"SS9nURSSSS9 URSSS S9 URS S S S 9 UR5nUR(a2[ R "5R[ R5 [R"[RRUR5SS9 [R"URSS9 [URURS9n[!SUS35 U$)z/Entry point for command-line execution and pipxz#Index Move files for the MCP Server)� descriptionz --docs-dir�docs/move_filesz:Directory containing Move files (default: docs/move_files))�default�helpz --index-file�data/faiss_index.binz<Path to save the FAISS index (default: data/faiss_index.bin)z --verbose� store_truezEnable verbose logging)�actionr3Tr )r#r$zIndexed z document chunks from Move files)�argparse�ArgumentParser� add_argument� parse_args�verbose�logging� getLogger�setLevel�DEBUGr r rr!r$r#r.�print)�parser�args� num_indexeds r-�mainrDVs��� � $� $�1V� W�F� ��� �.?�W��Y� ����0F�Y��[� ��� �L�3��5� � � � �D� �|�|�����$�$�W�]�]�3��K�K���������0�4�@��K�K�� � ��-�"�D�M�M�d�o�o�V�K� �H�[�M�!A� B�C� ���__main__)r1r4)�__doc__r r<r7�numpyr�#mcp_server.utils.document_processorr�mcp_server.models.vector_storer� basicConfig�INFOr=�__name__rr.rD�rEr-�<module>rOsh��� ����A�;����'�,�,�Q�S� � � �8� $��B�H�0 �z���F�rE

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/ProbonoBonobo/sui-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server