Grafana UI MCP Server logo

Grafana UI MCP Server

Organization
grafana

An mcp server to allow LLMS gain context about grafana-ui component structure, usage and installation

Publishergrafana
Repositorygrafana-ui-mcp-server
LanguageTypeScript
Forks
3
Stars
8
Available tools
0
Transport typestdio
Categories
LicenseMIT
Links
  • Connect tools to AI workflows

    Grafana UI MCP Server exposes MCP capabilities that can be used by compatible AI clients and agents.

  • 0 available tools

    Browse the callable actions below, including names and descriptions when provided by the server.

  • Ready-to-copy setup

    Use the installation snippets to configure this server in your preferred MCP client.

  • Open source signals

    8 stars and 3 forks from the linked repository.

Grafana UI MCP Server

npm version License: MIT

A Model Context Protocol (MCP) server that provides AI assistants with comprehensive access to Grafana UI components, documentation, stories, and design system tokens. This server enables AI tools like Claude Desktop, Continue.dev, and other MCP-compatible clients to retrieve and work with Grafana's React component library seamlessly.

๐Ÿš€ Key Features

  • Complete Component Access: Get the latest Grafana UI component TypeScript source code
  • Rich Documentation: Access comprehensive MDX documentation with usage guidelines
  • Interactive Stories: Retrieve Storybook stories with interactive examples and controls
  • Test Files: Access test files showing real usage patterns and edge cases
  • Design System Integration: Get Grafana's design tokens (colors, typography, spacing, shadows)
  • Dependency Analysis: Understand component relationships and dependency trees
  • Advanced Search: Search components by name and documentation content
  • GitHub API Integration: Efficient caching and intelligent rate limit handling

๐Ÿ› ๏ธ Unified Tool Interface

This MCP server provides a single unified tool called grafana_ui that consolidates all functionality through action-based routing. This reduces complexity and makes it easier for AI agents to understand and use.

๐ŸŽฏ The grafana_ui Tool

All operations are performed through one tool with an action parameter:

typescript
{
  "tool": "grafana_ui",
  "arguments": {
    "action": "get_component",
    "componentName": "Button"
  }
}

๐Ÿ“‹ Available Actions (11 Total)

Core Component Actions:

  • get_component - Get TypeScript source code for any Grafana UI component
  • get_demo - Get Storybook demo files showing component usage
  • list_components - List all available Grafana UI components
  • get_metadata - Get component props, exports, and metadata
  • get_directory - Browse the Grafana UI repository structure

Advanced Grafana Actions:

  • get_documentation - Get rich MDX documentation with sections and examples
  • get_stories - Get parsed Storybook stories with interactive controls
  • get_tests - Get test files showing usage patterns and edge cases
  • search - Search components by name and optionally by documentation content
  • get_theme_tokens - Get Grafana design system tokens (colors, typography, spacing, etc.)
  • get_dependencies - Get component dependency tree analysis (shallow or deep)

โœจ Benefits of the Unified Tool

  • Simplified Integration: Only one tool to configure in MCP clients
  • Easier for AI Agents: Reduced cognitive load with single entry point
  • Better Context Management: All functionality accessible through one interface
  • Parameter Validation: Comprehensive validation based on action type
  • Future-Proof: Easy to add new actions without breaking changes

๐Ÿ”„ Migration from Previous Versions

Breaking Change: Version 2.0+ uses a unified tool interface. If you were using individual tools like get_component, list_components, etc., you now need to use the grafana_ui tool with an action parameter.

Before (v1.x):

typescript
{ "tool": "get_component", "arguments": { "componentName": "Button" } }

After (v2.0+):

typescript
{ "tool": "grafana_ui", "arguments": { "action": "get_component", "componentName": "Button" } }

All functionality remains the same - only the interface has changed.

๐Ÿ“ฆ Quick Start

โšก Using npx (Recommended)

The fastest way to get started - no installation required!

bash
# Basic usage (rate limited to 60 requests/hour)
npx @shelldandy/grafana-ui-mcp-server

# With GitHub token for better rate limits (5000 requests/hour)
npx @shelldandy/grafana-ui-mcp-server --github-api-key ghp_your_token_here

# Short form
npx @shelldandy/grafana-ui-mcp-server -g ghp_your_token_here

# Using environment variable (either option works)
export GITHUB_PERSONAL_ACCESS_TOKEN=ghp_your_token_here
npx @shelldandy/grafana-ui-mcp-server

# Or using the common GITHUB_TOKEN variable
export GITHUB_TOKEN=ghp_your_token_here
npx @shelldandy/grafana-ui-mcp-server

๐ŸŽฏ Try it now: Run npx @shelldandy/grafana-ui-mcp-server --help to see all options!

๐Ÿ”ง Command Line Options

bash
grafana-ui-mcp [options]

Options:
  --github-api-key, -g <token>     GitHub Personal Access Token
  --grafana-repo-path, -l <path>   Path to local Grafana repository (takes precedence)
  --help, -h                       Show help message
  --version, -v                    Show version information

Environment Variables:
  GITHUB_PERSONAL_ACCESS_TOKEN     Alternative way to provide GitHub token
  GITHUB_TOKEN                     Alternative way to provide GitHub token
  GRAFANA_REPO_PATH               Path to local Grafana repository

Examples:
  npx @shelldandy/grafana-ui-mcp-server --help
  npx @shelldandy/grafana-ui-mcp-server --version
  npx @shelldandy/grafana-ui-mcp-server -g ghp_1234567890abcdef
  npx @shelldandy/grafana-ui-mcp-server --grafana-repo-path /path/to/grafana
  npx @shelldandy/grafana-ui-mcp-server -l /path/to/grafana
  GITHUB_PERSONAL_ACCESS_TOKEN=ghp_token npx @shelldandy/grafana-ui-mcp-server
  GITHUB_TOKEN=ghp_token npx @shelldandy/grafana-ui-mcp-server
  GRAFANA_REPO_PATH=/path/to/grafana npx @shelldandy/grafana-ui-mcp-server

๐Ÿ”‘ GitHub API Token Setup

Why do you need a token?

  • Without token: Limited to 60 API requests per hour
  • With token: Up to 5,000 requests per hour
  • Better reliability and faster responses
  • Access to the complete Grafana UI component library

๐Ÿ“ Getting Your Token (2 minutes)

  1. Go to GitHub Settings:

  2. Generate New Token:

    • Click "Generate new token (classic)"
    • Add a note: "Grafana UI MCP server"
    • Expiration: Choose your preference (90 days recommended)
    • Scopes: โœ… public_repo (for optimal access to Grafana repository)
  3. Copy Your Token:

    • Copy the generated token (starts with ghp_)
    • โš ๏ธ Save it securely - you won't see it again!

๐Ÿš€ Using Your Token

Method 1: Command Line (Quick testing)

bash
npx @shelldandy/grafana-ui-mcp-server --github-api-key ghp_your_token_here

Method 2: Environment Variable (Recommended)

bash
# Add to your shell profile (~/.bashrc, ~/.zshrc, etc.)
export GITHUB_PERSONAL_ACCESS_TOKEN=ghp_your_token_here

# Then simply run:
npx @shelldandy/grafana-ui-mcp-server

Method 3: Claude Desktop Configuration

json
{
  "mcpServers": {
    "grafana-ui": {
      "command": "npx",
      "args": ["@shelldandy/grafana-ui-mcp-server"],
      "env": {
        "GITHUB_PERSONAL_ACCESS_TOKEN": "ghp_your_token_here"
      }
    }
  }
}

โœ… Verify Your Setup

bash
# Test without token (should show rate limit warning)
npx @shelldandy/grafana-ui-mcp-server --help

# Test with token (should show success message)
npx @shelldandy/grafana-ui-mcp-server --github-api-key ghp_your_token --help

# Check your current rate limit
curl -H "Authorization: token ghp_your_token" https://api.github.com/rate_limit

๐Ÿ  Local Development Support

NEW: Work with a local Grafana repository for faster development and access to uncommitted changes!

๐ŸŽฏ Why Use Local Repository?

  • โšก Faster Access: Direct filesystem reads, no network latency
  • ๐Ÿšซ No Rate Limits: Unlimited component access
  • ๐Ÿ”„ Real-time Updates: See your local changes immediately
  • ๐Ÿ“ก Offline Support: Works without internet connection
  • ๐Ÿงช Development Workflow: Test with modified/uncommitted components

