home / mcp / ref mcp server

Ref MCP Server

Helping coding agents never make mistakes working with public or private libraries without wasting the context window.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "ref-tools-ref-tools-mcp": {
      "url": "https://api.ref.tools/mcp?apiKey=YOUR_API_KEY",
      "headers": {
        "REF_API_KEY": "sk-abc123"
      }
    }
  }
}

Ref MCP is a ModelContextProtocol server that provides your AI coding tool or agent with up-to-date documentation for APIs, services, libraries, and more. It helps your agent stay informed with the right context while using tokens efficiently, so you can answer questions or generate code with accurate references.

How to use

You connect your MCP client to Ref MCP to grant your agent access to documentation resources. Use the HTTP endpoint for remote access when you want a hosted MCP service, or run Ref locally via the standard input/output (stdio) mode for development or offline setups. Your agent can perform searches against documentation and then read the most relevant pages to extract precise snippets and facts without loading extraneous content.

How to install

Prerequisites: you need Node.js and npm installed on your machine.

Option A — Streamable HTTP (recommended) Use this to connect to a hosted MCP endpoint.

Option B — stdio (local server, legacy) Run Ref locally if you prefer an in-process MCP server that you start from your development environment.

Configuration and running

{
  "mcpServers": [
    {
      "type": "http",
      "name": "ref_mcp_http",
      "url": "https://api.ref.tools/mcp?apiKey=YOUR_API_KEY",
      "args": []
    },
    {
      "type": "stdio",
      "name": "ref_mcp_stdio",
      "command": "npx",
      "args": ["ref-tools-mcp@latest"],
      "env": {
        "REF_API_KEY": "<sign up to get an api key>"
      }
    }
  ],
  "language": "typescript"
}

Notes and tips

If you choose the HTTP option, replace YOUR_API_KEY with a valid API key you obtain from the Ref MCP service. If you run the stdio version, ensure the API key is provided as an environment variable named REF_API_KEY when starting the process.

Available tools

ref_search_documentation

Search technical documentation and sources to find relevant facts, code snippets, or API details.

ref_read_url

Fetch content from a URL and convert it to markdown for readable delivery within Ref.