Skip to main content

WebRTC Transport for Model Context Protocol

Project description

WebRTC Transport for Model Context Protocol

There are scenarios where neither STDIO nor StreamableHTTP transport can be used to connect an MCP client to an MCP server. WebRTC can often be used instead if there is some sort of signalling connection established between the two parties.

Usage

    from mcp_webrtc import webrtc_server_transport
    from aiortc.contrib.signaling import TcpSocketSignaling
    from mcp.server.lowlevel import Server
    from mcp.types import Tool

    app = Server("mcp-greeter")

    @app.list_tools()
    async def list_tools() -> list[Tool]:
        return [
            Tool(
                name="greet",
                description="Greets the caller",
                inputSchema={
                    "type": "object",
                    "required": [],
                    "properties": {},
                },
            )
        ]

    async with webrtc_server_transport(TcpSocketSignaling("localhost", 8000)) as (read, write):
        await app.run(
            read, write, app.create_initialization_options()
        )
    from mcp import ClientSession
    from mcp_webrtc import webrtc_client_transport
    from aiortc.contrib.signaling import TcpSocketSignaling

    async with (
        webrtc_client_transport(TcpSocketSignaling("localhost", 8000)) as (
            read,
            write,
        ),
        ClientSession(read, write) as session,
    ):
        await session.initialize()
        result = await session.list_tools()
        print(result.tools)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcp_webrtc-0.0.5.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mcp_webrtc-0.0.5-py3-none-any.whl (3.2 kB view details)

Uploaded Python 3

File details

Details for the file mcp_webrtc-0.0.5.tar.gz.

File metadata

  • Download URL: mcp_webrtc-0.0.5.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mcp_webrtc-0.0.5.tar.gz
Algorithm Hash digest
SHA256 396492cd28e3fc55cb95bfe18b71b068998db9e5c30115e60ab294f30e99ffc5
MD5 4eb0f97cceaed2365bfdc8478dfee244
BLAKE2b-256 f2a5e0c24a03067c8cbd08a223725ed3973a9e0dce7385b004ea624e56244fdb

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcp_webrtc-0.0.5.tar.gz:

Publisher: release.yml on pilartomas/mcp-webrtc

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mcp_webrtc-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: mcp_webrtc-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 3.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mcp_webrtc-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 2da743850ed59e655662cd08d55ee55c3163a35e238b8cd105015436da25ec9c
MD5 7bc0aea328fa58ff34f023c0ba5f7591
BLAKE2b-256 839c028e25f17510aef2c6c8816c52a9a0d2be37b7252f39cc9a52a3bf1b45ac

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcp_webrtc-0.0.5-py3-none-any.whl:

Publisher: release.yml on pilartomas/mcp-webrtc

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page