# Moesif MCP for AI Agents AI Agent Connect

> Moesif MCP lets you monitor and analyze your API traffic directly through your AI agent. Log requests, track user profiles with custom metadata like MRR, and run complex analytics queries using Elasticsearch filters. It's the fastest way to see how your customers are actually using your API without switching tabs.

## Overview
- **Category:** developer-tools
- **Price:** Free
- **Endpoint:** https://edge.vinkius.com/vk_preview_HdtyUX6SdDSjf9uGNbgYuUsMFDarSP5IcfAYPYIa/ai-agent-connect
- **Tags:** api-monitoring, api-analytics, elasticsearch-dsl, user-tracking, debugging

## Description

This Connector connects Moesif to your AI agent so you can see exactly what's happening in your API ecosystem. You can log single or batch API calls in real time, update user profiles with custom metadata, and run deep searches using Elasticsearch DSL. It turns your conversation into a live analytics window. It's a core part of the Vinkius ecosystem, making it easy to plug into your existing workflow. Instead of manually hunting for data, you get direct answers on API health, usage trends, and customer behavior. You can identify why a specific customer's calls are failing or see how many people on a specific plan hit their rate limits without leaving your chat. It removes the need to jump between multiple dashboards and manual filters, putting your API data right where you're already working.

## Tools

### log_events_batch
Send a group of API calls to Moesif in one go. This is the best way to log multiple events without making extra requests.

### search_events
Query your historical API data using Elasticsearch DSL. You can filter by status codes, endpoints, or any other custom metadata.

### count_events
Get the total number of events that match your filter criteria. This helps you quickly see how often specific actions occur.

### log_event
Send a single API request and response to the Moesif Collector. It's great for recording specific actions as they happen.

### update_company
Update a company profile in Moesif with custom information. You can sync things like MRR or plan types directly.

### update_user
Update a specific user's profile with custom metadata. It makes it easy to link API usage to specific customer details.

## Prompt Examples

**Prompt:** 
```
Show me the last 5 requests to the /v1/auth endpoint.
```

**Response:** 
```
Here are the 5 most recent requests to the `/v1/auth` endpoint:

| Timestamp | Method | Status | Endpoint |
| :--- | :--- | :--- | :--- |
| 2023-10-27 10:01:05 | POST | 200 | /v1/auth |
| 2023-10-27 10:00:58 | POST | 200 | /v1/auth |
| 2023-10-27 10:00:42 | POST | 401 | /v1/auth |
| 2023-10-27 10:00:30 | POST | 200 | /v1/auth |
| 2023-10-27 09:59:15 | POST | 200 | /v1/auth |
```

**Prompt:** 
```
How many users hit a 429 rate limit in the last hour?
```

**Response:** 
```
I've checked the logs for the last hour. There were **12 instances** of 429 rate limit errors. Most of these occurred on the `/v1/data` endpoint.
```

**Prompt:** 
```
Update the company 'Acme Corp' to the Enterprise plan.
```

**Response:** 
```
I've updated the profile for **Acme Corp**. The metadata now includes the **Enterprise** plan status.
```

## Capabilities

### Log API calls
Send single or batch requests to Moesif for real-time monitoring.

### Update customer profiles
Keep user and company metadata current with custom fields.

### Run complex searches
Use Elasticsearch DSL to find specific events based on filters.

### Count specific events
Get totals for specific API behaviors or error codes.

### Filter by time range
Query historical data for specific windows like the last 24 hours.

## Use Cases

### Debugging a production spike
A developer notices a spike in 500 errors and asks the agent to find the last 10 failed requests to a specific endpoint using search_events.

### Calculating MRR impact
A product manager asks how many users on the Pro plan made over 10,000 calls this month to gauge value.

### Identifying churn risks
A success lead asks to find users who haven't made any API calls in the last 30 days to proactively reach out.

### Rapid metadata updates
A script uses the agent to update company plan types across hundreds of profiles simultaneously using update_company.

## Benefits

- Stop switching tabs by querying Moesif logs directly in your AI client.
- Get instant answers on error rates using count_events without building a new dashboard.
- Keep your customer data fresh by using update_user and update_company to sync metadata.
- Perform deep-dive audits on specific endpoints using search_events and Elasticsearch DSL.
- Identify at-risk customers faster by filtering logs for 401 or 429 error codes.
- Track plan-specific usage by linking API calls to custom metadata like MRR.

## How It Works

The bottom line is you get a live feed of your API traffic directly inside your AI client.

1. Subscribe to the Moesif MCP on Vinkius.
2. Provide your Moesif Application ID and Management API Key.
3. Ask your agent to fetch logs, update users, or run analytics.

## Frequently Asked Questions

**Can I use Moesif to see my API errors?**
Yes, this Connector allows your agent to pull live logs and filter for specific error codes like 401 or 500, helping you identify issues instantly.

**How do I track which customers are on which plan?**
You can use the update tools to sync customer metadata. Once updated, your agent can query usage trends based on specific plan types.

**Can I search for logs from last month?**
Yes, the Connector supports time-series queries. You can ask your agent to look back at specific windows, like the last 30 days or a specific date range.

**Does this work with my existing Moesif account?**
Yes, you just need to provide your Moesif Application ID and Management API Key in the setup to connect your live data to your AI client.

**Can I count specific types of API calls?**
Absolutely. You can ask your agent to count how many times a specific endpoint was hit or how many times a certain action occurred using filters.

**How can I search for specific API errors from the last 24 hours?**
You can use the `search_events` tool. Provide a `query_body` with a filter for status codes (e.g., 500) and set the `from` parameter to '-24h'.

**Can I update a customer's subscription status in Moesif using this server?**
Yes! Use the `update_company` tool with the `company_id` and include the subscription details in the `metadata` JSON object.

**Is there a limit to how many events I can log at once?**
The `log_events_batch` tool supports batching. Moesif generally allows up to 1MB per event and a total batch size of 50MB.