logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

context-protocol-bridge

Facilitates the translation of captured web browsing network activity (from HAR archives) into structured Model Context Protocols (MCPs), granting autonomous agents like Claude immediate, functional access to external web service capabilities.

Author

context-protocol-bridge logo

theclarityproject

No License

Quick Info

GitHub GitHub Stars 0
NPM Weekly Downloads 0
Tools 1
Last Updated 2026-02-19

Tags

apisapirequestsweb apiaccess aiapis http

The Clarity Protocol Conduit: Bridging Browsers and AI Agents

Transform raw network logs into executable AI tools. This service smuggles your HTTP session data, packaged neatly as an MCP, for agent consumption.

Core Functionality

This application serves as the gateway to Model Context Protocols (MCPs). It ingests HTTP Archive (HAR) data, deduces the underlying API interactions, and formalizes them into consumable tools for large language models (LLMs) such as Claude. Essentially, we are packaging existing web functionality for AI exploitation.

Operational Flow

mermaid sequenceDiagram participant Agent as AI Agent (Client) participant Bridge as Context Bridge Server participant Engine as MCP Backend System participant Target as External Web Services

note over Agent,Target: Tool Lifecycle
Engine->>Engine: Ingest and Parse HAR Files
Engine->>Engine: Infer API Signatures & Parameters
Engine->>Engine: Construct Tool Definitions
Engine->>Engine: Persist Definitions

note over Agent,Target: Runtime Interaction
Agent->>Bridge: Establish Linkage (e.g., stdio)
Agent->>Bridge: Request Tool Inventory
Bridge->>Engine: Relay Inventory Query
Engine->>Bridge: Supply Available Tool Schema
Bridge->>Agent: Present Tools List

Agent->>Bridge: Initiate Tool Execution
Bridge->>Bridge: Normalize Call Syntax
Bridge->>Engine: Forward Executable Request
Engine->>Target: Execute Network Payload
Target->>Engine: Return Raw Response
Engine->>Bridge: Package Result Data
Bridge->>Agent: Deliver Final Output

Deployment Guide

bash

Install the required distribution package globally

npm install -g @lekt9/clarity-mcp

Configure necessary authorization token

export CLARITY_AUTH_TOKEN=your_secret_key

Optionally, set a specific protocol instance ID

export CLARITY_PROTOCOL_ID=your_designated_id

Launch the translation service

clarity-mcp

Protocol Generation Workflow

To fabricate custom Model Context Protocols from your browser sessions:

  1. Navigate to the official Clarity portal: https://www.theclarityproject.net
  2. Submit the requisite HAR file capture.
  3. The service will analyze the traffic and generate the functional tool specifications.
  4. Secure your unique access credential from the portal interface.

The Black Market for Agent Capabilities

Premium Agent Assets

MCPs represent the prized assets for advanced AI entities. These structured protocols grant LLMs the capacity to interface with live systems and retrieve current external data, liberating the AI from static training constraints.

APIs in New Packaging

Fundamentally, MCPs are simply conventional APIs dressed in AI-friendly attire. They adhere to established interface standards (like OpenAPI), but are meticulously formatted to be immediately consumable by AI execution environments. It's astute marketing applied to established networking primitives.

Deconstructing Live Traffic

Every modern website constantly transmits data via network calls. With the appropriate capture mechanism, these transmissions can be systematically reverse-engineered to create functional, proprietary duplicates of the underlying service interfaces.

From Log File to High-Value Protocol

our mechanism transforms pedestrian HAR logs into premium-grade MCPs attractive to any agent fleet. By scrutinizing endpoints, required inputs, and anticipated outputs, we generate a perfect, executable digital twin of the original interaction.

Operational Insight: When an agent invokes a tool, it executes a network operation mediated by an MCP. Manufacturing these protocols effectively grants the AI the power to interact with almost any internet-accessible resource.

Capturing the Traffic Payload (HAR Smuggling)

A HAR (HTTP Archive) file meticulously documents every request and response exchanged between your browser and a web server. Follow these steps to generate a compliant capture file:

Phase 1: Accessing Diagnostics

Invoke the browser's developer tools via right-click inspection or standard shortcuts:

  • Windows Browsers (Chrome/Edge/Firefox): F12 or Ctrl+Shift+I
  • macOS Browsers (Chrome/Edge/Firefox): Option+Cmd+I
  • Safari (Mac): Requires enabling the 'Develop' menu (Preferences > Advanced), then Option+Cmd+I

Phase 2: Recording Network Events

In the Developer Tools pane, select the "Network" tab.

  • Verify recording is active (usually indicated by a red recording indicator).
  • Enable "Preserve log" to retain data across navigation events.
  • Optionally, clear the current log to isolate the desired activity.
  • Execute the web application actions that generate the target API calls (e.g., form submission, data retrieval sequences).

Ensure comprehensive interaction to log all necessary API transactions.

Phase 3: Exporting the Archive

Locate any entry within the request list in the Network tab and right-click.

  • Select the option: "Save all as HAR with content" (or comparable export command).
  • Designate a secure storage location for the resulting .har file.

You are now prepared to submit this HAR file via the Clarity web upload interface.

Security Warning: HAR files frequently contain sensitive credentials, session tokens, and personal identification data. Treat these files with strict confidentiality and refrain from public dissemination.

