MCPcopy Index your code
hub / github.com/connectrpc/envoy-demo

github.com/connectrpc/envoy-demo @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
41 symbols 65 edges 4 files 8 documented · 20%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Connect-gRPC Envoy Bridge Demo

This repository contains a small demo of how to use the Connect-gRPC Envoy bridge.

Try it out!

To run locally, clone this repository:

git clone https://github.com/connectrpc/envoy-demo
cd envoy-demo

Then run docker-compose up to start the demo:

docker-compose up

After a minute or two, there should be a server listening on port 8080.

It's possible to browse to it directly, taking advantage of Connect's HTTP GET support: Screenshot of browsing to the Ping procedure with a Connect Get request in Mozilla Firefox.

Note: The Connect-gRPC filter requires the Connect protocol version to be set in the request to have any effect. For GET requests, this means including connect=v1 as a query parameter in the URL. For POST requests, this means including Connect-Protocol-Version: 1 in the HTTP request headers. Official Connect clients will do this automatically.

It's also possible to interact using buf curl. Since our Envoy configuration has both the Envoy gRPC Web filter and the Connect-gRPC bridge filter setup, we can use any of the available protocols:

$ buf curl http://localhost:8080/ping.v1.PingService/Ping --http2-prior-knowledge --schema . -d '{"number":2}' --protocol grpc
{"number":"2"}
$ buf curl http://localhost:8080/ping.v1.PingService/Ping --http2-prior-knowledge --schema . -d '{"number":2}' --protocol grpcweb
{"number":"2"}
$ buf curl http://localhost:8080/ping.v1.PingService/Ping --http2-prior-knowledge --schema . -d '{"number":2}' --protocol connect
{"number":"2"}

How it works

The gRPC server included in this repository is a typical gRPC-Go server with one simple addition—it includes a JSON codec. This makes it a lot simpler to interact with directly without the use of a Connect or gRPC client, though this is by no means required.

Then we have our Envoy configuration. The most important snippet is this part:

http_filters:
- name: envoy.filters.http.connect_grpc_bridge
  typed_config:
    "@type": type.googleapis.com/envoy.extensions.filters.http.connect_grpc_bridge.v3.FilterConfig
- name: envoy.filters.http.grpc_web
  typed_config:
    "@type": type.googleapis.com/envoy.extensions.filters.http.grpc_web.v3.GrpcWeb

These two filters will convert from the Connect and gRPC-Web protocols down to native gRPC for the upstream server.

Finally, to show all of this off in a contained environment, a Docker Compose manifest is included. It is trivial, containing only the Envoy container and the upstream vanilla gRPC server.

Try it with your server!

If you already use Envoy, please update to Envoy v1.26 and give the new Connect-gRPC bridge filter a try. Let us know how it works, and if you find any issues!

Extension points exported contracts — how you extend this code

Core symbols most depended-on inside this repo

Ping
called by 0
server.go
main
called by 0
server.go
init
called by 0
internal/codec/json/codec.go
Name
called by 0
internal/codec/json/codec.go
Marshal
called by 0
internal/codec/json/codec.go
Unmarshal
called by 0
internal/codec/json/codec.go

Shape

Method 23
Function 8
Struct 7
Interface 3

Languages

Go100%

Modules by API surface

internal/gen/ping/v1/ping.pb.go18 symbols
internal/gen/ping/v1/ping_grpc.pb.go15 symbols
internal/codec/json/codec.go5 symbols
server.go3 symbols

For agents

$ claude mcp add envoy-demo \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact