@mcp-b/transports 1.1.2-beta.2 → 1.1.2-beta.4
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/README.md +93 -2
- package/package.json +28 -8
package/README.md
CHANGED
|
@@ -1,6 +1,35 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @mcp-b/transports
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> Browser transport implementations for Model Context Protocol (MCP) - Connect AI agents like Claude, ChatGPT, and Gemini to web applications
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@mcp-b/transports)
|
|
6
|
+
[](https://www.npmjs.com/package/@mcp-b/transports)
|
|
7
|
+
[](https://opensource.org/licenses/MIT)
|
|
8
|
+
[](https://www.typescriptlang.org/)
|
|
9
|
+
[](https://bundlephobia.com/package/@mcp-b/transports)
|
|
10
|
+
|
|
11
|
+
📖 **[Full Documentation](https://docs.mcp-b.ai/packages/transports)** | 🚀 **[Quick Start](https://docs.mcp-b.ai/quickstart)** | 🔌 **[Transport Concepts](https://docs.mcp-b.ai/concepts/transports)**
|
|
12
|
+
|
|
13
|
+
**@mcp-b/transports** provides browser-native MCP transport implementations that enable AI agents and LLMs to communicate with web applications. Whether you're building Chrome extensions, embedded iframes, or in-page AI integrations, this library provides the secure messaging layer you need.
|
|
14
|
+
|
|
15
|
+
## Why Use @mcp-b/transports?
|
|
16
|
+
|
|
17
|
+
| Feature | Benefit |
|
|
18
|
+
|---------|---------|
|
|
19
|
+
| **Multiple Transport Types** | Choose the right transport for your architecture - Tab, Iframe, or Extension |
|
|
20
|
+
| **Secure by Default** | Origin validation, CORS configuration, and Chrome's secure messaging APIs |
|
|
21
|
+
| **AI-Agent Ready** | Built specifically for MCP, the standard protocol for AI tool integration |
|
|
22
|
+
| **TypeScript First** | Full type safety with comprehensive type definitions |
|
|
23
|
+
| **Zero Dependencies** | Only requires `zod` for schema validation |
|
|
24
|
+
| **Works Everywhere** | Chrome, Firefox, Edge, and any Chromium-based browser |
|
|
25
|
+
|
|
26
|
+
## Use Cases
|
|
27
|
+
|
|
28
|
+
- **Browser Extensions**: Build AI-powered extensions that interact with any webpage
|
|
29
|
+
- **Embedded AI Widgets**: Add AI capabilities to existing web applications via iframes
|
|
30
|
+
- **In-Page AI Assistants**: Create AI tools that work directly within your web app
|
|
31
|
+
- **Cross-Extension Communication**: Let extensions share AI tools with each other
|
|
32
|
+
- **Enterprise AI Portals**: Connect internal AI agents to web-based tools
|
|
4
33
|
|
|
5
34
|
## Installation
|
|
6
35
|
|
|
@@ -486,3 +515,65 @@ const result = await client.callTool({
|
|
|
486
515
|
- Server extensions should validate incoming connections from other extensions
|
|
487
516
|
- Configure `allowedOrigins` appropriately for your use case
|
|
488
517
|
- Tools execute in their original context (web page or extension)
|
|
518
|
+
|
|
519
|
+
## Frequently Asked Questions
|
|
520
|
+
|
|
521
|
+
### What is MCP (Model Context Protocol)?
|
|
522
|
+
|
|
523
|
+
MCP is an open protocol that standardizes how AI applications connect to external tools and data sources. It's used by AI agents like Claude, ChatGPT, Cursor, and Copilot to interact with external systems. Learn more at [modelcontextprotocol.io](https://modelcontextprotocol.io).
|
|
524
|
+
|
|
525
|
+
### Which transport should I use?
|
|
526
|
+
|
|
527
|
+
| Scenario | Recommended Transport |
|
|
528
|
+
|----------|----------------------|
|
|
529
|
+
| Same-page communication | `TabServerTransport` / `TabClientTransport` |
|
|
530
|
+
| Parent page to iframe | `IframeParentTransport` / `IframeChildTransport` |
|
|
531
|
+
| Browser extension to webpage | `ExtensionClientTransport` / `ExtensionServerTransport` |
|
|
532
|
+
| Extension to extension | `ExtensionExternalClientTransport` / `ExtensionExternalServerTransport` |
|
|
533
|
+
|
|
534
|
+
### Is this compatible with Claude Desktop, Cursor, or VS Code Copilot?
|
|
535
|
+
|
|
536
|
+
Yes! These transports implement the MCP standard, making them compatible with any MCP client. Use `@mcp-b/chrome-devtools-mcp` to connect desktop AI agents to browser-based tools.
|
|
537
|
+
|
|
538
|
+
### How do I handle cross-origin communication?
|
|
539
|
+
|
|
540
|
+
All transports support origin validation. Configure `allowedOrigins` on server transports and `targetOrigin` on client transports to control which origins can communicate.
|
|
541
|
+
|
|
542
|
+
### Can I use this without a browser extension?
|
|
543
|
+
|
|
544
|
+
Yes! `TabServerTransport` and `TabClientTransport` work entirely within a web page using `window.postMessage`. No extension required.
|
|
545
|
+
|
|
546
|
+
## Comparison with Alternatives
|
|
547
|
+
|
|
548
|
+
| Feature | @mcp-b/transports | Raw postMessage | WebSocket |
|
|
549
|
+
|---------|------------------|-----------------|-----------|
|
|
550
|
+
| MCP Protocol Support | Yes | No | Manual |
|
|
551
|
+
| Type Safety | Full TypeScript | Manual | Manual |
|
|
552
|
+
| Origin Validation | Built-in | Manual | N/A |
|
|
553
|
+
| Extension Support | Native | Limited | Complex |
|
|
554
|
+
| Server Discovery | Automatic | Manual | Manual |
|
|
555
|
+
|
|
556
|
+
## Related Packages
|
|
557
|
+
|
|
558
|
+
- [`@mcp-b/global`](https://docs.mcp-b.ai/packages/global) - W3C Web Model Context API polyfill for registering tools
|
|
559
|
+
- [`@mcp-b/react-webmcp`](https://docs.mcp-b.ai/packages/react-webmcp) - React hooks for MCP tool registration
|
|
560
|
+
- [`@mcp-b/extension-tools`](https://docs.mcp-b.ai/packages/extension-tools) - 62+ Chrome Extension API tools for MCP
|
|
561
|
+
- [`@mcp-b/chrome-devtools-mcp`](https://docs.mcp-b.ai/packages/chrome-devtools-mcp) - Connect desktop AI agents to browser tools
|
|
562
|
+
- [`@modelcontextprotocol/sdk`](https://www.npmjs.com/package/@modelcontextprotocol/sdk) - Official MCP SDK
|
|
563
|
+
|
|
564
|
+
## Resources
|
|
565
|
+
|
|
566
|
+
- [WebMCP Documentation](https://docs.mcp-b.ai)
|
|
567
|
+
- [Transport Concepts](https://docs.mcp-b.ai/concepts/transports)
|
|
568
|
+
- [Model Context Protocol Spec](https://modelcontextprotocol.io)
|
|
569
|
+
- [MCP GitHub Repository](https://github.com/modelcontextprotocol)
|
|
570
|
+
|
|
571
|
+
## License
|
|
572
|
+
|
|
573
|
+
MIT - see [LICENSE](../../LICENSE) for details
|
|
574
|
+
|
|
575
|
+
## Support
|
|
576
|
+
|
|
577
|
+
- [GitHub Issues](https://github.com/WebMCP-org/npm-packages/issues)
|
|
578
|
+
- [Documentation](https://docs.mcp-b.ai)
|
|
579
|
+
- [Discord Community](https://discord.gg/a9fBR6Bw)
|
package/package.json
CHANGED
|
@@ -1,24 +1,44 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mcp-b/transports",
|
|
3
|
-
"version": "1.1.2-beta.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "1.1.2-beta.4",
|
|
4
|
+
"description": "Browser transport implementations for Model Context Protocol (MCP) - postMessage, Chrome extension messaging, and iframe communication for AI agents and LLMs",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mcp",
|
|
7
7
|
"model-context-protocol",
|
|
8
8
|
"browser",
|
|
9
9
|
"transport",
|
|
10
10
|
"browser-extension",
|
|
11
|
-
"
|
|
12
|
-
"
|
|
11
|
+
"chrome-extension",
|
|
12
|
+
"postmessage",
|
|
13
|
+
"iframe",
|
|
14
|
+
"ai-agents",
|
|
15
|
+
"llm",
|
|
16
|
+
"claude",
|
|
17
|
+
"chatgpt",
|
|
18
|
+
"openai",
|
|
19
|
+
"anthropic",
|
|
20
|
+
"browser-automation",
|
|
21
|
+
"web-ai",
|
|
22
|
+
"ai-tools",
|
|
23
|
+
"message-passing",
|
|
24
|
+
"cross-origin",
|
|
25
|
+
"webmcp",
|
|
26
|
+
"ai-assistant",
|
|
27
|
+
"mcp-transport",
|
|
28
|
+
"mcp-client",
|
|
29
|
+
"mcp-server",
|
|
30
|
+
"gemini",
|
|
31
|
+
"cursor",
|
|
32
|
+
"copilot"
|
|
13
33
|
],
|
|
14
|
-
"homepage": "https://
|
|
34
|
+
"homepage": "https://docs.mcp-b.ai/packages/transports",
|
|
15
35
|
"bugs": {
|
|
16
|
-
"url": "https://github.com/
|
|
36
|
+
"url": "https://github.com/WebMCP-org/npm-packages/issues"
|
|
17
37
|
},
|
|
18
38
|
"repository": {
|
|
19
39
|
"type": "git",
|
|
20
|
-
"url": "git+https://github.com/
|
|
21
|
-
"directory": "
|
|
40
|
+
"url": "git+https://github.com/WebMCP-org/npm-packages.git",
|
|
41
|
+
"directory": "transports"
|
|
22
42
|
},
|
|
23
43
|
"license": "MIT",
|
|
24
44
|
"author": "Alex Nahas",
|