codex-xai-oauth 0.2.0 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.codex-plugin/plugin.json +1 -1
- package/README.md +62 -6
- package/RELEASE_NOTES.md +13 -0
- package/dist/cli.js +46 -7
- package/dist/mcp/server.js +58 -7
- package/dist/version.d.ts +1 -1
- package/dist/xai/constants.d.ts +1 -1
- package/package.json +1 -1
- package/skills/xai-generate-text/SKILL.md +25 -0
- package/skills/xai-grok/SKILL.md +43 -6
- package/skills/xai-image-generate/SKILL.md +58 -0
- package/skills/xai-login-instructions/SKILL.md +35 -0
- package/skills/xai-status/SKILL.md +16 -0
- package/skills/xai-tts/SKILL.md +28 -0
- package/skills/xai-video-generate/SKILL.md +43 -0
- package/skills/xai-web-search/SKILL.md +23 -0
- package/skills/xai-x-search/SKILL.md +25 -0
package/README.md
CHANGED
|
@@ -29,6 +29,8 @@ npm run build
|
|
|
29
29
|
python3 /Users/ilseoblee/.codex/skills/.system/plugin-creator/scripts/validate_plugin.py .
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
+
Release notes are tracked in [RELEASE_NOTES.md](RELEASE_NOTES.md).
|
|
33
|
+
|
|
32
34
|
## Install / Doctor
|
|
33
35
|
|
|
34
36
|
From a checkout:
|
|
@@ -57,6 +59,8 @@ codex-xai-oauth doctor
|
|
|
57
59
|
|
|
58
60
|
## Authentication
|
|
59
61
|
|
|
62
|
+
The default OAuth store is the shared xAI OIDC file at `~/.grok/auth.json`. This project reads and writes that shared store by default; it does not require a specific Grok CLI build. `CODEX_XAI_OAUTH_AUTH_FILE` is available only when you intentionally want a separate package-specific auth file.
|
|
63
|
+
|
|
60
64
|
Browser OAuth login:
|
|
61
65
|
|
|
62
66
|
```bash
|
|
@@ -93,22 +97,30 @@ Save generated image payloads to local artifacts:
|
|
|
93
97
|
npx codex-xai-oauth image --prompt "minimal blue dot icon" --response-format b64_json --artifact-dir .codex-xai-artifacts
|
|
94
98
|
```
|
|
95
99
|
|
|
96
|
-
OAuth credentials are stored
|
|
100
|
+
OAuth credentials are stored by default as an xAI OIDC entry in:
|
|
97
101
|
|
|
98
102
|
```text
|
|
99
|
-
~/.
|
|
103
|
+
~/.grok/auth.json
|
|
100
104
|
```
|
|
101
105
|
|
|
102
|
-
|
|
106
|
+
Legacy package-specific OAuth credentials are still read as a fallback from:
|
|
103
107
|
|
|
104
108
|
```text
|
|
105
|
-
~/.
|
|
109
|
+
~/.config/codex-xai-oauth/auth.json
|
|
106
110
|
```
|
|
107
111
|
|
|
112
|
+
Credential precedence:
|
|
113
|
+
|
|
114
|
+
- `CODEX_XAI_OAUTH_AUTH_FILE`, when explicitly set.
|
|
115
|
+
- `~/.grok/auth.json`.
|
|
116
|
+
- `~/.config/codex-xai-oauth/auth.json` legacy fallback.
|
|
117
|
+
- `XAI_API_KEY`.
|
|
118
|
+
- Codex model provider `experimental_bearer_token`.
|
|
119
|
+
|
|
108
120
|
Overrides:
|
|
109
121
|
|
|
110
|
-
- `CODEX_XAI_OAUTH_AUTH_FILE`: custom OAuth auth JSON path.
|
|
111
|
-
- `CODEX_XAI_OAUTH_GROK_AUTH_FILE`: custom
|
|
122
|
+
- `CODEX_XAI_OAUTH_AUTH_FILE`: custom package-format OAuth auth JSON path.
|
|
123
|
+
- `CODEX_XAI_OAUTH_GROK_AUTH_FILE`: custom shared xAI OIDC auth JSON path, mainly for tests or nonstandard installs.
|
|
112
124
|
- `XAI_API_KEY`: API-key fallback.
|
|
113
125
|
- `XAI_BASE_URL`: custom xAI-compatible base URL.
|
|
114
126
|
|
|
@@ -141,6 +153,50 @@ The proxy exposes:
|
|
|
141
153
|
- `.mcp.json` starts the stdio MCP server from `dist/mcp/server.js`.
|
|
142
154
|
- `skills/xai-grok/SKILL.md` tells Codex when to use the tools and how to avoid leaking secrets.
|
|
143
155
|
|
|
156
|
+
## Built-In Skills
|
|
157
|
+
|
|
158
|
+
The plugin bundles a general skill plus one dedicated skill for each MCP tool listed in What Works:
|
|
159
|
+
|
|
160
|
+
- `xai-grok`: umbrella skill for plugin overview, setup orientation, or multi-tool requests when no dedicated `xai_*` skill is a better fit.
|
|
161
|
+
- `xai_status`: dedicated trigger for `xai_status`.
|
|
162
|
+
- `xai_login_instructions`: dedicated trigger for `xai_login_instructions`.
|
|
163
|
+
- `xai_generate_text`: dedicated trigger for `xai_generate_text`.
|
|
164
|
+
- `xai_web_search`: dedicated trigger for `xai_web_search`.
|
|
165
|
+
- `xai_x_search`: dedicated trigger for `xai_x_search`.
|
|
166
|
+
- `xai_image_generate`: dedicated trigger for `xai_image_generate`.
|
|
167
|
+
- `xai_tts`: dedicated trigger for `xai_tts`.
|
|
168
|
+
- `xai_video_generate`: dedicated trigger for `xai_video_generate`.
|
|
169
|
+
|
|
170
|
+
The dedicated `xai_image_generate` skill lets Codex route natural-language image requests to `xai_image_generate`.
|
|
171
|
+
|
|
172
|
+
MCP tool arguments:
|
|
173
|
+
|
|
174
|
+
```json
|
|
175
|
+
{
|
|
176
|
+
"prompt": "tiny minimalist blue dot icon on white background",
|
|
177
|
+
"resolution": "2k",
|
|
178
|
+
"artifact_dir": ".codex-xai-artifacts"
|
|
179
|
+
}
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
Equivalent CLI:
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
npx codex-xai-oauth image \
|
|
186
|
+
--prompt "tiny minimalist blue dot icon on white background" \
|
|
187
|
+
--resolution 2k \
|
|
188
|
+
--artifact-dir .codex-xai-artifacts
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
For base64 image payloads saved locally:
|
|
192
|
+
|
|
193
|
+
```bash
|
|
194
|
+
npx codex-xai-oauth image \
|
|
195
|
+
--prompt "a cinematic robot reading a book" \
|
|
196
|
+
--response-format b64_json \
|
|
197
|
+
--artifact-dir .codex-xai-artifacts
|
|
198
|
+
```
|
|
199
|
+
|
|
144
200
|
Build before installing or using the MCP server:
|
|
145
201
|
|
|
146
202
|
```bash
|
package/RELEASE_NOTES.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Release Notes
|
|
2
|
+
|
|
3
|
+
## 0.2.2
|
|
4
|
+
|
|
5
|
+
- Changed the default OAuth read/write path to the shared xAI OIDC store at `~/.grok/auth.json`.
|
|
6
|
+
- Kept `CODEX_XAI_OAUTH_AUTH_FILE` as an explicit package-format override and `~/.config/codex-xai-oauth/auth.json` as a legacy fallback.
|
|
7
|
+
- Updated README, MCP login instructions, and bundled skills to explain that `~/.grok/auth.json` is a shared xAI OIDC auth store, not a requirement to use a specific Grok CLI build.
|
|
8
|
+
|
|
9
|
+
## 0.2.1
|
|
10
|
+
|
|
11
|
+
- Added dedicated built-in skills for every README-listed MCP tool: `xai_status`, `xai_login_instructions`, `xai_generate_text`, `xai_web_search`, `xai_x_search`, `xai_image_generate`, `xai_tts`, and `xai_video_generate`.
|
|
12
|
+
- Narrowed `xai-grok` to an umbrella skill for plugin overview, setup orientation, and multi-tool requests so specific `xai_*` skills can load only when needed.
|
|
13
|
+
- Updated README skill documentation to match the plugin surface promised by the MCP tool list.
|
package/dist/cli.js
CHANGED
|
@@ -3386,7 +3386,7 @@ import { randomBytes as randomBytes2 } from "node:crypto";
|
|
|
3386
3386
|
import { createServer } from "node:http";
|
|
3387
3387
|
|
|
3388
3388
|
// src/version.ts
|
|
3389
|
-
var PACKAGE_VERSION = "0.2.
|
|
3389
|
+
var PACKAGE_VERSION = "0.2.2";
|
|
3390
3390
|
|
|
3391
3391
|
// src/xai/constants.ts
|
|
3392
3392
|
var XAI_BASE_URL = "https://api.x.ai/v1";
|
|
@@ -4756,7 +4756,7 @@ function defaultAuthPath() {
|
|
|
4756
4756
|
return join(configHome(), "codex-xai-oauth", "auth.json");
|
|
4757
4757
|
}
|
|
4758
4758
|
function authPath() {
|
|
4759
|
-
return process.env["CODEX_XAI_OAUTH_AUTH_FILE"] ||
|
|
4759
|
+
return process.env["CODEX_XAI_OAUTH_AUTH_FILE"] || grokAuthPath();
|
|
4760
4760
|
}
|
|
4761
4761
|
function defaultGrokAuthPath() {
|
|
4762
4762
|
return join(homedir(), ".grok", "auth.json");
|
|
@@ -4765,10 +4765,13 @@ function grokAuthPath() {
|
|
|
4765
4765
|
return process.env["CODEX_XAI_OAUTH_GROK_AUTH_FILE"] || defaultGrokAuthPath();
|
|
4766
4766
|
}
|
|
4767
4767
|
function readStoredAuth(path2 = authPath()) {
|
|
4768
|
+
if (path2 === grokAuthPath()) {
|
|
4769
|
+
return readGrokStoredAuth(path2) || (!process.env["CODEX_XAI_OAUTH_AUTH_FILE"] ? readPackageStoredAuth(defaultAuthPath()) : void 0);
|
|
4770
|
+
}
|
|
4771
|
+
return readPackageStoredAuth(path2);
|
|
4772
|
+
}
|
|
4773
|
+
function readPackageStoredAuth(path2) {
|
|
4768
4774
|
if (!existsSync(path2)) {
|
|
4769
|
-
if (path2 === defaultAuthPath() && !process.env["CODEX_XAI_OAUTH_AUTH_FILE"]) {
|
|
4770
|
-
return readGrokStoredAuth();
|
|
4771
|
-
}
|
|
4772
4775
|
return void 0;
|
|
4773
4776
|
}
|
|
4774
4777
|
try {
|
|
@@ -4797,6 +4800,9 @@ function readStoredAuth(path2 = authPath()) {
|
|
|
4797
4800
|
throw error51;
|
|
4798
4801
|
}
|
|
4799
4802
|
}
|
|
4803
|
+
function grokEntryKey() {
|
|
4804
|
+
return `${XAI_OAUTH_ISSUER}::${XAI_OAUTH_CLIENT_ID}`;
|
|
4805
|
+
}
|
|
4800
4806
|
function parseGrokExpiry(value) {
|
|
4801
4807
|
const parsed = Date.parse(value);
|
|
4802
4808
|
return Number.isNaN(parsed) ? void 0 : parsed;
|
|
@@ -4851,9 +4857,40 @@ function readGrokStoredAuth(path2 = grokAuthPath()) {
|
|
|
4851
4857
|
}
|
|
4852
4858
|
}
|
|
4853
4859
|
function writeStoredAuth(auth, path2 = authPath()) {
|
|
4860
|
+
if (path2 === grokAuthPath()) {
|
|
4861
|
+
writeGrokStoredAuth(auth, path2);
|
|
4862
|
+
return;
|
|
4863
|
+
}
|
|
4854
4864
|
mkdirSync(dirname(path2), { recursive: true, mode: 448 });
|
|
4855
4865
|
writeFileSync(path2, JSON.stringify(auth, null, 2), { mode: 384 });
|
|
4856
4866
|
}
|
|
4867
|
+
function readGrokAuthFile(path2) {
|
|
4868
|
+
if (!existsSync(path2)) {
|
|
4869
|
+
return {};
|
|
4870
|
+
}
|
|
4871
|
+
try {
|
|
4872
|
+
const data = JSON.parse(readFileSync(path2, "utf8"));
|
|
4873
|
+
return isRecord(data) ? data : {};
|
|
4874
|
+
} catch (error51) {
|
|
4875
|
+
if (error51 instanceof Error) {
|
|
4876
|
+
return {};
|
|
4877
|
+
}
|
|
4878
|
+
throw error51;
|
|
4879
|
+
}
|
|
4880
|
+
}
|
|
4881
|
+
function writeGrokStoredAuth(auth, path2) {
|
|
4882
|
+
const data = readGrokAuthFile(path2);
|
|
4883
|
+
data[grokEntryKey()] = {
|
|
4884
|
+
auth_mode: "oidc",
|
|
4885
|
+
expires_at: new Date(auth.expires).toISOString(),
|
|
4886
|
+
key: auth.access,
|
|
4887
|
+
oidc_client_id: XAI_OAUTH_CLIENT_ID,
|
|
4888
|
+
oidc_issuer: XAI_OAUTH_ISSUER,
|
|
4889
|
+
refresh_token: auth.refresh
|
|
4890
|
+
};
|
|
4891
|
+
mkdirSync(dirname(path2), { recursive: true, mode: 448 });
|
|
4892
|
+
writeFileSync(path2, JSON.stringify(data, null, 2), { mode: 384 });
|
|
4893
|
+
}
|
|
4857
4894
|
function oauthExpiry(timestampSeconds) {
|
|
4858
4895
|
return Date.now() + Number(timestampSeconds || 3600) * 1e3;
|
|
4859
4896
|
}
|
|
@@ -5209,7 +5246,7 @@ async function resolveXaiCredentials() {
|
|
|
5209
5246
|
};
|
|
5210
5247
|
}
|
|
5211
5248
|
throw new Error(
|
|
5212
|
-
"xAI credentials not found. Run `codex-xai-oauth login --device`, set XAI_API_KEY, or configure a Codex model provider with experimental_bearer_token."
|
|
5249
|
+
"xAI credentials not found. Run `codex-xai-oauth login` to write ~/.grok/auth.json, run `codex-xai-oauth login --device`, set XAI_API_KEY, or configure a Codex model provider with experimental_bearer_token."
|
|
5213
5250
|
);
|
|
5214
5251
|
}
|
|
5215
5252
|
async function credentialStatus() {
|
|
@@ -20508,7 +20545,9 @@ program2.command("image").description("Generate an image through xAI /images/gen
|
|
|
20508
20545
|
console.log(JSON.stringify(result, null, 2));
|
|
20509
20546
|
}
|
|
20510
20547
|
);
|
|
20511
|
-
program2.command("login").description(
|
|
20548
|
+
program2.command("login").description(
|
|
20549
|
+
"Start xAI OAuth login and save credentials to the shared ~/.grok auth store"
|
|
20550
|
+
).option("--device", "use device-code login for headless environments").option("--no-browser", "print the URL without opening a browser").action(
|
|
20512
20551
|
async (options) => {
|
|
20513
20552
|
try {
|
|
20514
20553
|
const flow = options.device ? await beginDeviceOAuth() : await beginOAuth();
|
package/dist/mcp/server.js
CHANGED
|
@@ -30948,7 +30948,7 @@ var StdioServerTransport = class {
|
|
|
30948
30948
|
};
|
|
30949
30949
|
|
|
30950
30950
|
// src/version.ts
|
|
30951
|
-
var PACKAGE_VERSION = "0.2.
|
|
30951
|
+
var PACKAGE_VERSION = "0.2.2";
|
|
30952
30952
|
|
|
30953
30953
|
// src/xai/constants.ts
|
|
30954
30954
|
var XAI_BASE_URL = "https://api.x.ai/v1";
|
|
@@ -32309,7 +32309,7 @@ function defaultAuthPath() {
|
|
|
32309
32309
|
return join(configHome(), "codex-xai-oauth", "auth.json");
|
|
32310
32310
|
}
|
|
32311
32311
|
function authPath() {
|
|
32312
|
-
return process.env["CODEX_XAI_OAUTH_AUTH_FILE"] ||
|
|
32312
|
+
return process.env["CODEX_XAI_OAUTH_AUTH_FILE"] || grokAuthPath();
|
|
32313
32313
|
}
|
|
32314
32314
|
function defaultGrokAuthPath() {
|
|
32315
32315
|
return join(homedir(), ".grok", "auth.json");
|
|
@@ -32318,10 +32318,13 @@ function grokAuthPath() {
|
|
|
32318
32318
|
return process.env["CODEX_XAI_OAUTH_GROK_AUTH_FILE"] || defaultGrokAuthPath();
|
|
32319
32319
|
}
|
|
32320
32320
|
function readStoredAuth(path = authPath()) {
|
|
32321
|
+
if (path === grokAuthPath()) {
|
|
32322
|
+
return readGrokStoredAuth(path) || (!process.env["CODEX_XAI_OAUTH_AUTH_FILE"] ? readPackageStoredAuth(defaultAuthPath()) : void 0);
|
|
32323
|
+
}
|
|
32324
|
+
return readPackageStoredAuth(path);
|
|
32325
|
+
}
|
|
32326
|
+
function readPackageStoredAuth(path) {
|
|
32321
32327
|
if (!existsSync(path)) {
|
|
32322
|
-
if (path === defaultAuthPath() && !process.env["CODEX_XAI_OAUTH_AUTH_FILE"]) {
|
|
32323
|
-
return readGrokStoredAuth();
|
|
32324
|
-
}
|
|
32325
32328
|
return void 0;
|
|
32326
32329
|
}
|
|
32327
32330
|
try {
|
|
@@ -32350,6 +32353,9 @@ function readStoredAuth(path = authPath()) {
|
|
|
32350
32353
|
throw error51;
|
|
32351
32354
|
}
|
|
32352
32355
|
}
|
|
32356
|
+
function grokEntryKey() {
|
|
32357
|
+
return `${XAI_OAUTH_ISSUER}::${XAI_OAUTH_CLIENT_ID}`;
|
|
32358
|
+
}
|
|
32353
32359
|
function parseGrokExpiry(value) {
|
|
32354
32360
|
const parsed = Date.parse(value);
|
|
32355
32361
|
return Number.isNaN(parsed) ? void 0 : parsed;
|
|
@@ -32404,9 +32410,40 @@ function readGrokStoredAuth(path = grokAuthPath()) {
|
|
|
32404
32410
|
}
|
|
32405
32411
|
}
|
|
32406
32412
|
function writeStoredAuth(auth, path = authPath()) {
|
|
32413
|
+
if (path === grokAuthPath()) {
|
|
32414
|
+
writeGrokStoredAuth(auth, path);
|
|
32415
|
+
return;
|
|
32416
|
+
}
|
|
32407
32417
|
mkdirSync(dirname(path), { recursive: true, mode: 448 });
|
|
32408
32418
|
writeFileSync(path, JSON.stringify(auth, null, 2), { mode: 384 });
|
|
32409
32419
|
}
|
|
32420
|
+
function readGrokAuthFile(path) {
|
|
32421
|
+
if (!existsSync(path)) {
|
|
32422
|
+
return {};
|
|
32423
|
+
}
|
|
32424
|
+
try {
|
|
32425
|
+
const data = JSON.parse(readFileSync(path, "utf8"));
|
|
32426
|
+
return isRecord(data) ? data : {};
|
|
32427
|
+
} catch (error51) {
|
|
32428
|
+
if (error51 instanceof Error) {
|
|
32429
|
+
return {};
|
|
32430
|
+
}
|
|
32431
|
+
throw error51;
|
|
32432
|
+
}
|
|
32433
|
+
}
|
|
32434
|
+
function writeGrokStoredAuth(auth, path) {
|
|
32435
|
+
const data = readGrokAuthFile(path);
|
|
32436
|
+
data[grokEntryKey()] = {
|
|
32437
|
+
auth_mode: "oidc",
|
|
32438
|
+
expires_at: new Date(auth.expires).toISOString(),
|
|
32439
|
+
key: auth.access,
|
|
32440
|
+
oidc_client_id: XAI_OAUTH_CLIENT_ID,
|
|
32441
|
+
oidc_issuer: XAI_OAUTH_ISSUER,
|
|
32442
|
+
refresh_token: auth.refresh
|
|
32443
|
+
};
|
|
32444
|
+
mkdirSync(dirname(path), { recursive: true, mode: 448 });
|
|
32445
|
+
writeFileSync(path, JSON.stringify(data, null, 2), { mode: 384 });
|
|
32446
|
+
}
|
|
32410
32447
|
function oauthExpiry(timestampSeconds) {
|
|
32411
32448
|
return Date.now() + Number(timestampSeconds || 3600) * 1e3;
|
|
32412
32449
|
}
|
|
@@ -32574,7 +32611,7 @@ async function resolveXaiCredentials() {
|
|
|
32574
32611
|
};
|
|
32575
32612
|
}
|
|
32576
32613
|
throw new Error(
|
|
32577
|
-
"xAI credentials not found. Run `codex-xai-oauth login --device`, set XAI_API_KEY, or configure a Codex model provider with experimental_bearer_token."
|
|
32614
|
+
"xAI credentials not found. Run `codex-xai-oauth login` to write ~/.grok/auth.json, run `codex-xai-oauth login --device`, set XAI_API_KEY, or configure a Codex model provider with experimental_bearer_token."
|
|
32578
32615
|
);
|
|
32579
32616
|
}
|
|
32580
32617
|
async function credentialStatus() {
|
|
@@ -32918,8 +32955,22 @@ function createXaiMcpServer() {
|
|
|
32918
32955
|
async () => textJson({
|
|
32919
32956
|
auth_file: authPath(),
|
|
32920
32957
|
grok_auth_file: grokAuthPath(),
|
|
32958
|
+
legacy_auth_file: defaultAuthPath(),
|
|
32959
|
+
shared_auth_store: "~/.grok/auth.json",
|
|
32960
|
+
base_url: xaiBaseUrl(),
|
|
32961
|
+
browser_login: "codex-xai-oauth login",
|
|
32921
32962
|
device_login: "codex-xai-oauth login --device",
|
|
32922
|
-
|
|
32963
|
+
status: "codex-xai-oauth status",
|
|
32964
|
+
doctor: "codex-xai-oauth doctor",
|
|
32965
|
+
api_key: "Set XAI_API_KEY in the environment.",
|
|
32966
|
+
credential_precedence: [
|
|
32967
|
+
"CODEX_XAI_OAUTH_AUTH_FILE",
|
|
32968
|
+
"~/.grok/auth.json",
|
|
32969
|
+
"~/.config/codex-xai-oauth/auth.json",
|
|
32970
|
+
"XAI_API_KEY",
|
|
32971
|
+
"Codex model provider experimental_bearer_token"
|
|
32972
|
+
],
|
|
32973
|
+
note: "Default OAuth login writes a shared xAI OIDC entry to ~/.grok/auth.json; this is a shared auth store, not a requirement to use a specific Grok CLI build."
|
|
32923
32974
|
})
|
|
32924
32975
|
);
|
|
32925
32976
|
registerGenerationTools(server);
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const PACKAGE_VERSION = "0.2.
|
|
1
|
+
export declare const PACKAGE_VERSION = "0.2.2";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/dist/xai/constants.d.ts
CHANGED
|
@@ -12,6 +12,6 @@ export declare const XAI_REDIRECT_PATH = "/callback";
|
|
|
12
12
|
export declare const OPENAI_COMPAT_HOST = "127.0.0.1";
|
|
13
13
|
export declare const OPENAI_COMPAT_PORT = 8787;
|
|
14
14
|
export declare const REFRESH_SKEW_MS: number;
|
|
15
|
-
export declare const USER_AGENT = "codex-xai-oauth/0.2.
|
|
15
|
+
export declare const USER_AGENT = "codex-xai-oauth/0.2.2";
|
|
16
16
|
export declare function xaiBaseUrl(): string;
|
|
17
17
|
//# sourceMappingURL=constants.d.ts.map
|
package/package.json
CHANGED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: xai_generate_text
|
|
3
|
+
description: Use when the user asks to generate, draft, answer, rewrite, summarize, or reason with xAI/Grok text generation through xai_generate_text.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# xAI Generate Text
|
|
7
|
+
|
|
8
|
+
Use `xai_generate_text` for text generation with Grok through xAI Responses.
|
|
9
|
+
|
|
10
|
+
Preferred MCP call:
|
|
11
|
+
|
|
12
|
+
```json
|
|
13
|
+
{
|
|
14
|
+
"prompt": "Write a concise release note for artifact-backed image generation.",
|
|
15
|
+
"reasoning_effort": "medium"
|
|
16
|
+
}
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Options:
|
|
20
|
+
|
|
21
|
+
- `prompt`: required user request.
|
|
22
|
+
- `model`: optional Grok model.
|
|
23
|
+
- `reasoning_effort`: `low`, `medium`, or `high`.
|
|
24
|
+
|
|
25
|
+
Use `xai_web_search` instead when the user asks for current web information. Use `xai_x_search` instead when the user asks to search X/Twitter.
|
package/skills/xai-grok/SKILL.md
CHANGED
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: xai-grok
|
|
3
|
-
description: Use
|
|
3
|
+
description: Use only for general codex-xai-oauth/xAI Grok plugin overview, setup orientation, or multi-tool requests when no dedicated xai_* skill is a better fit.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# xAI Grok
|
|
7
7
|
|
|
8
|
-
Use
|
|
8
|
+
Use this umbrella skill only for general plugin overview, setup orientation, or multi-tool xAI/Grok requests. For a specific tool request, prefer the dedicated skill:
|
|
9
|
+
|
|
10
|
+
- `xai_status`
|
|
11
|
+
- `xai_login_instructions`
|
|
12
|
+
- `xai_generate_text`
|
|
13
|
+
- `xai_web_search`
|
|
14
|
+
- `xai_x_search`
|
|
15
|
+
- `xai_image_generate`
|
|
16
|
+
- `xai_tts`
|
|
17
|
+
- `xai_video_generate`
|
|
9
18
|
|
|
10
19
|
## Tools
|
|
11
20
|
|
|
@@ -20,10 +29,10 @@ Use the bundled MCP tools when the user asks for xAI, Grok, Grok Imagine, xAI im
|
|
|
20
29
|
|
|
21
30
|
## Credential Rules
|
|
22
31
|
|
|
23
|
-
- Prefer
|
|
24
|
-
-
|
|
25
|
-
- `
|
|
26
|
-
- `
|
|
32
|
+
- Prefer the shared xAI OIDC auth store at `~/.grok/auth.json`. It is a shared auth file, not a requirement to use a specific Grok CLI build.
|
|
33
|
+
- `CODEX_XAI_OAUTH_AUTH_FILE` overrides the auth-file path with a package-format OAuth file.
|
|
34
|
+
- `CODEX_XAI_OAUTH_GROK_AUTH_FILE` overrides the shared xAI OIDC auth-file path.
|
|
35
|
+
- Legacy package OAuth credentials at `~/.config/codex-xai-oauth/auth.json` are read only when the shared store is absent.
|
|
27
36
|
- `XAI_API_KEY` is the fallback credential.
|
|
28
37
|
- `XAI_BASE_URL` can override the API base URL.
|
|
29
38
|
- Do not print, quote, summarize, or store access tokens, refresh tokens, or API keys in chat.
|
|
@@ -52,6 +61,34 @@ codex-xai-oauth status
|
|
|
52
61
|
|
|
53
62
|
Use `xai_image_generate` when the user asks to generate an image, Grok Imagine image, or xAI image. Defaults are `model: grok-imagine-image`, `response_format: url`, and `n: 1`.
|
|
54
63
|
|
|
64
|
+
Preferred MCP call:
|
|
65
|
+
|
|
66
|
+
```json
|
|
67
|
+
{
|
|
68
|
+
"prompt": "tiny minimalist blue dot icon on white background",
|
|
69
|
+
"resolution": "2k",
|
|
70
|
+
"artifact_dir": ".codex-xai-artifacts"
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Direct CLI equivalent:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
codex-xai-oauth image \
|
|
78
|
+
--prompt "tiny minimalist blue dot icon on white background" \
|
|
79
|
+
--resolution 2k \
|
|
80
|
+
--artifact-dir .codex-xai-artifacts
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
For base64 image payloads saved locally:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
codex-xai-oauth image \
|
|
87
|
+
--prompt "a cinematic robot reading a book" \
|
|
88
|
+
--response-format b64_json \
|
|
89
|
+
--artifact-dir .codex-xai-artifacts
|
|
90
|
+
```
|
|
91
|
+
|
|
55
92
|
Supported image options:
|
|
56
93
|
|
|
57
94
|
- `prompt`: required image prompt.
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: xai_image_generate
|
|
3
|
+
description: Use when the user asks to generate, create, make, or save images with xAI, Grok Imagine, xai_image_generate, or codex-xai-oauth image artifacts.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# xAI Image Generate
|
|
7
|
+
|
|
8
|
+
Use `xai_image_generate` for xAI/Grok Imagine image requests.
|
|
9
|
+
|
|
10
|
+
## Preferred MCP Call
|
|
11
|
+
|
|
12
|
+
```json
|
|
13
|
+
{
|
|
14
|
+
"prompt": "tiny minimalist blue dot icon on white background",
|
|
15
|
+
"resolution": "2k",
|
|
16
|
+
"artifact_dir": ".codex-xai-artifacts"
|
|
17
|
+
}
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## CLI Equivalent
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
codex-xai-oauth image \
|
|
24
|
+
--prompt "tiny minimalist blue dot icon on white background" \
|
|
25
|
+
--resolution 2k \
|
|
26
|
+
--artifact-dir .codex-xai-artifacts
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
For base64 image payloads saved locally:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
codex-xai-oauth image \
|
|
33
|
+
--prompt "a cinematic robot reading a book" \
|
|
34
|
+
--response-format b64_json \
|
|
35
|
+
--artifact-dir .codex-xai-artifacts
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Options
|
|
39
|
+
|
|
40
|
+
- `prompt`: required image prompt.
|
|
41
|
+
- `model`: defaults to `grok-imagine-image`.
|
|
42
|
+
- `n`: number of images.
|
|
43
|
+
- `resolution`: `1k` or `2k`.
|
|
44
|
+
- `response_format`: `url` or `b64_json`.
|
|
45
|
+
- `size`: provider-specific size string.
|
|
46
|
+
- `artifact_dir`: local directory for saved image artifacts.
|
|
47
|
+
|
|
48
|
+
When `artifact_dir` is present, return the upstream JSON plus `artifacts`. Saved artifacts include `path`, `mime_type`, `source`, and `status`. If a remote URL cannot be downloaded, preserve its upstream `url` with `status: remote`.
|
|
49
|
+
|
|
50
|
+
## Credential Safety
|
|
51
|
+
|
|
52
|
+
Use existing credentials. If credentials are missing, ask the user to run:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
codex-xai-oauth login --device
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
or set `XAI_API_KEY`. Never print or expose OAuth tokens or API keys.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: xai_login_instructions
|
|
3
|
+
description: Use when the user asks how to log in, authenticate, configure OAuth, set up XAI_API_KEY, or fix missing xAI/Grok credentials for codex-xai-oauth.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# xAI Login Instructions
|
|
7
|
+
|
|
8
|
+
Use `xai_login_instructions` when the user needs setup commands or auth-file paths.
|
|
9
|
+
|
|
10
|
+
Default OAuth login writes a shared xAI OIDC entry to `~/.grok/auth.json`. This is a shared auth store, not a requirement to use a specific Grok CLI build.
|
|
11
|
+
|
|
12
|
+
For browser login:
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
codex-xai-oauth login
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
For OAuth device login:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
codex-xai-oauth login --device
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
For API-key fallback:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
export XAI_API_KEY=xai-...
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Credential safety:
|
|
31
|
+
|
|
32
|
+
- Do not expose token material.
|
|
33
|
+
- Prefer `~/.grok/auth.json` unless `CODEX_XAI_OAUTH_AUTH_FILE` is explicitly set.
|
|
34
|
+
- Treat `~/.config/codex-xai-oauth/auth.json` as a legacy fallback.
|
|
35
|
+
- Mention `XAI_API_KEY` only as an environment variable name, never as a value.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: xai_status
|
|
3
|
+
description: Use when the user asks to check xAI, Grok, codex-xai-oauth, OAuth, API-key, or credential status without exposing secrets.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# xAI Status
|
|
7
|
+
|
|
8
|
+
Use `xai_status` to check whether xAI credentials are available.
|
|
9
|
+
|
|
10
|
+
Return a concise status summary. Never print, quote, or expose OAuth tokens, refresh tokens, bearer tokens, or API keys.
|
|
11
|
+
|
|
12
|
+
CLI equivalent:
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
codex-xai-oauth status
|
|
16
|
+
```
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: xai_tts
|
|
3
|
+
description: Use when the user asks to generate speech, text-to-speech, audio narration, voice output, or TTS with xAI/Grok through xai_tts.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# xAI TTS
|
|
7
|
+
|
|
8
|
+
Use `xai_tts` to generate speech audio.
|
|
9
|
+
|
|
10
|
+
Preferred MCP call:
|
|
11
|
+
|
|
12
|
+
```json
|
|
13
|
+
{
|
|
14
|
+
"input": "Hello from Grok.",
|
|
15
|
+
"voice_id": "eve",
|
|
16
|
+
"language": "auto",
|
|
17
|
+
"codec": "mp3"
|
|
18
|
+
}
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Options:
|
|
22
|
+
|
|
23
|
+
- `input`: required text to speak.
|
|
24
|
+
- `voice_id`: optional voice, default `eve`.
|
|
25
|
+
- `language`: optional language, default `auto`.
|
|
26
|
+
- `codec`: optional output codec.
|
|
27
|
+
|
|
28
|
+
Return the content type and explain that the audio bytes are returned as base64 in the tool output.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: xai_video_generate
|
|
3
|
+
description: Use when the user asks to generate video, Grok Imagine video, text-to-video, image-to-video, or xAI video through xai_video_generate.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# xAI Video Generate
|
|
7
|
+
|
|
8
|
+
Use `xai_video_generate` for Grok Imagine video generation.
|
|
9
|
+
|
|
10
|
+
Preferred text-to-video MCP call:
|
|
11
|
+
|
|
12
|
+
```json
|
|
13
|
+
{
|
|
14
|
+
"prompt": "A serene mountain lake at sunrise with slow camera pan, cinematic lighting"
|
|
15
|
+
}
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Image-to-video MCP call:
|
|
19
|
+
|
|
20
|
+
```json
|
|
21
|
+
{
|
|
22
|
+
"prompt": "Animate this image with a slow camera push-in",
|
|
23
|
+
"image_url": "https://example.com/start-frame.jpg"
|
|
24
|
+
}
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Reference-image MCP call:
|
|
28
|
+
|
|
29
|
+
```json
|
|
30
|
+
{
|
|
31
|
+
"prompt": "Create a short cinematic shot using these reference images for style consistency",
|
|
32
|
+
"reference_image_urls": [
|
|
33
|
+
"https://example.com/reference-1.jpg",
|
|
34
|
+
"https://example.com/reference-2.jpg"
|
|
35
|
+
]
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Options:
|
|
40
|
+
|
|
41
|
+
- `prompt`: required video prompt.
|
|
42
|
+
- `image_url`: optional starting image for image-to-video.
|
|
43
|
+
- `reference_image_urls`: optional array of up to 7 reference images.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: xai_web_search
|
|
3
|
+
description: Use when the user asks xAI/Grok to search the web, find current information, answer with citations, or use server-side web_search.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# xAI Web Search
|
|
7
|
+
|
|
8
|
+
Use `xai_web_search` for web-backed answers through xAI Responses server-side `web_search`.
|
|
9
|
+
|
|
10
|
+
Preferred MCP call:
|
|
11
|
+
|
|
12
|
+
```json
|
|
13
|
+
{
|
|
14
|
+
"prompt": "Find the latest xAI model announcement and summarize it with citations."
|
|
15
|
+
}
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Options:
|
|
19
|
+
|
|
20
|
+
- `prompt`: required search question.
|
|
21
|
+
- `model`: optional Grok model.
|
|
22
|
+
|
|
23
|
+
Return a concise answer and include citations from the tool output when available.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: xai_x_search
|
|
3
|
+
description: Use when the user asks to search X, Twitter, posts, handles, or tweets through xAI/Grok server-side x_search.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# xAI X Search
|
|
7
|
+
|
|
8
|
+
Use `xai_x_search` for X/Twitter search through xAI Responses server-side `x_search`.
|
|
9
|
+
|
|
10
|
+
Preferred MCP call:
|
|
11
|
+
|
|
12
|
+
```json
|
|
13
|
+
{
|
|
14
|
+
"prompt": "Summarize recent posts from @xai",
|
|
15
|
+
"allowed_x_handles": ["xai"]
|
|
16
|
+
}
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Options:
|
|
20
|
+
|
|
21
|
+
- `prompt`: required X search request.
|
|
22
|
+
- `allowed_x_handles`: optional handles to include.
|
|
23
|
+
- `excluded_x_handles`: optional handles to exclude.
|
|
24
|
+
|
|
25
|
+
Do not pass both `allowed_x_handles` and `excluded_x_handles` in the same call.
|