Skip to content
Last updated

The Model Context Protocol (MCP) is an open standard that enables AI-powered tools to connect seamlessly with external data sources and capabilities.
An MCP server acts as the bridge between an AI assistant or agent and the APIs or functions it can use in real time, making workflows more efficient and streamlined.

What is the Bria MCP?

The Bria MCP Server brings this standard to visual AI, enabling developers to integrate enterprise-grade image generation and editing directly into AI assistants, chatbots, or automated workflows.
It delivers a smooth, reliable experience with improved task handling and flexible authentication options, making it simple to integrate and scale without building or maintaining your own infrastructure.

Key Advantages

  • Agent Ready – Any AI agent can instantly access Bria’s visual capabilities, including image generation and advanced editing tools.
  • Zero Maintenance – Bria runs, maintains, and secures MCP on its servers.
  • One Integration, All Capabilities – Replace multiple manual integrations with a single prompt-driven endpoint.

What can I do with the Bria MCP?

Bria’s MCP Server enables chat-based image generation and editing using Bria’s advanced capabilities, such as:

  • Background removal and generation
  • Image expansion
  • Increase resolution
  • Image Generation and Reimagine images based on their structure

Supported Image Formats

The Bria MCP Server supports JPG, public image URLs, or base64-encoded images.
When using Claude as your MCP client, only public image URLs are supported.


MCP Client Compatibility

The Bria MCP is compatible with all MCP clients.


Authenticating with the Bria MCP Server

To securely connect your AI application to the Bria platform, your application must authenticate with our Model Context Protocol (MCP) server. All authentication is token-based, requiring you to include a Bria-issued token in the header of your requests. This unified approach simplifies integration.

Link to MCP server: https://mcp.prod.bria-api.com/mcp/sse

We provide two methods for generating an authentication token. A key feature of Bria's platform is that all generated tokens are long-lived, which simplifies token management and eliminates the need for complex token rotation logic.

Choose the generation method that best suits your needs:

  1. Static API Key
  2. OAuth-based Bearer Token

Method 1: Static API Key

⚙️ How it works: You copy the key provided in the Bria Console and pass it in the api_token header of your MCP server request.

Steps

  1. Generate your API Key: Navigate to the API keys page and copy an API key for MCP.
  2. Store it Securely: Treat this key as a secret. Store it as an environment variable (e.g., BRIA_API_KEY) and never expose it in client-side code.
  3. Configure the MCP Request: In your model's API call, pass the API key within the headers parameter.

Method 2: OAuth-based Bearer Token

🔐 How it works: Your application guides the user through the OAuth 2.0 authorization process. Upon success, Bria provides a long-lived bearer token. You then pass this token in the authorization_token parameter of your MCP server request.

Steps

  1. Integrate the OAuth Flow: Implement the Bria OAuth 2.0 flow within your application to request authorization.
  2. Receive and Store the Token: After a user grants consent, your application will receive a long-lived bearer token. Store this token securely, associating it with the user.
  3. Configure the MCP Request: Pass the bearer token to the dedicated authorization_token parameter.

Link to Anthropic's official guide for obtaining the OAuth-based bearer token: https://docs.anthropic.com/en/docs/agents-and-tools/mcp-connector#obtaining-an-access-token-for-testing

Code Example: Bearer Token with Anthropic SDK

This example demonstrates connecting to Bria using a bearer token with the native Anthropic Python SDK. Remark: make sure to adjust to your relevant model and betas.

import os
import anthropic
from anthropic.types.beta import BetaMessageParam, BetaRequestMCPServerURLDefinitionParam
from dotenv import load_dotenv

load_dotenv()

# --- Credentials ---
# Get your Anthropic API key from https://console.anthropic.com/settings/keys
anthropic_api_key = os.environ.get("ANTHROPIC_API_KEY")
bria_auth_token = os.environ.get("BRIA_AUTH_TOKEN")
# follow this https://docs.anthropic.com/en/docs/agents-and-tools/mcp-connector#obtaining-an-access-token-for-testing

client = anthropic.Anthropic(api_key=anthropic_api_key)

# --- API Call ---
response = client.beta.messages.create(
    model="claude-3.5-sonnet-20240729",
    max_tokens=1024,
    messages=[
        BetaMessageParam(role="user", content="What Bria tools are available to me?")
    ],
    mcp_servers=[
        BetaRequestMCPServerURLDefinitionParam(
            type="url",
            url="https://mcp.prod.bria.api.com/mcp/sse",
            name="bria",
            # Pass the OAuth bearer token directly here
            authorization_token=bria_auth_token
        )
    ],
    # Ensure you are using a current beta flag
    betas=["mcp-client-2025-10-01"],
)

print(response.content[0].text)