๐Ÿ”ง Setup with Local Repository

  1. Clone the Grafana Repository:

    bash
    git clone https://github.com/grafana/grafana.git
    cd grafana
  2. Use Local Path (takes precedence over GitHub API):

    bash
    # Command line option
    npx @shelldandy/grafana-ui-mcp-server --grafana-repo-path /path/to/grafana
    npx @shelldandy/grafana-ui-mcp-server -l /path/to/grafana
    
    # Environment variable
    export GRAFANA_REPO_PATH=/path/to/grafana
    npx @shelldandy/grafana-ui-mcp-server
  3. Claude Desktop Configuration:

    json
    {
      "mcpServers": {
        "grafana-ui": {
          "command": "npx",
          "args": ["@shelldandy/grafana-ui-mcp-server"],
          "env": {
            "GRAFANA_REPO_PATH": "/path/to/your/grafana/repository"
          }
        }
      }
    }

๐Ÿ”„ Configuration Priority

The server checks sources in this order:

  1. Local Repository (--grafana-repo-path or GRAFANA_REPO_PATH)
  2. GitHub API with Token (--github-api-key or GITHUB_*_TOKEN)
  3. GitHub API without Token (rate limited to 60 requests/hour)

๐Ÿ›ก๏ธ Graceful Fallback

  • If local file doesn't exist โ†’ Falls back to GitHub API automatically
  • If local repository is invalid โ†’ Falls back to GitHub API with warning
  • Source is indicated in tool responses ("source": "local" vs "source": "github")

โœ… Verify Local Setup

bash
# Test local repository access
npx @shelldandy/grafana-ui-mcp-server --grafana-repo-path /path/to/grafana --help

# Should show: "Local Grafana repository configured: /path/to/grafana"

๐Ÿ› ๏ธ Tool Usage Examples

The MCP server provides the unified grafana_ui tool for AI assistants:

Basic Component Access

typescript
// Get Button component source code
{
  "tool": "grafana_ui",
  "arguments": { 
    "action": "get_component",
    "componentName": "Button" 
  }
}

// List all available components
{
  "tool": "grafana_ui",
  "arguments": { 
    "action": "list_components"
  }
}

// Get component metadata and props
{
  "tool": "grafana_ui",
  "arguments": { 
    "action": "get_metadata",
    "componentName": "Alert" 
  }
}

Advanced Documentation & Stories

typescript
// Get rich MDX documentation for a component
{
  "tool": "grafana_ui",
  "arguments": { 
    "action": "get_documentation",
    "componentName": "Button" 
  }
}

// Get Storybook stories with interactive examples
{
  "tool": "grafana_ui",
  "arguments": { 
    "action": "get_stories",
    "componentName": "Input" 
  }
}

// Get test files showing usage patterns
{
  "tool": "grafana_ui",
  "arguments": { 
    "action": "get_tests",
    "componentName": "Modal" 
  }
}

Search & Discovery

typescript
// Search components by name
{
  "tool": "grafana_ui",
  "arguments": { 
    "action": "search",
    "query": "button" 
  }
}

// Search components including documentation content
{
  "tool": "grafana_ui",
  "arguments": {
    "action": "search",
    "query": "form validation",
    "includeDescription": true
  }
}

Design System & Dependencies

typescript
// Get all design system tokens
{
  "tool": "grafana_ui",
  "arguments": { 
    "action": "get_theme_tokens"
  }
}

// Get specific token category (colors, typography, spacing, etc.)
{
  "tool": "grafana_ui",
  "arguments": { 
    "action": "get_theme_tokens",
    "category": "colors" 
  }
}

// Get component dependencies (shallow)
{
  "tool": "grafana_ui",
  "arguments": { 
    "action": "get_dependencies",
    "componentName": "Button" 
  }
}

// Get deep dependency analysis
{
  "tool": "grafana_ui",
  "arguments": {
    "action": "get_dependencies",
    "componentName": "DataTable",
    "deep": true
  }
}

๐Ÿ”— Claude Desktop Integration

Add to your Claude Desktop configuration (~/.config/Claude/claude_desktop_config.json):

json
{
  "mcpServers": {
    "grafana-ui": {
      "command": "npx",
      "args": [
        "@shelldandy/grafana-ui-mcp-server",
        "--github-api-key",
        "ghp_your_token_here"
      ]
    }
  }
}

Or with environment variable:

json
{
  "mcpServers": {
    "grafana-ui": {
      "command": "npx",
      "args": ["@shelldandy/grafana-ui-mcp-server"],
      "env": {
        "GITHUB_PERSONAL_ACCESS_TOKEN": "ghp_your_token_here"
      }
    }
  }
}

