babelwrap/babelwrap-js
JavaScript/TypeScript SDK for BabelWrap — the web, as an API, for your agents.
Platform-specific configuration:
{
"mcpServers": {
"babelwrap-js": {
"command": "npx",
"args": [
"-y",
"babelwrap-js"
]
}
}
}Add the config above to .claude/settings.json under the mcpServers key.
The official JavaScript/TypeScript SDK for BabelWrap — the web, as an API, for your agents.
npm install babelwrapimport { BabelWrap } from "babelwrap";
const bw = new BabelWrap({ apiKey: process.env.BABELWRAP_API_KEY! });
const session = await bw.createSession();
try {
// Navigate to a page
const snap = await session.navigate("https://news.ycombinator.com");
console.log(snap.title); // "Hacker News"
// Extract structured data
const stories = await session.extract("top 5 story titles and their URLs");
console.log(stories);
} finally {
await session.close();
}using (auto-cleanup)import { BabelWrap } from "babelwrap";
const bw = new BabelWrap({ apiKey: process.env.BABELWRAP_API_KEY! });
await using session = await bw.createSession();
await session.navigate("https://example.com");
await session.fill("Email field", "user@example.com");
await session.fill("Password field", "secret");
await session.submit();
const data = await session.extract("the user profile information");BabelWrapconst bw = new BabelWrap({
apiKey: "bw_...", // Required
baseUrl: "https://...", // Default: https://api.babelwrap.com
timeout: 60000, // Default: 60s
maxRetries: 3, // Default: 3
});Methods:
createSession(options?) — Create a new browser sessionusage() — Get current usage statshealth() — Health checkmapSite(url, cookies?) — Map a website and generate typed toolslistSites() — List mapped sitessiteTools(siteId) — Get tools for a mapped siteexecuteTool(siteId, toolName, params?) — Execute a site toolSessionAll methods return a Snapshot (attribute-accessible page state) unless noted.
navigate(url) — Navigate to URLclick(target) — Click element by description-
Loading reviews...