Demo Page for Testing MCP Tools
Use this page with the MCP Inspector to test various tools!
@@ -204,7 +204,7 @@ const HTML_PAGE = ` function logObject() { console.log('Object:', { - name: 'Firefox DevTools MCP', + name: 'Firefox MCP', version: '0.1.0', features: ['console', 'dialog', 'input', 'screenshot'], config: { headless: false, timeout: 5000 } @@ -263,7 +263,7 @@ const HTML_PAGE = ` } // Initial log - console.log('π¦ Firefox DevTools MCP Demo Page Loaded!'); + console.log('π¦ Firefox MCP Demo Page Loaded!'); console.info('Server running on http://localhost:3456'); console.info('Use MCP Inspector to test tools: list_console_messages, list_pages, etc.'); @@ -286,7 +286,7 @@ const server = http.createServer((req, res) => { server.listen(PORT, () => { console.log(''); - console.log('π¦ Firefox DevTools MCP - Demo Server'); + console.log('π¦ Firefox MCP - Demo Server'); console.log('====================================='); console.log(''); console.log(`π Server running at: http://localhost:${PORT}`); diff --git a/scripts/generate-moz-package.mjs b/scripts/generate-moz-package.mjs index bc0956fe..7cf7d614 100644 --- a/scripts/generate-moz-package.mjs +++ b/scripts/generate-moz-package.mjs @@ -1,7 +1,7 @@ #!/usr/bin/env node /** * Generates package.moz.json from package.json by applying the overrides - * needed for the @mozilla/firefox-devtools-mcp-moz npm package. + * needed for the @mozilla/firefox-mcp-moz npm package. */ import { readFileSync, writeFileSync } from 'node:fs'; @@ -13,13 +13,13 @@ const pkg = JSON.parse(readFileSync(resolve(root, 'package.json'), 'utf8')); const moz = { ...pkg, - name: '@mozilla/firefox-devtools-mcp-moz', + name: '@mozilla/firefox-mcp-moz', description: pkg.description + ' (moz build with privileged context support)', main: 'dist.moz/index.js', types: 'dist.moz/index.d.ts', bin: { - 'firefox-devtools-mcp-moz': './dist.moz/index.js', + 'firefox-mcp-moz': './dist.moz/index.js', }, files: ['dist.moz', 'README.md', 'LICENSE', 'scripts', 'plugins'], publishConfig: { diff --git a/scripts/publish-compat-package.mjs b/scripts/publish-compat-package.mjs new file mode 100755 index 00000000..79d64aea --- /dev/null +++ b/scripts/publish-compat-package.mjs @@ -0,0 +1,46 @@ +#!/usr/bin/env node +/** + * Publishes the current dist/ build as @mozilla/firefox-devtools-mcp, the + * package name used before the rename to firefox-mcp, so that existing + * `npx @mozilla/firefox-devtools-mcp@latest` setups keep updating. + * Run it after the main package is built. + * + * Any extra arguments are forwarded to npm publish, e.g.: + * node publish-compat-package.mjs --access public --provenance + */ + +import { existsSync, readFileSync, writeFileSync } from 'node:fs'; +import { resolve } from 'node:path'; +import { publishStaged, root } from './_helpers/publish-staged.mjs'; + +if (!existsSync(resolve(root, 'dist', 'index.js'))) { + console.error('dist/index.js not found, run npm run build first.'); + process.exit(1); +} + +const pkg = JSON.parse(readFileSync(resolve(root, 'package.json'), 'utf8')); +const compat = { + ...pkg, + name: '@mozilla/firefox-devtools-mcp', + // A bin name of its own, so both packages can be installed globally side by side + bin: { 'firefox-devtools-mcp': 'dist/index.js' }, +}; + +// prepublishOnly would rebuild inside the staging directory +delete compat.scripts; + +// mcpName claims the MCP registry entry of the canonical package, not this one +delete compat.mcpName; + +publishStaged({ + pkg: compat, + stagingPrefix: 'firefox-devtools-mcp-compat-', + npmArgs: process.argv.slice(2), + prepare: (stagingDir) => { + const readme = resolve(stagingDir, 'README.md'); + const notice = + `**This package is now published as [\`${pkg.name}\`](https://www.npmjs.com/package/${pkg.name}).** ` + + `\`${compat.name}\` gets the same releases, so existing setups keep working.\n\n`; + writeFileSync(readme, notice + readFileSync(readme, 'utf8')); + }, +}); diff --git a/scripts/publish-moz-package.mjs b/scripts/publish-moz-package.mjs index 9cf2667d..1d2321b8 100644 --- a/scripts/publish-moz-package.mjs +++ b/scripts/publish-moz-package.mjs @@ -1,6 +1,6 @@ #!/usr/bin/env node /** - * Builds and publishes the firefox-devtools-mcp-moz package. + * Builds and publishes the firefox-mcp-moz package. * Creates a staging directory with dist.moz/ and package.moz.json as package.json, * then runs npm publish from there. * @@ -8,37 +8,16 @@ * node publish-moz-package.mjs --access public --provenance */ -import { readFileSync, existsSync, cpSync, copyFileSync, mkdirSync, mkdtempSync, rmSync } from 'node:fs'; +import { readFileSync } from 'node:fs'; import { execSync } from 'node:child_process'; -import { resolve, dirname } from 'node:path'; -import { fileURLToPath } from 'node:url'; -import { tmpdir } from 'node:os'; - -const root = resolve(dirname(fileURLToPath(import.meta.url)), '..'); +import { resolve } from 'node:path'; +import { publishStaged, root } from './_helpers/publish-staged.mjs'; console.log('Building moz package...'); execSync('npm run build:moz', { cwd: root, stdio: 'inherit' }); -const mozPkg = JSON.parse(readFileSync(resolve(root, 'package.moz.json'), 'utf8')); -const stagingDir = mkdtempSync(resolve(tmpdir(), 'firefox-devtools-mcp-moz-')); - -try { - for (const entry of mozPkg.files) { - const src = resolve(root, entry); - const dst = resolve(stagingDir, entry); - if (!existsSync(src)) { - console.warn(`Warning: ${entry} not found, skipping`); - continue; - } - mkdirSync(dirname(dst), { recursive: true }); - cpSync(src, dst, { recursive: true }); - } - - copyFileSync(resolve(root, 'package.moz.json'), resolve(stagingDir, 'package.json')); - - const extraArgs = process.argv.slice(2).join(' '); - console.log(`Publishing ${mozPkg.name}@${mozPkg.version}...`); - execSync(`npm publish ${extraArgs}`, { cwd: stagingDir, stdio: 'inherit' }); -} finally { - rmSync(stagingDir, { recursive: true, force: true }); -} +publishStaged({ + pkg: JSON.parse(readFileSync(resolve(root, 'package.moz.json'), 'utf8')), + stagingPrefix: 'firefox-mcp-moz-', + npmArgs: process.argv.slice(2), +}); diff --git a/scripts/setup-mcp-config.js b/scripts/setup-mcp-config.js index f1aee91c..c4dc9ce0 100755 --- a/scripts/setup-mcp-config.js +++ b/scripts/setup-mcp-config.js @@ -62,7 +62,7 @@ function detectNodePath() { async function main() { console.log( - `${colors.bright}${colors.blue}π Firefox DevTools MCP Configuration Setup${colors.reset}\n` + `${colors.bright}${colors.blue}π Firefox MCP Configuration Setup${colors.reset}\n` ); // Ask which client to configure @@ -136,7 +136,7 @@ async function main() { // Create MCP config const mcpConfig = { mcpServers: { - 'firefox-devtools': { + 'firefox': { command: finalNodePath, args: [distIndexPath, '--headless=' + (headless.toLowerCase() === 'y' ? 'true' : 'false'), '--viewport=' + viewport], }, @@ -192,9 +192,9 @@ async function main() { if (fs.existsSync(configPath)) { try { existingConfig = JSON.parse(fs.readFileSync(configPath, 'utf8')); - if (existingConfig.mcpServers && existingConfig.mcpServers['firefox-devtools']) { + if (existingConfig.mcpServers && existingConfig.mcpServers['firefox']) { const overwrite = await question( - `\n${colors.yellow}β οΈ 'firefox-devtools' server already exists in ${clientName}. Overwrite? (y/n): ${colors.reset}` + `\n${colors.yellow}β οΈ 'firefox' server already exists in ${clientName}. Overwrite? (y/n): ${colors.reset}` ); if (overwrite.toLowerCase() !== 'y') { console.log(`Skipped ${clientName}`); diff --git a/server.json b/server.json index db42b209..ba82dcaf 100644 --- a/server.json +++ b/server.json @@ -1,19 +1,19 @@ { "$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json", - "name": "io.github.mozilla/firefox-devtools-mcp", - "title": "Firefox DevTools MCP", + "name": "io.github.mozilla/firefox-mcp", + "title": "Firefox MCP", "description": "Control and debug Firefox: navigate, fill forms, inspect network and console, profile.", "version": "0.10.7", - "websiteUrl": "https://github.com/mozilla/firefox-devtools-mcp", + "websiteUrl": "https://github.com/mozilla/firefox-mcp", "repository": { - "url": "https://github.com/mozilla/firefox-devtools-mcp", + "url": "https://github.com/mozilla/firefox-mcp", "source": "github" }, "packages": [ { "registryType": "npm", "registryBaseUrl": "https://registry.npmjs.org", - "identifier": "@mozilla/firefox-devtools-mcp", + "identifier": "@mozilla/firefox-mcp", "version": "0.10.7", "transport": { "type": "stdio" diff --git a/src/cli.ts b/src/cli.ts index ded1aeb1..421bd95c 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -1,5 +1,5 @@ /** - * CLI argument parsing for Firefox DevTools MCP server + * CLI argument parsing for Firefox MCP server */ import type { Options as YargsOptions } from 'yargs'; @@ -101,7 +101,7 @@ export const cliOptions = { firefoxArg: { type: 'array', description: - 'Additional arguments for Firefox. Only applies when Firefox is launched by firefox-devtools-mcp.', + 'Additional arguments for Firefox. Only applies when Firefox is launched by firefox-mcp.', }, startUrl: { type: 'string', @@ -229,7 +229,7 @@ export function parseArguments(version: string, argv = process.argv, includePriv const { enablePrivilegedContext: _, ...rest } = cliOptions; const options = includePrivileged ? cliOptions : rest; const yargsInstance = yargs(hideBin(argv)) - .scriptName('npx firefox-devtools-mcp@latest') + .scriptName('npx @mozilla/firefox-mcp@latest') .options(options) .example([ [ diff --git a/src/config/constants.ts b/src/config/constants.ts index 35afe5c3..18771398 100644 --- a/src/config/constants.ts +++ b/src/config/constants.ts @@ -1,12 +1,11 @@ /** - * Configuration constants for Firefox DevTools MCP server + * Configuration constants for Firefox MCP server */ // Injected at build time by esbuild define declare const __SERVER_NAME__: string | undefined; declare const __SERVER_VERSION__: string | undefined; -export const SERVER_NAME = - typeof __SERVER_NAME__ !== 'undefined' ? __SERVER_NAME__ : 'firefox-devtools'; +export const SERVER_NAME = typeof __SERVER_NAME__ !== 'undefined' ? __SERVER_NAME__ : 'firefox-mcp'; export const SERVER_VERSION = typeof __SERVER_VERSION__ !== 'undefined' ? __SERVER_VERSION__ : 'dev'; diff --git a/src/firefox/core.ts b/src/firefox/core.ts index 596c87b4..85289c47 100644 --- a/src/firefox/core.ts +++ b/src/firefox/core.ts @@ -316,7 +316,7 @@ export class FirefoxCore { throw new Error( `Another WebDriver session is already active in Firefox on 127.0.0.1:${port}, ` + 'and Marionette allows only one at a time. If it belongs to another ' + - 'firefox-devtools-mcp server started with --connect-existing, that server releases ' + + 'firefox-mcp server started with --connect-existing, that server releases ' + 'Firefox when it calls close_firefox_session or after it has been idle; try again then.' ); } diff --git a/src/firefox/profile.ts b/src/firefox/profile.ts index 10c36540..300f19f6 100644 --- a/src/firefox/profile.ts +++ b/src/firefox/profile.ts @@ -1,5 +1,5 @@ /** - * Profile path resolution for Firefox DevTools MCP + * Profile path resolution for Firefox MCP * * Unmarked user supplied paths use a dedicated subfolder to avoid reusing a * real browser profile in an automated session. Marked MCP profiles can be diff --git a/src/index.ts b/src/index.ts index 1a8014db..580e42ac 100644 --- a/src/index.ts +++ b/src/index.ts @@ -310,7 +310,7 @@ export async function run( const transport = new StdioServerTransport(); await mcpServer.connect(transport); - log('Firefox DevTools MCP server running on stdio'); + log('Firefox MCP server running on stdio'); log('Ready to accept tool requests'); // Clean up the Marionette session so Firefox accepts new connections. diff --git a/src/tools/downloads.ts b/src/tools/downloads.ts index a09dca31..af997e5c 100644 --- a/src/tools/downloads.ts +++ b/src/tools/downloads.ts @@ -1,5 +1,5 @@ /** - * Download tracking tools for Firefox DevTools MCP + * Download tracking tools for Firefox MCP * Surfaces BiDi download events and controls download behavior */ diff --git a/src/tools/network.ts b/src/tools/network.ts index 4880614f..8b34a4fd 100644 --- a/src/tools/network.ts +++ b/src/tools/network.ts @@ -1,5 +1,5 @@ /** - * Network monitoring tools for Firefox DevTools MCP + * Network monitoring tools for Firefox MCP * Provides network request inspection capabilities */ diff --git a/src/types/common.ts b/src/types/common.ts index 3571569e..b831ddc0 100644 --- a/src/types/common.ts +++ b/src/types/common.ts @@ -1,5 +1,5 @@ /** - * Common types shared across the Firefox DevTools MCP server + * Common types shared across the Firefox MCP server */ export type McpContentItem = diff --git a/src/utils/errors.ts b/src/utils/errors.ts index 6f89750a..ce64f8f4 100644 --- a/src/utils/errors.ts +++ b/src/utils/errors.ts @@ -1,5 +1,5 @@ /** - * Custom error classes for Firefox DevTools MCP + * Custom error classes for Firefox MCP */ /**