SDKs

PatchOps TypeScript and Python SDKs

First-party SDKs for the public OAuth-protected PatchOps MCP surface. Use them to discover the MCP endpoint, complete OAuth with PKCE, and call tools or resources over JSON-RPC without building the transport layer yourself.

For terminal workflows, install @patchops/cli from npm and authenticate directly against PatchOps with patchops login.

What the SDKs cover

MCP discovery via /api/mcp
OAuth authorization server and protected resource metadata
Dynamic client registration at /api/oauth/register
PKCE authorization URL generation for browser and desktop flows
Authorization code exchange and refresh token exchange
JSON-RPC helpers for initialize, tools/list, tools/call, resources/list, and resources/read

Current packaging

CLI
Published on npm as @patchops/cli.
TypeScript
Source lives in sdks/typescript.
Python
Source lives in sdks/python.
Intentional scope
These SDKs target the public MCP contract, not the cookie-authenticated dashboard APIs.

CLI install

@patchops/cli

Terminal

npm install -g @patchops/cli
patchops login
patchops tools list

TypeScript example

OAuth + MCP quickstart

TypeScript

import {
  PatchOpsOAuthClient,
  PatchOpsMcpClient,
} from "@patchops/sdk";

const oauth = new PatchOpsOAuthClient({
  baseUrl: "https://patchops.ai",
});

const auth = await oauth.createAuthorizationRequest({
  redirectUri: "http://localhost:8787/callback",
  clientName: "My PatchOps App",
});

const mcp = new PatchOpsMcpClient({
  baseUrl: "https://patchops.ai",
  accessToken,
});

await mcp.initialize();
const tools = await mcp.listTools();

Python example

OAuth + MCP quickstart

Python

from patchops_sdk import PatchOpsOAuthClient, PatchOpsMcpClient

oauth = PatchOpsOAuthClient("https://patchops.ai")

auth = oauth.create_authorization_request(
    redirect_uri="http://localhost:8787/callback",
    client_name="My PatchOps App",
)

mcp = PatchOpsMcpClient(
    base_url="https://patchops.ai",
    access_token=access_token,
)

initialize = mcp.initialize()
tools = mcp.list_tools()

OAuth flow

The SDKs handle discovery, registration, PKCE generation, authorization code exchange, and token refresh against the PatchOps OAuth endpoints.

MCP helpers

Session initialization and JSON-RPC methods are wrapped so you can focus on tools and resources instead of request shaping and session headers.

Recommended use

Use the SDKs for CLIs, local tools, MCP-aware apps, internal portals, or service-to-service workflows that need structured access to the PatchOps MCP surface.