# Greptile MCP for AI Agents AI Agent Connect

> Greptile lets your AI agent actually understand your entire codebase instead of just looking at the file you have open. It indexes your repositories so you can ask complex technical questions about your architecture, find specific logic across multiple repos, and get answers backed by actual code references.

## Overview
- **Category:** developer-tools
- **Price:** Free
- **Endpoint:** https://edge.vinkius.com/vk_preview_JjO0hZW2yPNTgFluo5v382Yb9GmYI7NAmGBDNUxG/ai-agent-connect
- **Tags:** codebase-intelligence, semantic-search, repository-indexing, natural-language-query, code-understanding, developer-productivity

## Description

Greptile gives your AI agent a complete map of your engineering workspace. When you're working on a massive codebase, finding the right piece of logic feels like searching for a needle in a haystack. You spend hours jumping between tabs, trying to figure out how a specific middleware handles authentication or where a certain database migration is defined. This Connector changes that by letting your agent see the relationships between files, functions, and dependencies. You can ask it to explain a complex flow, find every instance of a specific pattern, or even help you track down technical debt across different services. It handles the heavy lifting of indexing your GitHub or GitLab repos, so you don't have to manually feed the AI context every time you start a new task. You can find this and thousands of other tools in the Vinkius catalog to build out your development environment. Instead of copy-pasting snippets into a chat window, you just talk to your code. It gives you the ability to move faster without losing the context of the bigger picture. It's like giving your agent a senior engineer who has already read every line of your repository.

## Tools

### delete_repository
Remove an old or incorrect repository from your index to keep your workspace clean.

### query_with_context
Continue a conversation where the AI remembers the previous code snippets you discussed.

### reindex_repository
Trigger a fresh scan of a repository to ensure the AI has the latest code changes.

### search_by_filepath
Look for specific patterns or terms only within a single file path.

### search_codebase
Perform a semantic search across your entire indexed codebase to find relevant logic.

### get_file_info
Pull metadata for a specific file to see its size, lines, and last updated status.

### get_repository_status
Check if your repository is finished indexing or still processing in the background.

### get_greptile_usage
Monitor your API consumption and remaining rate limits to manage your subscription.

### index_repository
Submit a new GitHub or GitLab repository to the system for AI analysis.

### list_repositories
See a full list of all the repositories you've currently indexed.

### query_codebase
Ask a general technical question and get an answer with specific code references.

## Prompt Examples

**Prompt:** 
```
How does the authentication middleware work in our backend repository?
```

**Response:** 
```
Based on your indexed repository, the authentication middleware is implemented in `src/middleware/auth.ts` (lines 12-48). It uses a JWT-based flow:

* **Extracts** the Bearer token from the Authorization header (line 18).
* **Verifies** the token signature using the RS256 algorithm (line 24).
* **Attaches** the decoded user payload to `req.user` (line 32).

The middleware is applied globally in `src/app.ts` line 15 via `app.use(authMiddleware)`.
```

**Prompt:** 
```
Search for all files that import the database connection module and show me the file info.
```

**Response:** 
```
Semantic search for 'database connection import' found 8 files. 

| File Path | Functions | Status |
| :--- | :--- | :--- |
| `src/services/user-service.ts` | 42 | Indexed |
| `src/services/order-service.ts` | 28 | Indexed |
| `src/repositories/user-repo.ts` | 15 | Indexed |

File info for `src/config/database.ts`: 89 lines, exports `db` (Knex instance) and `pool` (pg Pool).
```

**Prompt:** 
```
Index our new frontend repository and check the indexing status.
```

**Response:** 
```
Repository submitted for indexing! 

**Remote:** github
**Repository:** company/frontend-app
**Branch:** main
**Current status:** processing (45% complete)

Estimated time remaining: 3 minutes. Once completed, you'll be able to query and search the frontend codebase.
```

## Capabilities

### Ask questions about your code
Query your entire codebase to get answers with specific code references.

### Keep track of conversation context
Continue a conversation where the AI remembers the previous code snippets you discussed.

### Find files by meaning
Perform a semantic search to locate logic even when you don't know the exact variable names.

### Search within specific file paths
Narrow down your search to a single file or directory for more precise results.

### Add new repos to the index
Submit new GitHub or GitLab repositories to be indexed for AI analysis.

### Check indexing progress
See if your repository is finished processing or still being scanned.

### View your API usage
Monitor your consumption and rate limits to manage your subscription.

## Use Cases

### Onboarding a new developer
An engineer asks the agent to explain the auth flow in a massive backend repo they just joined, getting a summary with code links.

### Hunting down bugs
A dev uses search_codebase to find every place a specific legacy function is called to see what might break during a refactor.

### Rapid code review
A reviewer asks for all files that import a specific module to check for missing dependencies or side effects in a PR.

### Architecture audits
A manager asks the agent to summarize the technical debt and architecture patterns in a shared library repository.

## Benefits

- Stop copy-pasting code into your chat window. Use query_codebase to let your agent find the relevant snippets itself.
- Get accurate answers on complex architecture. query_with_context ensures the AI remembers the flow of your previous questions.
- Find files by meaning, not just keywords. search_codebase helps you locate logic even when you don't know the exact variable names.
- Manage your workspace efficiently. Use list_repositories and delete_repository to keep your active index focused on what matters.
- Stay updated on your indexing status. get_repository_status lets you know exactly when your new code is ready for querying.
- Pinpoint issues in specific files. search_by_filepath narrows the search area so you don't get buried in irrelevant results.

## How It Works

The bottom line is you get a searchable, queryable map of your entire engineering workspace that your AI can actually use.

1. Grab your Greptile API Key from the developer dashboard.
2. Connect the Connector to your preferred AI client like Cursor or Claude.
3. Ask questions about your codebase and get answers with specific code links.

## Frequently Asked Questions

**Can Greptile help me understand a legacy codebase?**
Yes. It indexes your entire repository so your agent can explain complex logic, find dependencies, and walk you through how different parts of the system interact.

**How does Greptile handle multiple repositories?**
You can index multiple repositories at once. This allows your agent to answer questions that span across different services or shared libraries.

**Does Greptile help with finding technical debt?**
Absolutely. You can ask your agent to identify outdated patterns, find unused functions, or summarize technical debt across your indexed repos.

**Can I use Greptile to find specific code patterns?**
Yes. It uses semantic search to find logic based on meaning, not just exact keywords, making it much easier to find specific implementations.

**How do I keep my Greptile index up to date?**
You can trigger a reindex of your repository whenever you make significant changes to ensure your agent always has the latest information.

**Can I ask natural language questions about my codebase?**
Yes! The `query_codebase` tool sends a natural language question along with repository references and returns AI-generated answers with specific code references (file paths and line numbers). For follow-up questions, use `query_with_context` with the session ID from the previous response to maintain conversation continuity.

**Do I need to index my repository before querying it?**
Yes. Use `index_repository` with the remote host (github or gitlab), repository path (owner/repo), and branch name. Check indexing progress with `get_repository_status`. Once indexed, you can query and search the repository. Use `reindex_repository` to refresh the index after significant code changes.

**Can I search for specific code patterns across my repositories?**
Yes. The `search_codebase` tool performs semantic search across your indexed repositories to find relevant files and functions. For targeted results, use `search_by_filepath` to narrow the search to a specific file path. Use `get_file_info` to retrieve indexed metadata for any file.