AI Agents
The MCP server exposes the full GTL toolset: create worktrees, allocate resources, wire up cross-repo dependencies, and control the dev server. AI agents work with real allocations instead of guessing.
Your AI agent creates a worktree and tries to start the server. It doesn't know about port allocation, database cloning, or env files.
agent $ git worktree add ../fix-bug fix-bug
agent $ cd ../fix-bug && npm start
Error: EADDRINUSE :::3000
# Agent tries a random port...
agent $ PORT=4567 npm start
Warning: DATABASE_URL not set
# Agent guesses at database names...
agent $ createdb fix_bug_dev
# Works sometimes. Breaks often.
The new tool creates the worktree, allocates ports, clones the database, writes the env file, and returns structured JSON with everything the agent needs.
tool: new args: branch: fix-auth-bug base: main
{
"worktree": "/code/myapp-fix-auth",
"branch": "fix-auth-bug",
"ports": [3010],
"database": "myapp_dev_fix_auth",
"url": "https://myapp-fix-auth-bug.prt.dev"
}
The declarative config and a git hook (installed by gtl install) do the heavy lifting. The MCP server is how agents execute provisioning and stay informed about what's running.
The new and setup tools create worktrees with allocated ports, cloned databases, and resolved env files. One tool call, complete environment.
The link tool overrides resolution so {resolve:api} points to a specific branch. env_sync and restart apply the change.
Each worktree stays isolated: its own ports, database name, and supervisor socket. An orchestrator running three agents in parallel reads deterministic state via status or list.
Three lines in your editor config
{
"mcpServers": {
"gtl": {
"command": "gtl",
"args": ["mcp"]
}
}
}
The agent can call new, setup, link, start, and status as structured tool calls. No shell commands, no output parsing.
Query, provision, link, and control. Everything the CLI can do, agents can do via MCP.
Create worktrees, allocate resources, and manage configuration. These are the heavy lifters.
Read allocation state, configuration, routing URLs, and cross-service resolution.
Start, stop, and restart the dev server. Restart re-evaluates env including resolve links.
For agents that can run shell commands but don't support MCP, use --json on any read command:
gtl status --jsongtl routes --jsongtl doctor --jsongtl env --jsongtl resolve <project> --json
MCP is the preferred interface (native tool calls, no parsing), but --json works for any agent that can run commands.
Add the MCP config to your editor. Agents can then provision worktrees, manage links, and control the dev server.
{
"mcpServers": {
"gtl": {
"command": "gtl",
"args": ["mcp"]
}
}
}