MCP server for browser-use
Project description
browser-mcp
A MCP (Model Control Protocol) server for browser-use library. This package allows AI agents to perform web browsing tasks through a standardized interface.
Installation
You can install the package using pip:
pip install browser-mcp
Or with uv (recommended):
uv pip install browser-mcp
Setup
For development, clone the repository and install in development mode:
# Clone the repository
git clone https://github.com/pranav7/browser-mcp.git
cd browser-mcp
# Install dependencies with uv
uv pip install -e .
# Or with pip
pip install -e .
Environment Variables
Create a .env file with your OpenAI API key:
OPENAI_API_KEY=your_api_key_here
Usage
Running the MCP Server
In Development Mode
When working with the package in development mode, you can run it directly with Python:
python -m src
In Production
After installing the package from PyPI, you can run it with uvx:
uvx browser-mcp
The package is specifically designed to work with uvx, which allows for more efficient package loading and execution.
Using as a Client
from mcp.client import Client
async def main():
client = await Client.connect()
# Perform a task with the browser
result = await client.rpc("perform_task_with_browser",
task="Search for the latest news about AI and summarize the top 3 results")
print(result)
await client.close()
Programmatic Usage
You can also use the package programmatically:
# In development mode
from src import run
# In production (after installing the package)
# from browser_mcp import run
# Run the MCP server with stdio transport
run(transport="stdio")
# Or with SSE transport
# run(transport="sse")
Available RPC Methods
perform_task_with_browser(task: str)- Performs a specified task using the browser-use Agent with GPT-4o-mini
Development
Testing
Tests can be run with:
python -m unittest discover
You can also test the package functionality with:
python test_uvx.py
This script will:
- Test importing the package directly (development mode)
- Attempt to run it with uvx (production mode)
Note: The uvx test may fail in development mode unless the package is published to PyPI. This is expected behavior.
Publishing to PyPI
This project uses GitHub Actions to automatically publish to PyPI when a new release is created. The workflow:
- Builds the package using uv
- Publishes it to PyPI using trusted publishing
To create a new release:
- Update the version in
pyproject.toml - Create a new release on GitHub
- The GitHub Action will automatically build and publish the package
License
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file browser_mcp-0.1.0.tar.gz.
File metadata
- Download URL: browser_mcp-0.1.0.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
91d8260be37a052edabd4d8516f2921223af4d9a7ee5642bd4f4396415fd67fb
|
|
| MD5 |
c95ad5183828ad64b0cd28169287de28
|
|
| BLAKE2b-256 |
e62ea814321ef412a2bb93c7aaea47677ece992fa31b3d9d9d2f7309c15c102a
|
Provenance
The following attestation bundles were made for browser_mcp-0.1.0.tar.gz:
Publisher:
python-publish.yml on pranav7/browser-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
browser_mcp-0.1.0.tar.gz -
Subject digest:
91d8260be37a052edabd4d8516f2921223af4d9a7ee5642bd4f4396415fd67fb - Sigstore transparency entry: 180443449
- Sigstore integration time:
-
Permalink:
pranav7/browser-mcp@af15a8b340bab6290803e8bd8103e03d83dda92e -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/pranav7
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@af15a8b340bab6290803e8bd8103e03d83dda92e -
Trigger Event:
release
-
Statement type:
File details
Details for the file browser_mcp-0.1.0-py3-none-any.whl.
File metadata
- Download URL: browser_mcp-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4e3ad513c0338578807cba8d155f34cafa9ba58baf2db60fe05083f68c7c1b90
|
|
| MD5 |
4c54932523e9522e0a54762fc2aae09f
|
|
| BLAKE2b-256 |
050019fd7e385856ec3332fdd2be7c86d175ed64897c0ec06a54d9ff2c155309
|
Provenance
The following attestation bundles were made for browser_mcp-0.1.0-py3-none-any.whl:
Publisher:
python-publish.yml on pranav7/browser-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
browser_mcp-0.1.0-py3-none-any.whl -
Subject digest:
4e3ad513c0338578807cba8d155f34cafa9ba58baf2db60fe05083f68c7c1b90 - Sigstore transparency entry: 180443451
- Sigstore integration time:
-
Permalink:
pranav7/browser-mcp@af15a8b340bab6290803e8bd8103e03d83dda92e -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/pranav7
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@af15a8b340bab6290803e8bd8103e03d83dda92e -
Trigger Event:
release
-
Statement type: