Skip to main content
Glama

Browser Use MCP Server

main.cpython-311.pyc3.42 kB
� ��h����ddlmZddlmZddlZddlZddlmZejej d���ej e ��Z ed��Z dae ���ded efd ���Zd �Zd �Ze d kr e��dSdS)�)�FastMCP)�AgentN)�get_llmz4%(asctime)s - %(name)s - %(levelname)s - %(message)s)�level�formatz browser-use�task�returnc��RK� t�d|����t|t���}|����d{V��}d|��S#t $rF}t�dt|������dt|����cYd}~Sd}~wwxYw)z�Run a browser automation task described in natural language using browser_use Agent, it can perform many tasks like browsing the web, searching the web, and more. Args: task: Natural language description of the task to perform zStarting browser task: )r�llmNzTask completed: zError in async browser task: zError performing task: )�logger�inforr �run� Exception�error�str)r�agent�result�es �4/home/pietro/browser-use-mcp/browser_use_mcp/main.py�run_browser_use_taskrs����� 2�� � �4�d�4�4�5�5�5��4�S�)�)�)���y�y�{�{�"�"�"�"�"�"��*�&�*�*�*�� �2�2�2�� � �=�S��V�V�=�=�>�>�>�1��Q���1�1�1�1�1�1�1�1�����2���s�AA� B&� ;B!�B&�!B&c��tjd���}|�ddtdd���|���S)zParse command line arguments.zBrowser Use MCP Server)� descriptionz--modelz-mNzGSpecify the model to use. Overrides the default model for the provider.)�type�default�help)�argparse�ArgumentParser� add_argumentr� parse_args)�parsers rrr(sV�� � $�1I� J� J� J�F� ���� � �� V� ���� � � � � ��c�>�t��} t|j���anB#t$r5}t �dt|������Yd}~dSd}~wwxYwt �d��t� d���dS)z%Entry point for the command-line tool)� model_namezError initializing LLM: N�zStarting browser-use-mcp server�stdio)� transport) rr�modelr � ValueErrorr rrr �mcpr)�argsrs r�mainr+6s��� �<�<�D� ����,�,�,���� ����� � �8��A���8�8�9�9�9��q�q�q�q�q��������� �K�K�1�2�2�2��G�G�g�G�����s�&� A%�*A � A%�__main__)�mcp.server.fastmcpr� browser_user�loggingr�browser_use_mcp.modelsr� basicConfig�INFO� getLogger�__name__r r)r �toolrrrr+�r!r�<module>r7s��&�&�&�&�&�&���������������+�*�*�*�*�*���� �,�U����� �� �8� $� $���g�m���� �������2�S�2�S�2�2�2� ��2�$ � � ����$ �z����D�F�F�F�F�F��r!

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/pietrozullo/browser-use-mcp'

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