Skip to main content
Glama

Documentation for your agent Website License npm version

Ref MCP

ModelContextProtocolサーバーであり、AIコーディングツールやエージェントがAPI、サービス、ライブラリなどのドキュメントにアクセスできるようにします。エージェントがドキュメントを高速かつトークン効率よく最新の状態に保つためのワンストップショップです。

詳細については ref.tools を参照してください。

エージェントによる最適なコンテキストの検索

Refのツールは、モデルが検索する方法に合わせて設計されており、コンテキストの劣化を抑えるために可能な限り少ないコンテキストを使用します。目標は、最小限のトークンを使用して、コーディングエージェントが成功するために必要なコンテキストを正確に見つけることです。

プロンプトの複雑さに応じて、Claude CodeのようなLLMコーディングエージェントは通常、1回以上の検索を行い、その後、詳細に読むためのリソースをいくつか選択します。

FigmaのComment REST APIに関する単純なクエリの場合、必要な情報を正確に取得するために数回呼び出しを行います:

SEARCH 'Figma API post comment endpoint documentation' (54 tokens)
READ https://www.figma.com/developers/api#post-comments-endpoint (385 tokens)

より複雑な状況では、LLMは結果を読みながらプロンプトを洗練させようとします。例:

SEARCH 'n8n merge node vs Code node multiple inputs best practices' (126)
READ https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.merge/#merge (4961)
READ https://docs.n8n.io/flow-logic/merging/#merge-data-from-multiple-node-executions (138)
SEARCH 'n8n Code node multiple inputs best practices when to use' (107)
READ https://docs.n8n.io/code/code-node/#usage (80)
SEARCH 'n8n Code node access multiple inputs from different nodes' (370)
SEARCH 'n8n Code node $input access multiple node inputs' (372)
READ https://docs.n8n.io/code/builtin/output-other-nodes/#output-of-other-nodes (2310)

RefはMCPセッションを活用して検索の軌跡を追跡し、コンテキストの使用量を最小限に抑えます。他にも多くのアイデアを検討中ですが、現時点で実装済みの機能は以下の通りです。

1. 検索結果のフィルタリング

セッション内で同様の検索を繰り返す場合、Refは重複した結果を返すことはありません。従来は、次の結果へページングすることで検索結果を深く掘り下げていましたが、このアプローチではエージェントがページングを行うと同時にプロンプトを調整することも可能です。

2. ページ内の重要な部分の取得

ドキュメントのページを読む際、Refはエージェントのセッション検索履歴を使用して関連性の低いセクションを除外し、最も関連性の高い5kトークンを返します。これにより、Refは標準的な fetch() Webスクレイピングの大きな問題、つまり大きなドキュメントページにヒットした際に20kトークン以上をコンテキストに取り込んでしまい、そのほとんどが無関係であるという問題を回避できます。

Related MCP server: graphpilot

ドキュメントのコンテキストからトークンを最小限に抑えることがなぜ重要なのか?

1. コンテキストが多いとモデルの性能が低下する

2025年7月現在、トークンを多く入力するほどモデルの性能が低下することは十分に文書化されています。モデルが長いコンテキストを扱えるようになったという話を聞いたことがあるかもしれませんが、それはある程度真実ですが、全体像ではありません。研究に関する簡単な入門として、Chromaチームによるこのビデオをご覧ください

2. トークンにはコストがかかる

Claude Opusをバックグラウンドエージェントとして使用しており、エージェントがドキュメントのコンテキストを取り込むことから始めるとします。10,000トークンのコンテキストを取り込み、そのうち4,000が関連しており、6,000が余分なノイズだったと仮定します。API価格では、その6kトークンは1ステップあたり約$0.09かかります。もし1つのプロンプトでOpusを11ステップ使用した場合、理由もなく$1を費やしたことになります。

セットアップ

RefをMCPサーバーとしてセットアップするには、streamable-httpサーバー(推奨)またはローカルstdioサーバー(レガシー)の2つのオプションがあります。

このリポジトリには、レガシーなstdioサーバーが含まれています。

Streamable HTTP (推奨)

Install Ref MCP in Cursor

"Ref": {
  "type": "http",
  "url": "https://api.ref.tools/mcp?apiKey=YOUR_API_KEY"
}

stdio

Install Ref MCP in Cursor (stdio)

"Ref": {
  "command": "npx",
  "args": ["ref-tools-mcp@latest"],
  "env": {
    "REF_API_KEY": <sign up to get an api key>
  }
}

ツール

Ref MCPサーバーは、エージェントが必要とするすべてのドキュメント関連ツールを提供します。

ref_search_documentation

技術ドキュメントを確認するための強力な検索ツールです。事実やコードスニペットを見つけるのに最適です。Web上の公開ドキュメントやGitHubの検索だけでなく、リポジトリやPDFなどのプライベートリソースの検索にも使用できます。

パラメータ:

  • query (必須): 関連するドキュメントを検索するためのクエリ。完全な文章または質問である必要があります。

ref_read_url

URLからコンテンツを取得し、Refで読みやすいようにMarkdownに変換するツールです。関連コンテンツのURLを返す ref_search_documentation ツールと組み合わせて使用すると強力です。

