# Connect Grok

> **Release status.** The hosted endpoint, OAuth, curated operator tools and the send permission are live. The Masheev plugin for Grok Build is submitted to the [xAI plugin marketplace](https://github.com/xai-org/plugin-marketplace) and in review. On grok.com, add Masheev as a custom connector.

## Grok Build

The Masheev plugin bundles the hosted MCP server with the Masheev skills: building with the chat widget, channels, webhooks and API, and working the inbox, replies and AI agents. Once the marketplace listing is live, install `masheev` from the Grok Build plugin browser. The plugin source is the public [masheev/skills](https://github.com/masheev/skills) repository; it contains no scripts or hooks.

## grok.com

1. Open [grok.com/connectors](https://grok.com/connectors) and choose **New Connector → Custom**.
2. Enter `https://api.masheev.com/api/agents/mcp`.
3. Complete the Masheev sign-in, pick one workspace and the permissions to grant.

On Grok Business and Enterprise, a team admin may need to provision the connector first.

## xAI API

Use the remote MCP tool with a workspace agent key from **Developers → Connect an agent**. Keep the key in your server's secrets.

```python
import os
from openai import OpenAI

client = OpenAI(api_key=os.environ["XAI_API_KEY"], base_url="https://api.x.ai/v1")

response = client.responses.create(
    model="grok-4.7",
    input=[{"role": "user", "content": "List open Masheev conversations that need a human."}],
    tools=[{
        "type": "mcp",
        "server_url": "https://api.masheev.com/api/agents/mcp",
        "server_label": "masheev",
        "authorization": os.environ["MASHEEV_API_TOKEN"],
        "allowed_tools": ["find_conversations", "get_conversation", "list_escalations"],
    }],
)
```

`allowed_tools` keeps context small; without it every tool loads. In the native `xai_sdk`, the same fields are `allowed_tool_names` and `extra_headers`.

## Why sends are still safe

Grok cannot ask you before it calls a tool (`require_approval` is not supported). Masheev therefore enforces review on the server: `draft_reply` only creates a draft, and `confirm_send` sends a single, short-lived draft bound to your user and one conversation. Do not grant the send permission to an unattended API integration unless your application shows the draft to a person before calling `confirm_send`. Billing, irreversible deletes and credentials are unavailable.

See [Connect an agent](https://docs.masheev.com/agents.md) for permissions and revocation.
