Skip to main content
Glama
github_readme.cpython-313.pyc10.3 kB
� ��Ghv!� � �SSKrSSKrSSKJr SSKJrJrJr SSKJ r \ "S5r /SQr S\ S\ 4S jrS \S\\ \44S jrSS \ S \S\\ \44Sjjr\ R%5S \ S\\ \44Sj5r\ R%5S \ S\ 4Sj5r\ R%5SS \ S\ S\ S\ 4Sjj5r\ R%5S \ S\ S\ 4Sj5r\ R/S5S \ S\ 4Sj5r\S:Xa\ R55 gg)�N)�Path)�List�Dict�Any)�FastMCP� Github_Docs)z*.pyc� __pycache__z.gitz .gitignore� node_modulesz.envz*.logz .DS_Storez*.tmpz*.tempz.vscodez.ideaz*.sqlitez*.db�dist�buildz .pytest_cache�path�returnc��[RRU5n[H n[R"X5(dM g g)zACheck if a file/folder should be ignored based on common patternsTF)�osr �basename�IGNORE_PATTERNS�fnmatch)r �name�patterns �KC:\Users\dutta\OneDrive\Desktop\Summer\MCP\mcp-server-demo\github_readme.py� should_ignorers7�� �7�7� � �D� !�D�"�� �?�?�4� )� )��#� �� file_pathc���UR5nUR[U5URUR 5UR S.$![ [4a UR[U5SS.s$f=f)zGet information about a file)rr �size�is_file� extensionz Access denied)rr �error)�statr�str�st_sizer�suffix�OSError�PermissionError)rrs r� get_file_infor%su�� Z��~�~����N�N�� �N��L�L� �(�(�*�"�)�)�  � �� �_� %�Z�!����I���Y�Y�Z�s�A A�)A;�:A;� project_path� max_depthc ���[U5nUR5(dSSUS30$[U5//0[5/S.n/SQ/SQ/SQ/SQ/S QS S /S .n[R "U5GHdupVn[ [U5RU5R5nX�:�aM;UV s/sH4n [[RRXY55(aM2U PM6 sn US S &UH�n [U5U - n [[U 55(aM,[U 5n USRU 5 U RR5n U S;aUSR!U SS 5 UR#5HIup�UH>nU R5UR5:XdU U:XdM-[U 5USU'M@ MK M� GMg [%US5US'U$s sn f)z0Analyze project structure and identify key filesrzProject path 'z' does not exist)�root�files� directories� key_files� languages�framework_indicators)� README.mdz README.txtz README.rstz readme.md)�LICENSEz LICENSE.txtz LICENSE.md�license)� package.json�requirements.txtzsetup.py� Cargo.tomlz composer.jsonzpom.xmlz build.gradle�Gemfile)� Dockerfilezdocker-compose.ymlzdocker-compose.yaml)z.github/workflowsz.gitlab-ci.ymlz .travis.ymlz .env.examplez .env.sample)�readmer1�config�docker�ci�envNr*) z.pyz.jsz.tsz.javaz.cppz.cz.goz.rsz.rbz.phpr-�r,)r�existsr �setr�walk�len� relative_to�partsrr �joinr%�appendr"�lower�add�items�list)r&r'� project_root� structure�key_files_patternsr)�dirsr*� current_depth�d�filer� file_info�ext�category�patternsrs r�analyze_project_structurerT(s���� �%�L� � � � � ��>�,��7G�H�I�I��L�!�����U� "� �I�I�F�I�M�D�� �.��� �W�W�\�2���E��D��J�2�2�<�@�F�F�G� � � $� �#�O�d��-���� � �T�8M�*N�1�d�O��Q���D��T� �T�)�I��S��^�,�,��%�i�0�I� �g� � %� %�i� 0��"�"�(�(�*�C��_�_��+�&�*�*�3�q�r�7�3�'9�&>�&>�&@�"��'�G��z�z�|�w�}�}��6�$�'�/�;>�y�>� �+�.�x�8� (�'A��3�6"�)�K�"8�9�I�k�� ���-Ps �-0G*�!G*c��[U5$)z2Scan a project directory and analyze its structure)rT)r&s r� scan_projectrVbs�� %�\� 2�2rc��[USSS9nUR5nSSS5 U$!,(df  W$=f![af [USSS9nUR5nSSS5 O!,(df  O=fSW3s$![anS[ U53sSnAs$SnAff=f[anS[ U53sSnA$SnAff=f)z$Read the contents of a specific file�r�utf-8��encodingNzlatin-1z"[File read with latin-1 encoding] zError reading file: )�open�read�UnicodeDecodeError� Exceptionr )r�f�content�es r� read_filercgs��� /� �)�S�7� 3�q��f�f�h�G�4���4� 3���� �3� 3��i��y�9�Q��&�&�(��:�9�9��8�� �B� B��� 3�)�#�a�&��2� 2�� 3�� �/�%�c�!�f�X�.�.��/�sw� :�(� :� 7�:�:� C � B�A*�! B�* A8 �4 B�?C � B&� B!�B&�C �!B&�& C �2 C�?C �C � project_name� descriptionc��[U5nSU;aSUS3$U(d[U5RnSUS3nU(aXBS3- nOUS- nUS(a6US- n[US5HnUSUR 5S 3- nM US - nUS - nS [ UR S 055;aUS - nOOS[ UR S 055;aUS- nO*S[ UR S 055;aUS- nOUS- nUS- nUS- n[US5S::adUS- nUS- n[USSS9HCnUR SS5(dM[US5RUS5nXGS 3- nME US- nUS - nUS!- nUS"- nUS#- nUS$- nUS%- nS&UR S 05;a US'- nUS(- nU$))z0Generate a comprehensive README.md for a projectrzError: z# z z&A brief description of your project. r-z## Technologies Used z- � z## Installation r2r,z```bash npm install ``` r3z-```bash pip install -r requirements.txt ``` r4z```bash cargo build ``` z%Add installation instructions here. z ## Usage z(Describe how to use your project here. r*�z## Project Structure z``` c� �US$)Nr �)�xs r�<lambda>�!generate_readme.<locals>.<lambda>�s���6�r)�keyrTr r)z``` z## Contributing z1. Fork the repository zI2. Create your feature branch (`git checkout -b feature/AmazingFeature`) zC3. Commit your changes (`git commit -m 'Add some AmazingFeature'`) zA4. Push to the branch (`git push origin feature/AmazingFeature`) z5. Open a Pull Request r1z ## License zEThis project is licensed under the terms found in the LICENSE file. ) rTrr�sorted�upperr �getr@rA)r&rdre�analysis�readme_content�langrP�rel_paths r�generate_readmervxsS�� )��6�H��(����'�*�+�,�,� ��L�)�.�.� ��,��t�,�N���M��.�.���D�D��� ���4�4���8�K�0�1�D� ��4�:�:�<�.��3� 3�N�2��$����+�+�N���X�\�\�+�r�:�;�;��9�9�� �s�8�<�<� �R�#@�A� A��M�M�� ��X�\�\�+�r�:�;� ;��9�9���C�C���n�$�N��B�B�N� �8�G� ���#��4�4���'�!����� 1�7J�K�I��}�}�Y��-�-�� �&� 1�2�>�>�x��?O�P���J�b�/�1��L� �)�#���+�+�N��0�0�N��b�b�N��\�\�N��Z�Z�N��2�2�N��H�L�L��b�1�1��*�*���c�c�� �rrsc���[U5S- n[USSS9nURU5 SSS5 SU3$!,(df  N=f![anS[ U53sSnA$SnAff=f)z>Save README content to README.md file in the project directoryr/�wrYrZNz README.md saved successfully to zError saving README.md: )rr\�writer_r )r&rs� readme_pathr`rbs r� save_readmer{�sm��3��<�(�;�6� � �+�s�W� 5�� �G�G�N� #�6�1�+��?�?�6� 5�� �3�)�#�a�&��2�2��3�s1�A �:� A � A�A � A-� A(�"A-�(A-zproject://{project_path}c���[U5nSU;aSUS3$SUSS3nUS[US5S3- nUSS RUS 5S3- nUS S RUS R55S3- nU$) z%Get comprehensive project informationrzError analyzing project: zProject Analysis for: r)rgz Total files: r*zLanguages detected: z, r-zKey files found: r,)rTr@rC�keys)r&rr�infos r�get_project_infor�s���)��6�H��(��*�8�G�+<�*=�>�>� #�H�V�$4�#5�R� 8�D��m�C��� 1�2�3�2� 6�6�D��"�4�9�9�X�k�-B�#C�"D�B� G�G�D���� � �(�;�*?�*D�*D�*F� G�H�� K�K�D� �Kr�__main__)�)NN)rr�pathlibr�typingrrr�mcp.server.fastmcpr�mcprr �boolrr%�intrT�toolrVrcrvr{�resourcer�__name__�runrjrr�<module>r�s��� ���"�"�&��m����� ����� Z�T� Z�d�3��8�n� Z�8�C�8�C�8��S�RU�X��8�t����3�s�3�t�C��H�~�3� �3�����/��/��/� �/� ����E�#�E�S�E�c�E�]`�E� �E�N����3�c�3�3�3�3�3� �3����(�)� �3� �3� �*� � �z���G�G�I�r

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/DuttaAyush/MCP'

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