Skip to main content
Glama
sap_client.cpython-311.pyc3.49 kB
� � �h���ddlZddlmZddlmZddlmZddlmZGd�d��Z ded e d e fd �Z d �Z ed kreje ����dSdS)�N)�AsyncExitStack)� stdio_client)� ClientSession)� TextContentc��eZdZd�ZdS)� SimpleServerc��||_dS)N)�command)�selfr s � sap_client.py�__init__zSimpleServer.__init__ s ���� � � �N)�__name__� __module__� __qualname__r �rr rrs#����������rr�session� function_name� parametersc��2K� |�d||d�����d{V��}td|�d���|jD]+}t|t��rt|j���,dS#t $r }td|�d|����Yd}~dSd}~wwxYw)N�call_sap_function)rr)�name� argumentsz Result from �:zError calling z: )� call_tool�print�content� isinstancer�text� Exception)rrr�resultr�es r �call_and_printr# s����5��(�(�$�!.�(���)� � � � � � � � �� �/�}�/�/�/�0�0�0��~� $� $�G��'�;�/�/� $��g�l�#�#�#�� $� $�� �5�5�5� �3�}�3�3��3�3�4�4�4�4�4�4�4�4�4�����5���s�A&A,�, B�6B�Bc ��K�tddg��}t��4�d{V��}|�t|�����d{V��\}}t ||��4�d{V��}|����d{V��t |dddddd����d{V��t |d d d i���d{V��ddd���d{V��n#1�d{V��swxYwYddd���d{V��dS#1�d{V��swxYwYdS) N�pythonz sap_server.py�BAPI_GL_GETGLACCPERIODBALANCES�C999� 0010010101�2023�10)� COMPANYCODE�GLACCT� FISCALYEAR� CURRENCYTYPE�BAPI_USER_GET_DETAIL�USERNAME�SAPUSER)rr�enter_async_contextrr� initializer#)�server� exit_stack�read�writers r �mainr8s���� �8�_�5� 6� 6�F�����������:�&�:�:�<��;O�;O�P�P�P�P�P�P�P�P� ��e� ��u�-�-� � � � � � � ���$�$�&�&� &� &� &� &� &� &� &� ��*J�%�&�$� $� M�M��� � � � � � � �!��*@��I�C��� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ���� � � � ���������������������������������s7�AC0�*AC �:C0� C �C0�C �C0�0 C:�=C:�__main__)�asyncio� contextlibr�mcp.client.stdior�mcp.client.sessionr� mcp.typesrr�str�dictr#r8r�runrrr �<module>rBs�������%�%�%�%�%�%�)�)�)�)�)�)�,�,�,�,�,�,�!�!�!�!�!�!���������5�-�5��5�QU�5�5�5�5�"���& �z����G�K�����������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/Richard-Zhangxj/SAP_MCP'

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