From install to first call.
1
Install the SDK
Add the SDK to your project. Pick your language.
@patchops/sdk
Terminal
npm install @patchops/sdk2
Authenticate
Sign in with the CLI, or create a personal access token. Pass any PatchOps access token to the SDK as accessToken.
patchops login
Terminal
# Browser OAuth — stores a refreshable session
patchops login
# ...or use a personal access token
patchops config set-token po_pat_xxxxxxxx3
Call connectors from your app
Both SDKs wrap the same MCP surface: list tools, run structured connector calls, and read back results, logs, and timing.
@patchops/sdk
TypeScript
import { PatchOpsMcpClient, PatchOpsInvokeClient } from "@patchops/sdk";
// Reuse the access token from your CLI session or OAuth flow.
const mcp = new PatchOpsMcpClient({
baseUrl: "https://patchops.ai",
accessToken,
});
await mcp.initialize();
const { tools } = await mcp.listTools();
// Structured connector call: connector + method + args.
const invoke = new PatchOpsInvokeClient({
baseUrl: "https://patchops.ai",
accessToken,
});
const wells = await invoke.invoke({
connector: "welldatabase",
method: "getOperatorWells",
args: { county: "Loving", operator: "Mitsui" },
});
console.log(wells.result);Typed clients
TypeScript and Python clients wrap the MCP surface. No transport layer to write.
Same surface as the CLI
List tools and run structured connector calls identically across both languages.
Bring your own auth
Reuse the access token from your CLI session, or wire in your own OAuth flow.
