Connect an existing server

Read a server configuration

Understand the name, command, arguments, environment, and transport before copying a configuration into an AI host.

8 minute lesson

~~~

A local stdio configuration tells the host which process to start. The important fields are the server name, command, arguments, and optional environment variables.

Here is the shape, using placeholders rather than a real secret:

{
  "mcpServers": {
    "practice-notes": {
      "command": "npx",
      "args": ["-y", "example-package", "/absolute/path/to/practice"],
      "env": {
        "API_TOKEN": "<API_TOKEN>"
      }
    }
  }
}

The exact configuration file location depends on the host. Use its current documentation instead of assuming every host reads the same file.

Read the configuration as a process launch, not as passive data. In the example, the host runs npx under your account, allows it to download a package because of -y, passes a filesystem path, and injects an environment value. Changing any argument can change the server’s authority.

Prefer an absolute executable path or a well-understood runtime resolution when the host has a different $PATH from your terminal. Quote and encode arguments through the configuration format; do not build one shell string unless the host explicitly requires a shell.

Never commit a real token. Prefer the host secret store or an environment variable when it supports one.

An environment-variable placeholder is only safe if something outside the checked-in file resolves it. Confirm the host’s semantics: some pass the literal placeholder, some expand from their environment, and some provide a separate secret setting.

Before installing, translate the JSON into one sentence: “The host starts this exact executable and package, grants this directory, and supplies these variables.” Run the command manually in the disposable environment and check its version and help output.

Finally, keep a copy of the last working configuration without secrets. That gives you a reviewable rollback when an upgrade changes the launch contract.

Lesson completed

Take this course offline

Get every free book and course as PDF and EPUB files.

Get the download library →