๐Ÿ”— Cursor Integration

Add to your Cursor configuration file. Access this through:

  • Windows/Linux: Ctrl+Shift+P โ†’ "View: MCP Settings" โ†’ New MCP Server
  • macOS: Cmd+Shift+P โ†’ "View: MCP Settings" โ†’ New MCP Server

Method 1: With GitHub Token as Argument

json
{
  "mcp": {
    "grafana-ui": {
      "command": "npx",
      "args": [
        "@shelldandy/grafana-ui-mcp-server",
        "--github-api-key",
        "ghp_your_token_here"
      ]
    }
  }
}

Method 2: With Environment Variable (Recommended)

json
{
  "mcp": {
    "grafana-ui": {
      "command": "npx",
      "args": ["@shelldandy/grafana-ui-mcp-server"],
      "env": {
        "GITHUB_PERSONAL_ACCESS_TOKEN": "ghp_your_token_here"
      }
    }
  }
}

After adding the configuration, restart Cursor to enable the MCP server. You can then use the Grafana UI tools in your conversations with Cursor's AI assistant.

๐Ÿ—๏ธ Component Architecture

Grafana UI components follow a rich multi-file structure:

packages/grafana-ui/src/components/ComponentName/
โ”œโ”€โ”€ ComponentName.tsx          # Main component implementation
โ”œโ”€โ”€ ComponentName.mdx          # Rich documentation with examples
โ”œโ”€โ”€ ComponentName.story.tsx    # Storybook stories and interactive examples
โ”œโ”€โ”€ ComponentName.test.tsx     # Test files showing usage patterns
โ”œโ”€โ”€ types.ts                   # TypeScript type definitions
โ”œโ”€โ”€ utils.ts                   # Utility functions
โ””โ”€โ”€ styles.ts                  # Styling utilities (if applicable)

This server provides access to all these files, giving AI assistants comprehensive understanding of each component.

๐Ÿ” What's Covered

The server provides access to 200+ Grafana UI components including:

  • Input Components: Button, Input, Checkbox, Radio, Select, Switch, Slider
  • Display Components: Alert, Badge, Tag, Tooltip, Card, Panel, Stat
  • Layout Components: Layout, Container, Stack, Grid, Divider
  • Navigation Components: Menu, Breadcrumb, Tabs, Steps, Pagination
  • Data Components: Table, DataTable, List, Tree, Timeline
  • Feedback Components: Modal, Drawer, Notification, Spinner, Progress
  • Advanced Components: DatePicker, CodeEditor, Graph, Chart components

Plus access to:

  • Design System Tokens: Complete color palettes, typography scales, spacing system
  • Theme Files: Light/dark mode configurations
  • Utility Functions: Helper functions and shared utilities

๐Ÿ› Troubleshooting

Common Issues

"Rate limit exceeded" errors:

bash
# Solution: Add GitHub API token
npx @shelldandy/grafana-ui-mcp-server --github-api-key ghp_your_token_here

"Component not found" errors:

bash
# Check available components first
# Use grafana_ui tool with action: "list_components" via your MCP client
# Component names are case-sensitive (e.g., "Button", not "button")

"Command not found" errors:

bash
# Solution: Install Node.js 18+ and ensure npx is available
node --version  # Should be 18+
npx --version   # Should work

Network/proxy issues:

bash
# Set proxy if needed
export HTTP_PROXY=http://your-proxy:8080
export HTTPS_PROXY=http://your-proxy:8080
npx @shelldandy/grafana-ui-mcp-server

Debug Mode

Enable verbose logging:

bash
# Set debug environment variable
DEBUG=* npx @shelldandy/grafana-ui-mcp-server --github-api-key ghp_your_token

๐Ÿš€ Development

bash
# Clone the repository
git clone https://github.com/shelldandy/grafana-ui-mcp-server.git
cd grafana-ui-mcp-server

# Install dependencies
npm install

# Build the project
npm run build

# Run in development mode
npm run dev

# Test the package
npm run test

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿค Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

๐Ÿ“ž Support

๐Ÿ”— Related Projects

โญ Acknowledgments

  • Grafana Team for the amazing UI component library
  • Anthropic for the Model Context Protocol specification
  • The open source community for inspiration and contributions

Made with โค๏ธ by shelldandy

Star โญ this repo if you find it helpful!

Installation

TypingMind
Prerequisites:

Node.js 18+

