Skip to main content
Glama

MCP Unified Server

by getfounded
toolkit_client.cpython-312.pyc2.19 kB
� ]{|h/��D�ddlZddlZddlZddlmZmZmZGd�d�Zy)�N)�Dict�Any�Optionalc�<�eZdZdZd defd�Zdedeeefdefd�Zy) � MCPClientzGCustom client for interacting with MCP (Model Context Protocol) server.� server_urlc�d�|jd�|_tjd�|_y)zi Initialize the MCP client. Args: server_url: URL of the MCP server �/rN)�rstripr�logging� getLogger�logger)�selfrs �?C:\Users\JackThompson\python\mcp-tool-kit\app\toolkit_client.py�__init__zMCPClient.__init__ s(��%�+�+�C�0����'�'� �4�� �� tool_name�params�returnc�T� tj|j�d|��|ddi��}|j�|jS#tj $rM}d|�dt |���}|jj|�tjd|i�cYd}~Sd}~wwxYw) z� Call a tool on the MCP server. Args: tool_name: Name of the tool to call params: Parameters to pass to the tool Returns: Tool execution result as a string z /api/tools/z Content-Typezapplication/json)�json�headerszError calling tool z: �errorN) �requests�postr�raise_for_status�text�RequestException�strrrr�dumps)rrr�response�e� error_msgs r� call_toolzMCPClient.call_tools��� 4��}�}��?�?�#�;�y�k�:��'�);�<��H� � %� %� '��=�=� ���(�(� 4�-�i�[��3�q�6�(�C�I� �K�K� � �i� (��:�:�w� �2�3� 3�� 4�s�AA�B'�AB"�B'�"B'N)zhttp://localhost:8000) �__name__� __module__� __qualname__�__doc__rrrrr$�rrrrs3��Q�5�3�5�4�3�4��S�#�X��4�3�4rr)rrr �typingrrrrr)rr�<module>r+s��� ��&�&�$4�$4r

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/getfounded/mcp-tool-kit'

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