Overview
Making your web app ABP-compatible involves:- Implementing
window.abp— A JavaScript object with required methods - Creating a manifest — A JSON file describing your app and capabilities
- Adding a manifest link — A
<link>tag in your HTML head - Testing — Verify everything works with the MCP Bridge
Prerequisites
- Basic JavaScript/TypeScript knowledge
- A web application you want to expose to AI agents
- Node.js (for testing with the MCP Bridge)
Step-by-Step Implementation
Add Manifest Link to HTML
In your Key points:
index.html (or template), add this to the <head>:- Use
rel="abp-manifest"exactly (case-sensitive) hrefcan be relative (/abp.json) or absolute (https://cdn.example.com/abp.json)- Place it in
<head>, before or after other<link>tags - Framework users: The link must be in the server-rendered HTML. ABP clients discover the manifest via raw HTTP fetch (no JS execution), so a link injected via
useEffect,onMounted, or similar hooks will never be found. Use your framework’s server-side metadata API instead. See the ABP Implementation Guide — Framework Environments for a framework-by-framework table.
Create the Manifest File
Create Key points:
public/abp.json (or wherever your static files are served):abp: Protocol version (currently"1.0")app.id: Reverse-domain notation (e.g.,com.yourcompany.appname)app.version: Semantic versioningcapabilities: Array of capabilities you exposeinputSchema: JSON Schema defining parameters
Load the Runtime
In your Important: Load
index.html, load the ABP runtime:abp-runtime.js early so window.abp is available when agents connect.Framework users:
window.abp must be assigned at module scope (top-level code that runs when the JS bundle executes), not inside lifecycle hooks like useEffect or onMounted. Lifecycle hooks run after framework hydration, which may be too late for ABP clients. Guard with typeof window !== 'undefined' for SSR safety. See the ABP Implementation Guide — Framework Environments for details.Complete Example
Here’s a complete minimal ABP app:File: public/index.html
File: public/abp.json
File: public/abp-runtime.js
(Use the code from Step 3 above)
Serve it
server.js (if using Express):
Testing Your Implementation
1. Manual Test
Openhttp://localhost:8000 in Chrome and open DevTools Console:
2. Test with MCP Bridge
3. Test Discovery
Common Patterns
Pattern: Multiple Capabilities
Pattern: Parameter Validation
Pattern: Progress Reporting
Pattern: Using Existing Libraries
Best Practices
1. Return Actual Data, Not Status Messages
2. Never Trigger Native UI
3. Validate Inputs
Always validate against yourinputSchema:
4. Handle Errors Gracefully
5. Keep Manifest in Sync
When you add/remove capabilities, update both:abp.jsonmanifestwindow.abp.call()switch statement
Common Pitfalls
Pitfall 1: Manifest Not Served
Symptom: Discovery fails Cause: Manifest file not accessible Fix:Pitfall 2: CORS Issues
Symptom: Manifest fetch fails from different origin Fix: Add CORS headers if manifest is on a different domain:Pitfall 3: window.abp Not Available
Symptom: window.abp is undefined
Fix:
- Vanilla HTML: Load
abp-runtime.jsbefore other scripts - Framework apps (React, Next.js, Vue, etc.): Assign
window.abpat module scope, not inside lifecycle hooks (useEffect,onMounted, etc.) — they run after hydration, which may be too late. See ABP Implementation Guide — Framework Environments for details.
Pitfall 4: Returning Promises Instead of Results
Pitfall 5: Not Handling Initialization State
Chrome Extensions
This guide covers web applications served at HTTP URLs. If you want to expose Chrome extension APIs (chrome.tabs, chrome.scripting, chrome.bookmarks, etc.) as ABP capabilities, see the dedicated Chrome Extension Guide.
Key differences for extensions:
- No
<link rel="abp-manifest">orabp.jsonneeded — discovery is runtime-only - The ABP entry page is
abp-app.html(loaded viachrome-extension://ID/abp-app.html) - Capabilities can call
chrome.*APIs directly fromwindow.abp.call() - Connect via
abp_connect({ extensionPath: "/path/to/extension" })instead of a URL
Next Steps
Implementation Guide
Self-contained guide with feature analysis, capability mapping, and validation checklist
Common Pitfalls
Critical implementation mistakes to avoid before shipping
Conformance Requirements
Verify your app is ABP-compliant
MCP Bridge Quick Start
Test with the MCP Bridge
Capability Taxonomy
Explore the capability namespace system
Protocol Overview
Read the full specification
App-Side Implementation
See advanced patterns
Examples & Tutorials
Working code examples