Registry / devops / grpc-cli

grpc-cli

JSON →
library1.0.2jsnpmunverified

grpc-cli is a Node.js command-line utility for interacting with gRPC servers using .proto files. Version 1.0.2 is the current stable release. It allows executing gRPC commands, exploring services and namespaces, and provides an interactive REPL for advanced usage. Key differentiators include its simplicity for quick prototyping and debugging without a full client library. However, it has limited functionality: streaming RPCs and credentials are not yet implemented. The tool is globally installable via npm.

npm install grpc-cli
INSTALL
IMPORT
SIG · GRPC-CLI
G
grpc-cli
devopsjavascriptv1.0.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

grpc-cli
npx grpc-cli
grpc-cli (without npx if not globally installed)
Use npx to avoid global install.
CLI executable
npm install -g grpc-cli; grpc-cli [args]
npm install grpc-cli --save; then using as a module
This is a CLI tool, not a library. Do not require() it.
Protobuf parsing
grpc-cli myproto.proto localhost:50051 MyService.MyMethod '{"key":"val"}'
grpc-cli myproto.proto localhost:50051 MyService.MyMethod {key:val}
RPC param must be valid JSON string.

Installs grpc-cli globally, then executes a unary RPC call with a JSON parameter.

npm install -g grpc-cli # Define a simple proto file: helloworld.proto # service Greeter { rpc SayHello (HelloRequest) returns (HelloReply); } # message HelloRequest { string name = 1; } # message HelloReply { string message = 1; } grpc-cli helloworld.proto localhost:50051 helloworld.Greeter.SayHello '{"name":"World"}' # Expected output: {message: "Hello World"}
Debug
Known issues
gotchaStreaming RPCs not implemented. Only unary calls work.
fix
Not supported; use alternative client for streaming.
affects: <=1.0.2
gotchaCall and channel credentials are not implemented yet.
fix
Use --insecure or wrap with a library like google-grpc.
affects: <=1.0.2
gotchaRPC param must be a valid JSON string; incorrect JSON causes error.
fix
Use single quotes and double quotes inside: '{"name":"value"}'.
affects: all
deprecatedgrpc package is in maintenance mode; recommends using @grpc/grpc-js.
fix
Consider migrating to gRPC-JS or using grpc-cli only for quick tests.
affects: >=1.0
Errors
Common errors & fixes
Error: Cannot find module 'grpc'
grpc dependency not installed globally.
fix
npm install -g grpc-cli (includes grpc)
SyntaxError: Unexpected token { in JSON at position 0
RPC param not valid JSON (missing quotes).
fix
Use JSON.stringify format: '{"name":"World"}'
Error: 14 UNAVAILABLE: failed to connect to all addresses
gRPC server not running or wrong host:port.
fix
Verify server is running and host:port is correct.
Error: No such service: MyService
Service name does not match proto definition or missing package.
fix
Use full protobuf path (e.g., package.Service) as shown by --explore.
Upgrade
Version history
1.0.2latest on npm
Audit
Dependencies
grpcrequiredgRPC core library for making RPC calls
protobufjsrequiredParsing .proto files to generate service descriptors
commanderrequiredCommand-line argument parsing
reploptionalNode.js built-in REPL for interactive mode
Agent activity
11 hits · last 30 days
node
10
Amazon
1
Resources
grpc-cli — npm install grpc-cli · libregistry