Skip to content

Connect an MCP client

These examples assume the checkout is at ~/nasa-mcp (install) and the key is in ~/.config/nasa-mcp/env (key setup). 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:

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)

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:

{
  "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.