Adding a Server
Use thetestpilot mcp add command to register an MCP server for the current Git repository or
directory. To add a local server, pass the command that starts the server:
testpilot test.
To add a remote server, pass the server URL:
--env and --header flags. For example, you can pass an environment variable to a local
server:
$MY_TOKEN
above). This prevents secrets from being written to the .testpilot/mcp.json config file. Testpilot
expands environment variables from the config file before connecting to a server.
See the Environment Variables section for details.
Configuration File
MCP server configurations are stored in amcp.json file that follows a schema similar to Claude
Code and other agents. The file location depends on whether you’re running Testpilot in a Git
repository:
- Git repos: Testpilot searches for
.testpilot/mcp.jsonstarting from the current directory up to the repository root. If not found, it creates the file at.testpilot/mcp.jsonin the repository root. - Non-Git directories: Testpilot searches for
.testpilot/mcp.jsonstarting from the current directory up through parent directories. If not found, it creates the file at.testpilot/mcp.jsonin the current directory.
.testpilot directory to share MCP server configurations with your team and
use them in CI.
Local Servers
Local servers are commands that Testpilot starts as separate processes. Testpilot communicates with these servers through standard input/output.command field contains no path separators (’/’), Testpilot searches for the command in your
$PATH. Otherwise, Testpilot launches the command directly from the specified path.
Remote Servers
Remote servers communicate with Testpilot over HTTPS.mcp.json file. The example above sets the Authorization header to the value of
the API_KEY environment variable.
Environment Variables
Testpilot expands environment variables in thecommand, args, env, url, and headers fields
before connecting to a server. Use $VAR or ${VAR} to reference environment variables.
Environment variables can also have default values with ${VAR:-default_value}, where
default_value replaces $VAR when the variable is empty or unset. The example below uses the
GH_MCP_SERVER environment variable for the GitHub MCP server URL, with a fallback to the default
endpoint:
${VAR:-default} syntax. If any required environment
variables are missing, Testpilot will fail at startup with an error indicating which variables need
to be set. This ensures your MCP servers receive the necessary credentials and configuration before
any tests run.