Skip to content

Commit a1de805

Browse files
committed
docs: add native mcp setup guide
1 parent 049a672 commit a1de805

2 files changed

Lines changed: 52 additions & 1 deletion

File tree

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
the main setup path is `kagi auth`. on a real terminal it opens a guided setup flow where you choose `Session Link`, `API Key`, or `Legacy API Token`, get the official instructions inline, paste the credential, save it to `~/.config/kagi-cli/config.toml`, and validate it immediately. if you also use Kagi's paid API, the same wizard can add that too.
2222

23-
[documentation](https://kagi.micr.dev) | [npm](https://www.npmjs.com/package/kagi-cli) | [mcp](https://github.com/Microck/kagi-mcp)
23+
[documentation](https://kagi.micr.dev) | [npm](https://www.npmjs.com/package/kagi-cli) | [mcp](https://kagi.micr.dev/commands/mcp)
2424

2525
![search demo](images/demos/search.gif)
2626

@@ -470,6 +470,7 @@ for the fuller install matrix and platform-specific setup, use the [installation
470470
- [quickstart guide](https://kagi.micr.dev/guides/quickstart)
471471
- [authentication guide](https://kagi.micr.dev/guides/authentication)
472472
- [workflows](https://kagi.micr.dev/guides/workflows)
473+
- [mcp command](https://kagi.micr.dev/commands/mcp)
473474

474475
## contributing
475476

docs/commands/mcp.mdx

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,56 @@ Run a stdio JSON-RPC server that exposes Kagi tools for agents.
1313
kagi mcp
1414
```
1515

16+
## Use with Codex
17+
18+
`kagi mcp` is a stdio server. You normally do not run it in a separate terminal; your MCP client launches it when it needs Kagi tools.
19+
20+
Start by making sure `kagi` works from your shell:
21+
22+
```bash
23+
kagi auth status
24+
kagi auth check
25+
```
26+
27+
Then add it to Codex:
28+
29+
```bash
30+
codex mcp add kagi-mcp -- "$(command -v kagi)" mcp
31+
```
32+
33+
Check the saved entry:
34+
35+
```bash
36+
codex mcp get kagi-mcp
37+
```
38+
39+
You should see `command` pointing at the `kagi` binary and `args` set to `mcp`.
40+
41+
If Codex will not run from the directory that contains your `./.kagi.toml`, pass credentials through the MCP entry instead:
42+
43+
```bash
44+
codex mcp add kagi-mcp \
45+
--env KAGI_SESSION_TOKEN="$KAGI_SESSION_TOKEN" \
46+
-- "$(command -v kagi)" mcp
47+
```
48+
49+
Use only the environment values you need. `KAGI_SESSION_TOKEN` unlocks subscriber-backed search, Quick Answer, and news search. Add `--env KAGI_API_KEY="$KAGI_API_KEY"` when you want current `/api/v1` Search or Extract. Add `--env KAGI_API_TOKEN="$KAGI_API_TOKEN"` when you want the legacy public summarizer.
50+
51+
If you previously used the separate `kagi-mcp` wrapper, replace it with the native CLI server:
52+
53+
```bash
54+
codex mcp remove kagi-mcp
55+
codex mcp add kagi-mcp -- "$(command -v kagi)" mcp
56+
```
57+
58+
Restart Codex after changing MCP entries so the tool list is rediscovered.
59+
60+
To use a named profile from `./.kagi.toml`, put `--profile` after `mcp`:
61+
62+
```bash
63+
codex mcp add kagi-work -- "$(command -v kagi)" mcp --profile work
64+
```
65+
1666
## Tools
1767

1868
- `kagi_search` - search Kagi

0 commit comments

Comments
 (0)