概要
AI で Langfuse プロジェクトを読み取ります:コスト、トークン、レイテンシ付きの LLM トレース、オブザベーション、セッション、時系列のメトリクス、スコアと評価、バージョンとラベル付きのプロンプト、データセット、データセットアイテム、実験。プロンプトのバージョン公開、ラベルの移動、スコアの追加、データセットの作成もできます。
ガイド付きセットアップ
Langfuse を Claude に 2 分で接続
AnythingMCP Cloud の無料トライアルを始め、ガイド付きセットアップで Langfuse を接続して、MCP URL を Claude に追加します。コードもサーバーの運用も不要です。
クレジットカード不要 · 7日間の試用 · セルフホストの選択肢あり
AnythingMCP は Claude のコネクタディレクトリに掲載されています。ワンクリックで Claude に追加 (新しいタブで開きます)し、サインインして Claude が使える MCP サーバーを選んでください。
こう聞いてみよう
Langfuse のサンプルプロンプト
プロンプトをクリックでコピー。Claude / ChatGPT / Cursor / Gemini / Copilot / OpenClaw に貼り付けて、このコネクターで実行できます。
Claude は AI のため誤ることがあります。回答をご確認ください。
💡 インストール不要? cloud.anythingmcp.com を直接利用してください。 サインインし、Connectors → Langfuse をクリック、認証情報を貼り付け、MCP API キーを発行すれば完了です。Docker も
git cloneもローカルサーバーも不要。
Langfuse + Claude
AI で Langfuse プロジェクトを読み取ります:コスト、トークン、レイテンシ付きの LLM トレース、オブザベーション、セッション、時系列のメトリクス、スコアと評価、バージョンとラベル付きのプロンプト、データセット、データセットアイテム、実験。プロンプトのバージョン公開、ラベルの移動、スコアの追加、データセットの作成もできます。
前提条件
完全なセットアップ手順はコネクタ自体に組み込まれています (ストアでコネクタを選択すると表示)。必要な環境変数:
LANGFUSE_HOST, LANGFUSE_PUBLIC_KEY, LANGFUSE_SECRET_KEY
ステップ 1 — 認証情報を取得
セットアップは約 3 分です。Langfuse Cloud(EU、US、日本、HIPAA)またはセルフホストの Langfuse v4 上のプロジェクトが必要です。
- Langfuse でプロジェクトを開き、Settings、API Keys、Create new API keys の順に進みます。組織キーではなくプロジェクトキーを使ってください。
- 公開キー(
pk-lf-...)をLANGFUSE_PUBLIC_KEYに、シークレットキー(sk-lf-...、一度しか表示されません)をLANGFUSE_SECRET_KEYにコピーします。コネクタは両方を HTTP Basic 認証で送ります。 LANGFUSE_HOSTに、プロジェクトのリージョンを末尾のスラッシュなしで設定します:https://cloud.langfuse.com(EU)、https://us.cloud.langfuse.com(US)、https://jp.cloud.langfuse.com(日本)、https://hipaa.cloud.langfuse.com(HIPAA)、またはセルフホストのアドレス。あるリージョンのキーは別のリージョンでは使えません。- コネクタをインストールし、
langfuse_get_projectを実行してキーを確認します。langfuse_get_healthでサーバーのバージョンがわかります。
費用: モデルを実行するツールはありません。コネクタは Langfuse のデータを読み書きするだけで、表示されるコストは、アプリケーションの LLM 呼び出しについて Langfuse が記録したものです。
トレースデータ: Langfuse v4 では、トレースは同じ traceId を持つオブザベーション(スパン、ジェネレーション、ツール呼び出し、イベント)の集まりで、セッションは同じ sessionId を持つトレースの集まりです。コネクタはリアルタイムの読み取り経路である Observations API v2 と Metrics API v2 から読み取ります。古い /traces、/sessions、/metrics/daily エンドポイントは非推奨です(Langfuse Cloud では 2026 年 11 月 16 日まで提供)。ほかのエンドポイントは取り込みから 10 分ほど遅れることがあります。
langfuse_list_observationsは行を新しい順に返し、常にfrom_start_timeとto_start_timeで範囲を区切ります。フィルター:type(LLM 呼び出しは GENERATION)、name、user_id、session_id、trace_id、level(失敗は ERROR)、environment、is_root_observation(true でトレースごとに 1 行)、構造化したfilter。fieldsでフィールドグループcore、basic、time、io(入出力)、metadata、model、usage(トークンとコスト)、prompt、metrics(レイテンシ)、trace_contextを選びます。既定はcore,basic,usageです。langfuse_get_traceは 1 つのトレースのすべてのオブザベーションを、入出力、モデル、使用量、レイテンシとともに返します。ルートにはparentObservationIdがなく、トレースの入出力を持ちます。langfuse_get_sessionは既定でセッション内のトレースごとに 1 行を返し、root_only: falseですべてのオブザベーションを返します。langfuse_query_metricsは集計を行います。queryは JSON 文字列で、view(observations、scores-numeric、scores-boolean、scores-categorical)、metrics(count、latency、totalTokens、totalCost、timeToFirstTokenなどの指標と、集計sum、avg、count、max、min、p50、p75、p90、p95、p99)、dimensions(providedModelName、traceName、promptName、promptVersion、environment、releaseなど)、timeDimension(分、時、日、週、月ごと)、filters、fromTimestamp、toTimestampを含みます。userIdやsessionIdのように値の種類が多いフィールドは、絞り込みには使えますがグループ化には使えません。
スコア: langfuse_list_scores は name、source(API、ANNOTATION、EVAL)、data_type、トレース、セッション、オブザベーション、実験、値の範囲、期間で絞り込みます。langfuse_list_score_configs はスコアの定義を表示します。langfuse_create_score は、トレース、オブザベーション、セッション、実験の実行に 1 つのスコア(数値、0 または 1 のブール値、カテゴリ、テキスト)を追加します。処理は非同期(HTTP 202)で、同じ score_id を再送すると上書きされます。
プロンプト: langfuse_list_prompts は名前をバージョン、ラベル、タグとともに一覧表示します。langfuse_get_prompt は、version も label も指定しなければ production ラベルの付いたバージョンを返します。langfuse_create_prompt_version はテキストプロンプト({{variables}} 付き)またはチャットプロンプトの新しいバージョンを公開し、新しい名前ならプロンプトを作成します。langfuse_update_prompt_labels は production や staging などのラベルをあるバージョンに移します。production を移すとアプリケーションが取得する内容が変わるため、AI は事前に確認します。support/greeting のようなフォルダ付きの名前はそのまま渡します。
データセットと実験: langfuse_list_datasets、langfuse_get_dataset、langfuse_create_dataset(入力と期待出力の JSON スキーマも指定可能)、langfuse_list_dataset_items、langfuse_get_dataset_item、langfuse_upsert_dataset_item(アイテムを作成し、item_id が既存なら更新します。status を ARCHIVED にすると新しい実行から外れます)。langfuse_list_experiments はデータセットの実行と実験をスコアとともに一覧表示します。from_start_time は必須です。
Langfuse 自身の MCP サーバー: Langfuse は <LANGFUSE_HOST>/api/public/mcp でネイティブの MCP サーバーも提供しています(同じキーペアを使用)。主にプロンプト管理向けです。このコネクタはプロンプトに加え、トレースデータ、メトリクス、スコア、データセットも扱います。
インストール時にオフのツール: ありません。20 個のツールはすべて有効です。書き込み系のツールはプロンプトのバージョン、ラベル、スコア、データセット、アイテムを追加しますが、削除するものはありません。
データ形式: 時刻は UTC の ISO 8601 です。コストは USD で、v2 のオブザベーションでは inputPrice、outputPrice、totalPrice が小数の精度を保つため文字列になり、input と output は JSON テキストで届きます。メトリクスのレイテンシと最初のトークンまでの時間はミリ秒です。
ページング: オブザベーション、トレース、セッション、スコア、実験はカーソルを使います。AI は meta.cursor がなくなるまで、それを cursor に渡します(オブザベーションは既定 50 行、最大 1,000 行)。プロンプト、データセット、アイテム、スコア設定は page(1 から)と limit(既定 50、最大 100)を使い、meta.totalPages で総ページ数がわかります。
制限: オブザベーションとメトリクスのツールを使うには、セルフホストの Langfuse が v4 以降である必要があります。Observations API v2 と Metrics API v2 以外のデータは 10 分ほど遅れることがあります。
よくあるエラー: 400 はパラメータの誤りです(filter や query の JSON の不備、値の種類が多いフィールドでのグループ化、上限を超える limit)。401 はキーペアかリージョンの誤りです。403 はキーがこのエンドポイントを使えません(プロジェクトキーを使ってください)。404 はプロンプト、データセット、アイテムが見つからないか、v2 エンドポイントのないセルフホスト版です。429 はレート制限です(AI はループで再試行せずに待ちます)。
このコネクタは、トレース、プロンプト、データセット、スコアの削除は行わず、トレースの送信も行いません(それは Langfuse の SDK が OpenTelemetry で行います)。アノテーションキュー、LLM 接続、組織や SCIM の管理は含まれていません。
ステップ 2 — アダプターをインストール
curl -fsSL https://raw.githubusercontent.com/HelpCode-ai/anythingmcp/main/docker-compose.quickstart.yml -o docker-compose.yml
printf 'JWT_SECRET=%s\nENCRYPTION_KEY=%s\n' "$(openssl rand -hex 32)" "$(openssl rand -hex 32)" > .env
docker compose up -d
ステップ 3 — Claude にコネクタを追加
サーバーURL: AnythingMCP で MCP Servers を開き、このコネクタがあるサーバーを選んで URL(
https://cloud.anythingmcp.com/mcp/…)をコピーします。このガイドでYOUR_SERVER_IDと表示されている箇所に使ってください。
推奨ルート:設定ファイルを触らずに claude.ai web で動作します。
- Claude で Customize → Connectors を開きます。
- + をクリックし、Add custom connector を選びます。
- 名前(例:
Langfuse)とリモート MCP サーバー URLhttps://cloud.anythingmcp.com/mcp/YOUR_SERVER_IDを入力し、Add をクリックします。 - Connect をクリックし、AnythingMCP にサインイン(OAuth)してアクセスを許可します。
下記のすべてのツールがチャットに表示されます。プロンプトを入力し始めてください。
利用可能なツール
| Tool | What it does |
|---|---|
langfuse_get_project | Show the Langfuse project this key pair belongs to: id, name, organization and retention settings |
langfuse_get_health | Check that the Langfuse server and its database are up and read the Langfuse version (v4 or later is needed for the observation and metrics… |
langfuse_list_observations | List observations (LLM generations, spans, tool calls, events) of the Langfuse project, newest first, with the chosen field groups |
langfuse_get_trace | Read one Langfuse trace: all of its observations with input, output, model, token usage, cost and latency, newest first |
langfuse_get_session | Read one Langfuse session (for example a chat conversation): by default one row per trace, the entry point of each turn, with input, output… |
langfuse_query_metrics | Aggregate Langfuse data (Metrics API v2): counts, tokens, cost, latency percentiles or score values, grouped by dimensions such as model… |
langfuse_list_scores | List Langfuse scores (evaluations, user feedback, annotations) newest first, with name, value, data type, source, comment and the trace… |
langfuse_create_score | Add one score to a Langfuse trace, observation, session or experiment run, e.g. a quality rating or a correctness check |
langfuse_list_score_configs | List the score configs of the Langfuse project: name, data type, numeric range or categories, description and whether archived |
langfuse_list_prompts | List the prompts of the Langfuse project: name, type, versions, labels, tags and last update |
langfuse_get_prompt | Read one Langfuse prompt version: its text or chat messages, config (model, temperature), labels, tags, version and commit message |
langfuse_create_prompt_version | Publish a new version of a Langfuse prompt (a new name creates the prompt) |
langfuse_update_prompt_labels | Set the deployment labels of one Langfuse prompt version, e.g. promote version 4 to production |
langfuse_list_datasets | List the datasets of the Langfuse project with id, name, description, metadata and dates |
langfuse_get_dataset | Read one Langfuse dataset by name: description, metadata, input and expected-output JSON schemas and dates |
langfuse_create_dataset | Create a Langfuse dataset for evaluations and experiments, optionally with JSON schemas that every item's input and expected output must… |
langfuse_list_dataset_items | List the items of Langfuse datasets: input, expected output, metadata, status (ACTIVE or ARCHIVED) and the trace or observation they came… |
langfuse_get_dataset_item | Read one Langfuse dataset item: input, expected output, metadata, status, source trace and observation, dataset and dates |
langfuse_upsert_dataset_item | Add an item to a Langfuse dataset, or update it when item_id already exists: input, expected output, metadata, the source trace or… |
langfuse_list_experiments | List Langfuse experiments and dataset runs with recent activity first: name, dataset, metadata and, with fields scores, their aggregated… |
プロンプトの例
- 「過去 7 日間の LLM 呼び出しのコストを、モデル別・日別に教えてください。」
- 「昨日の level が ERROR のジェネレーションを、モデル、入力、出力付きで見せてください。」
- 「セッション chat-8f21 の会話全体を、各ターンの入力と出力付きで見せてください。」
- 「今週のトレース名ごとの p95 レイテンシはどれくらいですか?遅くなったものはどれですか?」
- 「プロンプト support/greeting の、より親しみやすい口調の新しいバージョンを公開してください。ただし production ラベルはまだ移さないでください。」
FAQ
Claude Code は Claude Desktop と同じように動作しますか? はい。両方を https://cloud.anythingmcp.com/mcp/YOUR_SERVER_ID に向けてください。
次のステップ
このガイドは役に立ちましたか?