Skip to content
This repository was archived by the owner on Oct 14, 2026. It is now read-only.

feat(cli): add zero-install DWS CLI and agent skill - #42

Closed
am-will wants to merge 1 commit into
PSPDFKit:mainfrom
am-will:feat/dws-cli-and-agent-skill
Closed

am-will wants to merge 1 commit into
PSPDFKit:mainfrom
am-will:feat/dws-cli-and-agent-skill

Conversation

@am-will

@am-will am-will commented Aug 28, 2026 •

Copy link
Copy Markdown

Why

Using DWS through the MCP server requires client-specific MCP configuration even when an agent or developer already has shell access. A zero-install CLI provides a lower-friction path for one-shot document operations, scripts, CI, and agent skills while preserving MCP as the richer tool-discovery interface.

Through an npx command, anyone regardless of their agent, can easily access the DWS without having to connect any MCP servers, which is complicated for non-technical users, and additionally requires no permanent installation.

Interactive users can authenticate once with browser OAuth instead of managing API keys or waiting for an API-backed operation to trigger login:

npx -y @nutrient-sdk/dws-mcp-server login

After that, agents and developers can invoke DWS directly without installing a package or configuring an MCP connection.

What Changed

  • Added standalone process, sign, redact, parse, extract, credits, and files commands with JSON input from an argument, file, or stdin.
  • Added login to complete and cache browser OAuth without uploading a document or consuming processing credits.
  • Extracted validated operation execution into a shared runner used by both MCP and CLI paths.
  • Added executable package aliases supporting direct npx -y @nutrient-sdk/dws-mcp-server <command> usage while preserving no-argument MCP startup.
  • Added text and machine-readable JSON output plus sandbox-aware path handling.
  • Added CLI documentation and a lightweight companion agent skill describing the available operations.
  • Added coverage for CLI parsing, dispatch, login, shared execution, and package metadata.

The companion skill is included here so the CLI and proposed agent experience can be reviewed together. Whether that skill should ultimately ship from this repository or the dedicated Nutrient skills repository is intentionally left open for maintainer feedback.

Verification

  • A real login --format json invocation completed successfully through the shared OAuth credential cache without making a document-processing request.
  • The CLI test verifies login does not call a DWS API endpoint.
  • npm pack --dry-run includes executable dist/index.js and dist/cli.js entry points.
  • All 260 CI tests pass.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a zero-install DWS CLI alongside the existing MCP server, sharing authentication, validation, sandboxing, and operation execution.

Changes:

  • Adds CLI commands, OAuth login, output formats, and executable aliases.
  • Extracts shared MCP/CLI operation execution.
  • Adds documentation, agent skill guidance, and tests.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/cli.ts Implements CLI parsing and execution.
src/index.ts Dispatches CLI or MCP startup.
src/tool-runner.ts Centralizes validated operation execution.
src/dws/client.ts Adds credential-only authentication.
package.json Publishes CLI executable aliases.
README.md Documents standalone CLI usage.
skills/nutrient-dws/SKILL.md Adds companion agent guidance.
tests/cli.test.ts Tests CLI behavior.
tests/index.test.ts Tests entrypoint dispatch.
tests/dws-client.test.ts Tests credential authentication.
tests/package-metadata.test.ts Verifies executable metadata.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/index.ts
let activeServer: RunServerResult | undefined
export function isCliInvocation(args: string[]): boolean {
const first = args[0]
return first === 'cli' || first === '--help' || first === '-h' || first === '--version' || first === '-v' || isCliCommand(first)
Comment thread src/cli.ts
Comment on lines +129 to +132
const operation = COMMAND_ALIASES[command as keyof typeof COMMAND_ALIASES]
if (!operation) {
throw new CliUsageError(`Unknown command: ${command}`)
}
Comment thread src/cli.ts
Comment on lines +290 to +297
if (staticProducts.length > 0) {
const message = `Static API key authentication is configured for ${staticProducts.join(' and ')}; browser login is not needed.`
if (parsed.outputFormat === 'json') {
writeLine(stdout, JSON.stringify({ authenticated: true, method: 'api-key', products: staticProducts }, null, 2))
} else {
writeLine(stdout, message)
}
return 0
@jdrhyne

jdrhyne commented Oct 14, 2026

Copy link
Copy Markdown
Member

Closing: the local MCP server is retired in favor of the hosted Nutrient MCP (https://mcp.nutrient.io/mcp). Thanks for the work here.

@jdrhyne jdrhyne closed this Oct 14, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants