mcp

mcp is a cursor rule for Cursor from tumf/grafana-loki-mcp. It costs 1,474 tokens per session, scanned A, original, MIT.

A standard way for large language models to connect to tools and information sources. An MCP server provides tools, data, and instructions, while an MCP client connects the model to them.

In plain words
What is it for?
Use it to connect an AI coding agent to databases, external APIs, files, documents, code repositories, calculations, and other tool-enabled services.
Why use it?
It avoids building a separate connection method for every tool or data source. The model can discover available capabilities and use them through one shared interface.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Good fit Use it to connect an AI coding agent to databases, external APIs, files, documents, code repositories, calculations, and other tool-enabled services.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/tumf/grafana-loki-mcp/mcp
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/tumf/grafana-loki-mcp

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for mcp

README.md
[![agentmods](https://agentmods.dev/badge/rules/tumf/grafana-loki-mcp/mcp/github.svg)](https://agentmods.dev/rules/tumf/grafana-loki-mcp/mcp)
Your own site
<a href="https://agentmods.dev/rules/tumf/grafana-loki-mcp/mcp"><img src="https://agentmods.dev/badge/rules/tumf/grafana-loki-mcp/mcp/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for mcp

Your own site · 80×15
<a href="https://agentmods.dev/rules/tumf/grafana-loki-mcp/mcp"><img src="https://agentmods.dev/badge/rules/tumf/grafana-loki-mcp/mcp.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 1,474 This file is loaded in full into every session.
When invoked 1,474 The same file — it is already loaded in full.
Security scan A 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.01474 $0.01474
Opus 5 $0.00737 $0.00737
Sonnet 5 $0.00295 $0.00295
Haiku 4.5 $0.00147 $0.00147

Measured 10d ago against content hash 645457551fd2, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

mcp scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 10d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

response = requests.post(url, headers=self.headers, json=params)
.cursor/rules/mcp.mdc · 148 lines

How it starts

The opening of the file, as written. The whole thing — 148 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Model Context Protocol (MCP) の基礎知識

MCPとは

Model Context Protocol (MCP) は、大規模言語モデル (LLM) とツールを接続するための標準プロトコルです。MCPを使用することで、LLMはさまざまなツールやリソースにアクセスし、より複雑なタスクを実行できるようになります。

MCPの主要コンポーネント

MCPは以下の主要なコンポーネントで構成されています:

  1. MCPサーバー: ツール、リソース、プロンプトを提供するサーバー
  2. MCPクライアント: サーバーに接続し、ツールを呼び出すクライアント
  3. LLM: クライアントからの入力を処理し、必要に応じてツールを呼び出す

MCPの主な機能

1. ツール (Tools)

ツールは、LLMが実行できる特定の機能を提供します。例えば:

  • データベースクエリの実行
  • 外部APIの呼び出し
  • ファイルの読み書き
  • 計算の実行

各ツールは名前、説明、パラメータスキーマ、戻り値スキーマを持ちます。

2. リソース (Resources)

リソースは、LLMがアクセスできるデータソースです。例えば:

  • ドキュメント
  • データベース
  • コードリポジトリ
  • 設定ファイル

リソースはURIで識別され、読み取り/書き込みアクセスが可能です。

3. プロンプト (Prompts)

プロンプトは、LLMに特定のタスクを実行させるための指示です。MCPサーバーは、特定のユースケース向けに最適化されたプロンプトを提供できます。

MCPの通信フロー

  1. クライアントがサーバーに接続: MCPクライアントがMCPサーバーに接続します
  2. ツール一覧の取得: クライアントがサーバーから利用可能なツールの一覧を取得します
  3. ユーザー入力の処理: ユーザーからの入力をLLMに送信します
  4. ツールの呼び出し: LLMが必要に応じてツールを呼び出します
  5. 結果の返却: ツールの実行結果をLLMに返し、LLMが最終的な応答を生成します

MCPの実装方法

サーバー側

# FastMCPを使用した例
from fastmcp import FastMCP

# サーバーの作成
mcp = FastMCP(
    "Example MCP Server",
    host="0.0.0.0",
    port=52229
)

# ツールの定義
@mcp.tool()
def example_tool(param1: str, param2: int) -> dict:
    """
    Example tool description.
    
    Args:
        param1: First parameter description
        param2: Second parameter description
        
    Returns:
        Dict containing results
    """
    # ツールの実装
    return {"result": f"{param1}: {param2}"}

# サーバーの実行
if __name__ == "__main__":
    mcp.run()

クライアント側

# 基本的なMCPクライアント
import requests

class MCPClient:
    def __init__(self, base_url: str = "http://localhost:52229"):
        self.base_url = base_url.rstrip("/")
        self.headers = {
            "Content-Type": "application/json",
        }
    
    def call_tool(self, tool_name: str, params: dict) -> dict:
        """ツールを呼び出す"""
        url = f"{self.base_url}/api/tools/{tool_name}"
        
        try:
            response = requests.post(url, headers=self.headers, json=params)
            response.raise_for_status()
            return response.json()
        except requests.RequestException as e:
            return {"error": str(e), "status": "error"}

Read the full file on GitHub · 148 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 10d ago First seen · 148 lines · 1,474 tokens per session scan A 645457551fd2

Subscribe to this mod's changes

mcp is a cursor rule published in the GitHub repository tumf/grafana-loki-mcp (29 stars, last pushed 8mo ago), licensed MIT. It adds 1,474 tokens to every session, about $0.0074 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.