パラメータ:

  • url (必須): 読み込むWebページのURL。

OpenAIのディープリサーチサポート

Refはディープリサーチのソースとして使用できます。OpenAIは特定のツール定義を必要とするため、OpenAIクライアントで使用する場合、Refは名前を少し変えて同じツールを提供します。

ref_search_documentation(query) -> search(query)
ref_read_url(url) -> fetch(id)

開発

npm install
npm run dev

Inspectorでの実行

開発およびデバッグの目的で、MCP Inspectorツールを使用できます。Inspectorは、MCPサーバーの対話をテストおよび監視するための視覚的なインターフェースを提供します。

詳細なセットアップ手順については、Inspectorのドキュメントを参照してください。

Inspectorでローカルテストを行うには:

npm run inspect

または、ウォッチャーとインスペクターの両方を実行します:

npm run dev

ローカル開発

  1. リポジトリをクローンします

  2. 依存関係をインストールします:

npm install
  1. プロジェクトをビルドします:

npm run build
  1. 自動リビルドを行う開発用:

npm run watch

ライセンス

MIT

Available Tools

2 tools
ref_read_urlAInspect

Read the content of a url as markdown. The entire exact URL from a Ref 'ref_search_documentation' result should be passed to this tool to read it.

ParametersJSON Schema
NameRequiredDescriptionDefault
urlYesThe URL of the webpage to read.

TDQS

A3.5/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool reads content and converts it to markdown, but lacks details on error handling, rate limits, authentication needs, or output format. For a tool with no annotations, this leaves significant gaps in understanding its behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is highly concise and well-structured in two sentences. The first sentence states the core purpose, and the second provides usage context. There is no wasted language, making it front-loaded and efficient.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (reading and converting web content) and lack of annotations or output schema, the description is adequate but incomplete. It covers purpose and basic usage but omits behavioral details like error cases or output specifics, leaving room for improvement in completeness.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, with the parameter 'url' documented as 'The URL of the webpage to read.' The description adds minimal value beyond this by specifying that the URL should come from 'ref_search_documentation' results, but does not provide additional syntax or format details. Baseline 3 is appropriate as the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Read the content of a url as markdown.' It specifies the verb ('Read') and resource ('content of a url'), making the action explicit. However, it does not explicitly distinguish this tool from its sibling 'ref_search_documentation', which likely searches rather than reads content, so it misses full differentiation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context for when to use this tool: 'The entire exact URL from a Ref 'ref_search_documentation' result should be passed to this tool to read it.' This implies usage after obtaining a URL from the sibling tool, offering a workflow guideline. However, it does not specify when not to use it or alternatives, keeping it from a perfect score.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

ref_search_documentationBInspect

Search for documentation on the web or github as well from private resources like repos and pdfs. Use Ref 'ref_read_url' to read the content of a url.

ParametersJSON Schema
NameRequiredDescriptionDefault
queryYesQuery for documentation. Should include programming language and framework or library names. Searches public only docs by default, include ref_src=private to search a user's private docs.

TDQS

B3.1/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden but only mentions searching capabilities and a related tool. It fails to disclose critical behavioral traits like whether this is a read-only operation, potential rate limits, authentication needs for private resources, or what the search results look like (e.g., format, pagination).

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise with two sentences that directly state the tool's function and a usage tip. It's front-loaded and avoids unnecessary words, though it could be slightly more structured for clarity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of a search tool with no annotations and no output schema, the description is incomplete. It doesn't explain what the tool returns (e.g., search results format), how private resources are accessed, or error handling, leaving significant gaps for an AI agent to use it effectively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% coverage, fully describing the single 'query' parameter with details on including language/framework names and the 'ref_src=private' option. The description adds no additional parameter semantics beyond what the schema provides, so it meets the baseline for high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose as searching for documentation across web, GitHub, and private resources, which is specific and actionable. However, it doesn't explicitly differentiate from its sibling 'ref_read_url', which is for reading URL content rather than searching, so it misses full sibling distinction.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage by mentioning 'ref_read_url' for reading content, suggesting a workflow, but lacks explicit guidance on when to use this tool versus alternatives or any exclusions. It provides some context but no clear when/when-not rules.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

TDQS

A3.5/5.0
Disambiguation5/5

The two tools have clearly distinct purposes: ref_search_documentation finds documentation resources, while ref_read_url reads the content of specific URLs. There is no overlap or ambiguity between searching and reading operations.

Naming Consistency5/5

Both tools follow a consistent 'ref_verb_noun' naming pattern with snake_case. The prefix 'ref_' provides clear namespace identification, and the verb-noun structure (search_documentation, read_url) is uniform and predictable.

Tool Count3/5

With only two tools, the server feels minimal but functional for its documentation search/read purpose. While it covers core workflows, the count is borderline thin—additional tools for filtering, saving, or managing searches might enhance completeness without overcomplication.

Completeness4/5

The tool set covers the essential documentation workflow: searching and reading. However, there are minor gaps, such as no tools for saving results, filtering searches, or managing cached content, which agents might need to work around for advanced use cases.

Maintenance

ActivityInactive
ResponsivenessSyncing

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ref-tools/ref-tools-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server