Installation
Prerequisites
Section titled “Prerequisites”vgi-rpc requires Bun runtime.
Install the package
Section titled “Install the package”bun add @query-farm/vgi-rpcOptional: Python CLI
Section titled “Optional: Python CLI”The vgi-rpc CLI is useful for testing and introspecting your servers:
pip install vgi-rpc[cli]The CLI can describe services, call unary methods, and interact with streaming methods from the command line.
Verify installation
Section titled “Verify installation”Create a minimal server to verify everything works:
import { Protocol, VgiRpcServer, str } from "@query-farm/vgi-rpc";
const protocol = new Protocol("Hello");
protocol.unary("hello", { params: { name: str }, result: { greeting: str }, handler: async ({ name }) => ({ greeting: `Hello, ${name}!` }),});
const server = new VgiRpcServer(protocol, { enableDescribe: true });server.run();Save this as server.ts and test with:
vgi-rpc --cmd "bun run server.ts" call hello name=World# {"greeting": "Hello, World!"}