Moesif MCP Server
The Moesif Model Context Protocol (MCP) server lets AI assistants like Claude Code query and act on your Moesif data using natural language. Instead of navigating dashboards in Moesif Portal, you can ask Claude to explore your API traffic, build charts, and manage dashboards on your behalf.
After you connect to the Moesif MCP server, you can use tools like Claude for tasks such as the following:
- Explore your API events and search across fields for information about endpoints, status codes, and latency.
- Create, preview, and save workspaces like time series, bar charts, and funnels.
- List, view, and update your dashboards.
This guide walks through adding the Moesif MCP server to Claude Code and trying it out with a few sample prompts.
Prerequisites
- Node.js 18 or later.
-
The Claude Code CLI. Follow the official instructions to install it and confirm it’s working:
claude --versionIf you have trouble installing Claude Code on your platform, see Claude Code’s setup documentation.
- A Moesif account with access to the organization and application you want to query.
Choose an Authentication Method
The Moesif MCP server supports two ways to authenticate:
- OAuth
- You sign in to Moesif in a browser and approve access. Choose this method if you want to pick the organization, application, and access level interactively.
- API key
- You use a Moesif Management API key in a request header. Choose this method if you don’t want to use OAuth, or if you want to control access with Management API key scopes.
Follow the relevant section for your chosen authentication method. Then continue to Verify the Connection.
Connect with OAuth
To connect Claude Code to Moesif using OAuth, follow these steps:
-
Register Moesif as an MCP server in Claude Code:
claude mcp add --transport http moesif https://api.moesif.com/mcp -
Run the login command to authorize Claude Code to access your Moesif data:
claude mcp login moesifThis command opens a browser window.
- Sign in to Moesif.
- In Organization and Application, select the organization and application you want Claude to use. Claude can access only the application you select.
- In Access Level, select Read-only or Read + write. For details, see OAuth Access Levels.
- Select Approve to finish connecting.
The Authorize access screen shows the organization and application selectors, the access level options, and the permissions that Claude receives:

Tip: If your session expires, reconnect with claude mcp login moesif. To disconnect Moesif entirely and clear the stored credentials, run claude mcp logout moesif.
Connect with an API Key
With API key authentication, you include your Moesif credentials as HTTP headers when you register the MCP server. You need the following credentials:
- Management API key (required)
- Authorizes Claude Code to read and act on your Moesif data. The key’s scopes control what Claude can do.
- Collector Application ID (optional)
- Lets Claude Code call the Moesif Collector API, for example to send events. Skip it if you only need to query and manage your data.
Generate a Management API Key
To generate a Management API key, follow these steps:
- In Moesif Portal, select the account icon to bring up the settings menu.
- Select API Keys.
-
In the Management API Key section, open the Scope Presets list and select Moesif MCP Server. The preset selects the scopes for the MCP server:
![Scope Presets list in the Management API Key section with the Moesif MCP Server preset highlighted above the scope checkboxes]()
- Optionally, adjust individual scopes. For example, clear the Create, Update, and Delete scopes to limit Claude to reading your data.
- Optionally, set the key’s expiration time.
- At the bottom of the screen, select Generate Token.
- Copy the generated key.
Get Your Collector Application ID
If you don’t need to send events to Moesif, skip this section.
Moesif provides two application IDs. Use the Collector Application ID. You can also use the Publishable Collector Application ID. But that results in some tools failing, such as moesif_collector_config, moesif_diagnose_governance_rule, and sending subscriptions with moesif_send_entity.
To get your Collector Application ID, follow these steps:
- In Moesif Portal, select the account icon to bring up the settings menu.
- Select API Keys.
- In the Collector Application Id section, find the Your Collector Application Id field.
- Select the copy button next to the field.
The Your Collector Application Id field has a copy button on its right:

Add the Moesif MCP Server
Run the following command to register Moesif as an MCP server in Claude Code. Replace <MANAGEMENT_API_KEY> with your Management API key:
claude mcp add --transport http moesif https://api.moesif.com/mcp \
--header "Authorization: Bearer <MANAGEMENT_API_KEY>"
To send events, run the following command instead. It adds the X-Moesif-Application-Id header. Replace <APPLICATION_ID> with your Collector Application ID:
claude mcp add --transport http moesif https://api.moesif.com/mcp \
--header "Authorization: Bearer <MANAGEMENT_API_KEY>" \
--header "X-Moesif-Application-Id: <APPLICATION_ID>"
Some MCP clients don’t let you add a header named X-Moesif-Application-Id. For example, when you add Moesif as a custom connector in the Claude web app, you can choose only from a fixed list of header names. In those cases, send your Collector Application ID in the X-API-Key header instead. The following example shows the header in a Claude Code command:
claude mcp add --transport http moesif https://api.moesif.com/mcp \
--header "Authorization: Bearer <MANAGEMENT_API_KEY>" \
--header "X-API-Key: <APPLICATION_ID>"
Note: These instructions use Claude Code. You can use the same server URL and headers with any MCP client that supports HTTP transport and custom request headers.
Verify the Connection
Run the following command to check the connection:
claude mcp list # moesif → ✓ connected
Start Claude Code with claude. Then run /mcp inside a session to see the available Moesif tools.
To confirm everything’s working, start a claude session and ask the following:
Run moesif whoami and tell me which org and app I'm connected to.
Try It Out
After you connect, type prompts like these in a claude session.
Explore Your Data
- What API traffic did we get in the last 24 hours? Break it down by endpoint and status code.
- Which fields are available on my events for filtering? Show me the most useful ones.
Create a Workspace Chart
- Create a workspace chart showing 4xx and 5xx errors per day over the last 30 days, grouped by status code. Name it “Error Rate by Status”.
- Create a workspace showing the top 10 endpoints by request volume for the last 7 days, as a bar chart.
- Preview a chart of P95 latency by endpoint over the last 7 days before saving it, then save it as “Latency p95 by Endpoint”.
Work with Dashboards
- List my dashboards, then add the “Error Rate by Status” workspace to the API Health dashboard.
- Show me the charts on my API Health dashboard and explain what each one measures.
Access Levels and Permissions
What Claude can do through the Moesif MCP server depends on how you authenticate.
OAuth Access Levels
The access level you choose during OAuth authentication controls what Claude can do:
- Read-only
- Claude can explore events and view workspaces and dashboards. Claude can’t create or change anything.
- Read + write
- In addition to read-only access, Claude can create and save workspaces, create or update dashboards, and send events.
To change the organization, application, or access level, run claude mcp logout moesif. Then run claude mcp login moesif again.
API Key Scopes
With API key authentication, the scopes of your Management API key control what Claude can do. For example, Claude needs write scopes for workspaces and dashboards to create or update them.
To change the scopes, generate a Management API key with the scopes you need. Then remove the server with claude mcp remove moesif and add it again with the new key.
Troubleshooting
claude mcp listdoesn’t show Moesif as connected- If you use OAuth, your session might have expired. Run
claude mcp login moesifto reauthenticate. If you use an API key, check that the key hasn’t expired and that theAuthorizationheader contains the full key. - Claude can’t see the organization or application you expect
- Confirm your Moesif account has access to that organization and application. For details, see Apps and Team.
- If you use OAuth, log out and back in. If you use an API key, the key works only for the application you generated it in. Generate a new key from the API Keys page of the application you want. Then remove the server with
claude mcp remove moesifand add it again with the new key. - Claude says it can’t create or save a workspace
- If you use OAuth, you likely authenticated with read-only access. Log out and back in. Then select Read + write. If you use an API key, generate a key with write scopes for workspaces and dashboards.
