Skip to content

feat: Grafana MCP を導入#55

Open
cp-20 wants to merge 1 commit intomainfrom
feat/grafana-mcp
Open

feat: Grafana MCP を導入#55
cp-20 wants to merge 1 commit intomainfrom
feat/grafana-mcp

Conversation

@cp-20
Copy link
Copy Markdown
Contributor

@cp-20 cp-20 commented Jan 27, 2026

PR Type

enhancement, configuration changes


Description

  • Grafana MCP の導入と設定を追加

  • MCPOptions に Authorization フィールドを追加

  • MCP のデフォルト設定に Grafana を追加

  • 必須環境変数の取得関数を追加


Diagram Walkthrough

flowchart LR
  A["MCPOptions"] -- "Add Authorization" --> B["ToolMcpParam"]
  B -- "Add Grafana MCP" --> C["DefaultSpecs"]
  C -- "Use MCPConfig" --> D["config.go"]
Loading

File Walkthrough

Relevant files
Enhancement
tooling.go
MCPOptions とデフォルト設定の強化                                                                     

internal/gpt/tooling/tooling.go

  • MCPOptions に Authorization フィールドを追加
  • MCP のデフォルト設定に Grafana を追加
  • MCPOptions のバリデーションを強化
+29/-2   
Tests
tooling_test.go
不要なテストの削除                                                                                               

internal/gpt/tooling/tooling_test.go

  • TestDefaultSpecsProvider テストを削除
+0/-21   
Configuration changes
config.go
MCPConfig の追加と環境変数管理の強化                                                                   

internal/pkg/config/config.go

  • 必須環境変数の取得関数を追加
  • MCPConfig 構造体を追加
+18/-0   

@cp-20 cp-20 requested a review from kaitoyama January 27, 2026 06:28
@cp-20 cp-20 self-assigned this Jan 27, 2026
@github-actions
Copy link
Copy Markdown

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Validation Logic

The validation logic for MCPOptions has been updated to include checks for Authorization and ApprovalPolicy. Ensure that these validations are comprehensive and correctly handle all possible input scenarios.

func (o MCPOptions) validate() error {
	if strings.TrimSpace(o.ServerLabel) == "" {
		return errors.New("mcp server label is required")
	}
	if !o.ServerURL.Valid() {
		return errors.New("mcp server url is required")
	}
	if strings.TrimSpace(o.ApprovalPolicy) == "" {
		return errors.New("mcp approval policy is required")
	}
	if o.ApprovalPolicy != "always" && o.ApprovalPolicy != "never" && o.ApprovalPolicy != "prompt" {
		return fmt.Errorf("invalid mcp approval policy: %s", o.ApprovalPolicy)
	}
	if o.Authorization.Valid() && strings.TrimSpace(o.Authorization.Value) == "" {
		return errors.New("mcp authorization, if provided, cannot be empty")
	}
Environment Variable Handling

The function mustGetEnv is introduced to handle required environment variables. Verify that this function is used appropriately and consider the implications of using panic if the environment variable is not set.

func mustGetEnv(key string) string {
	if value, exists := os.LookupEnv(key); exists {
		return value
	}

	panic(fmt.Sprintf("environment variable %s is required", key))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant