codex-xai-oauth 0.1.0
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 +28 -0
- package/.mcp.json +9 -0
- package/LICENSE +21 -0
- package/README.md +134 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.js +5905 -0
- package/dist/codex/doctor.d.ts +12 -0
- package/dist/codex/setup.d.ts +16 -0
- package/dist/mcp/server.d.ts +7 -0
- package/dist/mcp/server.js +33006 -0
- package/dist/openai-compat/server.d.ts +10 -0
- package/dist/version.d.ts +2 -0
- package/dist/xai/browser-oauth.d.ts +24 -0
- package/dist/xai/codex-config.d.ts +9 -0
- package/dist/xai/constants.d.ts +17 -0
- package/dist/xai/credentials.d.ts +4 -0
- package/dist/xai/device-oauth.d.ts +9 -0
- package/dist/xai/guards.d.ts +4 -0
- package/dist/xai/http.d.ts +7 -0
- package/dist/xai/index.d.ts +9 -0
- package/dist/xai/media.d.ts +35 -0
- package/dist/xai/oauth.d.ts +28 -0
- package/dist/xai/responses.d.ts +10 -0
- package/dist/xai/storage.d.ts +11 -0
- package/dist/xai/types.d.ts +58 -0
- package/package.json +58 -0
- package/skills/xai-grok/SKILL.md +49 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "codex-xai-oauth",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Use xAI/Grok OAuth or API-key credentials from Codex through local MCP tools.",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "ilseoblee"
|
|
7
|
+
},
|
|
8
|
+
"homepage": "https://github.com/islee23520/codex-xai-oauth",
|
|
9
|
+
"repository": "https://github.com/islee23520/codex-xai-oauth",
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"keywords": ["codex", "mcp", "xai", "grok", "oauth", "image-generation"],
|
|
12
|
+
"skills": "./skills/",
|
|
13
|
+
"mcpServers": "./.mcp.json",
|
|
14
|
+
"interface": {
|
|
15
|
+
"displayName": "xAI Grok OAuth",
|
|
16
|
+
"shortDescription": "Generate with Grok, including images, from Codex.",
|
|
17
|
+
"longDescription": "Adds local Codex MCP tools for xAI/Grok text, web search, X search, image generation, TTS, video generation, and credential status using OAuth or XAI_API_KEY.",
|
|
18
|
+
"developerName": "ilseoblee",
|
|
19
|
+
"category": "Productivity",
|
|
20
|
+
"capabilities": ["MCP", "Local tools", "Image generation"],
|
|
21
|
+
"defaultPrompt": [
|
|
22
|
+
"Generate an image with xAI.",
|
|
23
|
+
"Check my xAI credential status.",
|
|
24
|
+
"Search the web with Grok."
|
|
25
|
+
],
|
|
26
|
+
"brandColor": "#111111"
|
|
27
|
+
}
|
|
28
|
+
}
|
package/.mcp.json
ADDED
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 ilseoblee
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
# codex-xai-oauth
|
|
2
|
+
|
|
3
|
+
Codex plugin that exposes xAI/Grok tools through a local stdio MCP server. It is based on the reusable OAuth and xAI client behavior from `../opencode-xai-oauth`, adapted for Codex plugin packaging instead of OpenCode provider hooks.
|
|
4
|
+
|
|
5
|
+
## What Works
|
|
6
|
+
|
|
7
|
+
- `xai_status`
|
|
8
|
+
- `xai_login_instructions`
|
|
9
|
+
- `xai_generate_text`
|
|
10
|
+
- `xai_web_search`
|
|
11
|
+
- `xai_x_search`
|
|
12
|
+
- `xai_image_generate`
|
|
13
|
+
- `xai_tts`
|
|
14
|
+
- `xai_video_generate`
|
|
15
|
+
|
|
16
|
+
`xai_image_generate` calls xAI `/images/generations`. Default model is `grok-imagine-image`, default response format is `url`, and `resolution` supports `1k` or `2k`.
|
|
17
|
+
|
|
18
|
+
## Unofficial / Use At Your Own Risk
|
|
19
|
+
|
|
20
|
+
This project is not affiliated with or endorsed by xAI. OAuth behavior and media endpoints can change. You are responsible for reviewing and complying with xAI terms, API policies, X policies, account rules, and quota or billing implications before using it.
|
|
21
|
+
|
|
22
|
+
## Development
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npm install
|
|
26
|
+
npm test
|
|
27
|
+
npm run typecheck
|
|
28
|
+
npm run build
|
|
29
|
+
python3 /Users/ilseoblee/.codex/skills/.system/plugin-creator/scripts/validate_plugin.py .
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Install / Doctor
|
|
33
|
+
|
|
34
|
+
From a checkout:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
npm run setup
|
|
38
|
+
npm run doctor
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Via npx:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
npx codex-xai-oauth setup
|
|
45
|
+
npx codex-xai-oauth doctor
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Globally from GitHub:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
npm install -g github:islee23520/codex-xai-oauth
|
|
52
|
+
codex-xai-oauth setup
|
|
53
|
+
codex-xai-oauth doctor
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
`setup` syncs this package into the local `linalab` Codex marketplace and installs `codex-xai-oauth@linalab`. `doctor` checks the build output, Codex plugin install, MCP registration, and credential status.
|
|
57
|
+
|
|
58
|
+
## Authentication
|
|
59
|
+
|
|
60
|
+
Browser OAuth login:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
npx codex-xai-oauth login
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
OAuth device flow for headless environments:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
npx codex-xai-oauth login --device
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
API-key fallback:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
export XAI_API_KEY=xai-...
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Status:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
npx codex-xai-oauth status
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
OAuth credentials are stored at:
|
|
85
|
+
|
|
86
|
+
```text
|
|
87
|
+
~/.config/codex-xai-oauth/auth.json
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
If that file is absent and no custom auth file is configured, the tools also read the Grok CLI OIDC session from:
|
|
91
|
+
|
|
92
|
+
```text
|
|
93
|
+
~/.grok/auth.json
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Overrides:
|
|
97
|
+
|
|
98
|
+
- `CODEX_XAI_OAUTH_AUTH_FILE`: custom OAuth auth JSON path.
|
|
99
|
+
- `CODEX_XAI_OAUTH_GROK_AUTH_FILE`: custom Grok CLI auth JSON path, mainly for tests or nonstandard installs.
|
|
100
|
+
- `XAI_API_KEY`: API-key fallback.
|
|
101
|
+
- `XAI_BASE_URL`: custom xAI-compatible base URL.
|
|
102
|
+
|
|
103
|
+
## OpenAI-Compatible Proxy
|
|
104
|
+
|
|
105
|
+
After OAuth login, start a local `/v1` proxy backed by the stored xAI OAuth token:
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
npx codex-xai-oauth serve-openai --host 127.0.0.1 --port 8787
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Print a CLIProxyAPIPlus `openai-compatibility` snippet:
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
npx codex-xai-oauth cliproxy-config
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
The proxy exposes:
|
|
118
|
+
|
|
119
|
+
- `/v1/models`
|
|
120
|
+
- `/v1/chat/completions`
|
|
121
|
+
- `/v1/responses`
|
|
122
|
+
- `/v1/images/generations`
|
|
123
|
+
|
|
124
|
+
## Codex Plugin Surface
|
|
125
|
+
|
|
126
|
+
- `.codex-plugin/plugin.json` declares the plugin metadata, skill bundle, and MCP config.
|
|
127
|
+
- `.mcp.json` starts the stdio MCP server from `dist/mcp/server.js`.
|
|
128
|
+
- `skills/xai-grok/SKILL.md` tells Codex when to use the tools and how to avoid leaking secrets.
|
|
129
|
+
|
|
130
|
+
Build before installing or using the MCP server:
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
npm run build
|
|
134
|
+
```
|
package/dist/cli.d.ts
ADDED