Integrates with GitHub API to retrieve Grafana UI repository contents, with support for API tokens to increase rate limits from 60 to 5,000 requests per hour and efficient caching for component files.
Provides comprehensive access to Grafana UI component library, including TypeScript source code, MDX documentation, Storybook stories, test files, design system tokens (colors, typography, spacing), and component dependency analysis for the Grafana React components.
Grafana UI MCP Server
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:
๐ Available Actions (11 Total)
Core Component Actions:
get_component- Get TypeScript source code for any Grafana UI componentget_demo- Get Storybook demo files showing component usagelist_components- List all available Grafana UI componentsget_metadata- Get component props, exports, and metadataget_directory- Browse the Grafana UI repository structure
Advanced Grafana Actions:
get_documentation- Get rich MDX documentation with sections and examplesget_stories- Get parsed Storybook stories with interactive controlsget_tests- Get test files showing usage patterns and edge casessearch- Search components by name and optionally by documentation contentget_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 thegrafana_uitool with anactionparameter.
Before (v1.x):
After (v2.0+):
All functionality remains the same - only the interface has changed.
๐ฆ Quick Start
โก Using npx (Recommended)
The fastest way to get started - no installation required!
๐ฏ Try it now: Run npx @shelldandy/grafana-ui-mcp-server --help to see all options!
๐ง Command Line Options
๐ 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)
Go to GitHub Settings:
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)
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)
Method 2: Environment Variable (Recommended)
Method 3: Claude Desktop Configuration
โ Verify Your Setup
๐ 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
Clone the Grafana Repository:
git clone https://github.com/grafana/grafana.git cd grafanaUse Local Path (takes precedence over GitHub API):
# 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-serverClaude Desktop Configuration:
{ "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:
Local Repository (
--grafana-repo-pathorGRAFANA_REPO_PATH)GitHub API with Token (
--github-api-keyorGITHUB_*_TOKEN)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
๐ ๏ธ Tool Usage Examples
The MCP server provides the unified grafana_ui tool for AI assistants:
Basic Component Access
Advanced Documentation & Stories
Search & Discovery
Design System & Dependencies
๐ Claude Desktop Integration
Add to your Claude Desktop configuration (~/.config/Claude/claude_desktop_config.json):
Or with environment variable:
๐ Cursor Integration
Add to your Cursor configuration file. Access this through:
Windows/Linux:
Ctrl+Shift+Pโ "View: MCP Settings" โ New MCP ServermacOS:
Cmd+Shift+Pโ "View: MCP Settings" โ New MCP Server
Method 1: With GitHub Token as Argument
Method 2: With Environment Variable (Recommended)
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:
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:
"Component not found" errors:
"Command not found" errors:
Network/proxy issues:
Debug Mode
Enable verbose logging:
๐ Development
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ค Contributing
Fork the repository
Create a feature branch (
git checkout -b feature/amazing-feature)Commit your changes (
git commit -m 'Add amazing feature')Push to the branch (
git push origin feature/amazing-feature)Open a Pull Request
๐ Support
๐ Report Issues
๐ฌ Discussions
๐ Documentation
๐ฆ npm Package
๐ Related Projects
Grafana UI - The component library this server provides access to
Grafana - The main Grafana repository
Model Context Protocol - The protocol specification
MCP TypeScript SDK - Official MCP SDK
โญ 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
Star โญ this repo if you find it helpful!