bricks_analyze_url

UtilityIntermediateRead OnlyComplexity: 5/10
Extract design tokens (colors, fonts, spacing) from a URL

Overview

Analyzes a URL to extract design tokens including colors, fonts, sections, and layout patterns. Fetches the page HTML and parses it to identify design elements that can be used as reference when building in Bricks.

This is the foundation tool for the « clone design » workflow. By analyzing an existing website, you can extract its color palette, typography choices, section structure, and layout patterns, then recreate them in Bricks using the MCP design system tools.

Supports extraction of hex/rgb/hsl colors, CSS custom properties for colors, Google Fonts and font-family declarations, semantic HTML sections, and CSS layout patterns (grid, flexbox, Bootstrap, Tailwind).

Key Features

Color Extraction
Extracts hex, rgb/rgba, hsl/hsla colors and CSS custom properties that look like colors. Returns a deduplicated, sorted list of all colors found in the page HTML and inline styles.
Font Detection
Identifies fonts from font-family CSS declarations and Google Fonts link tags. Filters out generic families (serif, sans-serif, monospace) to return only custom font names.
Section Structure
Maps semantic HTML sections (section, header, footer, nav, main, aside, article) with their IDs, classes, and ARIA roles, giving you a blueprint for the page structure.
Layout Pattern Detection
Detects CSS layout patterns including CSS Grid, Flexbox, Bootstrap grid, Tailwind utilities, column counts from grid-template-columns, contained widths, and full-width sections.

When to Use

You want to clone or recreate an existing website design in Bricks
You need to extract the color palette from a reference site
You want to identify which fonts a website uses
You need to understand the section structure and layout patterns of a page
You are building a design system based on an existing site as reference
Prerequisites
The target URL must be publicly accessible
Bricks Builder version 1.9 or higher
The MCP server must have outbound HTTP access to fetch the URL

When NOT to Use

You want to import the actual content or elements — this only extracts design tokens
You need to analyze a page that requires authentication (login)
You want to analyze your own Bricks pages — use bricks_analyze_page instead

Parameters

2 Total Parameters1 Required1 Optional

Warning: Undefined array key "param_enum_values" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 28
urlstring (URL)REQUIRED
The URL to analyze (e.g., "https://example.com"). Must be a valid, publicly accessible URL.

Warning: Undefined array key "param_enum_values" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 28
extractarray of strings (enum)optional
Specific design tokens to extract. Options: colors, fonts, sections, layout. Omit to extract all.
Default: all types

Code Examples


Warning: Undefined array key "example_output" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 12

Extract all design tokens from a website

Analyzes a reference site to extract colors, fonts, sections, and layout patterns.

JSON
bricks_analyze_url({
  url: "https://example.com"
})
// Returns:
// {
//   url: "https://example.com",
//   colors: ["#1a1a2e", "#4361ee", "#e2e8f0", "rgba(0,0,0,0.1)"],
//   fonts: ["Inter", "Playfair Display"],
//   sections: [
//     { tag: "header", id: "site-header", classes: ["sticky", "bg-white"] },
//     { tag: "section", classes: ["hero", "full-width"] },
//     { tag: "section", id: "features", classes: ["py-20"] }
//   ],
//   layout_patterns: ["css-grid", "flexbox", "3-column-grid", "contained-width"]
// }

Warning: Undefined array key "example_output" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 12

Extract only colors and fonts

Focuses extraction on just the color palette and typography.

JSON
bricks_analyze_url({
  url: "https://example.com",
  extract: ["colors", "fonts"]
})

Common Mistakes


Warning: Undefined array key "fix_description" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 47

Deprecated: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-includes/kses.php on line 1935

Warning: Undefined array key "wrong_code" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 48

Warning: Undefined array key "right_code" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 49
This tool fetches the URL as an anonymous user. Pages behind login walls, paywalls, or basic auth will return the login page HTML, not the actual design. Only use with publicly accessible URLs.

Warning: Undefined array key "fix_description" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 47

Deprecated: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-includes/kses.php on line 1935

Warning: Undefined array key "wrong_code" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 48

Warning: Undefined array key "right_code" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 49
Colors are extracted from inline styles and CSS in the HTML. If styles are loaded from external CSS files, those colors may not be captured. Use the extracted colors as a starting point and refine manually.

Warning: Undefined array key "fix_description" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 47

Deprecated: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-includes/kses.php on line 1935

Warning: Undefined array key "wrong_code" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 48

Warning: Undefined array key "right_code" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 49
The tool returns ALL colors found, including browser defaults, utility classes, and one-off values. Curate the list to identify the primary, secondary, neutral, and semantic colors before creating your palette.

Tips & Warnings

Tips & Warnings

Tip: After extracting design tokens, use bricks_create_color_palette to create the color palette, bricks_upload_font or Google Fonts for typography, and bricks_update_theme_styles to set the typography scale.

Tip: The section structure output maps directly to Bricks sections. Use it as a blueprint: each detected <section> becomes a bricks_add_section call.

Tip: Layout pattern detection helps you choose between CSS Grid and Flexbox for your Bricks elements. If the reference site uses a 3-column grid, use _gridTemplateColumns: "1fr 1fr 1fr" in Bricks.

Warning: The URL fetch has a 15-second timeout. Very slow or large pages may time out. Single-page applications (SPAs) that render content via JavaScript may return minimal HTML.

Return Values

FieldTypeDescription
urlstringThe URL that was analyzed.
colorsarraySorted, deduplicated list of all colors found (hex, rgb, hsl, CSS custom properties).
fontsarraySorted list of custom font family names (excluding generic families).
sectionsarrayArray of semantic section objects with tag, id, classes, and role attributes.
layout_patternsarrayDetected layout patterns: css-grid, flexbox, bootstrap-grid, tailwind-utilities, N-column-grid, contained-width, full-width-sections.

Related Tools

Technical Details

Tool ID
bricks_analyze_url
API Endpoint
N/A (client-side fetch)
HTTP Method
GET
Namespace
analysis
Source File
analysis/design-import.ts
Version
1.0
Min Bricks Version
1.9
Requires Auth
Yes

Changelog

v1.0
Initial release with color, font, section, and layout pattern extraction from external URLs.
20250101