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

# Claude Code MCP Server

> Let Claude Code deploy, manage, and monitor your apps using natural language.

## What is MCP?

MCP (Model Context Protocol) is a way for AI tools to use external tools directly. Instead of Claude Code running terminal commands and parsing the output, MCP gives it structured tools it can call -- like "deploy this app" or "check the status" -- and get structured results back.

In plain terms: it lets Claude Code talk to Nometria natively, without you having to copy-paste commands.

## Install the MCP server

Run this once in your terminal:

```bash theme={null}
claude mcp add nometria -- npx @nometria-ai/claude-code
```

That's it. The next time you start a Claude Code session, it will have access to all 20 Nometria tools.

<Info>
  This installs the `@nometria-ai/claude-code` package as an MCP server. It runs automatically when Claude Code starts -- you do not need to start it manually.
</Info>

## Available tools

The MCP server exposes 20 tools that cover the full deployment lifecycle:

### Authentication

| Tool             | Description                                               |
| ---------------- | --------------------------------------------------------- |
| `nometria_login` | Save your API key or get instructions for browser sign-in |

### Deployment

| Tool                 | Description                                                       |
| -------------------- | ----------------------------------------------------------------- |
| `nometria_init`      | Create a `nometria.json` config file with auto-detected framework |
| `nometria_deploy`    | Build, upload, and deploy to production                           |
| `nometria_preview`   | Create a free staging preview (expires in 2 hours)                |
| `nometria_status`    | Check deployment status, URL, instance size, and IP               |
| `nometria_logs`      | View deployment and runtime logs                                  |
| `nometria_list_apps` | List all your deployed apps                                       |

### GitHub

| Tool                      | Description                                       |
| ------------------------- | ------------------------------------------------- |
| `nometria_github_connect` | Instructions to connect GitHub (requires browser) |
| `nometria_github_status`  | Check if GitHub is connected                      |
| `nometria_github_repos`   | List connected GitHub repos                       |
| `nometria_github_push`    | Push local changes to the connected repo          |

### Instance management

| Tool                 | Description                           |
| -------------------- | ------------------------------------- |
| `nometria_start`     | Start a stopped instance              |
| `nometria_stop`      | Stop a running instance               |
| `nometria_terminate` | Permanently delete an instance        |
| `nometria_upgrade`   | Resize instance (2gb, 4gb, 8gb, 16gb) |

### Configuration

| Tool                  | Description                                   |
| --------------------- | --------------------------------------------- |
| `nometria_domain_add` | Add a custom domain to your app               |
| `nometria_env_set`    | Set environment variables                     |
| `nometria_env_list`   | List environment variable keys                |
| `nometria_scan`       | Run an AI security and performance scan       |
| `nometria_setup`      | Generate AI tool config files for the project |

## Example conversation

Here is what a typical interaction looks like in Claude Code with the MCP server installed:

<Steps>
  <Step title="You ask Claude Code to deploy">
    ```
    You: Deploy this app to production
    ```
  </Step>

  <Step title="Claude Code initializes the project">
    Claude Code calls `nometria_init` to create a config file, detecting your framework automatically.

    ```
    Claude: I've initialized your project. Detected framework: vite, platform: aws.
            Created nometria.json.
    ```
  </Step>

  <Step title="Claude Code deploys">
    Claude Code calls `nometria_deploy` to build and push your code.

    ```
    Claude: Deployment started for my-app.
            Status: deploying
            URL: https://my-app.nometria.com

            I'll check the status for you.
    ```
  </Step>

  <Step title="Claude Code checks status">
    Claude Code calls `nometria_status` to confirm the deployment succeeded.

    ```
    Claude: Your app is live!
            URL: https://my-app.nometria.com
            Status: running
            Instance: 4gb
    ```
  </Step>
</Steps>

You can also do things like:

* "Set the DATABASE\_URL environment variable to postgres\://..."
* "Upgrade the instance to 8gb"
* "Run a security scan"
* "Show me the logs"
* "Add myapp.com as a custom domain"

Claude Code handles all of it through the MCP tools.

## Authentication

The MCP server looks for your API key in this order:

1. The `NOMETRIA_API_KEY` environment variable
2. Saved credentials at `~/.nometria/credentials.json` (created by `nom login`)

If you have already run `nom login` in your terminal, the MCP server picks up your credentials automatically. Otherwise, you can tell Claude Code your API key and it will save it using the `nometria_login` tool.

## Troubleshooting

<AccordionGroup>
  <Accordion title="Claude Code does not see the Nometria tools">
    Make sure you ran the install command:

    ```bash theme={null}
    claude mcp add nometria -- npx @nometria-ai/claude-code
    ```

    Then restart Claude Code. You can verify the server is registered by running:

    ```bash theme={null}
    claude mcp list
    ```

    You should see `nometria` in the list.
  </Accordion>

  <Accordion title="'Not authenticated' errors">
    Run `nom login` in your terminal first. The MCP server shares credentials with the CLI.

    Alternatively, tell Claude Code your API key directly:

    ```
    You: My Nometria API key is nometria_sk_abc123
    ```

    Claude Code will call `nometria_login` to save it.
  </Accordion>

  <Accordion title="'No nometria.json found' errors">
    Ask Claude Code to initialize the project:

    ```
    You: Initialize this project for Nometria deployment
    ```

    This calls `nometria_init` which detects your framework and creates the config file.
  </Accordion>

  <Accordion title="Deploy fails with build errors">
    The MCP server runs your build command (from `nometria.json`) before uploading. If the build fails, Claude Code will see the error output and can help you fix it.

    Make sure your build command works locally first:

    ```bash theme={null}
    npm run build
    ```
  </Accordion>

  <Accordion title="The MCP server is slow to start">
    The first time it runs, `npx` downloads the package. Subsequent starts are faster because the package is cached.

    To avoid the download delay, install it globally:

    ```bash theme={null}
    npm install -g @nometria-ai/claude-code
    ```

    Then update the MCP config to use the global install:

    ```bash theme={null}
    claude mcp remove nometria
    claude mcp add nometria -- nometria-claude
    ```
  </Accordion>
</AccordionGroup>
