openclaw-protocol-bridge 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 justin
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,567 @@
1
+ # Protocol Bridge
2
+
3
+ **The TCP/IP of Agent Standards** - Universal protocol translation layer for AI Agents
4
+
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6
+ [![TypeScript](https://img.shields.io/badge/TypeScript-5.7-blue)](https://www.typescriptlang.org/)
7
+ [![Node.js](https://img.shields.io/badge/Node.js-18+-green)](https://nodejs.org/)
8
+
9
+ > Bridging the AI Agent protocol divide - enabling seamless communication across MCP, A2A, ACP, and custom protocols.
10
+
11
+ ---
12
+
13
+ ## The Problem: Agent Sprawl
14
+
15
+ As of 2026, **40% of enterprise applications** now feature AI agents (up from 5% in 2025). However:
16
+
17
+ - Different departments use **incompatible protocols** (MCP, A2A, ACP)
18
+ - Agents built with different frameworks **cannot communicate**
19
+ - "Agent sprawl" is the **#1 concern** for enterprise CTOs
20
+ - No unified standard = **isolated AI agent islands**
21
+
22
+ **Protocol Bridge solves this.**
23
+
24
+ ---
25
+
26
+ ## What is Protocol Bridge?
27
+
28
+ Protocol Bridge is an **open-source universal translation layer** that enables AI agents to communicate regardless of their underlying protocol. Think of it as the **TCP/IP for AI agents** - a standardized routing and translation layer.
29
+
30
+ ### Core Capabilities
31
+
32
+ - **Multi-Protocol Support** - MCP, A2A, ACP, LangChain, AutoGPT, CrewAI
33
+ - **Real-Time Translation** - Convert messages between any two protocols
34
+ - **Message Routing** - Intelligent routing based on capability, availability, cost
35
+ - **Discovery Service** - Find and connect to agents across protocols
36
+ - **Security Layer** - Built-in authentication, encryption, audit logging
37
+ - **Fallback Mechanisms** - Automatic retry and failover logic
38
+
39
+ ---
40
+
41
+ ## Supported Protocols
42
+
43
+ | Protocol | Type | Status | Use Case |
44
+ |----------|------|--------|----------|
45
+ | **MCP** (Model Context Protocol) | Tool/Data | ✅ Full | Agent ↔ Tools/Data Sources |
46
+ | **A2A** (Agent-to-Agent) | Agent Comm | ✅ Full | Agent ↔ Agent Communication |
47
+ | **ACP** (Agent Comm Protocol) | Agent Comm | 🚧 Beta | Cross-framework messaging |
48
+ | **LangChain** | Framework | 🚧 Beta | LangChain agents |
49
+ | **AutoGPT** | Framework | ⏳ Planned | AutoGPT agents |
50
+ | **CrewAI** | Framework | ⏳ Planned | CrewAI multi-agent |
51
+ | **Custom** | - | ✅ Full | Bring your own protocol |
52
+
53
+ ---
54
+
55
+ ## Quick Start
56
+
57
+ ### Installation
58
+
59
+ ```bash
60
+ npm install -g openclaw-protocol-bridge
61
+ ```
62
+
63
+ Or clone and build:
64
+
65
+ ```bash
66
+ git clone https://github.com/ZhenRobotics/openclaw-protocol-bridge.git
67
+ cd openclaw-protocol-bridge
68
+ npm install
69
+ npm run build
70
+ ```
71
+
72
+ ### Basic Usage
73
+
74
+ ```typescript
75
+ import { ProtocolBridge } from 'openclaw-protocol-bridge';
76
+
77
+ // Initialize the bridge
78
+ const bridge = new ProtocolBridge({
79
+ protocols: ['mcp', 'a2a', 'acp'],
80
+ discovery: true,
81
+ security: {
82
+ encryption: true,
83
+ authentication: 'jwt'
84
+ }
85
+ });
86
+
87
+ // Register an MCP agent
88
+ await bridge.registerAgent({
89
+ id: 'research-agent',
90
+ protocol: 'mcp',
91
+ capabilities: ['search', 'summarize'],
92
+ endpoint: 'http://localhost:3001'
93
+ });
94
+
95
+ // Send message from A2A agent to MCP agent
96
+ const result = await bridge.send({
97
+ from: { id: 'assistant-agent', protocol: 'a2a' },
98
+ to: { id: 'research-agent', protocol: 'mcp' },
99
+ action: 'search',
100
+ params: { query: 'AI agent protocols 2026' }
101
+ });
102
+ ```
103
+
104
+ ### CLI Usage
105
+
106
+ ```bash
107
+ # Start the bridge server
108
+ protocol-bridge serve --port 8080
109
+
110
+ # Register an agent
111
+ protocol-bridge register \
112
+ --id my-agent \
113
+ --protocol mcp \
114
+ --endpoint http://localhost:3000
115
+
116
+ # List connected agents
117
+ protocol-bridge list
118
+
119
+ # Send a message
120
+ protocol-bridge send \
121
+ --from agent-a \
122
+ --to agent-b \
123
+ --action execute \
124
+ --data '{"task": "analyze data"}'
125
+ ```
126
+
127
+ ---
128
+
129
+ ## Architecture
130
+
131
+ Protocol Bridge uses a **layered architecture** similar to the OSI model:
132
+
133
+ ```
134
+ ┌─────────────────────────────────────────┐
135
+ │ Application Layer (Your Agents) │
136
+ ├─────────────────────────────────────────┤
137
+ │ Protocol Adapters (MCP/A2A/ACP) │
138
+ ├─────────────────────────────────────────┤
139
+ │ Translation Layer (Message Mapping) │
140
+ ├─────────────────────────────────────────┤
141
+ │ Routing Layer (Discovery & Routing) │
142
+ ├─────────────────────────────────────────┤
143
+ │ Transport Layer (HTTP/WebSocket/gRPC) │
144
+ ├─────────────────────────────────────────┤
145
+ │ Security Layer (Auth/Encryption) │
146
+ └─────────────────────────────────────────┘
147
+ ```
148
+
149
+ ### Key Components
150
+
151
+ 1. **Protocol Adapters** - Implement protocol-specific logic (MCP, A2A, ACP)
152
+ 2. **Message Translator** - Converts messages between protocols
153
+ 3. **Router** - Routes messages to appropriate agents based on capabilities
154
+ 4. **Discovery Service** - Maintains registry of available agents
155
+ 5. **Security Manager** - Handles authentication, encryption, authorization
156
+ 6. **Monitor** - Tracks metrics, health, performance
157
+
158
+ ---
159
+
160
+ ## Use Cases
161
+
162
+ ### 1. Enterprise Agent Orchestration
163
+
164
+ Connect agents across departments:
165
+ - **HR Agent** (MCP) ↔ **Finance Agent** (A2A) ↔ **IT Agent** (ACP)
166
+
167
+ ```typescript
168
+ // HR agent requests finance data
169
+ await bridge.send({
170
+ from: { id: 'hr-agent', protocol: 'mcp' },
171
+ to: { id: 'finance-agent', protocol: 'a2a' },
172
+ action: 'get_employee_costs',
173
+ params: { department: 'Engineering' }
174
+ });
175
+ ```
176
+
177
+ ### 2. Multi-Framework Development
178
+
179
+ Build with different frameworks, communicate seamlessly:
180
+
181
+ ```typescript
182
+ // LangChain agent → CrewAI agent
183
+ await bridge.send({
184
+ from: { id: 'langchain-agent', protocol: 'langchain' },
185
+ to: { id: 'crewai-team', protocol: 'crewai' },
186
+ action: 'delegate_task',
187
+ params: { task: 'research market trends' }
188
+ });
189
+ ```
190
+
191
+ ### 3. Protocol Migration
192
+
193
+ Migrate from one protocol to another without rewriting agents:
194
+
195
+ ```typescript
196
+ // Legacy MCP agent → New A2A agent
197
+ const bridge = new ProtocolBridge({
198
+ migrations: [
199
+ { from: 'mcp', to: 'a2a', agents: ['legacy-agent-1'] }
200
+ ]
201
+ });
202
+ ```
203
+
204
+ ### 4. Agent Marketplace
205
+
206
+ Create a marketplace where agents discover and hire each other:
207
+
208
+ ```typescript
209
+ // Find agents with specific capabilities
210
+ const agents = await bridge.discover({
211
+ capabilities: ['data-analysis', 'visualization'],
212
+ maxCost: 0.05,
213
+ protocols: ['mcp', 'a2a']
214
+ });
215
+ ```
216
+
217
+ ---
218
+
219
+ ## Configuration
220
+
221
+ ### Basic Config (`bridge.config.json`)
222
+
223
+ ```json
224
+ {
225
+ "protocols": {
226
+ "mcp": {
227
+ "enabled": true,
228
+ "version": "2025-11-25",
229
+ "adapters": ["http", "websocket"]
230
+ },
231
+ "a2a": {
232
+ "enabled": true,
233
+ "version": "1.0",
234
+ "discovery": true
235
+ },
236
+ "acp": {
237
+ "enabled": true,
238
+ "version": "beta"
239
+ }
240
+ },
241
+ "routing": {
242
+ "strategy": "capability-based",
243
+ "fallback": true,
244
+ "timeout": 30000
245
+ },
246
+ "security": {
247
+ "authentication": "jwt",
248
+ "encryption": "aes-256-gcm",
249
+ "allowedOrigins": ["*"]
250
+ },
251
+ "monitoring": {
252
+ "metrics": true,
253
+ "logging": "info",
254
+ "healthCheck": true
255
+ }
256
+ }
257
+ ```
258
+
259
+ ### Environment Variables
260
+
261
+ ```bash
262
+ # Server
263
+ BRIDGE_PORT=8080
264
+ BRIDGE_HOST=0.0.0.0
265
+
266
+ # Security
267
+ JWT_SECRET=your-secret-key
268
+ ENCRYPTION_KEY=your-encryption-key
269
+
270
+ # Protocols
271
+ MCP_ENABLED=true
272
+ A2A_ENABLED=true
273
+ ACP_ENABLED=true
274
+
275
+ # Logging
276
+ LOG_LEVEL=info
277
+ LOG_FORMAT=json
278
+ ```
279
+
280
+ ---
281
+
282
+ ## Protocol Specifications
283
+
284
+ ### Message Format
285
+
286
+ All messages are translated to a **universal format**:
287
+
288
+ ```json
289
+ {
290
+ "id": "msg-123",
291
+ "timestamp": "2026-03-13T10:00:00Z",
292
+ "from": {
293
+ "agentId": "agent-a",
294
+ "protocol": "mcp"
295
+ },
296
+ "to": {
297
+ "agentId": "agent-b",
298
+ "protocol": "a2a"
299
+ },
300
+ "type": "request",
301
+ "action": "execute_task",
302
+ "payload": {
303
+ "task": "analyze_data",
304
+ "params": { "dataset": "sales-2026" }
305
+ },
306
+ "metadata": {
307
+ "priority": "high",
308
+ "timeout": 60000,
309
+ "retry": true
310
+ }
311
+ }
312
+ ```
313
+
314
+ ### Protocol Mapping
315
+
316
+ | Concept | MCP | A2A | ACP |
317
+ |---------|-----|-----|-----|
318
+ | Agent Identity | `client_id` | `agent_id` | `participant_id` |
319
+ | Capability | `tool` | `skill` | `capability` |
320
+ | Message | `request/response` | `message` | `communication` |
321
+ | Discovery | `resources` | `registry` | `directory` |
322
+
323
+ ---
324
+
325
+ ## Advanced Features
326
+
327
+ ### Custom Protocol Adapters
328
+
329
+ Create your own protocol adapter:
330
+
331
+ ```typescript
332
+ import { BaseAdapter } from 'protocol-bridge';
333
+
334
+ export class MyCustomAdapter extends BaseAdapter {
335
+ async send(message: UniversalMessage): Promise<Response> {
336
+ // Transform to your protocol format
337
+ const customMessage = this.transform(message);
338
+ return await this.client.send(customMessage);
339
+ }
340
+
341
+ async receive(data: any): Promise<UniversalMessage> {
342
+ // Transform from your protocol to universal format
343
+ return this.transformToUniversal(data);
344
+ }
345
+ }
346
+
347
+ // Register the adapter
348
+ bridge.registerAdapter('custom', new MyCustomAdapter());
349
+ ```
350
+
351
+ ### Message Interceptors
352
+
353
+ Add middleware to process messages:
354
+
355
+ ```typescript
356
+ bridge.use(async (message, next) => {
357
+ // Log all messages
358
+ console.log(`Message: ${message.from.agentId} → ${message.to.agentId}`);
359
+
360
+ // Modify message
361
+ message.metadata.processedBy = 'bridge';
362
+
363
+ // Continue
364
+ return await next(message);
365
+ });
366
+ ```
367
+
368
+ ### Load Balancing
369
+
370
+ Distribute load across multiple agent instances:
371
+
372
+ ```typescript
373
+ bridge.configure({
374
+ routing: {
375
+ strategy: 'round-robin',
376
+ healthCheck: true,
377
+ instances: [
378
+ { id: 'agent-1', endpoint: 'http://localhost:3001' },
379
+ { id: 'agent-2', endpoint: 'http://localhost:3002' },
380
+ { id: 'agent-3', endpoint: 'http://localhost:3003' }
381
+ ]
382
+ }
383
+ });
384
+ ```
385
+
386
+ ---
387
+
388
+ ## Monitoring & Observability
389
+
390
+ ### Metrics Dashboard
391
+
392
+ ```bash
393
+ # Start with metrics enabled
394
+ protocol-bridge serve --metrics
395
+
396
+ # Access dashboard at http://localhost:8080/metrics
397
+ ```
398
+
399
+ **Available Metrics:**
400
+ - Total messages routed
401
+ - Success/failure rates by protocol
402
+ - Average latency per protocol
403
+ - Agent availability
404
+ - Protocol translation overhead
405
+
406
+ ### Health Checks
407
+
408
+ ```bash
409
+ curl http://localhost:8080/health
410
+ ```
411
+
412
+ Response:
413
+ ```json
414
+ {
415
+ "status": "healthy",
416
+ "uptime": 86400,
417
+ "protocols": {
418
+ "mcp": "active",
419
+ "a2a": "active",
420
+ "acp": "degraded"
421
+ },
422
+ "agents": {
423
+ "registered": 12,
424
+ "active": 10,
425
+ "inactive": 2
426
+ }
427
+ }
428
+ ```
429
+
430
+ ---
431
+
432
+ ## Security
433
+
434
+ ### Authentication
435
+
436
+ Supports multiple auth methods:
437
+
438
+ - **JWT** - JSON Web Tokens
439
+ - **OAuth 2.0** - Standard OAuth flow
440
+ - **API Keys** - Simple key-based auth
441
+ - **mTLS** - Mutual TLS certificates
442
+
443
+ ### Encryption
444
+
445
+ - **In-transit**: TLS 1.3 for all connections
446
+ - **At-rest**: AES-256-GCM for stored credentials
447
+ - **End-to-end**: Optional E2E encryption for messages
448
+
449
+ ### Audit Logging
450
+
451
+ All bridge operations are logged:
452
+
453
+ ```json
454
+ {
455
+ "timestamp": "2026-03-13T10:00:00Z",
456
+ "event": "message_routed",
457
+ "from": "agent-a",
458
+ "to": "agent-b",
459
+ "protocol_translation": "mcp→a2a",
460
+ "status": "success",
461
+ "latency_ms": 45
462
+ }
463
+ ```
464
+
465
+ ---
466
+
467
+ ## Roadmap
468
+
469
+ ### Q2 2026
470
+ - ✅ MCP support (v2025-11-25)
471
+ - ✅ A2A support (v1.0)
472
+ - ✅ Basic routing and discovery
473
+ - 🚧 ACP support (beta)
474
+
475
+ ### Q3 2026
476
+ - 🔜 LangChain adapter
477
+ - 🔜 AutoGPT adapter
478
+ - 🔜 CrewAI adapter
479
+ - 🔜 GraphQL API
480
+ - 🔜 WebSocket streaming
481
+
482
+ ### Q4 2026
483
+ - 🔜 Agent marketplace
484
+ - 🔜 Cost tracking and billing
485
+ - 🔜 Advanced load balancing
486
+ - 🔜 Multi-region deployment
487
+ - 🔜 NIST compliance certification
488
+
489
+ ---
490
+
491
+ ## Contributing
492
+
493
+ We welcome contributions! See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
494
+
495
+ ### Development Setup
496
+
497
+ ```bash
498
+ # Clone the repo
499
+ git clone https://github.com/ZhenRobotics/protocol-bridge.git
500
+ cd protocol-bridge
501
+
502
+ # Install dependencies
503
+ npm install
504
+
505
+ # Run tests
506
+ npm test
507
+
508
+ # Start dev server
509
+ npm run dev
510
+
511
+ # Build
512
+ npm run build
513
+ ```
514
+
515
+ ---
516
+
517
+ ## Standards & Compliance
518
+
519
+ Protocol Bridge is designed to align with:
520
+
521
+ - **NIST AI Agent Standards Initiative** (2026)
522
+ - **Linux Foundation Agentic AI Foundation** (AAIF)
523
+ - **MCP Specification** (2025-11-25)
524
+ - **A2A Protocol** (Google/partners)
525
+
526
+ ---
527
+
528
+ ## License
529
+
530
+ MIT License - see [LICENSE](LICENSE) for details.
531
+
532
+ ---
533
+
534
+ ## Acknowledgments
535
+
536
+ Built on the shoulders of giants:
537
+
538
+ - **Anthropic** - Model Context Protocol (MCP)
539
+ - **Google** - Agent-to-Agent Protocol (A2A)
540
+ - **Linux Foundation** - Agentic AI Foundation
541
+ - **NIST** - AI Agent Standards Initiative
542
+
543
+ ---
544
+
545
+ ## Links
546
+
547
+ - **Documentation**: https://protocol-bridge.dev/docs
548
+ - **GitHub**: https://github.com/ZhenRobotics/openclaw-protocol-bridge
549
+ - **npm**: https://www.npmjs.com/package/openclaw-protocol-bridge
550
+ - **ClawHub**: https://clawhub.com/protocol-bridge
551
+ - **Specification**: https://protocol-bridge.dev/spec
552
+ - **Community**: https://discord.gg/protocol-bridge
553
+
554
+ ---
555
+
556
+ **Unify your AI agents. Bridge the protocol divide.** 🌉🤖
557
+
558
+ ---
559
+
560
+ ## Sources
561
+
562
+ - [Model Context Protocol - Wikipedia](https://en.wikipedia.org/wiki/Model_Context_Protocol)
563
+ - [MCP Specification](https://modelcontextprotocol.io/specification/2025-11-25)
564
+ - [Anthropic MCP Announcement](https://www.anthropic.com/news/model-context-protocol)
565
+ - [NIST AI Agent Standards Initiative](https://www.nist.gov/caisi/ai-agent-standards-initiative)
566
+ - [Announcing A2A Protocol - Google](https://developers.googleblog.com/en/a2a-a-new-era-of-agent-interoperability/)
567
+ - [InfoQ: Architecting Agentic MLOps](https://www.infoq.com/articles/architecting-agentic-mlops-a2a-mcp/)
@@ -0,0 +1,93 @@
1
+ {
2
+ "douyin": {
3
+ "enabled": true,
4
+ "name": "抖音",
5
+ "api_base": "https://open.douyin.com",
6
+ "upload_endpoint": "/oauth/platform/upload/video",
7
+ "max_file_size": 268435456,
8
+ "supported_formats": ["mp4", "mov", "avi"],
9
+ "max_duration": 300,
10
+ "rate_limit": {
11
+ "requests_per_hour": 100,
12
+ "requests_per_day": 1000
13
+ }
14
+ },
15
+ "kuaishou": {
16
+ "enabled": true,
17
+ "name": "快手",
18
+ "api_base": "https://open.kuaishou.com",
19
+ "upload_endpoint": "/openapi/video/upload",
20
+ "max_file_size": 268435456,
21
+ "supported_formats": ["mp4", "mov"],
22
+ "max_duration": 600,
23
+ "rate_limit": {
24
+ "requests_per_hour": 100,
25
+ "requests_per_day": 1000
26
+ }
27
+ },
28
+ "weixin": {
29
+ "enabled": true,
30
+ "name": "微信视频号",
31
+ "api_base": "https://api.weixin.qq.com",
32
+ "upload_endpoint": "/channels/ec/basics/video/upload",
33
+ "max_file_size": 268435456,
34
+ "supported_formats": ["mp4"],
35
+ "max_duration": 300,
36
+ "rate_limit": {
37
+ "requests_per_hour": 50,
38
+ "requests_per_day": 500
39
+ }
40
+ },
41
+ "bilibili": {
42
+ "enabled": true,
43
+ "name": "哔哩哔哩",
44
+ "api_base": "https://member.bilibili.com",
45
+ "upload_endpoint": "/x/vu/web/add/v3",
46
+ "max_file_size": 4294967296,
47
+ "supported_formats": ["mp4", "flv", "mov"],
48
+ "max_duration": 7200,
49
+ "rate_limit": {
50
+ "requests_per_hour": 50,
51
+ "requests_per_day": 500
52
+ }
53
+ },
54
+ "xiaohongshu": {
55
+ "enabled": false,
56
+ "name": "小红书",
57
+ "api_base": "https://open.xiaohongshu.com",
58
+ "upload_endpoint": "/api/v1/video/upload",
59
+ "max_file_size": 268435456,
60
+ "supported_formats": ["mp4"],
61
+ "max_duration": 300,
62
+ "rate_limit": {
63
+ "requests_per_hour": 50,
64
+ "requests_per_day": 500
65
+ }
66
+ },
67
+ "youtube": {
68
+ "enabled": true,
69
+ "name": "YouTube",
70
+ "api_base": "https://www.googleapis.com",
71
+ "upload_endpoint": "/upload/youtube/v3/videos",
72
+ "max_file_size": 137438953472,
73
+ "supported_formats": ["mp4", "mov", "avi", "flv"],
74
+ "max_duration": 43200,
75
+ "rate_limit": {
76
+ "requests_per_hour": 1000,
77
+ "requests_per_day": 10000
78
+ }
79
+ },
80
+ "tiktok": {
81
+ "enabled": true,
82
+ "name": "TikTok",
83
+ "api_base": "https://open-api.tiktok.com",
84
+ "upload_endpoint": "/share/video/upload",
85
+ "max_file_size": 287453952,
86
+ "supported_formats": ["mp4", "mov"],
87
+ "max_duration": 300,
88
+ "rate_limit": {
89
+ "requests_per_hour": 100,
90
+ "requests_per_day": 1000
91
+ }
92
+ }
93
+ }