> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gdeltcloud.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Agent setup

> For a coding agent setting up GDELT Cloud in a project: connect both MCP servers, store the key, run one search.

This page is written for a coding agent (Claude Code, Codex, Cursor, VS Code or another MCP client)
that a person has asked to set up GDELT Cloud. Work through it in order, tell the person what you did
at each step, and stop to ask when a step needs them.

## 1. Check what is already connected

GDELT Cloud has two MCP servers:

| Server | URL | Auth |
| - | - | - |
| Data | `https://mcp.gdeltcloud.com/mcp` | `Authorization: Bearer <key>`, or OAuth |
| Docs | `https://docs.gdeltcloud.com/mcp` | none |

If you already have tools from both, go to step 3.

## 2. Connect both servers

The [plugin](https://docs.gdeltcloud.com/mcp/plugins.md) is the shortest path where it exists: it brings the data server, the docs
server and the workflow skills together.

> [tab] Claude Code
>
> Run both from a terminal. One install serves the Claude Code CLI and the Claude desktop app:
>
> ```bash theme={null}
> claude plugin marketplace add gdelt-cloud/plugins
> claude plugin install gdelt-cloud@gdelt-cloud
> ```
>
> Inside a session the person can type the same steps as `/plugin marketplace add gdelt-cloud/plugins`
> and `/plugin install gdelt-cloud@gdelt-cloud`. Claude Code asks them for the API key when the plugin
> is enabled and keeps it in their keychain. New tools appear after the session restarts.

> [tab] Codex
>
> Run both commands. The first only registers the marketplace; the second installs the plugin.
>
> ```bash theme={null}
> codex plugin marketplace add gdelt-cloud/plugins
> codex plugin add gdelt-cloud@gdelt-cloud
> ```
>
> Codex reads the key from `GDELT_CLOUD_API_KEY` in the environment it starts from. Ask the person to
> add `export GDELT_CLOUD_API_KEY=...` to their shell profile, then restart Codex. The Codex CLI and IDE
> extension share this install.

> [tab] Cursor
>
> Add both servers to `~/.cursor/mcp.json` (or the project's `.cursor/mcp.json`, if that file is
> ignored by git):
>
> ```json theme={null}
> {
>   "mcpServers": {
>     "gdelt-cloud": {
>       "url": "https://mcp.gdeltcloud.com/mcp",
>       "headers": { "Authorization": "Bearer ${env:GDELT_CLOUD_API_KEY}" }
>     },
>     "gdelt-cloud-docs": { "url": "https://docs.gdeltcloud.com/mcp" }
>   }
> }
> ```

> [tab] VS Code
>
> Add both servers to `.vscode/mcp.json`:
>
> ```json theme={null}
> {
>   "servers": {
>     "gdelt-cloud": {
>       "type": "http",
>       "url": "https://mcp.gdeltcloud.com/mcp",
>       "headers": { "Authorization": "Bearer ${env:GDELT_CLOUD_API_KEY}" }
>     },
>     "gdelt-cloud-docs": { "type": "http", "url": "https://docs.gdeltcloud.com/mcp" }
>   }
> }
> ```

> [tab] Other
>
> Any MCP client that speaks Streamable HTTP: add the two URLs from step 1, with the data server's
> `Authorization` header read from `GDELT_CLOUD_API_KEY`. See [MCP integrations](https://docs.gdeltcloud.com/mcp/integrations.md).

## 3. Store the key

Keep the key in an environment variable named `GDELT_CLOUD_API_KEY`. Older setups used
`GDELT_API_KEY`: if only that one is set, use its value and save it under the new name too. For code
in this project:

1. Make sure `.env` is listed in `.gitignore` before you write to it. Add it if it is not.
2. Add `GDELT_CLOUD_API_KEY=<key>` to `.env`. If the person downloaded `gdelt-cloud.env` from their
   setup screen, it holds that one line and is usually in `~/Downloads`: append its contents to
   `.env` without printing them, then delete the downloaded file.
3. Never commit the key, print it in full, or write it into source files.

If the person pasted the key into this chat, tell them once that it is now in the chat history and
that they can replace it any time on [API keys](https://gdeltcloud.com/api-keys).

## 4. Run the first search

Ask the data server for the five most significant Events of the last 24 hours. Without the MCP tools,
call the REST API directly:

```bash theme={null}
curl "https://gdeltcloud.com/api/v2/events?days=1&limit=5" \
  -H "Authorization: Bearer $GDELT_CLOUD_API_KEY"
```

Show the person each Event's date, place and title. That call appears on their GDELT Cloud setup
screen a few seconds later.

If it fails, read the `code` in the error body, not only the status: [Errors](https://docs.gdeltcloud.com/reference/errors.md)
says what each one means and what to do.

## 5. Before writing code

* Read [List incidents](https://docs.gdeltcloud.com/guides/best-practices.md) to list what happened in a place and period.
* Ask the docs server before guessing a parameter, and check `applied_filters` on every response.
* Parameters and values are listed in the [parameter reference](https://docs.gdeltcloud.com/reference/parameters.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.