Skip to content

Commit a5fd722

Browse files
mikecannConvex, Inc.
authored and
Convex, Inc.
committed
Adding github copilot docs (#37311)
GitOrigin-RevId: 1f859d4a81060b3075e372e467dc77c784018d1c
1 parent 00dbc4e commit a5fd722

6 files changed

+78
-4
lines changed

npm-packages/docs/docs/ai.mdx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,16 @@ models work best with Convex, check out our LLM
4141
AI code generation is most effective when you provide it with a set of rules to
4242
follow.
4343

44-
If you're using Cursor, add the `.mdc` files in your project's `.cursor/rules/`
45-
directory:
44+
See these documents for install instructions:
4645

47-
- [Convex Cursor Rules](https://convex.link/convex_rules.mdc)
46+
- [Cursor](/ai/using-cursor.mdx#add-convex-cursorrules)
47+
- [Windsurf](/ai/using-windsurf.mdx#add-convex-rules)
48+
- [Github Copilot](/ai/using-github-copilot.mdx#add-convex-instructions)
4849

4950
For all other IDEs, add the following rules file to your project and refer to it
5051
when prompting for changes:
5152

52-
- [Convex Rules](https://convex.link/convex_rules.txt)
53+
- [convex_rules.txt](https://convex.link/convex_rules.txt)
5354

5455
We're constantly working on improving the quality of these rules for Convex by
5556
using rigorous evals. You can help by

npm-packages/docs/docs/ai/convex-mcp-server.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ See editor specific instructions:
1919

2020
- [Cursor](/ai/using-cursor.mdx#setup-the-convex-mcp-server)
2121
- [Windsurf](/ai/using-windsurf.mdx#setup-the-convex-mcp-server)
22+
- [VSCode](/ai/using-github-copilot.mdx#setup-the-convex-mcp-server)
2223

2324
## Available Tools
2425

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
---
2+
title: "Using Github Copilot with Convex"
3+
sidebar_position: 200
4+
description: "Tips and best practices for using Github Copilot with Convex"
5+
slug: "using-github-copilot"
6+
---
7+
8+
[Github Copilot](https://github.com/features/copilot), the AI built into VSCode,
9+
makes it easy to write and maintain apps built with Convex. Let's walk through
10+
how to setup Github Copilot for the best possible results with Convex.
11+
12+
## Add Convex Instructions
13+
14+
Add the following
15+
[instructions](https://code.visualstudio.com/docs/copilot/copilot-customization#_instruction-files)
16+
file to your `.github/instructions` directory in your project and it will
17+
automatically be included when working with Typescript or Javascript files:
18+
19+
- [convex.instructions.md](https://convex.link/convex_github_copilot_instructions)
20+
21+
![Showing Where to Put Github Copilot Instructions](/img/showing-where-to-put-convex-instructions.png)
22+
23+
If you would rather that the instructions file is NOT automatically pulled into
24+
context then open the file in your editor and alter the `applyTo` field at the
25+
top. Read more about instructions files here:
26+
https://code.visualstudio.com/docs/copilot/copilot-customization#_use-instructionsmd-files
27+
28+
We're constantly working on improving the quality of these rules for Convex by
29+
using rigorous evals. You can help by
30+
[contributing to our evals repo](https://github.com/get-convex/convex-evals).
31+
32+
## Setup the Convex MCP Server
33+
34+
The Convex CLI comes with a
35+
[Convex Model Context Protocol](/ai/convex-mcp-server.mdx) (MCP) server built
36+
in. The Convex MCP server gives your AI coding agent access to the your Convex
37+
deployment to query and optimize your project.
38+
39+
To get started with
40+
[MCP in VSCode](https://code.visualstudio.com/docs/copilot/chat/mcp-servers)
41+
then create a file in `.vscode/mcp.json` and add the following:
42+
43+
```json
44+
{
45+
"servers": {
46+
"convex-mcp": {
47+
"type": "stdio",
48+
"command": "npx",
49+
"args": ["-y", "convex@latest", "mcp", "start"]
50+
}
51+
}
52+
}
53+
```
54+
55+
Once this is done it will take a few seconds to start up the MCP server and then
56+
you should see the Convex tool listed in the codelens:
57+
58+
![Convex Tool in Codelens](/img/convex-tool-in-codelens.png)
59+
60+
and in the selection of tools that the model has access to in chat:
61+
62+
![Convex Tool in Chat](/img/convex-tools-in-chat.png)
63+
64+
Now start asking it questions like:
65+
66+
- Evaluate and convex schema and suggest improvements
67+
- What are this app's public endpoints?
68+
- Run the `my_convex_function` query
69+
70+
If you want to use the MCP server globally for all your projects then you can
71+
add it to your user settings, please see these docs for more information:
72+
https://code.visualstudio.com/docs/copilot/chat/mcp-servers#_add-an-mcp-server-to-your-user-settings
Loading
Loading
Loading

0 commit comments

Comments
 (0)