# Set up with Claude Code or another coding agent

> Add the AgentMySite MCP server to your coding agent and let it install the widget, register your domains, index your content and curate tools for an admin panel.

Source: https://agentmysite.com/docs/guides/install/claude-code/

AgentMySite runs a remote [MCP](https://modelcontextprotocol.io) server. Add it to your coding agent once, approve it for one of your sites, and the agent can do the setup for you: paste the embed snippet in the right layout file, register your hostnames, start indexing your pages, and, for an admin panel, propose and import the tools the assistant may call.

Your code never leaves your machine. The agent reads and edits it; our server only answers the agent's questions about your site and performs the actions you approve.

## Add the server

<Steps>

1. In Claude Code, run:

   ```bash
   claude mcp add -t http agentmysite https://mcp.agentmysite.com/mcp
   ```

   Cursor, Windsurf and claude.ai connectors take the same URL (`https://mcp.agentmysite.com/mcp`) wherever they accept a remote MCP server.

2. The agent opens your browser on AgentMySite. Sign in with your email code; a new email creates an account.

3. Pick the site the agent may manage, or create one. Optionally allow `localhost` for up to 24 hours so you can test from a local dev server.

4. Select **Approve**. The browser returns to your agent and the connection is ready.

</Steps>

<Aside type="note">
The approval screen shows who is asking and where your browser will be sent afterwards. For Claude Code that is `localhost`, which is normal. If the screen shows an **Unverified client** badge, approve it only if you started the connection yourself.
</Aside>

## What the agent can do

One connection manages one site. These are the tools it gets:

| Tool | What it does |
|---|---|
| `get_site_context` | Site kind, allowed domains, indexed content, the embed snippet and the recommended next steps |
| `set_site_kind` | Records whether this is a website, an admin panel, a WooCommerce store or a Shopify store |
| `add_allowed_domain` | Registers a permanent hostname the widget may load on |
| `allow_localhost` | Allows `localhost` and `127.0.0.1` for 1 to 24 hours |
| `add_website_source`, `add_sitemap_source` | Index a page or pick pages from your sitemap (preview first, nothing is indexed silently) |
| `get_ingestion_status` | Indexing progress per document |
| `list_tools`, `import_tools` | Review and import tools for an admin panel; imports are a dry run by default and imported tools start disabled |
| `list_unanswered` | Questions visitors asked that the content could not answer |
| `diagnose_install` | Fetches one public page of your site and checks the loader tag, site key and origin |

The agent also gets an install guide per site kind, so a prompt like *"Add AgentMySite to this site"* is enough.

## Admin panels: how authorization works

When the agent sets up tools for an admin panel, the tools run through your own page. A tool call travels from our chat iframe to the host page, and the handler that runs it is your code with the session the signed-in user already has. Cookies are attached by the browser; a bearer token is added by your handler. AgentMySite never holds credentials and adds no authorization of its own, so the assistant can do exactly what that signed-in user can do and nothing more.

Three things to keep in mind:

- **Your backend still authorizes every call.** Tool arguments come from a model and prove nothing.
- **CSRF tokens are your handler's job**, like any other request from your page.
- **What the handler returns goes to the model** and into the tool audit. Return what the user may see on screen, nothing more.

## Local development

`add_allowed_domain` refuses `localhost`: permanent localhost origins would let anyone who copies your public site key use your account from their own machine. Use `allow_localhost` (or the toggle on the approval screen) for a window of up to 24 hours instead. The window closes by itself.

## Review or revoke a connection

Open **Site Settings** for the site. The **Coding agent connections** section lists every approved agent with its scopes and when it was last used. **Revoke** stops the agent's access on its next call. A connection also stops working when the site is deleted.

## For MCP client authors

The server is an OAuth 2.1 resource server. Discovery lives at `https://mcp.agentmysite.com/.well-known/oauth-protected-resource/mcp` and `/.well-known/oauth-authorization-server`. Clients may identify themselves with a Client ID Metadata Document or register dynamically; PKCE (S256) and the `resource` parameter are required, refresh tokens rotate, and loopback redirect URIs match without the port.
