Files
openai-mcp/README.md
2026-03-10 10:08:59 +01:00

1.4 KiB

OpenAI MCP Server

An MCP server to fetch OpenAI usage data.

Configuration

This server can authenticate in two ways:

Provide your OpenAI login credentials. The server will launch a headless browser to log in and retrieve session tokens.

  • OPENAI_EMAIL: Your OpenAI account email.
  • OPENAI_PASSWORD: Your OpenAI account password.
  • OPENAI_TOTP_SECRET: Your 2FA secret (if 2FA is enabled).

2. Manual Authentication (Fallback)

Manually provide tokens if automated login fails.

  • OPENAI_AUTH_TOKEN: The access token (from https://chatgpt.com/api/auth/session).
  • OPENAI_COOKIE: The full Cookie string from your browser session.

Usage

Automated Auth

export OPENAI_EMAIL="your_email@example.com"
export OPENAI_PASSWORD="your_password"
export OPENAI_TOTP_SECRET="your_totp_secret"
node build/index.js

Manual Auth

export OPENAI_AUTH_TOKEN="your_token_here"
export OPENAI_COOKIE="your_cookie_string_here"
node build/index.js

integrating with MCP Clients

Add to your MCP configuration:

{
  "mcpServers": {
    "openai": {
      "command": "node",
      "args": ["/path/to/openai-mcp/build/index.js"],
      "env": {
        "OPENAI_AUTH_TOKEN": "your_token_here",
        "OPENAI_COOKIE": "your_cookie_string_here"
      }
    }
  }
}

Tools

  • get_usage: Fetches the current usage statistics from OpenAI.