---
title: "Connect an MCP client"
description: "Register nasa-mcp with Claude Code, Claude Desktop or any MCP client over stdio, or point a client at the HTTP endpoint."
type: Guide
tags:
  - clients
  - claude
  - stdio
  - http
generated:
  by: "claude/opus-5.5"
  at: "2026-11-28T00:00:00Z"
sources:
  - id: design
    resource: "DESIGN.md"
    title: "nasa-mcp design"
    author: "team:nasa-mcp"
status: stable
---

<!--
SPDX-FileCopyrightText: 2026 Tyson Lee Swetnam
SPDX-License-Identifier: CC-BY-4.0
-->

# Connect an MCP client

These examples assume the checkout is at `~/nasa-mcp` ([install](install.md)) and the key is in
`~/.config/nasa-mcp/env` ([key setup](api-key.md)). Replace paths to match your machine. The key
is optional: without it everything except NeoWs and InSight works normally.

## The launcher: read the key at start-up

Rather than copying the key into each client's configuration, start the server through `sh`,
which sources the key file and then runs the server:

```bash
sh -c 'set -a; . "$HOME/.config/nasa-mcp/env"; set +a; exec uv run --frozen --directory "$HOME/nasa-mcp" nasa-mcp'
```

The key then lives in exactly one private file, and client configs contain no secret. If the
file is missing the launcher fails at once. Remove the `. ...env` part to run with DEMO_KEY.

GUI apps such as Claude Desktop often start with a minimal `PATH` that does not include `uv`. Use
the absolute path that `command -v uv` prints (for example `/opt/homebrew/bin/uv` or
`~/.local/bin/uv` expanded to its full path) in place of `uv` in the launcher.

## Claude Code (stdio)

```bash
claude mcp add nasa -s user -- \
  sh -c 'set -a; . "$HOME/.config/nasa-mcp/env"; set +a; exec uv run --frozen --directory "$HOME/nasa-mcp" nasa-mcp'
claude mcp list            # nasa ... connected
```

`-s user` registers the server for every project; leave it out to register it for the current
project only. Then ask Claude to "call nasa_ping": `apiKey.mode` should be `personal`.

Without the launcher, `claude mcp add nasa -e NASA_MCP_NASA__API_KEY=... -- uv run --directory
~/nasa-mcp nasa-mcp` also works, but it stores the key in plain text in Claude Code's user
configuration.

## Claude Desktop and other stdio clients

Edit the client's config file. For Claude Desktop that is
`~/Library/Application Support/Claude/claude_desktop_config.json` on macOS:

```json
{
  "mcpServers": {
    "nasa": {
      "command": "/bin/sh",
      "args": [
        "-c",
        "set -a; . \"$HOME/.config/nasa-mcp/env\"; set +a; exec /ABSOLUTE/PATH/TO/uv run --frozen --directory \"$HOME/nasa-mcp\" nasa-mcp"
      ]
    }
  }
}
```

Restart the client after editing. A plain alternative puts the key in the `env` block
(`"command": "/ABSOLUTE/PATH/TO/uv"`, `"args": ["run", "--directory", "/Users/you/nasa-mcp",
"nasa-mcp"]`, `"env": {"NASA_MCP_NASA__API_KEY": "<your key>"}`). That file then holds the key in
plain text, so keep it private.

If the server does not appear, run the launcher command in a terminal: errors such as a missing
key file or an unknown path show up there. The server's own logs go to stderr, which the client
usually writes to its MCP log.

## Streamable HTTP

Start the server with `nasa-mcp --transport http` (127.0.0.1:8080 by default) and point the client
at `http://127.0.0.1:8080/mcp`. The endpoint is stateless: no session header, plain JSON
responses, `POST` only. Over HTTP the operator's key is used only when
`NASA_MCP_NASA__ALLOW_KEY_IN_HTTP_MODE=true`. See [Transports](../mcp/transports.md).
