Skip to content
Agentmart
Submit a tool

hermes-gateway-api

Configure and troubleshoot the Hermes Gateway HTTP API server — enabling port 8642, setting API_SERVER_KEY, and connecting external tools (Studio, dashboards…

Skill by mattdanielmurphy

IndexedMIT
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/mattdanielmurphy-hermes-gateway-api

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Configure and troubleshoot the Hermes Gateway HTTP API server — enabling port 8642, setting API_SERVER_KEY, and connecting external tools (Studio, dashboards, scripts) via bearer auth.

Use cases: backend, security

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/hermes-gateway-api

What's inside

Skill name
hermes-gateway-api
Description
Configure and troubleshoot the Hermes Gateway HTTP API server — enabling port 8642, setting API_SERVER_KEY, and connecting external tools (Studio, dashboards, scripts) via bearer auth.
License
MIT
Instructions
178 lines in SKILL.md · view on GitHub

Before installing

  • Instructions call the network

Files (3)

  • SKILL.md
  • studio-gateway-connection.md · references/
  • websocket-jsonrpc-protocol.md · references/

SKILL.md (first lines)

# Hermes Gateway API Server

The Hermes Gateway can serve an **HTTP API server** on port 8642, which external tools (Hermes Studio, custom dashboards, CLI scripts, the ACP server) connect to for session management, chat, memory, skills, and config.

This API server is **opt-in** — it does not start by default, even when the gateway is running. It requires explicit configuration.

## Prerequisites

- Hermes Agent v0.18.0+ (the `API_SERVER_KEY` security check was added in v0.18.x)
- `hermes gateway run` already works (the gateway process starts for messaging platforms)

## Enabling the API Server

### 1. Enable the API server

Add to `~/.hermes/.env`:

```ini
API_SERVER_ENABLED=true
```

### 2. Set a secure API key

**Required.** The gateway v0.18.x refuses to start the API server without a key, even for loopback-only binds on `127.0.0.1`. The key must be:

- **At least 16 characters** — shorter keys are rejected with: `API_SERVER_KEY is a placeholder or too short (<16 chars)`
- **Not a placeholder** — `dev-key`, `test`, `secret`, etc. are rejected
- **Cryptographically random** — use `openssl rand -hex 16` or similar

```bash
# Generate a secure key
openssl rand -hex 16

# Add to ~/.hermes/.env
API_SERVER_KEY=28582603a4559f46346896b9741de429
```

### 3. Match the key in your client

Any tool connecting to the API server must send `Authorization: Bearer <API_SERVER_KEY>` as an HTTP header.

For **Hermes Studio**, add to the Studio's `.env`:

```ini
HERMES_API_TOKEN=28582603a4559f46346896b9741de429
```

### 4. Restart the gateway

```bash
hermes gateway run --replace
```

## Verification

Check the gateway is listening and the API server is healthy:

```bash
# Port should be listening
lsof -i :8642

# Health endpoint
curl http://localhost:8642/health

# Should return: {"status": "ok", "platform": "hermes-agent", "version": "0.18.2"}
```

## Common Errors

### `ECONNREFUSED 127.0.0.1:8642`

The gateway is running but the API server is not enabled. Check:

1. `API_SERVER_ENABLED=true` is set in `~/.hermes/.env`
2. `API_SERVER_KEY=<32-char-hex>` is set (≥16 chars, not a placeholder)
3. Gateway was restarted after adding these variables

### `API_SERVER_KEY is required for the API server`

The API server is enabled but no key was provided. Generate a key and add it to `.env`.

### `API_SERVER_KEY is a placeholder or too short (<16 chars)`

The key exists but is too short or guessable. Generate a proper key with `openssl rand -hex 16`.

### `Gateway connection refused / 401 Unauthorized`
The client's bearer token doesn't match the server's `API_SERVER_KEY`. Verify:

```bash
# Check the server's expected key
grep API_SERVER_KEY ~/.hermes/.env

# Check the client's token
grep HERMES_API_TOKEN /path/to/client/.env
```

### `Cannot read properties of undefined (reading 'slice')` (500 on `/api/history`)

The Studio connected but the API response format doesn't match. Hermes Gateway v0.18.x returns OpenAI-compatible list format (`{ object, data, limit, offset, has_more }`), but Studio expects `{ items, total }`.

**Fix:** Patch `listSessions()` and `getMessages()` in `src/server/hermes-api.ts` to handle both:

```typescript
return resp.data ?? resp.items ?? []
```

See `references/studio-gateway-connection.md` for full steps.

### `API server rejected invalid API key` (from Studio, using correct .env)

The Studio's `.env` has the right token, but there are two separate places in `vite.config.ts` where the token is needed:

**1. Vite SSR env gap** — `loadEnv` does NOT set `process.env` by default. The Studio's SSR code (in `src/server/gateway-capabilities.ts`) reads `process.env.HERMES_API_TOKEN` at import time — if it's not in the shell environment, the token is empty.

**Fix** — In `vite.config.ts`, forward loaded env vars to `process.env` right after `loadEnv`:

```typescript
const env = loadEnv(mode, process.cwd(), '')
// Forward env vars to process.env so SSR code can read them

From mattdanielmurphy/ai-os, MIT.

More from mattdanielmurphy/ai-os

Signals

Stars
0
Forks
0
Open issues
0
Last commit (this folder)
Oct 17, 2026 (12 days ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from mattdanielmurphy

Cite this page

hermes-gateway-api skill. Agent Mart. https://agentmart.dev/skills/mattdanielmurphy-hermes-gateway-api (last updated 2026-10-24)