octocode-mcp 7.0.2 → 7.0.3-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +587 -413
- package/dist/index.js +1 -1
- package/dist/src/prompts.d.ts +1 -0
- package/dist/src/tools/github_fetch_content.d.ts +2 -1
- package/dist/src/tools/github_search_code.d.ts +2 -1
- package/dist/src/tools/github_search_pull_requests.d.ts +2 -1
- package/dist/src/tools/github_search_repos.d.ts +2 -1
- package/dist/src/tools/github_view_repo_structure.d.ts +2 -1
- package/dist/src/tools/toolConfig.d.ts +2 -1
- package/dist/src/tools/toolsManager.d.ts +4 -1
- package/dist/src/types.d.ts +6 -0
- package/dist/tests/tools/callback.test.d.ts +1 -0
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -1,88 +1,49 @@
|
|
|
1
|
-
|
|
2
|
-
<img src="https://github.com/bgauryy/octocode-mcp/raw/main/packages/octocode-mcp/assets/logo_white.png" width="400px" alt="Octocode Logo">
|
|
3
|
-
|
|
4
|
-
**Transform Any AI Assistant Into a Code Research Expert**
|
|
5
|
-
|
|
6
|
-
The missing piece for AI agents that need quality code context. Search millions of repositories, analyze real implementations, and discover proven patterns — all through a secure, token-efficient MCP server.
|
|
7
|
-
|
|
8
|
-
[](https://github.com/modelcontextprotocol/servers)
|
|
9
|
-
[](https://deepwiki.com/bgauryy/octocode-mcp)
|
|
10
|
-
[](https://archestra.ai/mcp-catalog/bgauryy__octocode-mcp)
|
|
11
|
-
|
|
12
|
-
</div>
|
|
1
|
+
# Octocode MCP Server
|
|
13
2
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
## 📑 Table of Contents
|
|
17
|
-
|
|
18
|
-
- [Why Octocode MCP?](#-why-octocode-mcp)
|
|
19
|
-
- [Quick Start](#-quick-start-2-minutes)
|
|
20
|
-
- [How to Choose the Right Tool](#-how-to-choose-the-right-tool)
|
|
21
|
-
- [Available Tools](#-available-research-tools)
|
|
22
|
-
- [Platform Setup](#-platform-setup)
|
|
23
|
-
- [Real-World Examples](#-real-world-examples)
|
|
24
|
-
- [Advanced Configuration](#-advanced-configuration)
|
|
25
|
-
- [Documentation & Resources](#-documentation--resources)
|
|
26
|
-
- [Community & Support](#-community--support)
|
|
27
|
-
|
|
28
|
-
---
|
|
29
|
-
|
|
30
|
-
## Why Octocode MCP?
|
|
3
|
+
**Model Context Protocol Server for GitHub Code Research**
|
|
31
4
|
|
|
32
|
-
|
|
5
|
+
[](https://www.npmjs.com/package/octocode-mcp)
|
|
6
|
+
[](../../LICENSE)
|
|
33
7
|
|
|
34
|
-
|
|
8
|
+
MCP server implementation providing five specialized tools for AI-driven GitHub code research with enterprise-grade security and token optimization.
|
|
35
9
|
|
|
36
|
-
|
|
37
|
-
- ✅ Debug difficult issues by finding similar solutions
|
|
38
|
-
- ✅ Understand how enterprise-scale systems work
|
|
39
|
-
- ✅ Learn best practices from production code
|
|
40
|
-
- ✅ Create comprehensive technical documentation
|
|
10
|
+
**For general overview and getting started, see the [main README](../../README.md).**
|
|
41
11
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
### The Octocode Solution
|
|
45
|
-
|
|
46
|
-
Octocode MCP bridges this gap by providing AI assistants with **real-time access to millions of GitHub repositories**, enabling:
|
|
47
|
-
|
|
48
|
-
| Capability | What You Get |
|
|
49
|
-
|-----------|-------------|
|
|
50
|
-
| **🔍 Smart Code Discovery** | Find relevant implementations using semantic search across millions of repositories |
|
|
51
|
-
| **📊 Progressive Research** | AI-powered workflows that build comprehensive understanding through multiple queries |
|
|
52
|
-
| **🏗️ Ecosystem Understanding** | Analyze how real organizations structure complex systems and solve hard problems |
|
|
53
|
-
| **📚 Real-World Examples** | Access production code, not toy examples or outdated tutorials |
|
|
54
|
-
| **🔒 Enterprise-Grade Security** | Automatic content sanitization, respects GitHub permissions, redacts sensitive data |
|
|
55
|
-
| **⚡ Token-Efficient** | Smart content minification reduces token usage by up to 70% |
|
|
56
|
-
|
|
57
|
-
### Perfect For
|
|
12
|
+
---
|
|
58
13
|
|
|
59
|
-
|
|
60
|
-
- **🐛 Complex Bug Fixes**: Find real solutions for complex bugs by analyzing how others solved similar issues
|
|
61
|
-
- **🏢 Enterprise Solutions**: Understand how large-scale systems are architected and maintained
|
|
62
|
-
- **📖 Documentation**: Enrich technical docs with real, tested code examples
|
|
63
|
-
- **🎓 Learning**: Discover how experienced developers tackle challenging problems
|
|
64
|
-
- **🔍 Technology Research**: Research new frameworks, patterns, and best practices
|
|
14
|
+
## Table of Contents
|
|
65
15
|
|
|
66
|
-
|
|
16
|
+
- [Installation](#installation)
|
|
17
|
+
- [API Reference](#api-reference)
|
|
18
|
+
- [githubSearchCode](#githubsearchcode)
|
|
19
|
+
- [githubSearchRepositories](#githubsearchrepositories)
|
|
20
|
+
- [githubViewRepoStructure](#githubviewrepostructure)
|
|
21
|
+
- [githubGetFileContent](#githubgetfilecontent)
|
|
22
|
+
- [githubSearchPullRequests](#githubsearchpullrequests)
|
|
23
|
+
- [Configuration](#configuration)
|
|
24
|
+
- [Authentication](#authentication)
|
|
25
|
+
- [Advanced Usage](#advanced-usage)
|
|
26
|
+
- [Documentation](#documentation)
|
|
67
27
|
|
|
68
|
-
|
|
28
|
+
---
|
|
69
29
|
|
|
70
|
-
|
|
30
|
+
## Installation
|
|
71
31
|
|
|
72
|
-
|
|
32
|
+
### NPM
|
|
73
33
|
|
|
74
|
-
|
|
34
|
+
```bash
|
|
35
|
+
npm install octocode-mcp
|
|
36
|
+
```
|
|
75
37
|
|
|
76
|
-
###
|
|
38
|
+
### NPX (Recommended for MCP)
|
|
77
39
|
|
|
78
|
-
|
|
79
|
-
-
|
|
80
|
-
|
|
81
|
-
- Personal Access Token: Create at [github.com/settings/tokens](https://github.com/settings/tokens) with `repo`, `read:user`, `read:org` scopes
|
|
40
|
+
```bash
|
|
41
|
+
npx octocode-mcp@latest
|
|
42
|
+
```
|
|
82
43
|
|
|
83
|
-
###
|
|
44
|
+
### Configuration
|
|
84
45
|
|
|
85
|
-
Add
|
|
46
|
+
Add to your MCP client configuration:
|
|
86
47
|
|
|
87
48
|
```json
|
|
88
49
|
{
|
|
@@ -95,405 +56,529 @@ Add Octocode MCP to your AI assistant's configuration:
|
|
|
95
56
|
}
|
|
96
57
|
```
|
|
97
58
|
|
|
98
|
-
**
|
|
99
|
-
|
|
100
|
-
**Using a Personal Access Token?** Add it to the `env` section (see Platform Setup for examples).
|
|
101
|
-
|
|
102
|
-
### Verify Installation
|
|
103
|
-
|
|
104
|
-
After setup, try this in your AI assistant:
|
|
105
|
-
|
|
106
|
-
```
|
|
107
|
-
"Search for React hooks implementations in popular repositories"
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
If you see search results from GitHub repositories, you're all set! 🎉
|
|
59
|
+
**Platform-specific setup**: See [main README - Platform Setup](../../README.md#platform-specific-setup)
|
|
111
60
|
|
|
112
61
|
---
|
|
113
62
|
|
|
114
|
-
##
|
|
63
|
+
## API Reference
|
|
115
64
|
|
|
116
|
-
|
|
65
|
+
### githubSearchCode
|
|
117
66
|
|
|
118
|
-
|
|
119
|
-
📝 What do you want to do?
|
|
120
|
-
|
|
121
|
-
├─ 🔍 Find code or examples
|
|
122
|
-
│ ├─ Know what you're looking for → githubSearchCode
|
|
123
|
-
│ └─ Need to discover repositories first → githubSearchRepositories
|
|
124
|
-
│
|
|
125
|
-
├─ 📂 Explore a repository
|
|
126
|
-
│ ├─ See file/folder structure → githubViewRepoStructure
|
|
127
|
-
│ └─ Read specific files → githubGetFileContent
|
|
128
|
-
│
|
|
129
|
-
├─ 📚 Understand changes/history
|
|
130
|
-
│ └─ Analyze pull requests → githubSearchPullRequests
|
|
131
|
-
│
|
|
132
|
-
└─ Not sure where to start?
|
|
133
|
-
└─ Start broad with githubSearchRepositories → then narrow down
|
|
134
|
-
```
|
|
67
|
+
Search for code implementations across GitHub repositories.
|
|
135
68
|
|
|
136
|
-
|
|
69
|
+
#### Parameters
|
|
137
70
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
71
|
+
```typescript
|
|
72
|
+
interface GithubSearchCodeParams {
|
|
73
|
+
// Query parameters
|
|
74
|
+
keywordsToSearch: string[]; // Required: Search terms (AND logic)
|
|
75
|
+
|
|
76
|
+
// Filters
|
|
77
|
+
owner?: string; // Repository owner/organization
|
|
78
|
+
repo?: string; // Specific repository name
|
|
79
|
+
path?: string; // Directory path filter
|
|
80
|
+
filename?: string; // Filename pattern (case-insensitive)
|
|
81
|
+
extension?: string; // File extension without dot (e.g., "ts", "js")
|
|
82
|
+
|
|
83
|
+
// Search mode
|
|
84
|
+
match?: "file" | "path"; // "file" = search IN content (default)
|
|
85
|
+
// "path" = search file/directory names
|
|
86
|
+
|
|
87
|
+
// Control
|
|
88
|
+
limit?: number; // Max results: 1-20 (default: 10)
|
|
89
|
+
minify?: boolean; // Minify results (default: true)
|
|
90
|
+
sanitize?: boolean; // Sanitize secrets (default: true)
|
|
91
|
+
}
|
|
92
|
+
```
|
|
145
93
|
|
|
146
|
-
|
|
94
|
+
#### Response
|
|
147
95
|
|
|
148
|
-
|
|
96
|
+
```typescript
|
|
97
|
+
interface GithubSearchCodeResponse {
|
|
98
|
+
results: Array<{
|
|
99
|
+
path: string; // File path
|
|
100
|
+
repository: {
|
|
101
|
+
owner: string;
|
|
102
|
+
name: string;
|
|
103
|
+
full_name: string;
|
|
104
|
+
html_url: string;
|
|
105
|
+
description: string;
|
|
106
|
+
stars: number;
|
|
107
|
+
};
|
|
108
|
+
text_matches?: Array<{ // Only when match="file"
|
|
109
|
+
fragment: string; // Code snippet with match
|
|
110
|
+
matches: Array<{
|
|
111
|
+
text: string;
|
|
112
|
+
indices: [number, number];
|
|
113
|
+
}>;
|
|
114
|
+
}>;
|
|
115
|
+
}>;
|
|
116
|
+
total_count: number;
|
|
117
|
+
incomplete_results: boolean;
|
|
118
|
+
}
|
|
119
|
+
```
|
|
149
120
|
|
|
150
|
-
|
|
121
|
+
#### Best Practices
|
|
151
122
|
|
|
152
|
-
|
|
153
|
-
**
|
|
123
|
+
- **Discovery**: Use `match="path"` for fast file location (25x faster, 20 tokens vs 500)
|
|
124
|
+
- **Analysis**: Use `match="file"` with low `limit` (5-10) for detailed matches
|
|
125
|
+
- **Scope**: Always specify `owner`/`repo` when possible to avoid rate limits
|
|
126
|
+
- **Keywords**: Use specific terms (function names, error messages) over generic terms
|
|
154
127
|
|
|
155
|
-
|
|
156
|
-
- Finding how a function/class is implemented
|
|
157
|
-
- Discovering code patterns and examples
|
|
158
|
-
- Researching library usage
|
|
128
|
+
#### Examples
|
|
159
129
|
|
|
160
|
-
|
|
161
|
-
-
|
|
162
|
-
|
|
130
|
+
```typescript
|
|
131
|
+
// Fast discovery - find files with "auth" in path
|
|
132
|
+
{
|
|
133
|
+
keywordsToSearch: ["auth"],
|
|
134
|
+
match: "path"
|
|
135
|
+
}
|
|
163
136
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
137
|
+
// Detailed search - find OAuth implementations
|
|
138
|
+
{
|
|
139
|
+
owner: "passportjs",
|
|
140
|
+
repo: "passport",
|
|
141
|
+
keywordsToSearch: ["OAuth2", "strategy"],
|
|
142
|
+
extension: "js",
|
|
143
|
+
limit: 5
|
|
144
|
+
}
|
|
168
145
|
|
|
169
|
-
|
|
170
|
-
```typescript
|
|
146
|
+
// Targeted search - find exports in specific directory
|
|
171
147
|
{
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
extension?: string; // Filter by file type
|
|
178
|
-
limit?: number; // Max results (1-20)
|
|
148
|
+
owner: "facebook",
|
|
149
|
+
repo: "react",
|
|
150
|
+
path: "packages/react/src",
|
|
151
|
+
keywordsToSearch: ["export", "function"],
|
|
152
|
+
match: "file"
|
|
179
153
|
}
|
|
180
154
|
```
|
|
181
155
|
|
|
182
156
|
---
|
|
183
157
|
|
|
184
|
-
|
|
185
|
-
**Discover repositories by topic, language, or description**
|
|
186
|
-
|
|
187
|
-
**Best for:**
|
|
188
|
-
- Finding projects in specific domains
|
|
189
|
-
- Discovering popular implementations
|
|
190
|
-
- Research technology ecosystems
|
|
158
|
+
### githubSearchRepositories
|
|
191
159
|
|
|
192
|
-
|
|
193
|
-
- Searching inside code (use `githubSearchCode`)
|
|
194
|
-
- Reading repository content (use `githubViewRepoStructure` first)
|
|
160
|
+
Discover GitHub repositories by topics, keywords, or metadata.
|
|
195
161
|
|
|
196
|
-
|
|
197
|
-
- "Find popular React component libraries"
|
|
198
|
-
- "Show me microservices examples with high stars"
|
|
199
|
-
- "Discover AI agent frameworks"
|
|
162
|
+
#### Parameters
|
|
200
163
|
|
|
201
|
-
**Arguments:**
|
|
202
164
|
```typescript
|
|
203
|
-
{
|
|
204
|
-
|
|
205
|
-
topicsToSearch?: string[];
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
165
|
+
interface GithubSearchRepositoriesParams {
|
|
166
|
+
// Query modes (use one or both)
|
|
167
|
+
topicsToSearch?: string[]; // GitHub topic tags (exact match, curated)
|
|
168
|
+
keywordsToSearch?: string[]; // Search name/description/README (AND logic)
|
|
169
|
+
|
|
170
|
+
// Filters
|
|
171
|
+
owner?: string; // Organization or user
|
|
172
|
+
stars?: string; // Examples: ">1000", "100..500", "<100"
|
|
173
|
+
language?: string; // Programming language (e.g., "TypeScript")
|
|
174
|
+
size?: string; // Repo size in KB (e.g., ">1000", "<500")
|
|
175
|
+
created?: string; // Creation date (e.g., ">=2024-01-01")
|
|
176
|
+
updated?: string; // Last update date
|
|
177
|
+
|
|
178
|
+
// Search scope
|
|
179
|
+
match?: ("name" | "description" | "readme")[]; // Fields to search (OR logic)
|
|
180
|
+
|
|
181
|
+
// Control
|
|
182
|
+
sort?: "stars" | "forks" | "updated" | "best-match";
|
|
183
|
+
limit?: number; // Max results: 1-20 (default: 5)
|
|
211
184
|
}
|
|
212
185
|
```
|
|
213
186
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
#### `githubViewRepoStructure`
|
|
217
|
-
**Explore repository file and folder structure**
|
|
218
|
-
|
|
219
|
-
**Best for:**
|
|
220
|
-
- Understanding project organization
|
|
221
|
-
- Finding where specific code lives
|
|
222
|
-
- Navigating before reading files
|
|
223
|
-
|
|
224
|
-
**Not recommended for:**
|
|
225
|
-
- Reading file contents (use `githubGetFileContent`)
|
|
226
|
-
- Searching across repos (use `githubSearchCode`)
|
|
187
|
+
#### Response
|
|
227
188
|
|
|
228
|
-
**Example Prompts:**
|
|
229
|
-
- "Show me the structure of the React repository"
|
|
230
|
-
- "What's in the src folder of this project?"
|
|
231
|
-
- "Explore the components directory"
|
|
232
|
-
|
|
233
|
-
**Arguments:**
|
|
234
189
|
```typescript
|
|
235
|
-
{
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
190
|
+
interface GithubSearchRepositoriesResponse {
|
|
191
|
+
results: Array<{
|
|
192
|
+
owner: string;
|
|
193
|
+
name: string;
|
|
194
|
+
full_name: string;
|
|
195
|
+
description: string;
|
|
196
|
+
html_url: string;
|
|
197
|
+
stars: number;
|
|
198
|
+
forks: number;
|
|
199
|
+
language: string;
|
|
200
|
+
topics: string[];
|
|
201
|
+
created_at: string;
|
|
202
|
+
updated_at: string;
|
|
203
|
+
size: number; // KB
|
|
204
|
+
}>;
|
|
205
|
+
total_count: number;
|
|
241
206
|
}
|
|
242
207
|
```
|
|
243
208
|
|
|
244
|
-
|
|
209
|
+
#### Best Practices
|
|
245
210
|
|
|
246
|
-
|
|
247
|
-
**
|
|
211
|
+
- **Discovery**: Use `topicsToSearch` for curated, high-quality results
|
|
212
|
+
- **Quality**: Filter with `stars=">1000"` for production-ready code
|
|
213
|
+
- **Maintenance**: Use `updated` filter for actively maintained projects
|
|
214
|
+
- **Scope**: Combine topics + stars for best results
|
|
248
215
|
|
|
249
|
-
|
|
250
|
-
- Reading specific files
|
|
251
|
-
- Getting code context around matches
|
|
252
|
-
- Line-range based reading
|
|
216
|
+
#### Examples
|
|
253
217
|
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
218
|
+
```typescript
|
|
219
|
+
// Find quality TypeScript CLI tools
|
|
220
|
+
{
|
|
221
|
+
topicsToSearch: ["typescript", "cli"],
|
|
222
|
+
stars: ">1000",
|
|
223
|
+
sort: "stars"
|
|
224
|
+
}
|
|
257
225
|
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
226
|
+
// Recent authentication libraries
|
|
227
|
+
{
|
|
228
|
+
keywordsToSearch: ["authentication", "jwt"],
|
|
229
|
+
language: "JavaScript",
|
|
230
|
+
updated: ">=2024-01-01",
|
|
231
|
+
limit: 10
|
|
232
|
+
}
|
|
262
233
|
|
|
263
|
-
|
|
264
|
-
```typescript
|
|
234
|
+
// Organization's popular repos
|
|
265
235
|
{
|
|
266
|
-
owner:
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
startLine?: number; // Optional: Start reading from line
|
|
270
|
-
endLine?: number; // Optional: End reading at line
|
|
271
|
-
matchString?: string; // Optional: Find and return context around match
|
|
272
|
-
matchStringContextLines?: number; // Lines of context (default: 5)
|
|
273
|
-
branch?: string; // Branch name
|
|
236
|
+
owner: "facebook",
|
|
237
|
+
sort: "stars",
|
|
238
|
+
limit: 20
|
|
274
239
|
}
|
|
275
240
|
```
|
|
276
241
|
|
|
277
242
|
---
|
|
278
243
|
|
|
279
|
-
###
|
|
280
|
-
|
|
281
|
-
#### `githubSearchPullRequests`
|
|
282
|
-
**Analyze pull requests, changes, and discussions**
|
|
244
|
+
### githubViewRepoStructure
|
|
283
245
|
|
|
284
|
-
|
|
246
|
+
Explore repository directory structure with file sizes.
|
|
285
247
|
|
|
286
|
-
|
|
287
|
-
- Understanding how features were implemented
|
|
288
|
-
- Learning from code review discussions
|
|
289
|
-
- Analyzing bug fixes and solutions
|
|
248
|
+
#### Parameters
|
|
290
249
|
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
250
|
+
```typescript
|
|
251
|
+
interface GithubViewRepoStructureParams {
|
|
252
|
+
// Required
|
|
253
|
+
owner: string; // Repository owner
|
|
254
|
+
repo: string; // Repository name
|
|
255
|
+
branch: string; // Branch, tag, or SHA
|
|
256
|
+
|
|
257
|
+
// Optional
|
|
258
|
+
path?: string; // Directory path (default: "" = root)
|
|
259
|
+
depth?: 1 | 2; // Exploration depth (default: 1)
|
|
260
|
+
// 1 = current directory only
|
|
261
|
+
// 2 = includes subdirectories
|
|
262
|
+
}
|
|
263
|
+
```
|
|
294
264
|
|
|
295
|
-
|
|
296
|
-
- "Show me recent authentication PRs"
|
|
297
|
-
- "Find PRs that fixed performance issues"
|
|
298
|
-
- "Analyze how they implemented dark mode"
|
|
265
|
+
#### Response
|
|
299
266
|
|
|
300
|
-
**Arguments:**
|
|
301
267
|
```typescript
|
|
302
|
-
{
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
268
|
+
interface GithubViewRepoStructureResponse {
|
|
269
|
+
path: string; // Current directory path
|
|
270
|
+
files: Array<{
|
|
271
|
+
name: string;
|
|
272
|
+
path: string;
|
|
273
|
+
size: number; // Bytes
|
|
274
|
+
type: "file";
|
|
275
|
+
}>;
|
|
276
|
+
folders: Array<{
|
|
277
|
+
name: string;
|
|
278
|
+
path: string;
|
|
279
|
+
type: "dir";
|
|
280
|
+
files?: Array<...>; // Only when depth=2
|
|
281
|
+
folders?: Array<...>; // Only when depth=2
|
|
282
|
+
}>;
|
|
312
283
|
}
|
|
313
284
|
```
|
|
314
285
|
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
## 🖥️ Platform Setup
|
|
286
|
+
#### Best Practices
|
|
318
287
|
|
|
319
|
-
|
|
288
|
+
- **Start shallow**: Use `depth=1` for overview, then drill down
|
|
289
|
+
- **Navigate**: Use `path` to explore specific directories
|
|
290
|
+
- **Large repos**: Avoid `depth=2` on root of large repositories
|
|
320
291
|
|
|
321
|
-
|
|
292
|
+
#### Examples
|
|
322
293
|
|
|
323
|
-
```
|
|
294
|
+
```typescript
|
|
295
|
+
// Root overview
|
|
324
296
|
{
|
|
325
|
-
"
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
}
|
|
297
|
+
owner: "facebook",
|
|
298
|
+
repo: "react",
|
|
299
|
+
branch: "main",
|
|
300
|
+
path: "",
|
|
301
|
+
depth: 1
|
|
331
302
|
}
|
|
332
|
-
```
|
|
333
303
|
|
|
334
|
-
|
|
335
|
-
```json
|
|
304
|
+
// Deep dive into specific directory
|
|
336
305
|
{
|
|
337
|
-
"
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
"GITHUB_TOKEN": "ghp_your_token_here"
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
}
|
|
306
|
+
owner: "facebook",
|
|
307
|
+
repo: "react",
|
|
308
|
+
branch: "main",
|
|
309
|
+
path: "packages/react/src",
|
|
310
|
+
depth: 2
|
|
346
311
|
}
|
|
347
312
|
```
|
|
348
313
|
|
|
349
|
-
Restart Claude Desktop to activate.
|
|
350
|
-
|
|
351
314
|
---
|
|
352
315
|
|
|
353
|
-
###
|
|
316
|
+
### githubGetFileContent
|
|
354
317
|
|
|
355
|
-
|
|
356
|
-
2. Click **"+ Add New Global MCP Server"**
|
|
357
|
-
3. Enter configuration:
|
|
318
|
+
Read file contents with smart extraction capabilities.
|
|
358
319
|
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
320
|
+
#### Parameters
|
|
321
|
+
|
|
322
|
+
```typescript
|
|
323
|
+
interface GithubGetFileContentParams {
|
|
324
|
+
// Required
|
|
325
|
+
owner: string; // Repository owner
|
|
326
|
+
repo: string; // Repository name
|
|
327
|
+
path: string; // File path from repository root
|
|
328
|
+
|
|
329
|
+
// Optional
|
|
330
|
+
branch?: string; // Branch, tag, or SHA (default: default branch)
|
|
331
|
+
|
|
332
|
+
// Extraction modes (choose one)
|
|
333
|
+
// Mode 1: Pattern matching (most efficient)
|
|
334
|
+
matchString?: string; // Search pattern
|
|
335
|
+
matchStringContextLines?: number; // Context lines around match (1-50, default: 5)
|
|
336
|
+
|
|
337
|
+
// Mode 2: Line range
|
|
338
|
+
startLine?: number; // Start line (1-indexed)
|
|
339
|
+
endLine?: number; // End line (1-indexed)
|
|
340
|
+
|
|
341
|
+
// Mode 3: Full content
|
|
342
|
+
fullContent?: boolean; // Return entire file (default: false)
|
|
343
|
+
|
|
344
|
+
// Control
|
|
345
|
+
minified?: boolean; // Minify content (default: true)
|
|
346
|
+
sanitize?: boolean; // Sanitize secrets (default: true)
|
|
367
347
|
}
|
|
368
348
|
```
|
|
369
349
|
|
|
370
|
-
|
|
350
|
+
#### Response
|
|
371
351
|
|
|
372
|
-
|
|
352
|
+
```typescript
|
|
353
|
+
interface GithubGetFileContentResponse {
|
|
354
|
+
path: string;
|
|
355
|
+
content: string; // File content (full or extracted)
|
|
356
|
+
size: number; // Original file size in bytes
|
|
357
|
+
encoding: string;
|
|
358
|
+
sha: string;
|
|
359
|
+
extraction_mode: "pattern" | "range" | "full";
|
|
360
|
+
matches_found?: number; // When using matchString
|
|
361
|
+
}
|
|
362
|
+
```
|
|
373
363
|
|
|
374
|
-
|
|
364
|
+
#### Best Practices
|
|
375
365
|
|
|
376
|
-
|
|
366
|
+
- **Token efficiency**: Use `matchString` for 85% token savings vs `fullContent`
|
|
367
|
+
- **Large files**: Always use extraction (matchString or line range), never fullContent
|
|
368
|
+
- **Config files**: Set `minified=false` for JSON/YAML to preserve formatting
|
|
369
|
+
- **Precision**: Use `matchString` from `githubSearchCode` text_matches for accurate targeting
|
|
377
370
|
|
|
378
|
-
|
|
371
|
+
#### Examples
|
|
379
372
|
|
|
380
|
-
```
|
|
373
|
+
```typescript
|
|
374
|
+
// Extract function with context (BEST - most efficient)
|
|
381
375
|
{
|
|
382
|
-
"
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
376
|
+
owner: "jaredhanson",
|
|
377
|
+
repo: "passport",
|
|
378
|
+
path: "lib/strategies/oauth2.js",
|
|
379
|
+
matchString: "authorize",
|
|
380
|
+
matchStringContextLines: 20
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
// Read specific line range
|
|
384
|
+
{
|
|
385
|
+
owner: "facebook",
|
|
386
|
+
repo: "react",
|
|
387
|
+
path: "packages/react/src/React.js",
|
|
388
|
+
startLine: 1,
|
|
389
|
+
endLine: 50
|
|
388
390
|
}
|
|
389
|
-
```
|
|
390
391
|
|
|
391
|
-
|
|
392
|
+
// Read config file (preserve formatting)
|
|
393
|
+
{
|
|
394
|
+
owner: "microsoft",
|
|
395
|
+
repo: "TypeScript",
|
|
396
|
+
path: "tsconfig.json",
|
|
397
|
+
fullContent: true,
|
|
398
|
+
minified: false
|
|
399
|
+
}
|
|
400
|
+
```
|
|
392
401
|
|
|
393
402
|
---
|
|
394
403
|
|
|
395
|
-
###
|
|
404
|
+
### githubSearchPullRequests
|
|
396
405
|
|
|
397
|
-
|
|
406
|
+
Analyze pull requests, code changes, and discussions.
|
|
398
407
|
|
|
399
|
-
|
|
408
|
+
**Status**: Optional tool (disabled by default)
|
|
400
409
|
|
|
401
|
-
**
|
|
410
|
+
**Enable**: Set `ENABLE_TOOLS="githubSearchPullRequests"` in environment
|
|
402
411
|
|
|
403
|
-
|
|
412
|
+
#### Parameters
|
|
404
413
|
|
|
405
|
-
```
|
|
406
|
-
{
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
414
|
+
```typescript
|
|
415
|
+
interface GithubSearchPullRequestsParams {
|
|
416
|
+
// Identification (use one)
|
|
417
|
+
owner?: string; // Repository owner
|
|
418
|
+
repo?: string; // Repository name
|
|
419
|
+
prNumber?: number; // Direct PR fetch (fastest, bypasses search)
|
|
420
|
+
|
|
421
|
+
// Search filters (when not using prNumber)
|
|
422
|
+
state?: "open" | "closed";
|
|
423
|
+
merged?: boolean; // Only merged PRs (requires state="closed")
|
|
424
|
+
query?: string; // Free-text search in title/body/comments
|
|
425
|
+
match?: ("title" | "body" | "comments")[]; // Search scope
|
|
426
|
+
|
|
427
|
+
// Author and reviewers
|
|
428
|
+
author?: string;
|
|
429
|
+
assignee?: string;
|
|
430
|
+
reviewedBy?: string;
|
|
431
|
+
|
|
432
|
+
// Metadata filters
|
|
433
|
+
label?: string | string[]; // Label filter (OR logic if array)
|
|
434
|
+
base?: string; // Target branch
|
|
435
|
+
head?: string; // Source branch
|
|
436
|
+
|
|
437
|
+
// Date filters
|
|
438
|
+
created?: string; // Creation date (e.g., ">=2024-01-01")
|
|
439
|
+
updated?: string; // Last update date
|
|
440
|
+
merged?: string; // Merge date
|
|
441
|
+
closed?: string; // Close date
|
|
442
|
+
|
|
443
|
+
// Engagement filters
|
|
444
|
+
comments?: number | string; // Comment count (e.g., ">5", "10..20")
|
|
445
|
+
reactions?: number | string; // Reaction count
|
|
446
|
+
|
|
447
|
+
// Control
|
|
448
|
+
sort?: "created" | "updated" | "best-match";
|
|
449
|
+
order?: "asc" | "desc";
|
|
450
|
+
limit?: number; // Max results: 1-10 (default: 5)
|
|
451
|
+
|
|
452
|
+
// Content inclusion (token expensive)
|
|
453
|
+
withContent?: boolean; // Include code diffs (default: false)
|
|
454
|
+
withComments?: boolean; // Include comment threads (default: false)
|
|
415
455
|
}
|
|
416
456
|
```
|
|
417
457
|
|
|
418
|
-
|
|
458
|
+
#### Response
|
|
419
459
|
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
460
|
+
```typescript
|
|
461
|
+
interface GithubSearchPullRequestsResponse {
|
|
462
|
+
results: Array<{
|
|
463
|
+
number: number;
|
|
464
|
+
title: string;
|
|
465
|
+
state: "open" | "closed";
|
|
466
|
+
merged: boolean;
|
|
467
|
+
author: string;
|
|
468
|
+
html_url: string;
|
|
469
|
+
created_at: string;
|
|
470
|
+
updated_at: string;
|
|
471
|
+
merged_at?: string;
|
|
472
|
+
body: string;
|
|
473
|
+
|
|
474
|
+
// When withContent=true
|
|
475
|
+
files?: Array<{
|
|
476
|
+
filename: string;
|
|
477
|
+
status: "added" | "modified" | "removed";
|
|
478
|
+
additions: number;
|
|
479
|
+
deletions: number;
|
|
480
|
+
changes: number;
|
|
481
|
+
patch?: string; // Diff content
|
|
482
|
+
}>;
|
|
483
|
+
|
|
484
|
+
// When withComments=true
|
|
485
|
+
comments?: Array<{
|
|
486
|
+
author: string;
|
|
487
|
+
body: string;
|
|
488
|
+
created_at: string;
|
|
489
|
+
}>;
|
|
490
|
+
}>;
|
|
491
|
+
}
|
|
492
|
+
```
|
|
430
493
|
|
|
431
|
-
|
|
494
|
+
#### Best Practices
|
|
432
495
|
|
|
433
|
-
|
|
496
|
+
- **Direct fetch**: Use `prNumber` for 10x faster retrieval
|
|
497
|
+
- **Production code**: Use `state="closed"` + `merged=true` for shipped features
|
|
498
|
+
- **Token management**:
|
|
499
|
+
- `withComments=false`: 50% token savings
|
|
500
|
+
- `withContent=false`: 80% token savings
|
|
501
|
+
- **Analysis**: Enable content/comments only when needed for deep analysis
|
|
434
502
|
|
|
435
|
-
|
|
436
|
-
**Goal:** Create comprehensive context for building AI agents
|
|
503
|
+
#### Examples
|
|
437
504
|
|
|
438
|
-
|
|
505
|
+
```typescript
|
|
506
|
+
// Fetch specific PR with diffs (direct, fastest)
|
|
507
|
+
{
|
|
508
|
+
owner: "facebook",
|
|
509
|
+
repo: "react",
|
|
510
|
+
prNumber: 12345,
|
|
511
|
+
withContent: true
|
|
512
|
+
}
|
|
439
513
|
|
|
440
|
-
|
|
514
|
+
// Find merged authentication PRs
|
|
515
|
+
{
|
|
516
|
+
owner: "passportjs",
|
|
517
|
+
repo: "passport",
|
|
518
|
+
state: "closed",
|
|
519
|
+
merged: true,
|
|
520
|
+
query: "authentication",
|
|
521
|
+
limit: 5
|
|
522
|
+
}
|
|
441
523
|
|
|
442
|
-
|
|
443
|
-
|
|
524
|
+
// Recent open PRs with discussions
|
|
525
|
+
{
|
|
526
|
+
owner: "microsoft",
|
|
527
|
+
repo: "TypeScript",
|
|
528
|
+
state: "open",
|
|
529
|
+
sort: "updated",
|
|
530
|
+
withComments: true,
|
|
531
|
+
limit: 10
|
|
532
|
+
}
|
|
444
533
|
|
|
445
|
-
|
|
534
|
+
// Author's bug fixes
|
|
535
|
+
{
|
|
536
|
+
owner: "facebook",
|
|
537
|
+
repo: "react",
|
|
538
|
+
author: "gaearon",
|
|
539
|
+
label: "bug",
|
|
540
|
+
state: "closed",
|
|
541
|
+
merged: true
|
|
542
|
+
}
|
|
543
|
+
```
|
|
446
544
|
|
|
447
545
|
---
|
|
448
546
|
|
|
449
|
-
|
|
450
|
-
**See the dramatic difference** between generic AI and Octocode-enhanced AI:
|
|
547
|
+
## Configuration
|
|
451
548
|
|
|
452
|
-
|
|
549
|
+
### Environment Variables
|
|
453
550
|
|
|
454
|
-
|
|
551
|
+
| Variable | Type | Description | Default |
|
|
552
|
+
|----------|------|-------------|---------|
|
|
553
|
+
| `GITHUB_TOKEN` | string | Personal Access Token | Uses `gh` CLI if not set |
|
|
554
|
+
| `TOOLS_TO_RUN` | string | Comma-separated tool list (exclusive mode) | All default tools |
|
|
555
|
+
| `ENABLE_TOOLS` | string | Comma-separated tools to enable (additive) | None |
|
|
556
|
+
| `DISABLE_TOOLS` | string | Comma-separated tools to disable | None |
|
|
557
|
+
| `BETA` | "0" \| "1" | Enable experimental features | "0" |
|
|
455
558
|
|
|
456
|
-
|
|
559
|
+
**Notes**:
|
|
560
|
+
- `TOOLS_TO_RUN` is mutually exclusive with `ENABLE_TOOLS`/`DISABLE_TOOLS`
|
|
561
|
+
- Default tools: `githubSearchCode`, `githubSearchRepositories`, `githubViewRepoStructure`, `githubGetFileContent`
|
|
562
|
+
- Optional tools: `githubSearchPullRequests`
|
|
457
563
|
|
|
458
|
-
|
|
564
|
+
### Tool Selection Examples
|
|
459
565
|
|
|
460
|
-
### Tool Selection
|
|
461
|
-
|
|
462
|
-
**Run Specific Tools Only (Exclusive Mode):**
|
|
463
566
|
```bash
|
|
567
|
+
# Run only search tools (exclusive mode)
|
|
464
568
|
export TOOLS_TO_RUN="githubSearchCode,githubSearchRepositories"
|
|
465
|
-
```
|
|
466
569
|
|
|
467
|
-
|
|
468
|
-
```bash
|
|
570
|
+
# Enable PR search (additive mode)
|
|
469
571
|
export ENABLE_TOOLS="githubSearchPullRequests"
|
|
470
|
-
```
|
|
471
572
|
|
|
472
|
-
|
|
473
|
-
```bash
|
|
573
|
+
# Disable structure exploration
|
|
474
574
|
export DISABLE_TOOLS="githubViewRepoStructure"
|
|
475
|
-
```
|
|
476
575
|
|
|
477
|
-
|
|
478
|
-
```bash
|
|
576
|
+
# Enable experimental features
|
|
479
577
|
export BETA="1"
|
|
480
578
|
```
|
|
481
579
|
|
|
482
|
-
|
|
580
|
+
### MCP Configuration with Environment Variables
|
|
483
581
|
|
|
484
|
-
### Environment Variables
|
|
485
|
-
|
|
486
|
-
| Variable | Description | Default |
|
|
487
|
-
|----------|-------------|---------|
|
|
488
|
-
| `GITHUB_TOKEN` | Personal Access Token for authentication | Uses `gh` CLI if not set |
|
|
489
|
-
| `TOOLS_TO_RUN` | Comma-separated list of tools to run exclusively | All default tools |
|
|
490
|
-
| `ENABLE_TOOLS` | Comma-separated list of additional tools to enable | None |
|
|
491
|
-
| `DISABLE_TOOLS` | Comma-separated list of tools to disable | None |
|
|
492
|
-
| `BETA` | Enable experimental features | `0` |
|
|
493
|
-
|
|
494
|
-
### Example Configuration with Environment Variables
|
|
495
|
-
|
|
496
|
-
**Claude Desktop Config:**
|
|
497
582
|
```json
|
|
498
583
|
{
|
|
499
584
|
"mcpServers": {
|
|
@@ -502,101 +587,190 @@ export BETA="1"
|
|
|
502
587
|
"args": ["octocode-mcp@latest"],
|
|
503
588
|
"env": {
|
|
504
589
|
"GITHUB_TOKEN": "ghp_your_token_here",
|
|
505
|
-
"ENABLE_TOOLS": "githubSearchPullRequests"
|
|
590
|
+
"ENABLE_TOOLS": "githubSearchPullRequests",
|
|
591
|
+
"BETA": "1"
|
|
506
592
|
}
|
|
507
593
|
}
|
|
508
594
|
}
|
|
509
595
|
}
|
|
510
596
|
```
|
|
511
597
|
|
|
512
|
-
|
|
598
|
+
---
|
|
599
|
+
|
|
600
|
+
## Authentication
|
|
601
|
+
|
|
602
|
+
### Method 1: GitHub CLI (Recommended)
|
|
603
|
+
|
|
604
|
+
```bash
|
|
605
|
+
# Install GitHub CLI
|
|
606
|
+
brew install gh # macOS
|
|
607
|
+
# or download from https://cli.github.com/
|
|
608
|
+
|
|
609
|
+
# Authenticate
|
|
610
|
+
gh auth login
|
|
611
|
+
|
|
612
|
+
# Verify
|
|
613
|
+
gh auth status
|
|
614
|
+
```
|
|
615
|
+
|
|
616
|
+
**Pros**: Automatic token refresh, secure credential storage
|
|
617
|
+
**Cons**: Requires separate installation
|
|
618
|
+
|
|
619
|
+
### Method 2: Personal Access Token
|
|
513
620
|
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
-
|
|
517
|
-
-
|
|
621
|
+
1. Create token at [github.com/settings/tokens](https://github.com/settings/tokens)
|
|
622
|
+
2. Required scopes:
|
|
623
|
+
- `repo` - Access repositories (public and private)
|
|
624
|
+
- `read:user` - Read user profile
|
|
625
|
+
- `read:org` - Read organization data
|
|
626
|
+
3. Add to environment: `GITHUB_TOKEN=ghp_your_token_here`
|
|
518
627
|
|
|
519
|
-
**
|
|
520
|
-
|
|
521
|
-
- Partial file reading for large files
|
|
522
|
-
- Structured, predictable response formats
|
|
628
|
+
**Pros**: Simple, direct control
|
|
629
|
+
**Cons**: Manual token management, no auto-refresh
|
|
523
630
|
|
|
524
|
-
|
|
525
|
-
- Respects your GitHub permissions
|
|
526
|
-
- Works with public and private repositories
|
|
527
|
-
- Organization-level access support
|
|
631
|
+
### Rate Limits
|
|
528
632
|
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
633
|
+
| Authentication | Rate Limit | Recommended For |
|
|
634
|
+
|----------------|------------|-----------------|
|
|
635
|
+
| Unauthenticated | 60 req/hour | Testing only |
|
|
636
|
+
| Authenticated | 5,000 req/hour | Production use |
|
|
637
|
+
| GitHub Enterprise | Custom | Enterprise deployments |
|
|
638
|
+
|
|
639
|
+
**Built-in handling**: Server automatically retries with exponential backoff on rate limit errors.
|
|
533
640
|
|
|
534
641
|
---
|
|
535
642
|
|
|
536
|
-
##
|
|
643
|
+
## Advanced Usage
|
|
537
644
|
|
|
538
|
-
|
|
539
|
-
|----------|-------------|------|
|
|
540
|
-
| **🌐 Official Website** | Interactive tutorials and community | [octocode.ai](https://octocode.ai) |
|
|
541
|
-
| **📺 YouTube Channel** | Video tutorials and demos | [Octocode on YouTube](https://www.youtube.com/@Octocode-ai) |
|
|
542
|
-
| **📖 Usage Guide** | 20+ examples and best practices | [USAGE_GUIDE.md](./docs/USAGE_GUIDE.md) |
|
|
543
|
-
| **🔐 Authentication Guide** | Complete setup and enterprise features | [AUTHENTICATION.md](./docs/AUTHENTICATION.md) |
|
|
544
|
-
| **🔧 Tool Schemas** | Complete API reference for all tools | [TOOL_SCHEMAS.md](./docs/TOOL_SCHEMAS.md) |
|
|
545
|
-
| **🏗️ Architecture** | System design and performance details | [summary.md](./docs/summary.md) |
|
|
546
|
-
| **📦 NPM Package** | Latest releases and changelog | [octocode-mcp on NPM](https://www.npmjs.com/package/octocode-mcp) |
|
|
645
|
+
### Progressive Research Workflow
|
|
547
646
|
|
|
548
|
-
|
|
647
|
+
Recommended three-phase pattern for deep code understanding:
|
|
549
648
|
|
|
550
|
-
|
|
649
|
+
```typescript
|
|
650
|
+
// PHASE 1: DISCOVER - Find relevant repositories
|
|
651
|
+
const repos = await githubSearchRepositories({
|
|
652
|
+
topicsToSearch: ["microservices", "typescript"],
|
|
653
|
+
stars: ">1000"
|
|
654
|
+
});
|
|
655
|
+
|
|
656
|
+
// PHASE 2: EXPLORE - Understand structure
|
|
657
|
+
const structure = await githubViewRepoStructure({
|
|
658
|
+
owner: repos.results[0].owner,
|
|
659
|
+
repo: repos.results[0].name,
|
|
660
|
+
branch: "main",
|
|
661
|
+
path: "",
|
|
662
|
+
depth: 1
|
|
663
|
+
});
|
|
664
|
+
|
|
665
|
+
// PHASE 3: ANALYZE - Deep dive into code
|
|
666
|
+
const code = await githubSearchCode({
|
|
667
|
+
owner: repos.results[0].owner,
|
|
668
|
+
repo: repos.results[0].name,
|
|
669
|
+
keywordsToSearch: ["event", "handler"],
|
|
670
|
+
path: "src/services"
|
|
671
|
+
});
|
|
672
|
+
|
|
673
|
+
const fileContent = await githubGetFileContent({
|
|
674
|
+
owner: repos.results[0].owner,
|
|
675
|
+
repo: repos.results[0].name,
|
|
676
|
+
path: code.results[0].path,
|
|
677
|
+
matchString: "EventHandler",
|
|
678
|
+
matchStringContextLines: 30
|
|
679
|
+
});
|
|
680
|
+
```
|
|
681
|
+
|
|
682
|
+
### Token Optimization Strategies
|
|
551
683
|
|
|
552
|
-
|
|
684
|
+
1. **Use pattern matching over full content**
|
|
685
|
+
```typescript
|
|
686
|
+
// Good: 85% token savings
|
|
687
|
+
{ matchString: "function", matchStringContextLines: 10 }
|
|
553
688
|
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
- **🎓 Video Tutorials:** [YouTube Channel](https://www.youtube.com/@Octocode-ai)
|
|
689
|
+
// Avoid: High token cost
|
|
690
|
+
{ fullContent: true }
|
|
691
|
+
```
|
|
558
692
|
|
|
559
|
-
|
|
693
|
+
2. **Discovery before detailed search**
|
|
694
|
+
```typescript
|
|
695
|
+
// Fast discovery (20 tokens)
|
|
696
|
+
{ keywordsToSearch: ["auth"], match: "path" }
|
|
560
697
|
|
|
561
|
-
|
|
698
|
+
// Then detailed (500 tokens)
|
|
699
|
+
{ keywordsToSearch: ["OAuth2"], match: "file", limit: 5 }
|
|
700
|
+
```
|
|
562
701
|
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
5. **Submit a pull request**
|
|
702
|
+
3. **Scope searches**
|
|
703
|
+
```typescript
|
|
704
|
+
// Good: Scoped
|
|
705
|
+
{ owner: "org", repo: "repo", path: "src" }
|
|
568
706
|
|
|
569
|
-
|
|
707
|
+
// Avoid: Unscoped (slow, generic results)
|
|
708
|
+
{ keywordsToSearch: ["helper"] }
|
|
709
|
+
```
|
|
570
710
|
|
|
571
|
-
###
|
|
711
|
+
### Error Handling
|
|
572
712
|
|
|
573
|
-
|
|
713
|
+
All tools return standard error responses:
|
|
714
|
+
|
|
715
|
+
```typescript
|
|
716
|
+
interface ErrorResponse {
|
|
717
|
+
error: {
|
|
718
|
+
code: string;
|
|
719
|
+
message: string;
|
|
720
|
+
details?: any;
|
|
721
|
+
};
|
|
722
|
+
}
|
|
723
|
+
```
|
|
574
724
|
|
|
575
|
-
|
|
576
|
-
-
|
|
577
|
-
-
|
|
578
|
-
-
|
|
725
|
+
Common error codes:
|
|
726
|
+
- `RATE_LIMIT_EXCEEDED` - Wait for rate limit reset
|
|
727
|
+
- `AUTHENTICATION_FAILED` - Check GitHub credentials
|
|
728
|
+
- `NOT_FOUND` - Repository or file doesn't exist
|
|
729
|
+
- `VALIDATION_ERROR` - Invalid parameters
|
|
730
|
+
- `CONTENT_TOO_LARGE` - File exceeds size limits
|
|
731
|
+
|
|
732
|
+
### Performance Characteristics
|
|
733
|
+
|
|
734
|
+
| Operation | Typical Latency | Token Cost (avg) |
|
|
735
|
+
|-----------|----------------|------------------|
|
|
736
|
+
| `githubSearchRepositories` | 200-500ms | 100-300 tokens |
|
|
737
|
+
| `githubSearchCode` (path) | 300-800ms | 50-200 tokens |
|
|
738
|
+
| `githubSearchCode` (file) | 500-1500ms | 500-2000 tokens |
|
|
739
|
+
| `githubViewRepoStructure` (depth=1) | 200-400ms | 100-500 tokens |
|
|
740
|
+
| `githubViewRepoStructure` (depth=2) | 400-1000ms | 500-2000 tokens |
|
|
741
|
+
| `githubGetFileContent` (pattern) | 300-600ms | 200-800 tokens |
|
|
742
|
+
| `githubGetFileContent` (full) | 400-1000ms | 1000-5000 tokens |
|
|
743
|
+
| `githubSearchPullRequests` (no content) | 400-800ms | 200-600 tokens |
|
|
744
|
+
| `githubSearchPullRequests` (with content) | 800-2000ms | 2000-10000 tokens |
|
|
579
745
|
|
|
580
746
|
---
|
|
581
747
|
|
|
582
|
-
|
|
748
|
+
## Documentation
|
|
749
|
+
|
|
750
|
+
### Comprehensive Resources
|
|
583
751
|
|
|
584
|
-
|
|
752
|
+
- **[Main README](../../README.md)** - Getting started, overview, examples
|
|
753
|
+
- **[Usage Guide](./docs/USAGE_GUIDE.md)** - 20+ real-world examples
|
|
754
|
+
- **[Authentication Guide](./docs/AUTHENTICATION.md)** - Setup and troubleshooting
|
|
755
|
+
- **[Tool Schemas](./docs/TOOL_SCHEMAS.md)** - Complete JSON schemas
|
|
756
|
+
- **[Architecture](./docs/summary.md)** - System design and internals
|
|
585
757
|
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
758
|
+
### External Links
|
|
759
|
+
|
|
760
|
+
- **[NPM Package](https://www.npmjs.com/package/octocode-mcp)** - Releases and changelog
|
|
761
|
+
- **[GitHub Repository](https://github.com/bgauryy/octocode-mcp)** - Source code
|
|
762
|
+
- **[Official Website](https://octocode.ai)** - Interactive tutorials
|
|
763
|
+
- **[YouTube Channel](https://www.youtube.com/@Octocode-ai)** - Video guides
|
|
589
764
|
|
|
590
765
|
---
|
|
591
766
|
|
|
592
|
-
|
|
767
|
+
## Support
|
|
593
768
|
|
|
594
|
-
**
|
|
769
|
+
- **Issues**: [github.com/bgauryy/octocode-mcp/issues](https://github.com/bgauryy/octocode-mcp/issues)
|
|
770
|
+
- **Discussions**: [github.com/bgauryy/octocode-mcp/discussions](https://github.com/bgauryy/octocode-mcp/discussions)
|
|
595
771
|
|
|
596
772
|
---
|
|
597
773
|
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
[](https://github.com/modelcontextprotocol/servers)
|
|
774
|
+
## License
|
|
601
775
|
|
|
602
|
-
|
|
776
|
+
MIT - See [LICENSE](../../LICENSE) for details.
|