Command Line Interface

The CLI is the main way to configure Bookface. The main functions are to login, refresh credentials, manage saved credentials, and start the MCP server.

Running Commands

Use your preferred package runner.

npx facebook --help
Copied
Note

If you haven't authenticated yet, start with the getting started and authentication guides. Most commands will validate credentials before proceeding.

Authentication

Login

Starts a guided flow that collects your app credentials, generates tokens, and writes a credentials.json.

npx facebook login
Copied

Options (all optional):

  • --appId: Facebook App ID
  • --appSecret: Facebook App Secret
  • --appToken: Existing App token
  • --userToken: Existing User token
  • --userId: Existing User ID
  • --pageId: Existing Page ID
  • --pageIndex: Page index when selecting a page
  • --pageToken: Existing Page token
  • --scope: Permissions as a JSON string
  • --credentials: Path to read existing creds (defaults to ./credentials.json)
  • --path: Path to write final creds file (defaults to ./credentials.json)

You edit this scope by changing the credentials.json file created, or by using the --scope flag.

npx facebook login --scope "{\"pages_manage_posts\": true}"
Copied

Refresh

Re-generates fresh tokens using your App ID/Secret and writes them to disk.

npx facebook refresh
Copied

Accepts the same options as login. Tokens are recreated; use this when tokens expire or scopes change.

Credentials

View

Prints the currently resolved credentials (working directory and global fallback).

npx facebook credentials view
Copied
npx facebook creds view
Copied

Clear

Clears saved tokens/IDs in the current working directory file.

npx facebook credentials clear
Copied
npx facebook creds clear
Copied

Store Globally

Writes a global fallback credentials.json to your OS config directory so tools can authenticate outside your project folder.

npx facebook credentials store
Copied
npx facebook creds store
Copied
Tip

Use this before launching the MCP from IDEs or agents that run in isolated directories.

JSON

Pretty-prints credentials as JSON for quick copy/paste into configs.

npx facebook credentials json
Copied
npx facebook creds json
Copied

Shell

Prints environment variable exports to source into your shell.

npx facebook credentials shell
Copied
npx facebook creds shell
Copied

MCP

Start the built-in MCP server for agent integrations. See the full guide at MCP.

Streamable HTTP

Starts a local HTTP server. Add --dual to expose user and page tools together.

npx facebook mcp start
Copied
npx facebook mcp start --dual
Copied

stdio (Most clients)

Runs the MCP over stdio. Choose a profile: user, page (default), or dual.

npx facebook mcp raw --profile user
Copied

For sandboxed clients (e.g. IDEs), you can execute directly from the registry:

npx -y @anonyo/facebook.js mcp raw --profile user
Copied