# API & MCP

ClearFeed provides two programmatic ways to manage requests: the **REST API** for direct integration and the **MCP server** for AI agent workflows.

***

## REST API

ClearFeed's REST API provides comprehensive access to create, search, update, and analyze requests. Build custom integrations, automate workflows, and connect ClearFeed to your existing tools.

### What You Can Do

| Area              | Capabilities                                        |
| ----------------- | --------------------------------------------------- |
| **Requests**      | Create, search, update, post messages, close        |
| **Insights**      | Query response times, SLA metrics, team performance |
| **Customers**     | Look up and update customer information             |
| **Collections**   | List collections, add channels                      |
| **Custom Fields** | List, create, update, delete custom fields          |

### Getting Started

1. Generate a **Personal Access Token** from **Settings → Developer Settings**
2. Use the token in the `Authorization: Bearer` header for all API requests
3. See [Developer Settings](https://docs.clearfeed.ai/clearfeed-help-center/account-setup/developer-settings) for authentication details

**Full API Reference:** [ClearFeed API Documentation](https://docs.clearfeed.ai/api/reference)

***

## MCP Server

The **MCP (Model Context Protocol) server** exposes ClearFeed's REST APIs as tools for AI agents. This enables AI assistants like Claude, Cursor, and Codex to work with ClearFeed data directly.

### What You Can Do

| Area                | Example prompts for AI agents                             |
| ------------------- | --------------------------------------------------------- |
| **Search requests** | "Find all high-priority requests from the last week"      |
| **Summarize**       | "Summarize the open requests assigned to me"              |
| **Update requests** | "Mark request CF-1234 as in progress and assign to @john" |
| **Post updates**    | "Reply to request CF-5678 saying we're investigating"     |
| **Look up details** | "Show me the customer info for request CF-9012"           |
| **Analytics**       | "What's our average response time this month?"            |
| **Link tickets**    | "Link the Jira ticket PROJ-123 to request CF-4567"        |

### Available Tools

| Category    | Tools                                                                                                             |
| ----------- | ----------------------------------------------------------------------------------------------------------------- |
| Requests    | `requests_search`, `requests_list`, `requests_get`, `requests_create`, `requests_update`, `requests_post_message` |
| Customers   | `customers_list`, `customers_search`, `customers_get`, `customers_create`, `customers_update`                     |
| Collections | `collections_list`, `collections_add_channels`                                                                    |
| Tickets     | `tickets_get_form`, `tickets_link`                                                                                |
| Insights    | `insights_query`                                                                                                  |
| Other       | Channels, Custom Fields, Teams, Users                                                                             |

### Getting Started

1. Clone the [ClearFeed MCP repository](https://github.com/clearfeed/clearfeed-mcp)
2. Set `CLEARFEED_API_BASE_URL` and `CLEARFEED_API_TOKEN` environment variables
3. Configure your MCP client (Claude Code, Cursor, etc.) to use the server

**Full Documentation:** [MCP Server Setup](https://docs.clearfeed.ai/api/quick-start/mcp-server)

***

## FAQs

1. **How do I get my API token?**\
   **Answer:** Navigate to **Settings → Developer Settings** and click **Generate Token**. See [Developer Settings](https://docs.clearfeed.ai/clearfeed-help-center/account-setup/developer-settings).
2. **What's the difference between REST API and MCP?**\
   **Answer:** REST API is for direct HTTP-based integration. MCP server wraps the REST API as tools for AI agents to use via the Model Context Protocol.
3. **Are webhooks available for real-time updates?**\
   **Answer:** Yes, configure webhooks in **Settings → Developer Settings → Events API Subscription**.
