fastmcp

fastmcp is a cursor rule for Cursor from tumf/grafana-loki-mcp. It costs 9 tokens per session (1,922 once invoked), scanned A, original, MIT.

A Python framework for building Model Context Protocol (MCP) servers. MCP is a standard way for AI assistants to call tools provided by another program.

In plain words
What is it for?
Use it to create an MCP server, add callable tools, and run the server from a Python program.
Why use it?
It reduces the amount of setup code needed to expose Python functions as tools an AI assistant can use.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Good fit Use it to create an MCP server, add callable tools, and run the server from a Python program.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/tumf/grafana-loki-mcp/fastmcp
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 fastmcp

README.md
[![agentmods](https://agentmods.dev/badge/rules/tumf/grafana-loki-mcp/fastmcp/github.svg)](https://agentmods.dev/rules/tumf/grafana-loki-mcp/fastmcp)
Your own site
<a href="https://agentmods.dev/rules/tumf/grafana-loki-mcp/fastmcp"><img src="https://agentmods.dev/badge/rules/tumf/grafana-loki-mcp/fastmcp/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 fastmcp

Your own site · 80×15
<a href="https://agentmods.dev/rules/tumf/grafana-loki-mcp/fastmcp"><img src="https://agentmods.dev/badge/rules/tumf/grafana-loki-mcp/fastmcp.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 9 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,922 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. 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.00009 $0.01922
Opus 5 $0.00005 $0.00961
Sonnet 5 $0.00002 $0.00384
Haiku 4.5 $0.00001 $0.00192

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

Security

Grade A, and why

fastmcp scanned grade A with 0 findings 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 9d 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.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursor/rules/fastmcp.mdc · 280 lines

How it starts

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

FastMCPとは

FastMCPは、Model Context Protocol (MCP) サーバーを簡単に構築するためのPythonフレームワークです。Pythonの関数をデコレータで装飾するだけで、MCPサーバーを素早く構築できます。

🎉 FastMCPは現在、公式のMCP SDKに統合されています! 公式のModel Context Protocol Python SDK: github.com/modelcontextprotocol/python-sdk

主な特徴

  • 高速: 高レベルなインターフェースにより、少ないコードで迅速な開発が可能
  • シンプル: 最小限のボイラープレートコードでMCPサーバーを構築
  • Pythonic: Python開発者にとって自然な感覚で使用可能
  • 完全: MCPの仕様を完全に実装することを目指している

インストール方法

FastMCPは uv を使ってインストールすることが推奨されています:

uv pip install fastmcp

macOSでは、Claude Desktopアプリで利用するために、Homebrewを使って uv をインストールする必要がある場合があります:

brew install uv

あるいは、デプロイせずにSDKを使用する場合は、pipを使用することもできます:

pip install fastmcp

クイックスタート

以下は、簡単な計算ツールを提供するMCPサーバーの例です:

# server.py
from fastmcp import FastMCP

# MCPサーバーの作成
mcp = FastMCP("Demo")

# 足し算ツールの追加
@mcp.tool()
def add(a: int, b: int) -> int:
    """二つの数値を足し算する"""
    return a + b

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

これだけで、動作するMCPサーバーが完成します!

主要コンポーネント

FastMCPは以下の主要コンポーネントをサポートしています:

1. サーバー

サーバーはFastMCPのメインオブジェクトで、すべての機能の中心となります:

from fastmcp import FastMCP

mcp = FastMCP(
    "サーバー名",
    host="0.0.0.0",  # オプション
    port=52229,      # オプション
)

2. ツール

ツールはLLMが呼び出せる関数です。デコレータを使って簡単に定義できます:

@mcp.tool()
def my_tool(param1: str, param2: int) -> str:
    """
    ツールの説明
    
    Args:
        param1: 最初のパラメータの説明
        param2: 2番目のパラメータの説明
        
    Returns:
        結果の説明
    """
    # ツールの実装
    return f"結果: {param1}, {param2}"

3. リソース

リソースはLLMがアクセスできるデータです:

@mcp.resource("echo://{message}")
def echo_resource(message: str) -> str:
    """リソースとしてメッセージをエコーする"""
    return f"Resource echo: {message}"

4. プロンプト

プロンプトはLLMに特定のタスクを実行させるための指示です:

@mcp.prompt()
def analyze_table(table: str) -> str:
    """テーブル分析用のプロンプトテンプレートを作成する"""
    return f"""このデータベーステーブルを分析してください:
テーブル: {table}
スキーマ: 
{get_schema()}

構造と関係性についてどのような洞察を提供できますか?"""

Read the full file on GitHub · 280 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. 9d ago First seen · 280 lines · 9 tokens per session scan A 3470fa31567e

Subscribe to this mod's changes

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