Skip to main content
Greptile MCP supports OAuth and organization API keys.
Use OAuth for interactive IDE sessions. Use an API key for automation or clients that cannot complete a browser sign-in.
OAuth requires a server entry without a static Authorization header or bearer-token setting. Remove either credential before starting OAuth. Other headers, including X-Greptile-Tenant, can be used with OAuth.

OAuth setup

OAuth signs you in through your browser. You do not need to create an API key or register an OAuth client.
1

Open MCP settings

Open Customize and select MCPs.
2

Add Greptile

Add this configuration to project-level .cursor/mcp.json or user-level ~/.cursor/mcp.json:
3

Sign in

Ask Cursor:
On the first protected tool call, follow the browser prompt to sign in.
4

Verify the connection

Run the same prompt again. A successful list_custom_context result confirms authentication. Seeing Greptile’s tools in settings confirms discovery, but not authentication.

Multiple organizations

Accounts with more than one Greptile organization get tenant_required. The error lists every organization you belong to, by name and id. Set X-Greptile-Tenant to your organization’s handle or id. The handle is the first path segment of every Greptile URL, for example app.greptile.com/your-handle. The id is the one in the error. Any member can read the handle from the URL. Only an admin can change it. See Change organization handle. If the handle changes, update the header. The id never changes. This header routes requests. It does not authenticate them and works with OAuth.
Add the header to the OAuth server entry:
If your client cannot set headers, pass the same handle or id as the organization argument on any tool call. If you set both, reads follow the argument. Tool calls that write are rejected when the two name different organizations.

API key setup

Create an API key in Settings > Organization > API Keys, then configure your client below.
Do not paste an API key directly into a configuration file that can be committed. Use an environment variable or a password input.
On macOS or Linux, open the Command Palette and run Shell Command: Install ‘cursor’ command in PATH once. Then set the key and launch Cursor from the same terminal so the app inherits it:
Then add this configuration to project-level .cursor/mcp.json or user-level ~/.cursor/mcp.json:
Save the file, then call a Greptile tool to verify authentication.

Verify API key authentication

Call an authenticated tool directly:
A valid key returns a JSON-RPC result. An invalid or revoked key returns 401 Unauthorized.

Troubleshooting

MCP discovery can succeed before authentication is complete. Run claude mcp login greptile or codex mcp login greptile. In Cursor or VS Code, invoke a protected tool such as list_custom_context, then finish the OAuth prompt.
Remove any static Authorization header or bearer-token setting from the Greptile server entry, restart the client, then invoke a protected tool such as list_custom_context. The resulting authentication challenge starts OAuth discovery.
Claude Code users can run claude mcp login greptile --no-browser and open the printed URL manually. In Cursor or VS Code, invoke a protected tool such as list_custom_context to trigger authentication.
Your account belongs to multiple Greptile organizations. See Multiple organizations to find your organization’s handle or id and set it as the X-Greptile-Tenant header. Agents can pass it as the organization argument instead.
Confirm that the key has no extra spaces, has not been revoked, and belongs to an organization that can access the requested repositories. Use the authenticated curl request above to test it.
Restart the client, confirm Greptile is enabled, and check that the server URL is exactly https://api.greptile.com/mcp.
Confirm that your organization has repositories indexed in Greptile and that your user or API key can access them.

Configuration file locations

Next steps

Auto-Fix Workflow

Resolve Greptile comments from your IDE.

Tools Reference

Read the tools reference.