Hangar has an MCP server, so an AI agent working on your code can also ship it. From Claude Code, Cursor, VS Code or any client that speaks the Model Context Protocol, the agent can find the service your repository deploys to, deploy it, follow the build, read the logs when something fails, and check metrics and traces once it is live.
The server is hosted by Hangar: there is nothing to install.
Connect your agent
- Add Hangar to your client. For Claude Code:
claude mcp add --transport http --scope user hangar https://tryhangar.io/api/mcp
For Cursor (~/.cursor/mcp.json), VS Code (.vscode/mcp.json) and other clients, Settings → AI agents has the configuration to paste. Any client needs only the URL https://tryhangar.io/api/mcp and the Streamable HTTP transport.
-
Sign in. In Claude Code, run
/mcp, pickhangarand authenticate; other clients ask on their own the first time. Your browser opens Hangar, you choose the organization the agent will act in, and you allow it. -
In your project, ask: "Deploy this to Hangar and check the logs for errors."
Connecting an agent needs the same role as creating API keys: owner or admin, or a custom role with API access.
Without a browser
On a CI runner or a machine where nobody can sign in, use an API key instead: Settings → AI agents → No browser? Use an API key instead creates one and gives the command with the key in it, sent as Authorization: Bearer <your-api-key>.
What the agent can do
| Area | Tools |
|---|---|
| Find things | whoami, list_projects, get_service, find_services_by_repo, list_regions |
| Deploy | deploy_service, wait_for_deployment, list_deployments, get_deployment, get_deployment_logs, cancel_deployment, rollback_service |
| Run | start_service, stop_service, restart_service |
| Observe | get_service_logs, get_service_metrics, get_traffic, list_requests, get_trace |
| Configure | get_env, set_env, add_domain, remove_domain, get_database_connection, connect_database |
| Create | create_project, create_environment, create_app_from_github, create_database |
| Local code | prepare_upload |
The agent finds the service for the code in front of it with find_services_by_repo, passing the repository's Git remote. A service built from GitHub, GitLab, Bitbucket, Gitea or a Git URL is matched by its repository.
Deploying
A service deploys from its branch, so the agent commits and pushes before calling deploy_service. If the service deploys on every push, the push already started a deployment and the agent follows that one instead. wait_for_deployment returns once the build finishes, with the end of the build log when it failed.
rollback_service puts an application back on the image of an earlier deployment without rebuilding, when rollbacks are enabled on it.
Observing
get_service_logs reads the service's log history with a text search and a minimum level, so "errors in the last hour" is one call. list_requests lists the requests the service handled, with status and duration, and get_trace opens one of them as a tree of spans across your services, with exception messages, database statements and the log lines written under each span. See Observability for how traces are collected.
Security
- The agent acts as you. Every call runs with your role and project permissions in the organization you chose for it, and appears in the audit log as yours, marked with the agent and the tool it used.
- You approve every agent. Hangar always shows who is asking and where it will send you back before an agent gets access. Its access lasts an hour at a time and renews while you keep using it, for up to 30 days without use.
- Secrets stay hidden by default.
get_envandget_database_connectionmask values unless the agent asks to reveal them.connect_databasewrites a database's connection URL, password included, into an app's variables on Hangar's side, so the password never passes through the conversation. - Nothing is deleted. The agent can stop services and remove domains, but it cannot delete services, databases or volumes.
- Agents are rate limited. An agent can make 120 calls a minute, and a person 300 across all their agents. Past that, Hangar answers with HTTP 429 and how many seconds to wait.
- Upload links are short-lived. A link from
prepare_uploaddeploys one application, once, within 10 minutes.
Disconnect an agent in Settings → AI agents, or revoke its key in Profile → API/CLI Keys.