> ## Documentation Index
> Fetch the complete documentation index at: https://developers.mihu.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Mihu MCP Server

> Connect LLM clients to Mihu via the Model Context Protocol

Use this guide to connect the Mihu MCP Server to your client and start using it safely.

* **Endpoint:** `https://mcp.mihu.ai/mcp`
* **Transport:** Streamable HTTP (MCP standard)
* **Health:** [`https://mcp.mihu.ai/health`](https://mcp.mihu.ai/health)

## Before you start

Make sure you have:

* access to the target Mihu tenant (e.g. `your-tenant.mihu.ai`),
* an MCP-compatible client (Claude Desktop, IDE agent, or custom MCP client),
* and a Mihu API token from your tenant panel.

## Access model

Each token is tied to **one Mihu tenant**. The token inherits the panel permissions of the API key it was minted from — your client cannot exceed them. The MCP server itself stores no credentials.

| Property               | Value                                        |
| ---------------------- | -------------------------------------------- |
| Tenant binding         | One token, one tenant subdomain              |
| Permissions            | Inherited from the underlying Mihu API token |
| OAuth access token TTL | 1 hour (re-mint as needed)                   |
| Storage                | In-memory on the server (not persisted)      |

## Connect Mihu MCP Server

There are two ways to authenticate. Pick whichever your client supports.

### Option A — OAuth 2.1 (recommended for Claude Desktop)

```text theme={null}
Authorization Server : https://mcp.mihu.ai
Token URL            : https://mcp.mihu.ai/oauth/token
Grant types          : client_credentials, authorization_code (PKCE)
client_id            : <your tenant subdomain, e.g. "minders">
client_secret        : <your Mihu API token>
```

Claude Desktop discovers the OAuth flow automatically — no manual register step.

In **Settings → Connectors → Add custom connector**:

| Field               | Value                     |
| ------------------- | ------------------------- |
| URL                 | `https://mcp.mihu.ai/mcp` |
| OAuth Client ID     | your tenant subdomain     |
| OAuth Client Secret | your Mihu API token       |

### Option B — Direct headers (for scripts / curl / custom clients)

```text theme={null}
Authorization  : Bearer <Mihu API token>
X-Mihu-Tenant  : <tenant subdomain>
```

No token mint needed; tenant is set per request.

### Mint a token directly

```bash theme={null}
curl -s -X POST https://mcp.mihu.ai/oauth/token \
  -d grant_type=client_credentials \
  -d client_id=<tenant> \
  -d client_secret=<api-token>
# → {"access_token":"...","token_type":"Bearer","expires_in":3600}
```

Then call MCP with `Authorization: Bearer <access_token>`.

## Test the connection

Try a few read-only prompts first:

* "List my agents."
* "How many contacts do we have?"
* "Show conversations from the last 24 hours."

## First setup checks

After you connect, confirm these basics:

* You are connected to the expected tenant.
* Read tools (`list_agents`, `list_contacts`) return data.
* Your panel permissions allow the actions you plan to run.

## What it can do

The server exposes 375 tools across 43 modules. Common capabilities:

| Capability          | Example tools                                                               |
| ------------------- | --------------------------------------------------------------------------- |
| Place real calls    | `initiate_call`, `say_in_call`, `forward_call`, `mute_agent`, `hangup_call` |
| Send SMS / WhatsApp | `send_sms`, `send_whatsapp_template`, `whatsapp_call`                       |
| Manage agents       | `list_agents`, `create_agent`, `add_agent_guideline`, `add_agent_intent`    |
| Bulk outbound       | `create_listing`, `add_contacts_to_listing`, `run_listing`, `stop_listing`  |
| Contacts            | `list_contacts`, `create_contact`, `update_contact`, `add_tag_to_contact`   |
| Appointments        | `book_appointment`, `list_appointments`, `get_available_slots`              |
| Conversations       | `list_conversations`, `get_conversation`, `get_session_evaluation`          |
| Phone numbers       | `search_available_phone_numbers`, `provision_call_channel`                  |

Each tool's description includes required fields, enums, and example shapes — readable by the LLM at call-time, no external docs needed.

## What to include in a prompt

Include these details when relevant:

* **Time range** — "last 7 days", "yesterday", "this month"
* **Target** — an agent, campaign, contact, conversation, or schedule
* **Output** — summary, ranking, comparison, trend, or draft
* **Action boundary** — "prepare only", "show preview", or "do not send"

### Example prompt patterns

**Analysis**

* "Summarize agent performance for the last 7 days."
* "Which campaigns drove the most completed calls last week?"
* "Compare SMS vs WhatsApp delivery rates for the last 14 days."

**Audience and contact investigation**

* "Show recent conversations for contact +90555…"
* "List appointments booked in the last 3 days."
* "Which contacts have the `vip` tag?"

**Operational requests**

* "Initiate a call from agent X to +90555… with greeting 'Hi…'"
* "Create a listing for these 50 leads under agent Y."
* "Stop the active listing named 'Q2 outbound'."

## How write actions work

Write actions follow the underlying Mihu API permissions of the token:

* The token inherits exactly what your API key can do in the panel — nothing more.
* Bulk operations (e.g. `create_listing` with thousands of contacts) are accepted, but the agent's channel binding and tenant rate limits still apply.
* All actions are logged in the standard Mihu request logs for the tenant.

## Troubleshooting

| Symptom                        | First check                                                              |
| ------------------------------ | ------------------------------------------------------------------------ |
| `401` from upstream            | Wrong tenant or wrong/expired API token.                                 |
| `404` from upstream            | Tenant subdomain typo — does `<tenant>.mihu.ai` resolve?                 |
| "Missing tenant context" error | Client didn't send `X-Mihu-Tenant`, or OAuth token expired (1-hour TTL). |
| OAuth token expired            | Re-mint at `/oauth/token`. Default TTL is 1 hour.                        |
| Action blocked by permissions  | Underlying Mihu API key lacks the permission — adjust in the panel.      |
| Cannot access another tenant   | Each token is tied to one tenant. Mint a separate token per tenant.      |

## Support

* **Status / health:** [`https://mcp.mihu.ai/health`](https://mcp.mihu.ai/health) → `{"ok": true}`
* **Issues:** email [support@mihu.ai](mailto:support@mihu.ai)