Integration with Claude

  1. Install the official Claude client application.
  2. Access Claude's configuration settings and locate the MCP configuration area.
  3. Register a new MCP endpoint using this initialization command:

npx -y @smithery/cli@latest install @lekt9/clarity-mcp --claude

  1. Commence dialogue with Claude, utilizing the functions now exposed by your Clarity Protocol Bridge.

Configurable Environment Parameters

  • CLARITY_AUTH_TOKEN: Mandatory credential for authenticating against the central Clarity processing engine.
  • CLARITY_PROTOCOL_ID: Optional identifier to select a specific, pre-configured MCP instance.
  • NEXTJS_APP_URL: Address pointing to the core Clarity service infrastructure (defaults to https://clarity.org/).

Internal Mechanism Overview

Structural Design

The server operates fundamentally as a protocol intermediary:

  1. MCP Standard Handling: Manages the specific communication schema required by the MCP specification for client interaction.
  2. Request Tunneling: Efficiently routes client-initiated requests onward to the remote Clarity backend.
  3. Output Normalization: Re-formats the backend's response data to strictly conform to the expected MCP output format.

Essential Components

  • Bridge Module: The primary server implementation, utilizing the MCP SDK framework.
  • Dispatchers: Dedicated routines for processing ListTools and CallTool operations.
  • Syntax Converters: Logic dedicated to mapping and translating naming conventions between systems.
  • Fault Tolerance Layer: Ensures robust error propagation and graceful failure handling.

Development Environment Setup

To initiate local development operation:

bash

Obtain the source code repository

git clone https://github.com/lekt9/clarity-mcp.git cd clarity-mcp

Install project dependencies

npm install

Compile the necessary service artifacts

npm run build

Operational Constraints

  • Successful operation mandates a valid authentication token for backend communication.
  • Tool execution fidelity is directly dependent on the connectivity and availability of the Clarity backend infrastructure.
  • The server intentionally omits local caching mechanisms for tool schemas or execution results.

Licensing

Under the terms of the MIT License.

== WIKIPEDIA CONTEXT (For Reference) ==

XMLHttpRequest (XHR) is an application programming interface available within JavaScript environments, designed to facilitate the transmission of HTTP requests between a web browser environment and a remote web server. Its methods enable browser-based applications to perform server communications asynchronously subsequent to the initial page load, retrieving data without forcing a full page refresh. XHR is a foundational element of Asynchronous JavaScript and XML (Ajax) programming techniques. Before Ajax gained prominence, the standard methods for server interaction were traditional page navigation via hyperlinks or form submissions, which inherently replaced the current viewport content.

== Genesis == The foundational concepts underpinning XMLHttpRequest were first conceived around the year 2000 by the development team responsible for Microsoft Outlook. This idea was subsequently brought to fruition within the Internet Explorer 5 browser release (1999). However, the initial implementation did not utilize the canonical XMLHttpRequest identifier. Instead, developers relied on instantiating COM objects using identifiers such as ActiveXObject("Msxml2.XMLHTTP") and ActiveXObject("Microsoft.XMLHTTP"). By the time Internet Explorer 7 was released in 2006, universal support for the standardized XMLHttpRequest identifier was established across the platform. This standardized identifier has since become the recognized convention across all major browser engines, including Mozilla's Gecko (2002), Safari 1.2 (2004), and Opera 8.0 (2005).

=== Standardization Efforts === The World Wide Web Consortium (W3C) released an initial Working Draft specification for the XMLHttpRequest object on April 5, 2006. A subsequent Level 2 specification was published by the W3C on February 25, 2008. The Level 2 revision introduced crucial capabilities such as progress monitoring events, mechanisms for enabling cross-site requests (CORS), and enhanced support for handling binary byte streams. By the close of 2011, the features defined in the Level 2 document were formally merged back into the primary specification. In late 2012, responsibility for the maintenance and evolution of the standard transitioned to the WHATWG group, which now sustains a living document utilizing the Web IDL notation.

== Operational Usage == Generally, executing a server request via XMLHttpRequest involves a defined sequence of programming actions.

  1. Object Instantiation: Create an instance of the XMLHttpRequest object by invoking its constructor.
  2. Configuration: Invoke the open method to define the HTTP verb, specify the target resource URI, and designate whether the operation will be synchronous or asynchronous.
  3. Event Listener Setup: For asynchronous operations, establish a callback function to be triggered upon changes in the request's state.
  4. Transmission: Signal the initiation of the request by calling the send method, optionally including payload data.
  5. State Monitoring: The event listener processes state transitions. Upon successful receipt of server data, it is typically stored in the responseText property. When the transaction concludes, the state transitions to 4, signifying the "done" status. Beyond these fundamental steps, XMLHttpRequest offers extensive control over request dispatch and response interpretation. Custom HTTP headers can be injected to direct server behavior, and data can be streamed to the server via arguments within the send call. Responses can be automatically parsed from JSON text into native JavaScript data structures, or processed incrementally as they arrive rather than awaiting the complete payload. Furthermore, requests can be terminated mid-flight or configured with a mandatory timeout limit.

== Inter-Domain Communication ==

In the nascent period of the World Wide Web, it was quickly identified that security constraints prevented the direct breach of the same-origin policy, making it impossible to initiate requests between domains without encountering restrictions...

See Also

`