CLI Overview
Introduction to the @markdocket/cli npm package — installation, available commands, how the tool catalog is derived from the agent registry, authentication methods, and the MCP server surface.
What is @markdocket/cli?
@markdocket/cli is the official MarkDocket command-line tool and stdio MCP server. It gives you access to the same IP research capabilities available in the web app — trademark searches, patent lookups, prior-art scans, portfolio operations, and more — directly from your terminal or any MCP-compatible AI host.
The CLI is a public npm package that works standalone. It has no hidden service dependencies beyond the MarkDocket API.
Installation
npm install -g @markdocket/cliOr use it without installing:
npx @markdocket/cli --helpAfter installation, verify the CLI is working:
markdocket --version
markdocket --helpAuthentication
The CLI supports two login modes. Run the login command and follow the prompts:
markdocket loginBrowser OAuth (recommended)
The default mode opens your browser to complete an OAuth 2.1 authorization flow. The CLI dynamically registers a fresh public client for each login session — no static client ID is embedded in the package. A PKCE challenge is used throughout. After authorization, a short-lived access token is stored locally and used for subsequent commands.
Browser-OAuth sessions route all tool calls through the hosted MCP endpoint. Access tokens issued this way are resource-bound to that endpoint and cannot be used against other API surfaces directly.
Personal API Key
If you prefer non-interactive authentication (CI pipelines, scripts, or server environments), you can authenticate with a personal API key from your MarkDocket account settings:
markdocket login --key YOUR_API_KEYAPI-key sessions call the MarkDocket API directly via bearer token. They have a wider direct API surface than browser-OAuth sessions and are well-suited to automation.
If you do not have an account yet, create one at markdocket.com first, then run markdocket login again.
Available Commands
All commands follow the pattern:
markdocket <command> [subcommand] [options]General
| Command | Description |
|---|---|
markdocket login | Authenticate with MarkDocket (browser OAuth or API key) |
markdocket logout | Remove stored credentials |
markdocket --help | List all commands and options |
markdocket --version | Display the installed CLI version |
Tool Invocation
The CLI exposes every tool in the MarkDocket catalog as a directly callable command:
markdocket call <tool-name> [--input '{"key":"value"}']To list all available tools:
markdocket call --listThis is the primary way to run trademark searches, patent lookups, prior-art scans, clearance checks, and other IP operations from the terminal.
Patent Review
The CLI includes a structured patent review workflow that orchestrates multiple steps automatically:
markdocket patent review [--repo .] [options]When you pass . as the repository argument, the CLI inspects your local Git repository and checks for uncommitted changes or unpushed commits before starting the scan. Results are returned as a structured envelope with coverage information and embedded telemetry.
The workflow automatically runs prior-art follow-up for the top findings and waits for the scan to complete — you do not need to poll manually.
Automations
markdocket automations list
markdocket automations update --id <id> [--file definition.json]The update command always fetches the current automation state before writing, using the retrieved timestamp to guard against overwriting concurrent changes.
How the Tool Catalog Is Derived
The set of tools available in the CLI — and in the MCP server — is not hand-written in the CLI package. Instead, the catalog is generated at runtime from the MarkDocket agent's tool registry:
- Every tool's name, description, input schema, and HTTP method metadata comes from a single shared registry.
- When a new tool is added to that registry, it automatically appears as a
markdocket call <name>command and as a registered MCP tool — with no additional wiring required. - A small set of agent-internal tools (such as web search and classification utilities that depend on the agent's own AI session) are excluded from the external catalog and are never available via the CLI or MCP.
This means the CLI's command set always reflects the current state of the platform's tool surface.
MCP tool annotations (readOnlyHint, idempotentHint, destructiveHint) are automatically derived from each tool's HTTP method and naming conventions — there is no separate annotation registry to maintain.
MCP Server
@markdocket/cli includes a built-in stdio MCP (Model Context Protocol) server. You can connect any MCP-compatible AI host — such as Claude Desktop — directly to MarkDocket's tool catalog.
Starting the MCP server
markdocket mcpThis starts the stdio MCP server, which registers the same catalog of tools available to the CLI. Your AI host can then invoke MarkDocket tools as part of its reasoning loop.
Configuring Claude Desktop (example)
Add the following to your Claude Desktop MCP configuration file:
{
"mcpServers": {
"markdocket": {
"command": "markdocket",
"args": ["mcp"]
}
}
}Once connected, the AI host can search trademarks, run prior-art scans, look up USPTO filings, and perform other IP operations on your behalf using your authenticated MarkDocket session.
Response handling
The MCP server applies domain-aware compaction before returning large results to stay within size limits. For example, polling tools return a streamlined status response by default, while final-result tools return full structured output. If a result must be truncated, the server returns the first portion with a truncated: true indicator rather than an error.
Billing events
If a tool call triggers a billing limit, the MCP server returns a structured error response with billing information in the structuredContent field, rather than a generic failure. Your AI host can surface this information to guide next steps.
Hosted MCP Endpoint
In addition to the local stdio MCP server, MarkDocket operates a hosted MCP endpoint accessible at markdocket.com. The hosted endpoint exposes the same tool catalog and is authenticated via OAuth 2.1 access tokens. This is useful when you want to connect a cloud-based AI service to MarkDocket without running the CLI locally.
See the MCP documentation for setup details.
What the CLI Cannot Do
A few capabilities are intentionally outside the CLI's scope:
- Interactive agent chat sessions — long-form conversational agent turns are available in the web app only.
- BYOK (Bring Your Own Key) AI provider configuration — custom AI provider keys apply only to Automation Run agent nodes and are managed through the web app's account settings.
- Supervised USPTO form filing — the automated form-filling workflow requires the MarkDocket Desktop companion app.
Next Steps
MarkDocket Documentation
Overview of the MarkDocket IP intelligence platform — its six components, how data and trust flow between them, key developer-facing surfaces (API, CLI, MCP), and where to start for each role.
CLI Authentication
How to authenticate the MarkDocket CLI using browser OAuth (with dynamic client registration and PKCE) or a personal API key, and what capabilities each authentication mode enables.