atmos.mcp
The atmos.mcp function runs atmos mcp through the current Atmos executable. Use it to inspect, test, and
configure the Model Context Protocol servers in atmos.yaml and the AI clients that use them.
Usage
atmos.mcp(
*positionals,
flags = {},
args = [],
working_directory = ...,
env = ...,
output = "stream",
check = True,
)
Subcommands
Pass the subcommand and its positional arguments as strings before the keyword arguments. The call
atmos.mcp("tools", "aws-docs") runs atmos mcp tools aws-docs.
| Subcommand | Purpose |
|---|---|
list | List configured MCP servers. |
status | Show the status of all MCP servers. |
tools | List the tools from an MCP server. |
test | Test connectivity to an MCP server. |
restart | Validate that an MCP server can stop and restart cleanly. |
add | Add an MCP server to mcp.servers in atmos.yaml. |
remove | Remove an MCP server from mcp.servers in atmos.yaml. |
export | Export .mcp.json from the MCP server configuration. |
install | Install configured MCP servers into AI client config files. |
uninstall | Remove installed MCP servers from AI client config files. |
start | Start the Atmos MCP server. |
See the atmos mcp command reference for each subcommand's flags.
Arguments
*positionals(Optional) Strings placed on the command line right after
mcp, in order: the subcommand and its positional arguments, such as a server name. Every value must be a string.flags(Optional) A dictionary of command-line options; see flag translation. A bare key such as
"format"becomes--format. Forstart, the keys"transport","host", and"port"become--transport,--host, and--port. Fortools, the keys"format","columns", and"sort"shape the output.args- (Optional) A list or tuple of strings appended after the flags.
working_directory,env,output,check(Optional) See
atmos.runfor process options and defaults.
Options other than the positionals are keyword-only.
Returns
A result with stdout, stderr, and exit_code. See atmos.run for output and error behavior.
Examples
List the configured servers
servers = atmos.mcp("list", output = "capture")
print(servers.stdout)
Read the tools of a server as JSON
tools = atmos.mcp("tools", "aws-docs", flags = {"format": "json"}, output = "capture")
for tool in json.decode(tools.stdout):
print(tool)
Fail when a server is unreachable
probe = atmos.mcp("test", "aws-docs", output = "capture", check = False)
if probe.exit_code != 0:
fail("The aws-docs MCP server did not respond:\n" + probe.stderr)
Inspection subcommands such as list, status, tools, and test finish on their own and suit scripts. The start
subcommand runs the server until it is stopped, so the script waits at that call until the server exits. Atmos prints
its experimental notice when the script runs MCP commands.
Related
atmos.runruns any Atmos command from an argument list.atmos mcpdocuments the server and each subcommand.- Atmos Automation Language and the script step