npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@papercraneai/cli

v1.1.0

Published

CLI tool for managing OAuth credentials for LLM integrations

Readme

papercrane

A CLI tool for managing OAuth credentials for LLM integrations.

Features

  • 🔐 Google OAuth 2.0 authentication using PKCE flow
  • 💾 Secure credential storage in ~/.papercrane/google
  • 📋 List and manage stored credentials
  • 🌐 Automatic browser-based authentication flow

Installation

Local Development

npm install
chmod +x bin/papercrane.js
npm link

Global Installation

npm install -g papercrane

Setup

Before using papercrane, you need to create OAuth 2.0 credentials in the Google Cloud Console:

  1. Go to Google Cloud Console
  2. Create a new project or select an existing one
  3. Enable the APIs you want to access (e.g., Gmail API, Drive API, Calendar API)
  4. Go to APIs & Services > Credentials
  5. Click Create Credentials > OAuth client ID
  6. Select Desktop app as the application type
  7. Set the redirect URI to http://127.0.0.1:8080/callback
  8. Save your Client ID and Client Secret

Usage

Authenticate with Google

papercrane google <scope1> [scope2] [...]

Examples:

# Authenticate for Gmail read-only access
papercrane google https://www.googleapis.com/auth/gmail.readonly

# Authenticate for multiple scopes
papercrane google https://www.googleapis.com/auth/drive.readonly https://www.googleapis.com/auth/calendar.readonly

# Authenticate for Gmail and Drive
papercrane google https://www.googleapis.com/auth/gmail.readonly https://www.googleapis.com/auth/drive.file

The command will:

  1. Prompt you for your Google OAuth Client ID and Client Secret
  2. Generate PKCE credentials for secure authentication
  3. Start a local server on port 8080
  4. Open your browser to complete authentication
  5. Store the credentials in ~/.papercrane/google/

List Stored Credentials

papercrane list

This shows all stored credentials including:

  • File name and path
  • Creation and expiration dates
  • Token validity status
  • Granted scopes
  • Refresh token availability

Help

papercrane help
papercrane --help

Credential Storage

Credentials are stored as JSON files in:

~/.papercrane/google/credentials-<hash>.json

Each credential file contains:

  • access_token: The OAuth access token
  • refresh_token: The refresh token (if available)
  • expires_in: Token lifetime in seconds
  • expires_at: Absolute expiration timestamp
  • scope: Granted OAuth scopes
  • token_type: Token type (usually "Bearer")
  • created_at: Creation timestamp

Common OAuth Scopes

Gmail

  • https://www.googleapis.com/auth/gmail.readonly - Read-only access
  • https://www.googleapis.com/auth/gmail.compose - Compose and send messages
  • https://www.googleapis.com/auth/gmail.modify - Read, send, and modify emails

Google Drive

  • https://www.googleapis.com/auth/drive.readonly - Read-only access
  • https://www.googleapis.com/auth/drive.file - Per-file access
  • https://www.googleapis.com/auth/drive - Full access

Google Calendar

  • https://www.googleapis.com/auth/calendar.readonly - Read-only access
  • https://www.googleapis.com/auth/calendar - Full access

See Google OAuth 2.0 Scopes for a complete list.

Security Considerations

  • PKCE Flow: Uses Proof Key for Code Exchange for enhanced security
  • Local Storage: Credentials are stored locally on your machine
  • Refresh Tokens: Requested by default (access_type=offline) for long-term access
  • Localhost Only: Callback server binds to 127.0.0.1 (localhost only)

Development

Project Structure

papercrane/
├── bin/
│   └── papercrane.js          # CLI entry point
├── lib/
│   ├── callback-server.js  # Local OAuth callback server
│   ├── google-auth.js      # Google OAuth flow implementation
│   ├── list-credentials.js # Credential listing
│   ├── pkce.js            # PKCE generation utilities
│   └── storage.js         # Credential storage management
├── package.json
└── README.md

Technologies

  • Commander.js: CLI framework
  • Axios: HTTP client for token exchange
  • Chalk: Terminal styling
  • Inquirer: Interactive prompts
  • Open: Cross-platform browser opening

Troubleshooting

Port 8080 already in use

If port 8080 is occupied, stop any processes using it or modify the PORT constant in lib/google-auth.js.

Browser doesn't open automatically

Copy the authorization URL from the terminal and paste it into your browser manually.

Invalid client error

Ensure your Client ID and Client Secret are correct and that the redirect URI http://127.0.0.1:8080/callback is registered in your Google Cloud Console OAuth credentials.

License

MIT