octocode-mcp 7.0.12-alpha.1 → 7.0.12-alpha.3

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.
@@ -1,2 +1,2 @@
1
1
  import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
- export declare function registerAllTools(server: McpServer): Promise<void>;
2
+ export declare function registerAllTools(server: McpServer, _content: import('./tools/toolMetadata.js').CompleteMetadata): Promise<void>;
@@ -1,3 +1,4 @@
1
1
  import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ import type { CompleteMetadata } from '../tools/toolMetadata.js';
2
3
  export declare const PROMPT_NAME = "kudos";
3
- export declare function registerKudosPrompt(server: McpServer): void;
4
+ export declare function registerKudosPrompt(server: McpServer, content: CompleteMetadata): void;
@@ -1,6 +1,7 @@
1
1
  import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ import type { CompleteMetadata } from '../tools/toolMetadata.js';
2
3
  /**
3
4
  * Register all prompts with the MCP server
4
5
  * Each prompt is defined in its own file under the prompts directory
5
6
  */
6
- export declare function registerPrompts(server: McpServer): void;
7
+ export declare function registerPrompts(server: McpServer, content: CompleteMetadata): void;
@@ -1,3 +1,4 @@
1
1
  import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ import type { CompleteMetadata } from '../tools/toolMetadata.js';
2
3
  export declare const PROMPT_NAME = "research";
3
- export declare function registerResearchPrompt(server: McpServer): void;
4
+ export declare function registerResearchPrompt(server: McpServer, content: CompleteMetadata): void;
@@ -1,3 +1,4 @@
1
1
  import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ import type { CompleteMetadata } from '../tools/toolMetadata.js';
2
3
  export declare const PROMPT_NAME = "use";
