# PromptHub — how to use (mcp.ai)

Connect your PromptHub account and use 4 tools for artificial intelligence straight from your AI agent. Connect with your own API key. PromptHub provides versioned prompt management, retrieval, and execution through its API.

## Option A — via MCP (recommended)
Remote MCP endpoint (HTTP, streamable): `https://api.mcp.ai/p_prompt_hub?ms=1787291400000`
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. `prompt_hub_get_current_team`).

## Option B — via direct REST API
Base URL: `https://api.mcp.ai/api/prompt_hub`
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/prompt_hub/_endpoints`

### Endpoints
- `POST https://api.mcp.ai/api/prompt_hub/get/current/team` — Return the current PromptHub team ID for the connected account. Use it when a team-scoped operation must target an explicit team.
- `POST https://api.mcp.ai/api/prompt_hub/get/project/head` — Retrieve a project's latest committed prompt and model configuration, with optional branch and variable resolution.
  - body: { branch?: string, variables?: object, project_id: integer, use_fallback_defaults?: boolean }
- `POST https://api.mcp.ai/api/prompt_hub/list/projects` — List projects in a PromptHub team, optionally filtered by group, model, or provider.
  - body: { group?: string, model?: string, team_id?: integer, provider?: string }
- `POST https://api.mcp.ai/api/prompt_hub/run/project` — Execute a committed PromptHub project prompt with optional variables and return the generated text, usage, cost, and timing metadata. This invokes the configured LLM, consumes the PromptHub plan's LLM
  - body: { hash?: string, branch?: string, variables?: object, project_id: integer }

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

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