octocode-mcp 7.0.12 → 7.0.13

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.
@@ -0,0 +1,218 @@
1
+ export interface ToolMetadata {
2
+ name: string;
3
+ description: string;
4
+ schema: Record<string, string>;
5
+ hints: {
6
+ hasResults: readonly string[];
7
+ empty: readonly string[];
8
+ };
9
+ }
10
+ export interface CompleteMetadata {
11
+ instructions: string;
12
+ prompts: {
13
+ research: {
14
+ name: string;
15
+ description: string;
16
+ content: string;
17
+ };
18
+ reviewSecurity: {
19
+ name: string;
20
+ description: string;
21
+ content: string;
22
+ };
23
+ use: {
24
+ name: string;
25
+ description: string;
26
+ content: string;
27
+ };
28
+ [key: string]: {
29
+ name: string;
30
+ description: string;
31
+ content: string;
32
+ };
33
+ };
34
+ toolNames: {
35
+ GITHUB_FETCH_CONTENT: 'githubGetFileContent';
36
+ GITHUB_SEARCH_CODE: 'githubSearchCode';
37
+ GITHUB_SEARCH_PULL_REQUESTS: 'githubSearchPullRequests';
38
+ GITHUB_SEARCH_REPOSITORIES: 'githubSearchRepositories';
39
+ GITHUB_VIEW_REPO_STRUCTURE: 'githubViewRepoStructure';
40
+ };
41
+ baseSchema: {
42
+ mainResearchGoal: string;
43
+ researchGoal: string;
44
+ reasoning: string;
45
+ bulkQuery: (toolName: string) => string;
46
+ };
47
+ tools: Record<string, ToolMetadata>;
48
+ baseHints: {
49
+ hasResults: readonly string[];
50
+ empty: readonly string[];
51
+ };
52
+ genericErrorHints: readonly string[];
53
+ }
54
+ export declare function initializeToolMetadata(): Promise<void>;
55
+ export declare function loadToolContent(): Promise<CompleteMetadata>;
56
+ export declare function getInstructionsSync(): string;
57
+ export declare function getPromptsSync(): CompleteMetadata['prompts'];
58
+ export declare const TOOL_NAMES: CompleteMetadata["toolNames"];
59
+ export type ToolName = (typeof TOOL_NAMES)[keyof typeof TOOL_NAMES];
60
+ export declare const BASE_SCHEMA: CompleteMetadata["baseSchema"];
61
+ export declare const GENERIC_ERROR_HINTS: readonly string[];
62
+ export declare function getCompleteMetadata(): Promise<CompleteMetadata>;
63
+ export declare function getToolsMetadata(): Promise<Record<string, ToolMetadata>>;
64
+ export declare function getToolMetadata(toolName: string): Promise<ToolMetadata | undefined>;
65
+ export declare function getToolDescription(toolName: string): Promise<string>;
66
+ export declare function getToolSchema(toolName: string): Promise<Record<string, string>>;
67
+ export declare function isToolAvailableSync(toolName: string): boolean;
68
+ export declare function getToolHints(toolName: string, resultType: 'hasResults' | 'empty'): Promise<readonly string[]>;
69
+ export declare function getToolHintsSync(toolName: string, resultType: 'hasResults' | 'empty'): readonly string[];
70
+ export declare function getGenericErrorHints(): Promise<readonly string[]>;
71
+ export declare function getGenericErrorHintsSync(): readonly string[];
72
+ export declare function getBaseHints(): Promise<{
73
+ hasResults: readonly string[];
74
+ empty: readonly string[];
75
+ }>;
76
+ export declare function getDynamicHints(toolName: string, hintType: 'topicsHasResults' | 'topicsEmpty' | 'keywordsEmpty'): readonly string[];
77
+ export declare function getBulkOperationsInstructions(): {
78
+ base: string;
79
+ hasResults: string;
80
+ empty: string;
81
+ error: string;
82
+ };
83
+ export declare const DESCRIPTIONS: Record<string, string>;
84
+ export declare const TOOL_HINTS: Record<string, {
85
+ hasResults: readonly string[];
86
+ empty: readonly string[];
87
+ }> & {
88
+ base: {
89
+ hasResults: readonly string[];
90
+ empty: readonly string[];
91
+ };
92
+ };
93
+ export declare const GITHUB_FETCH_CONTENT: {
94
+ scope: {
95
+ owner: string;
96
+ repo: string;
97
+ branch: string;
98
+ path: string;
99
+ };
100
+ processing: {
101
+ minified: string;
102
+ sanitize: string;
103
+ };
104
+ range: {
105
+ startLine: string;
106
+ endLine: string;
107
+ fullContent: string;
108
+ matchString: string;
109
+ matchStringContextLines: string;
110
+ };
111
+ validation: {
112
+ parameterConflict: string;
113
+ };
114
+ };
115
+ export declare const GITHUB_SEARCH_CODE: {
116
+ search: {
117
+ keywordsToSearch: string;
118
+ };
119
+ scope: {
120
+ owner: string;
121
+ repo: string;
122
+ };
123
+ filters: {
124
+ extension: string;
125
+ stars: string;
126
+ filename: string;
127
+ path: string;
128
+ match: string;
129
+ };
130
+ resultLimit: {
131
+ limit: string;
132
+ };
133
+ processing: {
134
+ minify: string;
135
+ sanitize: string;
136
+ };
137
+ };
138
+ export declare const GITHUB_SEARCH_REPOS: {
139
+ search: {
140
+ keywordsToSearch: string;
141
+ topicsToSearch: string;
142
+ };
143
+ scope: {
144
+ owner: string;
145
+ };
146
+ filters: {
147
+ stars: string;
148
+ size: string;
149
+ created: string;
150
+ updated: string;
151
+ match: string;
152
+ };
153
+ sorting: {
154
+ sort: string;
155
+ };
156
+ resultLimit: {
157
+ limit: string;
158
+ };
159
+ };
160
+ export declare const GITHUB_SEARCH_PULL_REQUESTS: {
161
+ search: {
162
+ query: string;
163
+ };
164
+ scope: {
165
+ prNumber: string;
166
+ owner: string;
167
+ repo: string;
168
+ };
169
+ filters: {
170
+ match: string;
171
+ created: string;
172
+ updated: string;
173
+ state: string;
174
+ assignee: string;
175
+ author: string;
176
+ commenter: string;
177
+ involves: string;
178
+ mentions: string;
179
+ "review-requested": string;
180
+ "reviewed-by": string;
181
+ label: string;
182
+ "no-label": string;
183
+ "no-milestone": string;
184
+ "no-project": string;
185
+ "no-assignee": string;
186
+ head: string;
187
+ base: string;
188
+ closed: string;
189
+ "merged-at": string;
190
+ comments: string;
191
+ reactions: string;
192
+ interactions: string;
193
+ merged: string;
194
+ draft: string;
195
+ };
196
+ sorting: {
197
+ sort: string;
198
+ order: string;
199
+ };
200
+ resultLimit: {
201
+ limit: string;
202
+ };
203
+ outputShaping: {
204
+ withComments: string;
205
+ withContent: string;
206
+ };
207
+ };
208
+ export declare const GITHUB_VIEW_REPO_STRUCTURE: {
209
+ scope: {
210
+ owner: string;
211
+ repo: string;
212
+ branch: string;
213
+ path: string;
214
+ };
215
+ range: {
216
+ depth: string;
217
+ };
218
+ };
@@ -1,6 +1,6 @@
1
1
  import type { GitHubAPIError } from '../github/githubAPI';