3
- export declare function registerUsePrompt(server: McpServer): void;
4
+ export declare function registerUsePrompt(server: McpServer, content: CompleteMetadata): void;
@@ -67,23 +67,23 @@ export declare const GitHubPullRequestSearchQuerySchema: z.ZodObject<{
67
67
  repo?: string | undefined;
68
68
  sort?: "created" | "updated" | "best-match" | undefined;
69
69
  head?: string | undefined;
70
- 'no-label'?: boolean | undefined;
71
- 'no-milestone'?: boolean | undefined;
72
- 'no-project'?: boolean | undefined;
73
- 'no-assignee'?: boolean | undefined;
74
- 'merged-at'?: string | undefined;
70
+ base?: string | undefined;
75
71
  match?: ("title" | "body" | "comments")[] | undefined;
76
72
  limit?: number | undefined;
77
73
  merged?: boolean | undefined;
74
+ 'merged-at'?: string | undefined;
78
75
  author?: string | undefined;
79
76
  mentions?: string | undefined;
80
77
  commenter?: string | undefined;
81
78
  involves?: string | undefined;
82
79
  'reviewed-by'?: string | undefined;
83
80
  'review-requested'?: string | undefined;
84
- base?: string | undefined;
85
81
  interactions?: string | number | undefined;
86
82
  label?: string | string[] | undefined;
83
+ 'no-assignee'?: boolean | undefined;
84
+ 'no-label'?: boolean | undefined;
85
+ 'no-milestone'?: boolean | undefined;
86
+ 'no-project'?: boolean | undefined;
87
87
  prNumber?: number | undefined;
88
88
  withComments?: boolean | undefined;
89
89
  withContent?: boolean | undefined;
@@ -104,23 +104,23 @@ export declare const GitHubPullRequestSearchQuerySchema: z.ZodObject<{
104
104
  repo?: string | undefined;
105
105
  sort?: "created" | "updated" | "best-match" | undefined;
106
106
  head?: string | undefined;
107
- 'no-label'?: boolean | undefined;
108
- 'no-milestone'?: boolean | undefined;
109
- 'no-project'?: boolean | undefined;
110
- 'no-assignee'?: boolean | undefined;
111
- 'merged-at'?: string | undefined;
107
+ base?: string | undefined;
112
108
  match?: ("title" | "body" | "comments")[] | undefined;
113
109
  limit?: number | undefined;
114
110
  merged?: boolean | undefined;
111
+ 'merged-at'?: string | undefined;
115
112
  author?: string | undefined;
116
113
  mentions?: string | undefined;
117
114
  commenter?: string | undefined;
118
115
  involves?: string | undefined;
119
116
  'reviewed-by'?: string | undefined;
120
117
  'review-requested'?: string | undefined;
121
- base?: string | undefined;
122
118
  interactions?: string | number | undefined;
123
119
  label?: string | string[] | undefined;
120
+ 'no-assignee'?: boolean | undefined;
121
+ 'no-label'?: boolean | undefined;
122
+ 'no-milestone'?: boolean | undefined;
123
+ 'no-project'?: boolean | undefined;
124
124
  order?: "asc" | "desc" | undefined;
125
125
  prNumber?: number | undefined;
126
126
  withComments?: boolean | undefined;
@@ -184,23 +184,23 @@ export declare const GitHubPullRequestSearchBulkQuerySchema: z.ZodObject<{
184
184
  repo?: string | undefined;
185
185
  sort?: "created" | "updated" | "best-match" | undefined;
186
186
  head?: string | undefined;
187
- 'no-label'?: boolean | undefined;
188
- 'no-milestone'?: boolean | undefined;
189
- 'no-project'?: boolean | undefined;
190
- 'no-assignee'?: boolean | undefined;
191
- 'merged-at'?: string | undefined;
187
+ base?: string | undefined;
192
188
  match?: ("title" | "body" | "comments")[] | undefined;
193
189
  limit?: number | undefined;
194
190
  merged?: boolean | undefined;
191
+ 'merged-at'?: string | undefined;
195
192
  author?: string | undefined;
196
193
  mentions?: string | undefined;
197
194
  commenter?: string | undefined;
198
195
  involves?: string | undefined;
199
196
  'reviewed-by'?: string | undefined;
200
197
  'review-requested'?: string | undefined;
201
- base?: string | undefined;
202
198
  interactions?: string | number | undefined;
203
199
  label?: string | string[] | undefined;
200
+ 'no-assignee'?: boolean | undefined;
201
+ 'no-label'?: boolean | undefined;
202
+ 'no-milestone'?: boolean | undefined;
203
+ 'no-project'?: boolean | undefined;
204
204
  prNumber?: number | undefined;
205
205
  withComments?: boolean | undefined;
206
206
  withContent?: boolean | undefined;
@@ -221,23 +221,23 @@ export declare const GitHubPullRequestSearchBulkQuerySchema: z.ZodObject<{
221
221
  repo?: string | undefined;
222
222
  sort?: "created" | "updated" | "best-match" | undefined;
223
223
  head?: string | undefined;
224
- 'no-label'?: boolean | undefined;
225
- 'no-milestone'?: boolean | undefined;
226
- 'no-project'?: boolean | undefined;
227
- 'no-assignee'?: boolean | undefined;
228
- 'merged-at'?: string | undefined;
224
+ base?: string | undefined;
229
225
  match?: ("title" | "body" | "comments")[] | undefined;
230
226
  limit?: number | undefined;
231
227
  merged?: boolean | undefined;
228
+ 'merged-at'?: string | undefined;
232
229
  author?: string | undefined;
233
230
  mentions?: string | undefined;
234
231
  commenter?: string | undefined;
235
232
  involves?: string | undefined;
236
233
  'reviewed-by'?: string | undefined;
237
234
  'review-requested'?: string | undefined;
238
- base?: string | undefined;
239
235
  interactions?: string | number | undefined;
240
236
  label?: string | string[] | undefined;
237
+ 'no-assignee'?: boolean | undefined;
238
+ 'no-label'?: boolean | undefined;
239
+ 'no-milestone'?: boolean | undefined;
240
+ 'no-project'?: boolean | undefined;
241
241
  order?: "asc" | "desc" | undefined;
242
242
  prNumber?: number | undefined;
243
243
  withComments?: boolean | undefined;
@@ -262,23 +262,23 @@ export declare const GitHubPullRequestSearchBulkQuerySchema: z.ZodObject<{
262
262
  repo?: string | undefined;
263
263
  sort?: "created" | "updated" | "best-match" | undefined;
264
264
  head?: string | undefined;
265
- 'no-label'?: boolean | undefined;
266
- 'no-milestone'?: boolean | undefined;
267
- 'no-project'?: boolean | undefined;
268
- 'no-assignee'?: boolean | undefined;
269
- 'merged-at'?: string | undefined;
265
+ base?: string | undefined;
270
266
  match?: ("title" | "body" | "comments")[] | undefined;
271
267
  limit?: number | undefined;
272
268
  merged?: boolean | undefined;
269
+ 'merged-at'?: string | undefined;
273
270
  author?: string | undefined;
274
271
  mentions?: string | undefined;
275
272
  commenter?: string | undefined;
276
273
  involves?: string | undefined;
277
274
  'reviewed-by'?: string | undefined;
278
275
  'review-requested'?: string | undefined;
279
- base?: string | undefined;
280
276
  interactions?: string | number | undefined;
281
277
  label?: string | string[] | undefined;
278
+ 'no-assignee'?: boolean | undefined;
279
+ 'no-label'?: boolean | undefined;
280
+ 'no-milestone'?: boolean | undefined;
281
+ 'no-project'?: boolean | undefined;
282
282
  prNumber?: number | undefined;
283
283
  withComments?: boolean | undefined;
284
284
  withContent?: boolean | undefined;
@@ -301,23 +301,23 @@ export declare const GitHubPullRequestSearchBulkQuerySchema: z.ZodObject<{
301
301
  repo?: string | undefined;
302
302
  sort?: "created" | "updated" | "best-match" | undefined;
303
303
  head?: string | undefined;
304
- 'no-label'?: boolean | undefined;
305
- 'no-milestone'?: boolean | undefined;
306
- 'no-project'?: boolean | undefined;
307
- 'no-assignee'?: boolean | undefined;
308
- 'merged-at'?: string | undefined;
304
+ base?: string | undefined;
309
305
  match?: ("title" | "body" | "comments")[] | undefined;
310
306
  limit?: number | undefined;
311
307
  merged?: boolean | undefined;
308
+ 'merged-at'?: string | undefined;
312
309
  author?: string | undefined;
313
310
  mentions?: string | undefined;
314
311
  commenter?: string | undefined;
315
312
  involves?: string | undefined;
316
313
  'reviewed-by'?: string | undefined;
317
314
  'review-requested'?: string | undefined;
318
- base?: string | undefined;
319
315
  interactions?: string | number | undefined;
320
316
  label?: string | string[] | undefined;
317
+ 'no-assignee'?: boolean | undefined;
318
+ 'no-label'?: boolean | undefined;
319
+ 'no-milestone'?: boolean | undefined;
320
+ 'no-project'?: boolean | undefined;
321
321
  order?: "asc" | "desc" | undefined;
322
322
  prNumber?: number | undefined;
323
323
  withComments?: boolean | undefined;
@@ -0,0 +1,217 @@
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
+ kudos: {
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 getToolHints(toolName: string, resultType: 'hasResults' | 'empty'): Promise<readonly string[]>;
68
+ export declare function getToolHintsSync(toolName: string, resultType: 'hasResults' | 'empty'): readonly string[];
69
+ export declare function getGenericErrorHints(): Promise<readonly string[]>;
70
+ export declare function getGenericErrorHintsSync(): readonly string[];
71
+ export declare function getBaseHints(): Promise<{
72
+ hasResults: readonly string[];
73
+ empty: readonly string[];
74
+ }>;
75
+ export declare function getDynamicHints(toolName: string, hintType: 'topicsHasResults' | 'topicsEmpty' | 'keywordsEmpty'): readonly string[];
76
+ export declare function getBulkOperationsInstructions(): {
77
+ base: string;
78
+ hasResults: string;
79
+ empty: string;
80
+ error: string;
81
+ };
82
+ export declare const DESCRIPTIONS: Record<string, string>;
83
+ export declare const TOOL_HINTS: Record<string, {
84
+ hasResults: readonly string[];
85
+ empty: readonly string[];
86
+ }> & {
87
+ base: {
88
+ hasResults: readonly string[];
89
+ empty: readonly string[];
90
+ };
91
+ };
92
+ export declare const GITHUB_FETCH_CONTENT: {
93
+ scope: {
94
+ owner: string;
95
+ repo: string;
96
+ branch: string;
97
+ path: string;
98
+ };
99
+ processing: {
100
+ minified: string;
101
+ sanitize: string;
102
+ };
103
+ range: {
104
+ startLine: string;
105
+ endLine: string;
106
+ fullContent: string;
107
+ matchString: string;
108
+ matchStringContextLines: string;
109
+ };
110
+ validation: {
111
+ parameterConflict: string;
112
+ };
113
+ };
114
+ export declare const GITHUB_SEARCH_CODE: {
115
+ search: {
116
+ keywordsToSearch: string;
117
+ };
118
+ scope: {
119
+ owner: string;
120
+ repo: string;
121
+ };
122
+ filters: {
123
+ extension: string;
124
+ stars: string;
125
+ filename: string;
126
+ path: string;
127
+ match: string;
128
+ };
129
+ resultLimit: {
130
+ limit: string;
131
+ };
132
+ processing: {
133
+ minify: string;
134
+ sanitize: string;
135
+ };
136
+ };
137
+ export declare const GITHUB_SEARCH_REPOS: {
138
+ search: {
139
+ keywordsToSearch: string;
140
+ topicsToSearch: string;
141
+ };
142
+ scope: {
143
+ owner: string;
144
+ };
145
+ filters: {
146
+ stars: string;
147
+ size: string;
148
+ created: string;
149
+ updated: string;
150
+ match: string;
151
+ };
152
+ sorting: {
153
+ sort: string;
154
+ };
155
+ resultLimit: {
156
+ limit: string;
157
+ };
158
+ };
159
+ export declare const GITHUB_SEARCH_PULL_REQUESTS: {
160
+ search: {
161
+ query: string;
162
+ };
163
+ scope: {
164
+ prNumber: string;
165
+ owner: string;
166
+ repo: string;
167
+ };
168
+ filters: {
169
+ match: string;
170
+ created: string;
171
+ updated: string;
172
+ state: string;
173
+ assignee: string;
174
+ author: string;
175
+ commenter: string;
176
+ involves: string;
177
+ mentions: string;
178
+ "review-requested": string;
179
+ "reviewed-by": string;
180
+ label: string;
181
+ "no-label": string;
182
+ "no-milestone": string;
183
+ "no-project": string;
184
+ "no-assignee": string;
185
+ head: string;
186
+ base: string;
187
+ closed: string;
188
+ "merged-at": string;
189
+ comments: string;
190
+ reactions: string;
191
+ interactions: string;
192
+ merged: string;
193
+ draft: string;
194
+ };
195
+ sorting: {
196
+ sort: string;
197
+ order: string;
198
+ };
199
+ resultLimit: {
200
+ limit: string;
201
+ };
202
+ outputShaping: {
203
+ withComments: string;
204
+ withContent: string;
205
+ };
206
+ };
207
+ export declare const GITHUB_VIEW_REPO_STRUCTURE: {
208
+ scope: {
209
+ owner: string;
210
+ repo: string;
211
+ branch: string;
212
+ path: string;
213
+ };
214
+ range: {
215
+ depth: string;
216
+ };
217
+ };
@@ -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 {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "octocode-mcp",
3
- "version": "7.0.12-alpha.1",
3
+ "version": "7.0.12-alpha.3",
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",
@@ -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];