MCPcopy Index your code
hub / github.com/cantino/browser-friend

github.com/cantino/browser-friend @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
32 symbols 84 edges 9 files 0 documented · 0%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Browser Friend

GPT4 embedded in your browser, with the ability to use tools.

Current tools:

type RequestDOM = { cssSelector: string }; // Receive a summarized DOM for a selector.
type RequestText = { cssSelector: string }; // Request the visible text inside of a page region
type GetSelection = "GetSelection"; // Request the user's currently highlighted text
type Fill = { cssSelector: string, text: string } // To fill in form fields
type Calculate = { jsFormula: string } // To eval arbitrary JS in a sandbox, and return the result to the assistant.
type Respond = { textToDisplay: string } // To display a response to the user

Examples:

This example includes DOM viewing and form filling: hn-post

This example includes DOM viewing, text fetching, and doing a calculation in a sandbox: hn-math

More advanced calculation (sometimes it writes a recursive version if you don't encourage it not to): fib

Development

This extension is based on Plasmo and was bootstrapped with plasmo init.

Getting Started

First, run the development server:

pnpm dev
# or
npm run dev

Open your browser and load the appropriate development build. For example, if you are developing for the chrome browser, using manifest v3, use: build/chrome-mv3-dev.

Making production build

Run the following:

pnpm build
# or
npm run build

This should create a production bundle for your extension, ready to be zipped and published to the stores.

Submit to the webstores

The easiest way to deploy your Plasmo extension is to use the built-in bpp GitHub action. Prior to using this action however, make sure to build your extension and upload the first version to the store to establish the basic credentials. Then, simply follow this setup instruction and you should be on your way for automated submission!

Extension points exported contracts — how you extend this code

ChatMessage (Interface)
(no doc)
background/messages/openai.ts

Core symbols most depended-on inside this repo

callback
called by 9
popup.tsx
logAndSend
called by 9
contents/pageRequestHandler.ts
nextTick
called by 3
popup.tsx
sendToBot
called by 3
popup.tsx
assistantResponseFromString
called by 2
popup.tsx
getCurrentTabUrl
called by 1
popup.tsx
addReminders
called by 1
popup.tsx
injectContext
called by 1
popup.tsx

Shape

Function 31
Interface 1

Languages

TypeScript100%

Modules by API surface

popup.tsx20 symbols
contents/pageRequestHandler.ts5 symbols
helpers/openaiChatApiHelpers.tsx2 symbols
helpers/domHelpers.ts2 symbols
background/messages/openai.ts2 symbols
options.tsx1 symbols

For agents

$ claude mcp add browser-friend \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact