Skip to main content
Context7 provides multiple packages for different use cases. Choose the installation method that fits your needs.

MCP Server

The MCP server enables AI coding assistants to access Context7’s documentation database.

Package Information

Installation Options

Running as HTTP Server

You can also run the MCP server as a standalone HTTP server:
The server will start at http://localhost:3000/mcp. Available endpoints:
  • /mcp - MCP protocol endpoint (anonymous access)
  • /mcp/oauth - OAuth-protected endpoint
  • /ping - Health check
  • /.well-known/oauth-protected-resource - OAuth metadata

SDK

The TypeScript/JavaScript SDK provides programmatic access to Context7’s API.

Installation

Usage

API Methods

searchLibrary

Search for libraries matching a query.

getContext

Get documentation for a specific library.

Error Handling

CLI

The ctx7 CLI provides tools for authentication and quick MCP setup.

Installation

Commands

setup

Configure Context7 MCP for your AI coding agents:
This command:
  • Authenticates via OAuth (or uses provided API key)
  • Generates API key automatically if using OAuth
  • Configures MCP server in your agent’s config file
  • Adds a rule to auto-invoke Context7
  • Installs Context7 skill

auth

Manage authentication:

skills

Manage Context7 skills:

AI SDK Tools

Pre-built tools for Vercel AI SDK that provide Context7 functionality.

Installation

Requires peer dependencies: @upstash/context7-sdk, ai (v6.0.0+), and zod (v4.0.0+)

Usage

Available Tools

resolveLibraryId

Resolves a library name to a Context7-compatible library ID.

queryDocs

Fetches documentation for a library using its Context7 library ID.

Context7 Agent

A pre-configured agent that combines both tools:

System Prompts

The package exports system prompts that you can use in your own agents:

Getting an API Key

1

Visit the dashboard

2

Sign in

Authenticate with your GitHub, Google, or email account
3

Generate API key

Click “Create API Key” and give it a name
4

Copy the key

Copy your API key (starts with ctx7sk_) and store it securely
API keys provide higher rate limits than anonymous access. Keep your API key secure and never commit it to version control.

Environment Variables

All packages support the CONTEXT7_API_KEY environment variable:
Or add to your .env file:

Next Steps

Quickstart Guide

Get Context7 running in under 5 minutes

API Reference

Explore the REST API documentation

Adding Libraries

Submit your library to Context7

Troubleshooting

Common issues and solutions