{
  "mcpServers": {
    "grafana-ui": {
      "command": "npx",
      "args": [
        "@shelldandy/grafana-ui-mcp-server"
      ],
      "env": {
        "GITHUB_PERSONAL_ACCESS_TOKEN": "ghp_your_token_here"
      }
    }
  }
}

Use Grafana UI MCP Server MCP with multiple AI models

TypingMind connects MCP tools at the workspace level, so once Grafana UI MCP Server is connected, you can use it with different AI models in TypingMind instead of setting it up separately for each model. This MCP runs locally through the TypingMind MCP connector on your device.

Setup guide to use the local connector

Use this when the MCP server needs access to local files, apps, or private resources on your computer.

1

Open the MCP settings

In TypingMind, go to Settings, Advanced Settings, then Model Context Protocol and choose Setup Connector.

  1. Open TypingMind in your browser.
  2. Click the Settings icon.
  3. Go to Advanced Settings.
  4. Open the Model Context Protocol section.
  5. Click Setup Connector and choose This Device.
TypingMind MCP connector setup screen with This Device selected
2

Run the connector command

Choose This Device, copy the command from TypingMind, and run it in Terminal. Keep the process running while you use MCP.

  1. Copy the setup command shown by TypingMind.
  2. Open Terminal on macOS or Windows Terminal on Windows.
  3. Paste and run the command.
  4. Approve the package install if Terminal asks you to proceed.
  5. Keep the Terminal window running while using MCP tools.
3

Add Grafana UI MCP Server as a server

When the connector status is Ready, click Edit Servers and paste the MCP server configuration.

  1. Wait until the connector status shows Ready.
  2. Click Edit Servers.
  3. Paste the Grafana UI MCP Server MCP server configuration.
  4. Save the server list.
  5. Refresh if you want to confirm the connector is still ready.
TypingMind MCP settings showing active server and Edit Servers button
{
  "mcpServers": {
    "grafana-ui-mcp-server": {
      "command": "npx",
      "args": [
        "-y",
        "@shelldandy/grafana-ui-mcp-server"
      ]
    }
  }
}
4

Use it across models

Save the server list, open Plugins, enable the Grafana UI MCP Server MCP tools, then select any supported AI model in TypingMind and use the tools in chat or assign them to an AI agent.

  1. Open the Plugins page in TypingMind.
  2. Enable the Grafana UI MCP Server MCP tools.
  3. Start a chat and choose the AI model you want to use.
  4. Use the MCP tools in chat or assign them to an AI agent.
  5. Switch to another AI model whenever needed without reconnecting MCP.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use Grafana UI MCP Server to help me with this task?
Grafana UI MCP Server
Sure. I read it.
Here is what I found using Grafana UI MCP Server.

Frequently asked questions

What is the Grafana UI MCP Server MCP server used for?

Grafana UI MCP Server is an MCP server that lets compatible AI clients connect to external tools and context. In TypingMind, you can add this MCP server once and make its tools available in your AI workspace.

Can I use Grafana UI MCP Server MCP with multiple AI models in TypingMind?

Yes. TypingMind connects MCP tools at the workspace level, so you can use Grafana UI MCP Server with different AI models such as Claude, ChatGPT, Gemini, or other models you have configured in TypingMind without setting up the MCP server separately for each model.

Why use Grafana UI MCP Server MCP with TypingMind?

TypingMind is one of the best frontends for LLM chat because it brings multiple AI models, prompts, plugins, AI agents, API keys, and MCP tools into one workspace. With Grafana UI MCP Server connected, you can use its MCP tools across your preferred models while keeping your chat workflow organized in TypingMind.

How do I connect Grafana UI MCP Server MCP to TypingMind?

Grafana UI MCP Server runs through the TypingMind local MCP connector. This is best when the MCP server needs access to local files, desktop apps, command-line tools, or private resources on your computer.

What tools does Grafana UI MCP Server MCP provide in TypingMind?

Grafana UI MCP Server exposes MCP capabilities that can be enabled from the TypingMind Plugins page and used in chat or assigned to AI agents.

Do I need to share my API keys with TypingMind to use Grafana UI MCP Server MCP?

No. TypingMind is local-first and lets you keep your model providers, API keys, prompts, and MCP configuration under your control. If Grafana UI MCP Server requires authentication, add the required headers, OAuth settings, or local configuration for that MCP server when you create the connection.

Related MCP Servers

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter ๐Ÿ‘‡