2
2
  import type { ToolErrorResult, ToolSuccessResult } from '../types.js';
3
- import { TOOL_NAMES } from '../constants.js';
3
+ import { TOOL_NAMES } from './toolMetadata.js';
4
4
  export declare function createErrorResult(query: {
5
5
  mainResearchGoal?: string;
6
6
  researchGoal?: string;
@@ -358,13 +358,6 @@ export interface CacheStats {
358
358
  totalKeys: number;
359
359
  lastReset: Date;
360
360
  }
361
- /** Options for command execution */
362
- export type ExecOptions = {
363
- timeout?: number;
364
- cwd?: string;
365
- env?: Record<string, string>;
366
- cache?: boolean;
367
- };
368
361
  /** Result of a promise with error isolation */
369
362
  export interface PromiseResult<T> {
370
363
  success: boolean;
@@ -1,8 +1,3 @@
1
1
  import { CallToolResult } from '@modelcontextprotocol/sdk/types';
2
- import type { ExecOptions } from '../types.js';
3
- declare const ALLOWED_NPM_COMMANDS: readonly ["view", "search", "ping", "config", "whoami"];
4
- export type NpmCommand = (typeof ALLOWED_NPM_COMMANDS)[number];
5
2
  export declare function parseExecResult(stdout: string, stderr: string, error?: Error | null, exitCode?: number): CallToolResult;
6
- export declare function executeNpmCommand(command: NpmCommand, args: string[], options?: ExecOptions): Promise<CallToolResult>;
7
3
  export declare function getGithubCLIToken(): Promise<string | null>;
8
- export {};
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Fetch with retry mechanism and exponential backoff
3
+ */
4
+ export interface FetchWithRetriesOptions {
5
+ /**
6
+ * Maximum number of retry attempts (excluding the initial request)
7
+ * @default 3
8
+ */
9
+ maxRetries?: number;
10
+ /**
11
+ * Initial delay in milliseconds for exponential backoff
12
+ * @default 1000 (1 second)
13
+ */
14
+ initialDelayMs?: number;
15
+ /**
16
+ * Custom headers to include in the request
17
+ */
18
+ headers?: Record<string, string>;
19
+ /**
20
+ * HTTP method
21
+ * @default 'GET'
22
+ */
23
+ method?: string;
24
+ }
25
+ /**
26
+ * Fetches a URL with automatic retries and exponential backoff.
27
+ *
28
+ * Retry behavior:
29
+ * - Retries on network errors, server errors (5xx), and rate limits (429)
30
+ * - Respects 'Retry-After' header for 429 responses
31
+ * - Does NOT retry on client errors (4xx) except rate limits
32
+ * - Uses exponential backoff: 1s, 2s, 4s (default) if no Retry-After header
33
+ *
34
+ * @param url - The URL to fetch
35
+ * @param options - Configuration options for retries and request
36
+ * @returns The JSON response (or null for 204 No Content)
37
+ * @throws Error if all retry attempts fail
38
+ *
39
+ * @example
40
+ * ```typescript
41
+ * const data = await fetchWithRetries('https://api.example.com/data', {
42
+ * maxRetries: 3,
43
+ * headers: { 'User-Agent': 'MyApp/1.0' }
44
+ * });
45
+ * ```
46
+ */
47
+ export declare function fetchWithRetries(url: string, options?: FetchWithRetriesOptions): Promise<unknown>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "octocode-mcp",
3
- "version": "7.0.12",
3
+ "version": "7.0.13",
4
4
  "description": "Model Context Protocol (MCP) server for advanced GitHub repository analysis and code discovery. Provides AI assistants with powerful tools to search, analyze, and understand codebases across GitHub.",
5
5
  "keywords": [
6
6
  "mcp",
@@ -34,6 +34,12 @@
34
34
  "bugs": "https://github.com/bgauryy/octocode-mcp/issues",
35
35
  "license": "MIT",
36
36
  "mcpName": "io.github.bgauryy/octocode-mcp",
37
+ "exports": {
38
+ ".": {
39
+ "types": "./dist/src/index.d.ts",
40
+ "import": "./dist/index.js"
41
+ }
42
+ },
37
43
  "bin": {
38
44
  "octocode-mcp": "dist/index.js",
39
45
  "octocode-mcp-beta": "dist/index.js"
package/server.json CHANGED
@@ -8,12 +8,12 @@
8
8
  "url": "https://github.com/bgauryy/octocode-mcp",
9
9
  "source": "github"
10
10
  },
11
- "version": "7.0.12",
11
+ "version": "7.0.13",
12
12
  "packages": [
13
13
  {
14
14
  "registryType": "npm",
15
15
  "identifier": "octocode-mcp",
16
- "version": "7.0.12",
16
+ "version": "7.0.13",
17
17
  "transport": {
18
18
  "type": "stdio"
19
19
  },
@@ -1,8 +0,0 @@
1
- export declare const TOOL_NAMES: {
2
- readonly GITHUB_FETCH_CONTENT: "githubGetFileContent";
3
- readonly GITHUB_SEARCH_CODE: "githubSearchCode";
4
- readonly GITHUB_SEARCH_PULL_REQUESTS: "githubSearchPullRequests";
5
- readonly GITHUB_SEARCH_REPOSITORIES: "githubSearchRepositories";
6
- readonly GITHUB_VIEW_REPO_STRUCTURE: "githubViewRepoStructure";
7
- };
8
- export type ToolName = (typeof TOOL_NAMES)[keyof typeof TOOL_NAMES];
@@ -1,3 +0,0 @@
1
- import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
- export declare const PROMPT_NAME = "kudos";
3
- export declare function registerKudosPrompt(server: McpServer): void;
@@ -1,180 +0,0 @@
1
- export declare const COMMON: {
2
- scope: {
3
- owner: string;
4
- repo: string;
5
- branch: string;
6
- path: string;
7
- };
8
- processing: {
9
- minify: string;
10
- minified: string;
11
- sanitize: string;
12
- };
13
- filters: {
14
- stars: string;
15
- created: string;
16
- updated: string;
17
- state: string;
18
- extension: string;
19
- filename: string;
20
- };
21
- users: {
22
- author: string;
23
- assignee: string;
24
- commenter: string;
25
- involves: string;
26
- mentions: string;
27
- };
28
- git: {
29
- head: string;
30
- base: string;
31
- merged: string;
32
- draft: string;
33
- };
34
- sorting: {
35
- sort: string;
36
- order: string;
37
- };
38
- resultLimit: {
39
- limit: string;
40
- };
41
- engagement: {
42
- comments: string;
43
- reactions: string;
44
- interactions: string;
45
- };
46
- dates: {
47
- closed: string;
48
- 'merged-at': string;
49
- };
50
- labels: {
51
- label: string;
52
- 'no-label': string;
53
- 'no-milestone': string;
54
- 'no-project': string;
55
- 'no-assignee': string;
56
- };
57
- };
58
- export declare const GITHUB_SEARCH_CODE: {
59
- search: {
60
- keywordsToSearch: string;
61
- };
62
- scope: {
63
- owner: string;
64
- repo: string;
65
- };
66
- filters: {
67
- extension: string;
68
- stars: string;
69
- filename: string;
70
- path: string;
71
- match: string;
72
- };
73
- resultLimit: {
74
- limit: string;
75
- };
76
- processing: {
77
- minify: string;
78
- sanitize: string;
79
- };
80
- };
81
- export declare const GITHUB_SEARCH_REPOS: {
82
- search: {
83
- keywordsToSearch: string;
84
- topicsToSearch: string;
85
- };
86
- scope: {
87
- owner: string;
88
- };
89
- filters: {
90
- stars: string;
91
- size: string;
92
- created: string;
93
- updated: string;
94
- match: string;
95
- };
96
- sorting: {
97
- sort: string;
98
- };
99
- resultLimit: {
100
- limit: string;
101
- };
102
- };
103
- export declare const GITHUB_SEARCH_PULL_REQUESTS: {
104
- search: {
105
- query: string;
106
- };
107
- scope: {
108
- prNumber: string;
109
- owner: string;
110
- repo: string;
111
- };
112
- filters: {
113
- state: string;
114
- assignee: string;
115
- author: string;
116
- commenter: string;
117
- involves: string;
118
- mentions: string;
119
- 'review-requested': string;
120
- 'reviewed-by': string;
121
- label: string;
122
- 'no-label': string;
123
- 'no-milestone': string;
124
- 'no-project': string;
125
- 'no-assignee': string;
126
- head: string;
127
- base: string;
128
- created: string;
129
- updated: string;
130
- closed: string;
131
- 'merged-at': string;
132
- comments: string;
133
- reactions: string;
134
- interactions: string;
135
- merged: string;
136
- draft: string;
137
- match: string;
138
- };
139
- sorting: {
140
- sort: string;
141
- order: string;
142
- };
143
- resultLimit: {
144
- limit: string;
145
- };
146
- outputShaping: {
147
- withComments: string;
148
- withContent: string;
149
- };
150
- };
151
- export declare const GITHUB_FETCH_CONTENT: {
152
- scope: {
153
- owner: string;
154
- repo: string;
155
- branch: string;
156
- path: string;
157
- };
158
- processing: {
159
- minified: string;
160
- sanitize: string;
161
- };
162
- range: {
163
- startLine: string;
164
- endLine: string;
165
- fullContent: string;
166
- matchString: string;
167
- matchStringContextLines: string;
168
- };
169
- };
170
- export declare const GITHUB_VIEW_REPO_STRUCTURE: {
171
- scope: {
172
- owner: string;
173
- repo: string;
174
- branch: string;
175
- path: string;
176
- };
177
- range: {
178
- depth: string;
179
- };
180
- };
@@ -1,7 +0,0 @@
1
- export declare const DESCRIPTIONS: {
2
- githubGetFileContent: string;
3
- githubSearchCode: string;
4
- githubSearchRepositories: string;
5
- githubViewRepoStructure: string;
6
- githubSearchPullRequests: string;
7
- };
@@ -1,29 +0,0 @@
1
- export declare const TOOL_HINTS: {
2
- readonly base: {
3
- readonly hasResults: readonly ["Validate results against researchGoal: do findings answer your question? If partial, identify gaps and continue", "Check result quality: verify dates, stars, last activity to ensure code is maintained and relevant", "Include referenced GitHub URLs in output for user navigation", "Got sufficient examples (3+)? Consider stopping to avoid over-research and token waste"];
4
- readonly empty: readonly ["No results: Are keywords too specific? Try broader terms or related concepts from domain", "Test filters individually: remove one constraint at a time to identify what blocks results", "Split complex searches: separate concerns into multiple simpler queries"];
5
- };
6
- readonly githubSearchCode: {
7
- readonly hasResults: readonly ["Extract text_matches locations and copy exact match text into FETCH_CONTENT matchString for full context", "Found implementation? Follow imports/dependencies with new searches to understand flow", "Multiple matches? Compare patterns across files to identify common approaches"];
8
- readonly empty: readonly ["Current match mode not working? Try the opposite (file↔path) and compare", "Scoped search failed? Drop owner/repo to discover cross-repo patterns, then narrow down", "Apply semantic variants from your domain: expand abbreviations, try synonyms, related terms"];
9
- };
10
- readonly githubSearchRepositories: {
11
- readonly hasResults: readonly ["Validate relevance: fetch README with FETCH_CONTENT to confirm repo matches researchGoal", "Quality check: stars + last_update + topics should align with your requirements", "Map architecture: use VIEW_REPO_STRUCTURE to understand layout, then SEARCH_CODE for implementations", "Multiple repos found? Compare patterns/dependencies/approaches and document key differences"];
12
- readonly empty: readonly ["Filters too strict? Test one at a time: relax stars, then size, then dates to find blocking constraint", "Topics not matching? Try keywords search or vice versa - test both approaches", "Expand search terms with domain synonyms (e.g., \"server\"→\"provider\"/\"backend\", \"plugin\"→\"extension\"/\"addon\")", "Try name-only search: match=[\"name\"] can find repos when description search fails"];
13
- };
14
- readonly githubViewRepoStructure: {
15
- readonly hasResults: readonly ["Identified key directories? Convert paths to SEARCH_CODE queries with path+extension filters for targeted search", "Document structure insight: note entry points, config locations, implementation directories, test organization", "Large codebase? Prioritize directories by name relevance to researchGoal (e.g., \"auth\" dir for authentication research)"];
16
- readonly empty: readonly ["Path not found? Start at root (path=\"\", depth=1) to see top-level structure", "Monorepo? Check common patterns: packages/, apps/, libs/, modules/, workspaces/", "Verify repo exists: use SEARCH_CODE match=\"path\" to confirm repository accessibility"];
17
- };
18
- readonly githubGetFileContent: {
19
- readonly hasResults: readonly ["Follow code flow: trace imports/dependencies with SEARCH_CODE, then fetch related files with matchString", "Large file result? Use matchString with specific function/class names to reduce tokens and get focused context", "Check if context is sufficient: do you understand the implementation? If not, widen matchStringContextLines or fetch related files"];
20
- readonly empty: readonly ["Path invalid? Verify with VIEW_REPO_STRUCTURE or SEARCH_CODE match=\"path\" first", "Branch not found? Omit branch parameter to auto-detect default, or try main/master/develop", "Check path format: no leading slash, use exact case (e.g., \"src/api/auth.ts\" not \"/Src/API/auth.ts\")"];
21
- };
22
- readonly githubSearchPullRequests: {
23
- readonly hasResults: readonly ["Extract implementation insights: examine discussions for rationale, diffs for patterns, review comments for gotchas", "Need code details? Extract changed files/functions and search with SEARCH_CODE or fetch with FETCH_CONTENT", "Token budget tight? Start without withContent/withComments, add only if discussions/diffs are critical", "Multiple PRs? Identify common patterns: same authors, related issues, similar file changes"];
24
- readonly empty: readonly ["Search too narrow? Remove constraints progressively: state, then labels, then author, then merged", "Date range limiting results? Widen time window or remove date filters entirely", "Try different search angles: switch from query to author/label filters or vice versa", "Branch-specific work? Add head/base branch filters to find workstream PRs"];
25
- };
26
- };
27
- export declare const GENERIC_ERROR_HINTS: readonly ["Check authentication token validity and required scopes", "Verify network connectivity and GitHub API status", "Review rate limits and retry after cooldown if exceeded", "Validate input parameters (owner, repo, path, branch) for correctness", "Check repository visibility (public vs private) and access permissions", "Retry the operation after a brief delay for transient errors"];
28
- export declare function getToolHints(toolName: keyof typeof TOOL_HINTS, resultType: 'hasResults' | 'empty'): readonly string[];
29
- export declare function getGenericErrorHints(): readonly string[];