# MCP server for AI agents

> Connect Ladehase to Claude, ChatGPT or Cursor. Tools for locations, devices, charging, tariffs and reports.

Ladehase offers an MCP server (Model Context Protocol). AI agents such as Claude, ChatGPT or Cursor can query your charging stations, propose tariffs, start charging or create reports. The tools are generated from the same endpoints as the REST API.

- **URL:** `https://api.ladehase.com/mcp`
- **Transport:** Streamable HTTP (JSON-RPC via `POST`)
- **Authentication:** `Authorization: Bearer lh_live_…` or `lh_test_…`

> **Hinweis:** Start with a test key. The agent can try everything without controlling real charging stations or moving money.

## Claude

In Claude Desktop, open the settings under «Developer» and edit the configuration:

```json
{
  "mcpServers": {
    "ladehase": {
      "command": "npx",
      "args": ["-y", "mcp-remote", "https://api.ladehase.com/mcp", "--header", "Authorization:Bearer lh_test_…"]
    }
  }
}
```

In Claude Code a single command is enough:

```bash
claude mcp add --transport http ladehase https://api.ladehase.com/mcp --header "Authorization: Bearer lh_test_…"
```

## ChatGPT

In ChatGPT, add a custom connector under «Settings», «Connectors» (developer mode). Enter `https://api.ladehase.com/mcp` as the URL and the API key as bearer token.

## Cursor

Create the file `.cursor/mcp.json` in your project:

```json
{
  "mcpServers": {
    "ladehase": {
      "url": "https://api.ladehase.com/mcp",
      "headers": { "Authorization": "Bearer lh_test_…" }
    }
  }
}
```

## Tools

`tools/list` returns all tools with description and JSON schema. Names match the endpoints in the [API reference](/en/docs/api) in snake case, for example:

- `list_devices`, `get_device_state`: charge points and their state
- `create_session`, `stop_session`, `list_sessions`: start, stop and analyse charging
- `preview_tariff_draft`, `create_tariff`: calculate and create tariffs
- `create_code`, `render_signs`: QR codes and signs
- `get_report_summary`: key figures
- `create_access_grant`: access for residents or employees

Read-only tools are marked with `readOnlyHint`, changing tools such as stop, lock or refund with `destructiveHint`. Good agents ask before such actions.

## Example

```bash
curl -X POST https://api.ladehase.com/mcp \
  -H "Authorization: Bearer lh_test_…" \
  -H "Content-Type: application/json" \
  -d '{ "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "list_devices", "arguments": {} } }'
```

## Units for agents

On connect the server tells agents that amounts are in Rappen, energy in Wh and energy prices in hundredths of a Rappen per kWh. Repeat this rule in your own instructions when an agent should create tariffs.

## Disable writing tools

Writing tools can be disabled for an organisation. The agent can then only read and receives a clear message for changing calls. Write to [developer@ladehase.com](mailto:developer@ladehase.com) if you want this for your organisation.
