CONNECT APP
Build with Grafana
Data Analytics
- API key
MCP
Give your agent Grafana tools
Every Grafana action is exposed as an MCP tool on Pipedream's remote server. Point a client at it with your end user's ID and Connect resolves that user's Grafana account for each tool call — you store no tokens.
// accessToken: mint a short-lived token with the Connect SDK — see the MCP guide
const transport = new StreamableHTTPClientTransport(
new URL("https://remote.mcp.pipedream.net/v3"),
{
requestInit: {
headers: {
Authorization: `Bearer ${accessToken}`,
"x-pd-project-id": "{project_id}",
"x-pd-environment": "production",
"x-pd-external-user-id": "{external_user_id}", // any stable ID for this user in your system
"x-pd-app-slug": "grafana",
},
},
},
)
const mcp = new Client({ name: "my-agent", version: "1.0.0" })
await mcp.connect(transport)
const { tools } = await mcp.listTools()
// e.g. run Create Annotation:
const result = await mcp.callTool({
name: "grafana-create-annotation",
arguments: {
text: "Text",
dashboardUid: "Dashboard UID",
},
})# access_token: mint a short-lived token with the Connect SDK — see the MCP guide
headers = {
"Authorization": f"Bearer {access_token}",
"x-pd-project-id": "{project_id}",
"x-pd-environment": "production",
"x-pd-external-user-id": "{external_user_id}", # any stable ID for this user in your system
"x-pd-app-slug": "grafana",
}
async with streamablehttp_client("https://remote.mcp.pipedream.net/v3", headers=headers) as (read, write, _):
async with ClientSession(read, write) as session:
await session.initialize()
tools = await session.list_tools()
# e.g. run Create Annotation:
result = await session.call_tool("grafana-create-annotation", {
"text": "Text",
"dashboardUid": "Dashboard UID",
})API PROXY
Call the Grafana API directly
For an endpoint with no pre-built tool, the Connect proxy forwards your request to the Grafana API with the connected user's credentials attached. You store no tokens and write no refresh logic.
const resp = await pd.proxy.get({
externalUserId: "{external_user_id}", // any stable ID for this user in your system
accountId: "apn_xxxxxxx",
url: "https://api.example.com/v1/me",
})
// Any allowed Grafana endpoint works here. Pipedream attaches the
// connected account's credentials to the outgoing request.# The path segment is the target URL, URL-safe base64 encoded:
# https://api.example.com/v1/me
curl "https://api.pipedream.com/v1/connect/{project_id}/proxy/aHR0cHM6Ly9hcGkuZXhhbXBsZS5jb20vdjEvbWU?external_user_id={external_user_id}&account_id=apn_xxxxxxx" \
-H "Authorization: Bearer {access_token}" \
-H "x-pd-environment: production"SDK
Run Grafana actions from your backend
Connect a user's Grafana account once, then run Create Annotation on their behalf from your own code — TypeScript, Python, or plain HTTP.
import { PipedreamClient } from "@pipedream/sdk"
const pd = new PipedreamClient({
projectId: process.env.PIPEDREAM_PROJECT_ID!,
clientId: process.env.PIPEDREAM_CLIENT_ID!,
clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
projectEnvironment: "production",
})
const result = await pd.actions.run({
id: "grafana-create-annotation",
externalUserId: "{external_user_id}", // any stable ID for this user in your system
configuredProps: {
grafana: { authProvisionId: "apn_xxxxxxx" },
text: "Text",
dashboardUid: "Dashboard UID",
},
})from pipedream import Pipedream
pd = Pipedream(
client_id="{oauth_client_id}",
client_secret="{oauth_client_secret}",
project_id="{project_id}",
project_environment="production",
)
result = pd.actions.run(
id="grafana-create-annotation",
external_user_id="{external_user_id}", # any stable ID for this user in your system
configured_props={
"grafana": {"authProvisionId": "apn_xxxxxxx"},
"text": "Text",
"dashboardUid": "Dashboard UID",
},
)curl -X POST https://api.pipedream.com/v1/connect/{project_id}/actions/run \
-H "Content-Type: application/json" \
-H "X-PD-Environment: production" \
-H "Authorization: Bearer {access_token}" \
-d '{
"external_user_id": "{external_user_id}",
"id": "grafana-create-annotation",
"configured_props": {
"grafana": { "authProvisionId": "apn_xxxxxxx" },
"text": "Text",
"dashboardUid": "Dashboard UID"
}
}'TOOLS
Grafana actions
On-demand operations your product or agent can configure and run on behalf of a connected user.
-
Create Annotation
actionCreate an annotation on a dashboard or globally. Annotations mark events like deployments, incidents, or configuration changes on dashboard timelines. Use Search Dashboards to find the dashboard UID. OmitdashboardUidfor a global annotation visible on all dashboards. UsetimeandtimeEndfor range annotations (e.g., deployment window).Writev0.0.3 -
Delete Dashboard
actionPermanently delete a Grafana dashboard by UID. This cannot be undone. Use Search Dashboards to find the dashboard UID.Writev0.0.3 -
Get Current User
actionGet the current authenticated Grafana user's identity, including user ID, name, email, organization, and role. Use this to understand the user's permissions and organizational context. The user ID and org context may be needed when creating dashboards or filtering resources.Read-onlyv0.0.3 -
Get Dashboard
actionGet the full dashboard model by UID, including all panels, their queries, variables, and configuration. Use Search Dashboards first to find the dashboard UID. The returned model can be modified and saved back with Save Dashboard.Read-onlyv0.0.3 -
List Alert Rules
actionList all alert rules with their current state (firing, normal, pending, inactive). Returns rule definitions including conditions, labels, and annotations. Use this to answer questions like 'what alerts are firing?' or 'what alerts exist for service X?'Read-onlyv0.0.3 -
List Data Sources
actionList all configured data sources (Prometheus, Loki, InfluxDB, MySQL, etc.), their types, and UIDs. Use the data source UID with Query Data Source to execute queries. Thetypefield indicates what query language to use (e.g.,prometheus→ PromQL,loki→ LogQL,mysql→ SQL).Read-onlyv0.0.3 -
List Folders
actionList all dashboard folders. Folders organize dashboards into logical groups. Use folder UIDs with Search Dashboards to filter by folder, or with Save Dashboard to place a dashboard in a specific folder.Read-onlyv0.0.3 -
Query Data Source
actionExecute a query against any configured data source. Use List Data Sources first to discover available data sources and their UIDs. The query language depends on the data source type:
Prometheus (PromQL):
rate(http_requests_total[5m]),sum by (status_code) (rate(http_requests_total[5m]))Loki (LogQL):
{app="myapp"} |= "error",rate({app="myapp"}[5m])Note: This tool uses the
exprquery field, which works with Prometheus and Loki. For SQL-based data sources (MySQL, Postgres) or InfluxDB, the query field name differs and may not work with this tool.Time range defaults to last 1 hour. Use
fromandtofor custom ranges (supports relative:now-24h,now-7d, or epoch milliseconds).Read-onlyv0.0.3 -
Save Dashboard
actionCreate or update a Grafana dashboard. This is an upsert operation — if the dashboard UID exists, it updates; otherwise it creates. Use Get Dashboard to retrieve an existing dashboard model before modifying it. Use List Folders to find the target folder UID. Passoverwrite: trueto force-save over version conflicts. See the documentationWritev0.0.3 -
Search Dashboards
actionSearch for dashboards by title, tag, or folder. Returns dashboard UIDs, titles, URLs, tags, and folder info. Use the UID with Get Dashboard to retrieve the full dashboard model. Use List Folders to discover folder UIDs for filtering.Read-onlyv0.0.3
EVENTS
Grafana triggers
Event sources your backend can deploy for users and receive through a webhook.
No Grafana triggers are available yet.
MULTI-APP
Use Grafana with other popular apps
Most products don't stop at one integration. Pair Grafana with the other apps your users rely on, and ship use cases that span both.
- App slug
- grafana
- Authentication
- API key
- Categories
- Data Analytics
- Actions
- 10
- Triggers
- 0
- API proxy
- Available