# Context7

Let Lyna AI read up-to-date documentation and code examples for the libraries your project uses.

Add Context7 so Lyna AI can read current documentation and code examples for a library, at the version you use, before it writes code against it.

## What it lets you do

- Find a library by its usual name and get Context7's id for it.
- Fetch documentation for that library on a question you ask.
- Put code examples in a given language first.

| Item                         | Detail                                                                               |
| ---------------------------- | ------------------------------------------------------------------------------------ |
| What it asks for             | Nothing. No key and no sign-in.                                                      |
| Who pays the provider        | Lyna asks for no payment details here. A free Context7 key gives higher rate limits. |
| Do actions change real data? | No. It only reads documentation.                                                     |
| Where it runs                | In your project's cloud machine, never on your computer.                             |
| Who uses it                  | Lyna AI while it builds, in Build mode. Your published app does not use it.          |

## What you need before you start

- No Context7 account: this connector needs no key and no sign-in.
- A Context7 account only if you want higher limits or your private repositories (see below).
- Edit access to your Lyna project.
- An open project: a local connector starts in the project's cloud machine.

### Permissions in Context7

With no key there is no account and nothing to grant: the connector only reads documentation that Context7 lists. A Context7 key changes two things, higher rate limits and your private repositories. A free account includes 1,000 API calls a month.

| Task                           | What you need                                          |
| ------------------------------ | ------------------------------------------------------ |
| Read public library docs       | Nothing                                                |
| Read past the lower limits     | A key, added with **Add custom** (see Ways to connect) |
| Read your private repositories | A key from your account                                |

A server added with a key runs on Context7's side, so it needs no open project. See [Context7's overview](https://context7.com/docs/overview).

## Ways to connect

**On the connector's page.** No account, no key and no sign-in. The connector works once connected.

**Who owns the account?** Nobody: Context7 has no account in this setup.

**Who can use it?** Only you, in the projects you link it to, until you change it. On the connector's page, **Who can use it** also offers **Only this project**. **The whole workspace** is not offered, because a local server runs in your project's cloud machine. See [Who can use a connection](/integrations/connectors#who-can-use-a-connection).

**A key, for higher limits and private repositories.** In **Connectors**, choose **Add custom**, then **Custom server**. Give it a name, paste `https://mcp.context7.com/mcp` in **Server address**, set **How it signs in** to **Key or token**, paste the value, and choose **Add and test**. Create the key in your [Context7 dashboard](https://context7.com/dashboard). It starts with `ctx7sk-` and is shown once.

## Set it up

1. ### Open the connector

   Open the **+** menu of the chat and choose **Connectors**. Find **Context7** with the search field or under **Developer tools**, then open its page.
2. ### Connect

   Choose **Connect**. The **New connection** page opens and reads "Nothing to set up. Connect and it is ready." Choose **Connect** at the bottom of the page. **Sharing**, just above, sets who can use it.
3. ### Read the result

   Lyna starts the server in the project's cloud machine, so the project has to be open. It can take up to 20 seconds. **Connected** means Lyna can use it.

> [!WARNING]
>
> **What never to share**
>
> Never paste a Context7 key in the chat or commit it. The connector's own page has no field for one: a key goes in the request header of a custom server.

### Check it works

The test starts the Context7 server in your project's cloud machine, asks for its tools and closes it. **Connected** proves that it started and answered. A pass does not prove access to every piece of data. Context7 covers the libraries listed on it, and the docs are written by each project.

To check for real, ask for something you know exists:

- "Use Context7 to find the library id of the charting library in this project."

## What to ask Lyna AI

Type these in the chat, in Build mode, and adjust the names to yours. Once it is connected, **Use Context7** on its page starts a message for you.

| What you build or do             | What to type                                                                                                      | What happens                                                |
| -------------------------------- | ----------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------- |
| Fix code against current docs    | "Use Context7 to check how the current version of this date library formats time zones, then fix my date helper." | Lyna AI fetches the docs, then changes your helper.         |
| Add a feature with a new library | "Look up the latest docs for this charting library and add a line chart to the dashboard."                        | It reads the docs and adds the chart.                       |
| Find the right library           | "Use Context7 to find the library id of the charting library in this project."                                    | It answers with the id it found.                            |
| Get examples in your language    | "Find TypeScript examples for this form library's validation."                                                    | It puts examples in that language first.                    |
| Upgrade with care                | "Use Context7 to list what changes in the next major version of this router library."                             | It reads the docs and tells you what it found.              |
| Settle a question                | "Use Context7 to check whether this library's upload option accepts a list."                                      | It answers from the docs and names the library it read.     |
| Compare two options              | "Use Context7 to compare how these two date libraries parse time zones."                                          | It reads both sets of docs and tells you where they differ. |

### Approvals and tool switches

Before a call, Lyna AI shows the tool and what it asks. You choose **Deny**, **Allow once**, **Always allow this tool** or **Always allow this connector**. A tool its server marks as read-only does not ask. A changed or new tool asks again, and **Ask again** on the connector's page takes a choice back.

Under **What Lyna AI can use**, each tool has a switch. Lyna AI stops using a tool you turn off, in your chats in this project.

### Stay safe

What a connector answers reaches the AI as data, never as instructions. Read each approval before you accept it.

- Context7's listed projects are contributed by their own owners. Context7 states that it cannot guarantee the accuracy, completeness or security of all library documentation.
- Read code examples like any code from the web before you keep them.

## Limits

- With no key you get lower rate limits. Context7 does not give the figures.
- The server code is open, but the backend that parses and crawls docs is private. See [Context7 on GitHub](https://github.com/upstash/context7).
- Connector tools run in Build mode. Plan and Ask do not run them.

## Troubleshooting

| What you see                                                               | What it means and what to do                                                                                                     |
| -------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
| **The project's cloud machine is off. Open the project, then test again.** | This connector runs in that machine. Open the project, then choose **Test connection**.                                          |
| **The server stopped before it answered. Check its command and settings.** | Choose **Test connection**. If it stops again, choose **Delete connection** under **More options**, then **Connect**.            |
| **Not tested yet**                                                         | No test has answered. Choose **Test connection**.                                                                                |
| **Connection failed**                                                      | The page says why next to it. If the server did not answer, choose **Test connection**.                                          |
| **New tools to review**                                                    | The server changed its list of tools, so Lyna stops using it until you decide. Read the list, then choose **Approve new tools**. |
| **Turned off**                                                             | Lyna AI does not use it. Choose **Turn on**.                                                                                     |
| Results are for the wrong library                                          | Give the exact library name or its id in your request.                                                                           |
| Lyna AI answers without Context7                                           | Add `use context7` to your request, as Context7 suggests.                                                                        |
| You reach a rate limit                                                     | Limits are lower with no key. Add a key from your Context7 account, as Ways to connect explains.                                 |

### Disconnect

**Turn off** stops Lyna from using the connector and keeps your settings. **Remove from this project**, under **More options**, takes it out of this project only, and shows when another project uses it. **Delete connection**, in the same menu, removes it from every project, with what it stored, and says first how many projects lose it. Context7 holds no account of yours in this setup, so there is nothing else to end.

## Related

- [Connectors](/integrations/connectors): What connectors are and how the chat uses them.
- [Brave Search](/integrations/connectors/brave-search): Search the web from the chat.
- [MCP servers](/features/ai/mcp-servers): Manage your servers.
- [Chat modes](/features/ai/chat-modes): Build, Plan and Ask.
