add usage tracker
This commit is contained in:
64
README.md
Normal file
64
README.md
Normal file
@@ -0,0 +1,64 @@
|
||||
# OpenAI MCP Server
|
||||
|
||||
An MCP server to fetch OpenAI usage data.
|
||||
|
||||
## Configuration
|
||||
|
||||
This server can authenticate in two ways:
|
||||
|
||||
### 1. Automated Authentication (Recommended)
|
||||
|
||||
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
|
||||
|
||||
```bash
|
||||
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
|
||||
|
||||
```bash
|
||||
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:
|
||||
|
||||
```json
|
||||
{
|
||||
"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.
|
||||
Reference in New Issue
Block a user