# Agentql — how to use (mcp.ai)

Connect your Agentql account and use 3 tools for web scraping straight from your AI agent. Connect with your own API key. AgentQL is a suite of tools designed to connect AI agents to the web, enabling web interaction and structured data extraction through a specialized query language.

## Option A — via MCP (recommended)
Remote MCP endpoint (HTTP, streamable): `https://api.mcp.ai/p_agentql?ms=1787291460000`
Add it as a custom/remote MCP connector in your client (Claude, Cursor, VS Code…), then authenticate when prompted. Once connected, ask the agent to use the server's tools (e.g. `agentql_create_remote_browser_session`).

## Option B — via direct REST API
Base URL: `https://api.mcp.ai/api/agentql`
Auth: `Authorization: Bearer sk_live_…` — create a workspace API key at https://mcp.ai/settings/api-keys
Discover endpoints: `GET https://api.mcp.ai/api/agentql/_endpoints`

### Endpoints
- `POST https://api.mcp.ai/api/agentql/create/remote/browser/session` — Tool to create a remote browser session. Use when you need to run browser automation on remote infrastructure.
  - body: { proxy?: object, browser_profile?: string, browser_ua_preset?: string, inactivity_timeout_seconds?: integer }
- `POST https://api.mcp.ai/api/agentql/get/usage` — Retrieves API usage statistics and subscription limits for the AgentQL account. Returns current billing cycle dates, lifetime usage limits, API key usage counts, and total account usage. Useful for mo
- `POST https://api.mcp.ai/api/agentql/query/data` — Tool to query structured data as JSON from a web page using an AgentQL query or natural language prompt. Use after defining your query or prompt and a URL or HTML.
  - body: { url?: string, html?: string, query?: string, params?: object, prompt?: string }

## Example prompts
- "What can I do in Agentql?"
- "Show me a summary of my Agentql account"

## More
- Page: https://mcp.ai/agentql
- Agent spec (llms.txt): https://mcp.ai/agentql/llms.txt
- Postman collection: https://mcp.ai/agentql/postman.json
