webear and web perception
About
Give your AI real senses (audio, visuals, performance, network, security, and console logs) in real time from any running web application.
Details
- Author
- asume21
- Categories
- Developer Tools
Jump to
Setup
Install webear and web perception in your MCP client (Claude Desktop, Cursor, Windsurf, and others).
Repository: https://github.com/asume21/webear
Follow the installation instructions in the repository README, then restart your MCP client.
Give your AI real senses — hear, see, and feel any web app.
"The beat sounds muddy"→ your AI captures 3 seconds, measures the spectral centroid at 580 Hz with 45% energy below 250 Hz, and tells you exactly why.
Browser (Web Audio API) ↓ MediaRecorder taps the AudioContext output node ↓ Uploads WebM blob via HTTP POST Express Middleware (your dev server) ↓ Stores captures in memory, dispatches commands via SSE MCP Server (stdio — runs inside your IDE) ↓ Retrieves captures, sends to CodedSwitch analysis API AI Coding Assistant → "Your bass band is 42% of the mix (high), spectral centroid is 580 Hz (muddy), and timing jitter is 23ms — the scheduler is drifting under load."
The key difference from every other audio MCP:this taps the Web Audio graph directly, bypassing room acoustics, microphone hardware, and the need to export files.
2. Add the Express middleware to your dev server
import express from 'express' import { webearMiddleware } from 'webear/middleware' const app = express() app.use(express.json()) // Mount the audio debug bridge (automatically disabled in production) app.use('/api/webear', webearMiddleware()) app.listen(5000)
3. Add the client snippet to your web app
Option A — auto-detect everything (Tone.js or raw Web Audio)
import WebEar from 'webear/client' WebEar.init()
const ctx = new AudioContext() const masterGain = ctx.createGain() masterGain.connect(ctx.destination) WebEar.init({ audioContext: ctx, outputNode: masterGain })
import as Tone from 'tone' WebEar.init({ toneJs: true })
import as THREE from 'three' const listener = new THREE.AudioListener() camera.add(listener) WebEar.init({ tapNode: listener.getInput() })
<script src="node_modules/webear/client-snippet.js"></script> <script>WebEar.init()</script>
Claude Code(.mcp.jsonin project root):
{ "mcpServers": { "webear": { "command": "npx", "args": ["webear"], "env": { "WEBEAR_BASE_URL": "http://localhost:5000", "CODEDSWITCH_API_KEY": "your-key-here" } } } }
{ "mcpServers": { "webear": { "command": "npx", "args": ["webear"], "env": { "WEBEAR_BASE_URL": "http://localhost:5000", "CODEDSWITCH_API_KEY": "your-key-here" } } } }
{ "webear": { "command": "npx", "args": ["webear"], "disabled": false, "env": { "WEBEAR_BASE_URL": "http://localhost:5000", "CODEDSWITCH_API_KEY": "your-key-here" } } }
5. Get an API key — optional, and not to start
analyze_audioworks with no key and no account.Ifffmpegis on your PATH, it decodes and analyzes the captureon your machineand returns a basic report: duration, loudness, peak level and whether the audio is clipping. Nothing is uploaded. Try the tool before you sign up for anything.
A key unlocks the parts that need more than arithmetic:
- Create a free account atcodedswitch.com.
- Go tocodedswitch.com/developer(also in the account menu asDeveloper API).
- ClickGenerate API Key— that value is yourCODEDSWITCH_API_KEY. Keys start withwbr_.
Free tier: 50 analyses/day. No credit card required.
6. Start your dev server, open your app, play audio, then ask your AI:
"Capture 3 seconds and tell me why the bass sounds muddy."
"Compare the audio before and after my last commit."
"Is there any clipping in the high-frequency range?"
── Audio Analysis Report ────────────────────────────── Duration: 3.02s ── Loudness ───────────────────────────────────────── RMS: -12.4 dBFS Peak: -1.2 dBFS Dynamic range: 11.2 dB Crest factor: 3.63 Clipping: none ── Tone ────────────────────────────────────────────── Spectral centroid: 2847 Hz DC offset: 0.00012 (ok) ── Frequency Bands ─────────────────────────────────── Sub (20-80 Hz): 8.2% Bass (80-250 Hz): 22.1% Mid (250-2k Hz): 38.4% Hi-mid (2-6k Hz): 21.8% High (6k+ Hz): 9.5% ── Rhythm ──────────────────────────────────────────── Estimated BPM: 92 Onset count: 12 Timing jitter: 4.2 ms std dev ── Summary ─────────────────────────────────────────── Loudness: -12.4 dBFS RMS, peak -1.2 dBFS. Tone: balanced (centroid 2847 Hz). Band mix — sub: 8% | bass: 22% | mid: 38% | hi-mid: 22% | high: 10%. Rhythm: estimated 92 BPM, 12 onsets detected. Timing: very tight (< 5 ms jitter).
── Audio Diff: a1b2c3d4… → e5f6g7h8… ── ── Loudness ────────────────────────────────────────── RMS: -14.2 dBFS → -12.4 dBFS (+1.8 dBFS) ⚠ Peak: -3.1 dBFS → -0.2 dBFS (+2.9 dBFS) ⚠ CLIPPING INTRODUCED — gain staging regression ── Tone ────────────────────────────────────────────── ⚠ Spectral centroid: 2847.0 Hz → 1920.0 Hz (-927.0 Hz) ── Interpretation ──────────────────────────────────── A gain bug was introduced that causes clipping. Tonal character changed noticeably — EQ or filter behaviour may have shifted.
webearMiddleware({ maxCaptures: 50, // Max captures in memory (default: 50) maxAgeMins: 10, // Auto-evict after N minutes (default: 10) maxUploadBytes: 50e6, // Max upload size (default: 50MB) devOnly: true, // Disable in production (default: true) })
WebEar.init({ audioContext: myCtx, // Your AudioContext instance outputNode: myGainNode, // The node to tap (defaults to destination) toneJs: true, // Auto-detect Tone.js context bridgeBase: '/api/webear', // Override API path devOnly: true, // Only init outside of production (default: true) })
- Node.js>= 18
- A browser that supportsMediaRecorder(Chrome, Firefox, Edge, Safari 14+)
- ACODEDSWITCH_API_KEYfor analysis (free atcodedswitch.com)
- Web Audio / Tone.js developers— debug beats, synths, effects, and mixing without leaving your IDE
- Game audio developers— verify sound effects, spatial audio, and mixing in real-time
- Music app builders— catch regressions between code changes withdiff_audio
- Podcast / streaming apps— validate audio quality, levels, and encoding
- Anyone whose app makes sound— if it has a Web Audio graph, your AI can now hear it
Microphone MCPs capture room sound — your fan noise, chair creaks, and room reverb are all in the recording.webeartaps the Web Audio APIbefore it hits the DAC, giving you a clean digital signal with no room artifacts.
WebEar started as audio-only.Web Perceptionexpands it to 6 senses:
import { WebPerception } from 'webear/perception' WebPerception.init({ apiKey: 'wbr_YOUR_API_KEY', relayUrl: 'https://www.codedswitch.com', sensors: ['ear', 'eye', 'sense', 'nerve', 'shield', 'log'], })
import { WebEar } from 'webear/perception' WebEar.init({ apiKey: 'wbr_YOUR_API_KEY', ear: { audioContext: myCtx, audioNode: masterGain }, })
Connect via MCP (hosted relay — no local server required)
{ "mcpServers": { "webear": { "url": "https://www.codedswitch.com/api/webear/mcp/sse", "headers": { "Authorization": "Bearer wbr_YOUR_API_KEY" } } } }
- Create a free account atcodedswitch.com.
- Opencodedswitch.com/developer— also linked asDeveloper APIin the account menu.
- ClickGenerate API Keyand copy it. Keys start withwbr_.
Free tier: 50 analyses/day, no credit card required.
- Fixed the getting-started path for API keys.The previous instruction ("Settings → WebEar") was wrong — there is no WebEar section under Settings. Keys live atcodedswitch.com/developer(linked asDeveloper APIin the account menu). Both the Quick Start and the Web Perception sections now point to the correct place.
- The SDK's "missing API key" console error now links straight to the key page.
This is a web browser that enables your coding agent, such as Claude Code, to visit websites on your behalf and assist you in identifying bugs or creating UI test cases.
Create crafted UI components inspired by the best 21st.dev design engineers.
Bring agent evaluations, observability, and synthetic test set generation directly into your IDE for free with Galileo's new MCP server
An MCP server to help AI assistants to answer questions and generate AccelByte Extend SDK code more effectively .
MCP server for AI Diagram Maker — generate beautiful software engineering diagrams directly inside Cursor, Claude Desktop, Claude Code, or any MCP-compatible AI agent
ALAPI MCP Tools,Call hundreds of API interfaces via MCP
AI-powered SVG animation generator that transforms static files into animated SVG components using the Allyson platform
MCP server that gives AI assistants on-demand access to 1,500+ amCharts docs, ~300 code examples, and 1000+ class API references.
APIMatic MCP Server is used to validate OpenAPI specifications using APIMatic. The server processes OpenAPI files and returns validation summaries by leveraging APIMatic’s API.
One shared context layer for AI agents and humans — live API specs, DB schemas, and versioned contracts across repos so every agent and teammate works from the same source of truth.
Build and deploy full-stack Next.js apps with 98 tools for React, AWS, and MongoDB
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.





