octocode-mcp 8.1.0 → 9.0.0-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/dist/index.js +3 -3
- package/dist/src/github/client.d.ts +0 -1
- package/dist/src/github/githubAPI.d.ts +3 -5
- package/dist/src/github/index.d.ts +2 -2
- package/dist/src/scheme/github_fetch_content.d.ts +12 -0
- package/dist/src/scheme/github_search_pull_requests.d.ts +6 -6
- package/dist/src/scheme/package_search.d.ts +196 -0
- package/dist/src/tools/package_search.d.ts +3 -0
- package/dist/src/tools/toolConfig.d.ts +2 -1
- package/dist/src/tools/toolMetadata.d.ts +13 -0
- package/dist/src/types.d.ts +35 -2
- package/dist/src/utils/cache.d.ts +0 -10
- package/dist/src/utils/diffParser.d.ts +0 -7
- package/dist/src/utils/exec.d.ts +24 -2
- package/dist/src/utils/githubRepoFallback.d.ts +17 -0
- package/dist/src/utils/npmPackage.d.ts +3 -0
- package/dist/src/utils/package.d.ts +50 -0
- package/dist/src/utils/pythonPackage.d.ts +2 -0
- package/dist/tests/security/mask.branches.test.d.ts +1 -0
- package/dist/tests/tools/package_search.test.d.ts +1 -0
- package/dist/tests/tools/toolConfig.branches.test.d.ts +1 -0
- package/dist/tests/tools/toolConfig.test.d.ts +1 -0
- package/dist/tests/tools/toolMetadata.branches.test.d.ts +1 -0
- package/dist/tests/utils/githubRepoFallback.test.d.ts +1 -0
- package/dist/tests/utils/npmPackage.test.d.ts +1 -0
- package/dist/tests/utils/pythonPackage.test.d.ts +1 -0
- package/package.json +4 -3
|
@@ -2,4 +2,3 @@ import { AuthInfo } from '@modelcontextprotocol/sdk/server/auth/types';
|
|
|
2
2
|
export declare const OctokitWithThrottling: any;
|
|
3
3
|
export declare function getOctokit(authInfo?: AuthInfo): Promise<InstanceType<typeof OctokitWithThrottling>>;
|
|
4
4
|
export declare function clearCachedToken(): void;
|
|
5
|
-
export declare function getDefaultBranch(owner: string, repo: string): Promise<string | null>;
|
|
@@ -50,11 +50,6 @@ export interface GitHubAPISuccess<T> {
|
|
|
50
50
|
headers?: Record<string, string>;
|
|
51
51
|
}
|
|
52
52
|
export type GitHubAPIResponse<T> = GitHubAPISuccess<T> | GitHubAPIError;
|
|
53
|
-
export type RepositoryReference = {
|
|
54
|
-
owner: string;
|
|
55
|
-
repo: string;
|
|
56
|
-
ref?: string;
|
|
57
|
-
};
|
|
58
53
|
export type OptimizedCodeSearchResult = {
|
|
59
54
|
items: Array<Pick<CodeSearchResultItem, 'path' | 'url'> & {
|
|
60
55
|
matches: Array<{
|
|
@@ -71,6 +66,9 @@ export type OptimizedCodeSearchResult = {
|
|
|
71
66
|
repository?: {
|
|
72
67
|
name: string;
|
|
73
68
|
url: string;
|
|
69
|
+
createdAt?: string;
|
|
70
|
+
updatedAt?: string;
|
|
71
|
+
pushedAt?: string;
|
|
74
72
|
};
|
|
75
73
|
securityWarnings?: string[];
|
|
76
74
|
minified?: boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { getOctokit, OctokitWithThrottling,
|
|
1
|
+
export { getOctokit, OctokitWithThrottling, clearCachedToken } from './client';
|
|
2
2
|
export { handleGitHubAPIError } from './errors';
|
|
3
|
-
export type { GitHubAPIError, GitHubAPIResponse, GitHubAPISuccess, Repository, OptimizedCodeSearchResult, GitHubPullRequestItem, GitHubPullRequestsSearchParams,
|
|
3
|
+
export type { GitHubAPIError, GitHubAPIResponse, GitHubAPISuccess, Repository, OptimizedCodeSearchResult, GitHubPullRequestItem, GitHubPullRequestsSearchParams, GetContentParameters, GetRepoResponse, isGitHubAPIError, isGitHubAPISuccess, isRepository, } from './githubAPI';
|
|
4
4
|
export type { components } from '@octokit/openapi-types';
|
|
5
5
|
export type { RestEndpointMethodTypes } from '@octokit/plugin-rest-endpoint-methods';
|
|
6
6
|
export { buildCodeSearchQuery, buildRepoSearchQuery, buildPullRequestSearchQuery, shouldUseSearchForPRs, } from './queryBuilders';
|
|
@@ -15,6 +15,7 @@ export declare const FileContentQuerySchema: z.ZodEffects<z.ZodObject<{
|
|
|
15
15
|
endLine: z.ZodOptional<z.ZodNumber>;
|
|
16
16
|
matchString: z.ZodOptional<z.ZodString>;
|
|
17
17
|
matchStringContextLines: z.ZodDefault<z.ZodNumber>;
|
|
18
|
+
addTimestamp: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
18
19
|
}, "strip", z.ZodTypeAny, {
|
|
19
20
|
path: string;
|
|
20
21
|
fullContent: boolean;
|
|
@@ -26,6 +27,7 @@ export declare const FileContentQuerySchema: z.ZodEffects<z.ZodObject<{
|
|
|
26
27
|
sanitize: boolean;
|
|
27
28
|
minified: boolean;
|
|
28
29
|
matchStringContextLines: number;
|
|
30
|
+
addTimestamp: boolean;
|
|
29
31
|
branch?: string | undefined;
|
|
30
32
|
startLine?: number | undefined;
|
|
31
33
|
endLine?: number | undefined;
|
|
@@ -45,6 +47,7 @@ export declare const FileContentQuerySchema: z.ZodEffects<z.ZodObject<{
|
|
|
45
47
|
minified?: boolean | undefined;
|
|
46
48
|
matchString?: string | undefined;
|
|
47
49
|
matchStringContextLines?: number | undefined;
|
|
50
|
+
addTimestamp?: boolean | undefined;
|
|
48
51
|
}>, {
|
|
49
52
|
path: string;
|
|
50
53
|
fullContent: boolean;
|
|
@@ -56,6 +59,7 @@ export declare const FileContentQuerySchema: z.ZodEffects<z.ZodObject<{
|
|
|
56
59
|
sanitize: boolean;
|
|
57
60
|
minified: boolean;
|
|
58
61
|
matchStringContextLines: number;
|
|
62
|
+
addTimestamp: boolean;
|
|
59
63
|
branch?: string | undefined;
|
|
60
64
|
startLine?: number | undefined;
|
|
61
65
|
endLine?: number | undefined;
|
|
@@ -75,6 +79,7 @@ export declare const FileContentQuerySchema: z.ZodEffects<z.ZodObject<{
|
|
|
75
79
|
minified?: boolean | undefined;
|
|
76
80
|
matchString?: string | undefined;
|
|
77
81
|
matchStringContextLines?: number | undefined;
|
|
82
|
+
addTimestamp?: boolean | undefined;
|
|
78
83
|
}>;
|
|
79
84
|
export declare const FileContentBulkQuerySchema: z.ZodObject<{
|
|
80
85
|
queries: z.ZodArray<z.ZodEffects<z.ZodObject<{
|
|
@@ -93,6 +98,7 @@ export declare const FileContentBulkQuerySchema: z.ZodObject<{
|
|
|
93
98
|
endLine: z.ZodOptional<z.ZodNumber>;
|
|
94
99
|
matchString: z.ZodOptional<z.ZodString>;
|
|
95
100
|
matchStringContextLines: z.ZodDefault<z.ZodNumber>;
|
|
101
|
+
addTimestamp: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
96
102
|
}, "strip", z.ZodTypeAny, {
|
|
97
103
|
path: string;
|
|
98
104
|
fullContent: boolean;
|
|
@@ -104,6 +110,7 @@ export declare const FileContentBulkQuerySchema: z.ZodObject<{
|
|
|
104
110
|
sanitize: boolean;
|
|
105
111
|
minified: boolean;
|
|
106
112
|
matchStringContextLines: number;
|
|
113
|
+
addTimestamp: boolean;
|
|
107
114
|
branch?: string | undefined;
|
|
108
115
|
startLine?: number | undefined;
|
|
109
116
|
endLine?: number | undefined;
|
|
@@ -123,6 +130,7 @@ export declare const FileContentBulkQuerySchema: z.ZodObject<{
|
|
|
123
130
|
minified?: boolean | undefined;
|
|
124
131
|
matchString?: string | undefined;
|
|
125
132
|
matchStringContextLines?: number | undefined;
|
|
133
|
+
addTimestamp?: boolean | undefined;
|
|
126
134
|
}>, {
|
|
127
135
|
path: string;
|
|
128
136
|
fullContent: boolean;
|
|
@@ -134,6 +142,7 @@ export declare const FileContentBulkQuerySchema: z.ZodObject<{
|
|
|
134
142
|
sanitize: boolean;
|
|
135
143
|
minified: boolean;
|
|
136
144
|
matchStringContextLines: number;
|
|
145
|
+
addTimestamp: boolean;
|
|
137
146
|
branch?: string | undefined;
|
|
138
147
|
startLine?: number | undefined;
|
|
139
148
|
endLine?: number | undefined;
|
|
@@ -153,6 +162,7 @@ export declare const FileContentBulkQuerySchema: z.ZodObject<{
|
|
|
153
162
|
minified?: boolean | undefined;
|
|
154
163
|
matchString?: string | undefined;
|
|
155
164
|
matchStringContextLines?: number | undefined;
|
|
165
|
+
addTimestamp?: boolean | undefined;
|
|
156
166
|
}>, "many">;
|
|
157
167
|
}, "strip", z.ZodTypeAny, {
|
|
158
168
|
queries: {
|
|
@@ -166,6 +176,7 @@ export declare const FileContentBulkQuerySchema: z.ZodObject<{
|
|
|
166
176
|
sanitize: boolean;
|
|
167
177
|
minified: boolean;
|
|
168
178
|
matchStringContextLines: number;
|
|
179
|
+
addTimestamp: boolean;
|
|
169
180
|
branch?: string | undefined;
|
|
170
181
|
startLine?: number | undefined;
|
|
171
182
|
endLine?: number | undefined;
|
|
@@ -187,5 +198,6 @@ export declare const FileContentBulkQuerySchema: z.ZodObject<{
|
|
|
187
198
|
minified?: boolean | undefined;
|
|
188
199
|
matchString?: string | undefined;
|
|
189
200
|
matchStringContextLines?: number | undefined;
|
|
201
|
+
addTimestamp?: boolean | undefined;
|
|
190
202
|
}[];
|
|
191
203
|
}>;
|
|
@@ -80,8 +80,8 @@ export declare const GitHubPullRequestSearchQuerySchema: z.ZodObject<{
|
|
|
80
80
|
updated?: string | undefined;
|
|
81
81
|
owner?: string | undefined;
|
|
82
82
|
repo?: string | undefined;
|
|
83
|
-
sort?: "created" | "updated" | "best-match" | undefined;
|
|
84
83
|
head?: string | undefined;
|
|
84
|
+
sort?: "created" | "updated" | "best-match" | undefined;
|
|
85
85
|
base?: string | undefined;
|
|
86
86
|
match?: ("title" | "body" | "comments")[] | undefined;
|
|
87
87
|
limit?: number | undefined;
|
|
@@ -123,8 +123,8 @@ export declare const GitHubPullRequestSearchQuerySchema: z.ZodObject<{
|
|
|
123
123
|
updated?: string | undefined;
|
|
124
124
|
owner?: string | undefined;
|
|
125
125
|
repo?: string | undefined;
|
|
126
|
-
sort?: "created" | "updated" | "best-match" | undefined;
|
|
127
126
|
head?: string | undefined;
|
|
127
|
+
sort?: "created" | "updated" | "best-match" | undefined;
|
|
128
128
|
base?: string | undefined;
|
|
129
129
|
match?: ("title" | "body" | "comments")[] | undefined;
|
|
130
130
|
limit?: number | undefined;
|
|
@@ -223,8 +223,8 @@ export declare const GitHubPullRequestSearchBulkQuerySchema: z.ZodObject<{
|
|
|
223
223
|
updated?: string | undefined;
|
|
224
224
|
owner?: string | undefined;
|
|
225
225
|
repo?: string | undefined;
|
|
226
|
-
sort?: "created" | "updated" | "best-match" | undefined;
|
|
227
226
|
head?: string | undefined;
|
|
227
|
+
sort?: "created" | "updated" | "best-match" | undefined;
|
|
228
228
|
base?: string | undefined;
|
|
229
229
|
match?: ("title" | "body" | "comments")[] | undefined;
|
|
230
230
|
limit?: number | undefined;
|
|
@@ -266,8 +266,8 @@ export declare const GitHubPullRequestSearchBulkQuerySchema: z.ZodObject<{
|
|
|
266
266
|
updated?: string | undefined;
|
|
267
267
|
owner?: string | undefined;
|
|
268
268
|
repo?: string | undefined;
|
|
269
|
-
sort?: "created" | "updated" | "best-match" | undefined;
|
|
270
269
|
head?: string | undefined;
|
|
270
|
+
sort?: "created" | "updated" | "best-match" | undefined;
|
|
271
271
|
base?: string | undefined;
|
|
272
272
|
match?: ("title" | "body" | "comments")[] | undefined;
|
|
273
273
|
limit?: number | undefined;
|
|
@@ -313,8 +313,8 @@ export declare const GitHubPullRequestSearchBulkQuerySchema: z.ZodObject<{
|
|
|
313
313
|
updated?: string | undefined;
|
|
314
314
|
owner?: string | undefined;
|
|
315
315
|
repo?: string | undefined;
|
|
316
|
-
sort?: "created" | "updated" | "best-match" | undefined;
|
|
317
316
|
head?: string | undefined;
|
|
317
|
+
sort?: "created" | "updated" | "best-match" | undefined;
|
|
318
318
|
base?: string | undefined;
|
|
319
319
|
match?: ("title" | "body" | "comments")[] | undefined;
|
|
320
320
|
limit?: number | undefined;
|
|
@@ -358,8 +358,8 @@ export declare const GitHubPullRequestSearchBulkQuerySchema: z.ZodObject<{
|
|
|
358
358
|
updated?: string | undefined;
|
|
359
359
|
owner?: string | undefined;
|
|
360
360
|
repo?: string | undefined;
|
|
361
|
-
sort?: "created" | "updated" | "best-match" | undefined;
|
|
362
361
|
head?: string | undefined;
|
|
362
|
+
sort?: "created" | "updated" | "best-match" | undefined;
|
|
363
363
|
base?: string | undefined;
|
|
364
364
|
match?: ("title" | "body" | "comments")[] | undefined;
|
|
365
365
|
limit?: number | undefined;
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
declare const NpmPackageQuerySchema: z.ZodObject<{
|
|
3
|
+
mainResearchGoal: z.ZodString;
|
|
4
|
+
researchGoal: z.ZodString;
|
|
5
|
+
reasoning: z.ZodString;
|
|
6
|
+
} & {
|
|
7
|
+
name: z.ZodString;
|
|
8
|
+
searchLimit: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
9
|
+
npmFetchMetadata: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
10
|
+
}, "strip", z.ZodTypeAny, {
|
|
11
|
+
name: string;
|
|
12
|
+
mainResearchGoal: string;
|
|
13
|
+
researchGoal: string;
|
|
14
|
+
reasoning: string;
|
|
15
|
+
searchLimit: number;
|
|
16
|
+
npmFetchMetadata: boolean;
|
|
17
|
+
}, {
|
|
18
|
+
name: string;
|
|
19
|
+
mainResearchGoal: string;
|
|
20
|
+
researchGoal: string;
|
|
21
|
+
reasoning: string;
|
|
22
|
+
searchLimit?: number | undefined;
|
|
23
|
+
npmFetchMetadata?: boolean | undefined;
|
|
24
|
+
}>;
|
|
25
|
+
declare const PythonPackageQuerySchema: z.ZodObject<{
|
|
26
|
+
mainResearchGoal: z.ZodString;
|
|
27
|
+
researchGoal: z.ZodString;
|
|
28
|
+
reasoning: z.ZodString;
|
|
29
|
+
} & {
|
|
30
|
+
name: z.ZodString;
|
|
31
|
+
searchLimit: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
32
|
+
pythonFetchMetadata: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
33
|
+
}, "strip", z.ZodTypeAny, {
|
|
34
|
+
name: string;
|
|
35
|
+
mainResearchGoal: string;
|
|
36
|
+
researchGoal: string;
|
|
37
|
+
reasoning: string;
|
|
38
|
+
searchLimit: number;
|
|
39
|
+
pythonFetchMetadata: boolean;
|
|
40
|
+
}, {
|
|
41
|
+
name: string;
|
|
42
|
+
mainResearchGoal: string;
|
|
43
|
+
researchGoal: string;
|
|
44
|
+
reasoning: string;
|
|
45
|
+
searchLimit?: number | undefined;
|
|
46
|
+
pythonFetchMetadata?: boolean | undefined;
|
|
47
|
+
}>;
|
|
48
|
+
export declare const PackageSearchQuerySchema: z.ZodDiscriminatedUnion<"ecosystem", [z.ZodObject<{
|
|
49
|
+
mainResearchGoal: z.ZodString;
|
|
50
|
+
researchGoal: z.ZodString;
|
|
51
|
+
reasoning: z.ZodString;
|
|
52
|
+
} & {
|
|
53
|
+
name: z.ZodString;
|
|
54
|
+
searchLimit: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
55
|
+
npmFetchMetadata: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
56
|
+
} & {
|
|
57
|
+
ecosystem: z.ZodLiteral<"npm">;
|
|
58
|
+
}, "strip", z.ZodTypeAny, {
|
|
59
|
+
name: string;
|
|
60
|
+
mainResearchGoal: string;
|
|
61
|
+
researchGoal: string;
|
|
62
|
+
reasoning: string;
|
|
63
|
+
searchLimit: number;
|
|
64
|
+
npmFetchMetadata: boolean;
|
|
65
|
+
ecosystem: "npm";
|
|
66
|
+
}, {
|
|
67
|
+
name: string;
|
|
68
|
+
mainResearchGoal: string;
|
|
69
|
+
researchGoal: string;
|
|
70
|
+
reasoning: string;
|
|
71
|
+
ecosystem: "npm";
|
|
72
|
+
searchLimit?: number | undefined;
|
|
73
|
+
npmFetchMetadata?: boolean | undefined;
|
|
74
|
+
}>, z.ZodObject<{
|
|
75
|
+
mainResearchGoal: z.ZodString;
|
|
76
|
+
researchGoal: z.ZodString;
|
|
77
|
+
reasoning: z.ZodString;
|
|
78
|
+
} & {
|
|
79
|
+
name: z.ZodString;
|
|
80
|
+
searchLimit: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
81
|
+
pythonFetchMetadata: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
82
|
+
} & {
|
|
83
|
+
ecosystem: z.ZodLiteral<"python">;
|
|
84
|
+
}, "strip", z.ZodTypeAny, {
|
|
85
|
+
name: string;
|
|
86
|
+
mainResearchGoal: string;
|
|
87
|
+
researchGoal: string;
|
|
88
|
+
reasoning: string;
|
|
89
|
+
searchLimit: number;
|
|
90
|
+
pythonFetchMetadata: boolean;
|
|
91
|
+
ecosystem: "python";
|
|
92
|
+
}, {
|
|
93
|
+
name: string;
|
|
94
|
+
mainResearchGoal: string;
|
|
95
|
+
researchGoal: string;
|
|
96
|
+
reasoning: string;
|
|
97
|
+
ecosystem: "python";
|
|
98
|
+
searchLimit?: number | undefined;
|
|
99
|
+
pythonFetchMetadata?: boolean | undefined;
|
|
100
|
+
}>]>;
|
|
101
|
+
export declare const PackageSearchBulkQuerySchema: z.ZodObject<{
|
|
102
|
+
queries: z.ZodArray<z.ZodDiscriminatedUnion<"ecosystem", [z.ZodObject<{
|
|
103
|
+
mainResearchGoal: z.ZodString;
|
|
104
|
+
researchGoal: z.ZodString;
|
|
105
|
+
reasoning: z.ZodString;
|
|
106
|
+
} & {
|
|
107
|
+
name: z.ZodString;
|
|
108
|
+
searchLimit: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
109
|
+
npmFetchMetadata: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
110
|
+
} & {
|
|
111
|
+
ecosystem: z.ZodLiteral<"npm">;
|
|
112
|
+
}, "strip", z.ZodTypeAny, {
|
|
113
|
+
name: string;
|
|
114
|
+
mainResearchGoal: string;
|
|
115
|
+
researchGoal: string;
|
|
116
|
+
reasoning: string;
|
|
117
|
+
searchLimit: number;
|
|
118
|
+
npmFetchMetadata: boolean;
|
|
119
|
+
ecosystem: "npm";
|
|
120
|
+
}, {
|
|
121
|
+
name: string;
|
|
122
|
+
mainResearchGoal: string;
|
|
123
|
+
researchGoal: string;
|
|
124
|
+
reasoning: string;
|
|
125
|
+
ecosystem: "npm";
|
|
126
|
+
searchLimit?: number | undefined;
|
|
127
|
+
npmFetchMetadata?: boolean | undefined;
|
|
128
|
+
}>, z.ZodObject<{
|
|
129
|
+
mainResearchGoal: z.ZodString;
|
|
130
|
+
researchGoal: z.ZodString;
|
|
131
|
+
reasoning: z.ZodString;
|
|
132
|
+
} & {
|
|
133
|
+
name: z.ZodString;
|
|
134
|
+
searchLimit: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
135
|
+
pythonFetchMetadata: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
136
|
+
} & {
|
|
137
|
+
ecosystem: z.ZodLiteral<"python">;
|
|
138
|
+
}, "strip", z.ZodTypeAny, {
|
|
139
|
+
name: string;
|
|
140
|
+
mainResearchGoal: string;
|
|
141
|
+
researchGoal: string;
|
|
142
|
+
reasoning: string;
|
|
143
|
+
searchLimit: number;
|
|
144
|
+
pythonFetchMetadata: boolean;
|
|
145
|
+
ecosystem: "python";
|
|
146
|
+
}, {
|
|
147
|
+
name: string;
|
|
148
|
+
mainResearchGoal: string;
|
|
149
|
+
researchGoal: string;
|
|
150
|
+
reasoning: string;
|
|
151
|
+
ecosystem: "python";
|
|
152
|
+
searchLimit?: number | undefined;
|
|
153
|
+
pythonFetchMetadata?: boolean | undefined;
|
|
154
|
+
}>]>, "many">;
|
|
155
|
+
}, "strip", z.ZodTypeAny, {
|
|
156
|
+
queries: ({
|
|
157
|
+
name: string;
|
|
158
|
+
mainResearchGoal: string;
|
|
159
|
+
researchGoal: string;
|
|
160
|
+
reasoning: string;
|
|
161
|
+
searchLimit: number;
|
|
162
|
+
npmFetchMetadata: boolean;
|
|
163
|
+
ecosystem: "npm";
|
|
164
|
+
} | {
|
|
165
|
+
name: string;
|
|
166
|
+
mainResearchGoal: string;
|
|
167
|
+
researchGoal: string;
|
|
168
|
+
reasoning: string;
|
|
169
|
+
searchLimit: number;
|
|
170
|
+
pythonFetchMetadata: boolean;
|
|
171
|
+
ecosystem: "python";
|
|
172
|
+
})[];
|
|
173
|
+
}, {
|
|
174
|
+
queries: ({
|
|
175
|
+
name: string;
|
|
176
|
+
mainResearchGoal: string;
|
|
177
|
+
researchGoal: string;
|
|
178
|
+
reasoning: string;
|
|
179
|
+
ecosystem: "npm";
|
|
180
|
+
searchLimit?: number | undefined;
|
|
181
|
+
npmFetchMetadata?: boolean | undefined;
|
|
182
|
+
} | {
|
|
183
|
+
name: string;
|
|
184
|
+
mainResearchGoal: string;
|
|
185
|
+
researchGoal: string;
|
|
186
|
+
reasoning: string;
|
|
187
|
+
ecosystem: "python";
|
|
188
|
+
searchLimit?: number | undefined;
|
|
189
|
+
pythonFetchMetadata?: boolean | undefined;
|
|
190
|
+
})[];
|
|
191
|
+
}>;
|
|
192
|
+
export type NpmPackageQuery = z.infer<typeof NpmPackageQuerySchema>;
|
|
193
|
+
export type PythonPackageQuery = z.infer<typeof PythonPackageQuerySchema>;
|
|
194
|
+
export type PackageSearchQuery = z.infer<typeof PackageSearchQuerySchema>;
|
|
195
|
+
export type PackageSearchBulkParams = z.infer<typeof PackageSearchBulkQuerySchema>;
|
|
196
|
+
export {};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import type { ToolInvocationCallback } from '../types.js';
|
|
3
|
+
export declare function registerPackageSearchTool(server: McpServer, callback?: ToolInvocationCallback): Promise<RegisteredTool | null>;
|
|
@@ -5,11 +5,12 @@ export interface ToolConfig {
|
|
|
5
5
|
description: string;
|
|
6
6
|
isDefault: boolean;
|
|
7
7
|
type: 'search' | 'content' | 'history' | 'debug';
|
|
8
|
-
fn: (server: McpServer, callback?: ToolInvocationCallback) => RegisteredTool
|
|
8
|
+
fn: (server: McpServer, callback?: ToolInvocationCallback) => RegisteredTool | Promise<RegisteredTool | null>;
|
|
9
9
|
}
|
|
10
10
|
export declare const GITHUB_SEARCH_CODE: ToolConfig;
|
|
11
11
|
export declare const GITHUB_FETCH_CONTENT: ToolConfig;
|
|
12
12
|
export declare const GITHUB_VIEW_REPO_STRUCTURE: ToolConfig;
|
|
13
13
|
export declare const GITHUB_SEARCH_REPOSITORIES: ToolConfig;
|
|
14
14
|
export declare const GITHUB_SEARCH_PULL_REQUESTS: ToolConfig;
|
|
15
|
+
export declare const PACKAGE_SEARCH: ToolConfig;
|
|
15
16
|
export declare const DEFAULT_TOOLS: ToolConfig[];
|
|
@@ -27,6 +27,7 @@ export interface CompleteMetadata {
|
|
|
27
27
|
GITHUB_SEARCH_PULL_REQUESTS: 'githubSearchPullRequests';
|
|
28
28
|
GITHUB_SEARCH_REPOSITORIES: 'githubSearchRepositories';
|
|
29
29
|
GITHUB_VIEW_REPO_STRUCTURE: 'githubViewRepoStructure';
|
|
30
|
+
PACKAGE_SEARCH: 'packageSearch';
|
|
30
31
|
};
|
|
31
32
|
baseSchema: {
|
|
32
33
|
mainResearchGoal: string;
|
|
@@ -72,6 +73,7 @@ export declare const GITHUB_FETCH_CONTENT: {
|
|
|
72
73
|
processing: {
|
|
73
74
|
minified: string;
|
|
74
75
|
sanitize: string;
|
|
76
|
+
addTimestamp: string;
|
|
75
77
|
};
|
|
76
78
|
range: {
|
|
77
79
|
startLine: string;
|
|
@@ -191,4 +193,15 @@ export declare const GITHUB_VIEW_REPO_STRUCTURE: {
|
|
|
191
193
|
depth: string;
|
|
192
194
|
};
|
|
193
195
|
};
|
|
196
|
+
export declare const PACKAGE_SEARCH: {
|
|
197
|
+
search: {
|
|
198
|
+
ecosystem: string;
|
|
199
|
+
name: string;
|
|
200
|
+
};
|
|
201
|
+
options: {
|
|
202
|
+
searchLimit: string;
|
|
203
|
+
npmFetchMetadata: string;
|
|
204
|
+
pythonFetchMetadata: string;
|
|
205
|
+
};
|
|
206
|
+
};
|
|
194
207
|
export {};
|
package/dist/src/types.d.ts
CHANGED
|
@@ -106,6 +106,7 @@ export interface FileContentQuery {
|
|
|
106
106
|
matchStringContextLines?: number;
|
|
107
107
|
minified?: boolean;
|
|
108
108
|
sanitize?: boolean;
|
|
109
|
+
addTimestamp?: boolean;
|
|
109
110
|
mainResearchGoal?: string;
|
|
110
111
|
researchGoal?: string;
|
|
111
112
|
reasoning?: string;
|
|
@@ -135,6 +136,8 @@ export interface ContentResultData {
|
|
|
135
136
|
originalQuery?: FileContentQuery;
|
|
136
137
|
securityWarnings?: string[];
|
|
137
138
|
sampling?: SamplingInfo;
|
|
139
|
+
lastModified?: string;
|
|
140
|
+
lastModifiedBy?: string;
|
|
138
141
|
}
|
|
139
142
|
/** Complete file content result */
|
|
140
143
|
export interface ContentResult extends BaseToolResult<FileContentQuery>, ContentResultData {
|
|
@@ -162,7 +165,9 @@ export interface SimplifiedRepository {
|
|
|
162
165
|
stars: number;
|
|
163
166
|
description: string;
|
|
164
167
|
url: string;
|
|
168
|
+
createdAt: string;
|
|
165
169
|
updatedAt: string;
|
|
170
|
+
pushedAt: string;
|
|
166
171
|
}
|
|
167
172
|
/** Repository search result */
|
|
168
173
|
export interface RepoSearchResult extends BaseToolResult<GitHubReposSearchQuery> {
|
|
@@ -190,6 +195,36 @@ export interface RepoStructureResultData {
|
|
|
190
195
|
/** Complete repository structure result */
|
|
191
196
|
export interface RepoStructureResult extends BaseToolResult<GitHubViewRepoStructureQuery>, RepoStructureResultData {
|
|
192
197
|
}
|
|
198
|
+
/** Query parameters for searching packages */
|
|
199
|
+
export interface PackageSearchQuery {
|
|
200
|
+
name: string;
|
|
201
|
+
ecosystem: 'npm' | 'python';
|
|
202
|
+
searchLimit?: number;
|
|
203
|
+
npmFetchMetadata?: boolean;
|
|
204
|
+
mainResearchGoal?: string;
|
|
205
|
+
researchGoal?: string;
|
|
206
|
+
reasoning?: string;
|
|
207
|
+
}
|
|
208
|
+
/** Individual package in search results */
|
|
209
|
+
export interface PackageInfo {
|
|
210
|
+
name: string;
|
|
211
|
+
version: string;
|
|
212
|
+
description: string | null;
|
|
213
|
+
keywords: string[];
|
|
214
|
+
repository: string | null;
|
|
215
|
+
license?: string;
|
|
216
|
+
homepage?: string;
|
|
217
|
+
author?: string;
|
|
218
|
+
}
|
|
219
|
+
/** Package search result data */
|
|
220
|
+
export interface PackageSearchResultData {
|
|
221
|
+
packages: PackageInfo[];
|
|
222
|
+
ecosystem: 'npm' | 'python';
|
|
223
|
+
totalFound: number;
|
|
224
|
+
}
|
|
225
|
+
/** Complete package search result */
|
|
226
|
+
export interface PackageSearchResult extends BaseToolResult<PackageSearchQuery>, PackageSearchResultData {
|
|
227
|
+
}
|
|
193
228
|
/** Query parameters for searching pull requests */
|
|
194
229
|
export interface GitHubPullRequestSearchQuery {
|
|
195
230
|
query?: string;
|
|
@@ -425,8 +460,6 @@ export interface SanitizationResult {
|
|
|
425
460
|
hasSecrets: boolean;
|
|
426
461
|
secretsDetected: string[];
|
|
427
462
|
warnings: string[];
|
|
428
|
-
hasPromptInjection?: boolean;
|
|
429
|
-
isMalicious?: boolean;
|
|
430
463
|
}
|
|
431
464
|
/** Result of parameter validation */
|
|
432
465
|
export interface ValidationResult {
|
|
@@ -1,14 +1,4 @@
|
|
|
1
1
|
import type { CacheStats } from '../types.js';
|
|
2
|
-
export declare const CACHE_TTL_CONFIG: {
|
|
3
|
-
readonly 'gh-api-code': 3600;
|
|
4
|
-
readonly 'gh-api-repos': 7200;
|
|
5
|
-
readonly 'gh-api-prs': 1800;
|
|
6
|
-
readonly 'gh-api-file-content': 3600;
|
|
7
|
-
readonly 'gh-repo-structure-api': 7200;
|
|
8
|
-
readonly 'github-user': 900;
|
|
9
|
-
readonly default: 86400;
|
|
10
|
-
};
|
|
11
|
-
export type CachePrefix = keyof typeof CACHE_TTL_CONFIG | string;
|
|
12
2
|
export declare function generateCacheKey(prefix: string, params: unknown, sessionId?: string): string;
|
|
13
3
|
/**
|
|
14
4
|
* Generic typed cache wrapper for raw data (avoids JSON round-trips)
|
|
@@ -1,8 +1 @@
|
|
|
1
|
-
export interface PatchLine {
|
|
2
|
-
originalLineNumber: number | null;
|
|
3
|
-
newLineNumber: number | null;
|
|
4
|
-
content: string;
|
|
5
|
-
type: 'context' | 'addition' | 'deletion';
|
|
6
|
-
}
|
|
7
|
-
export declare function parsePatch(patch: string): PatchLine[];
|
|
8
1
|
export declare function filterPatch(patch: string, additions?: number[], deletions?: number[]): string;
|
package/dist/src/utils/exec.d.ts
CHANGED
|
@@ -1,3 +1,25 @@
|
|
|
1
|
-
import { CallToolResult } from '@modelcontextprotocol/sdk/types';
|
|
2
|
-
export declare function parseExecResult(stdout: string, stderr: string, error?: Error | null, exitCode?: number): CallToolResult;
|
|
3
1
|
export declare function getGithubCLIToken(): Promise<string | null>;
|
|
2
|
+
declare const ALLOWED_NPM_COMMANDS: readonly ["view", "search", "ping", "config", "whoami"];
|
|
3
|
+
type NpmCommand = (typeof ALLOWED_NPM_COMMANDS)[number];
|
|
4
|
+
type NpmExecOptions = {
|
|
5
|
+
timeout?: number;
|
|
6
|
+
cwd?: string;
|
|
7
|
+
env?: Record<string, string>;
|
|
8
|
+
};
|
|
9
|
+
interface NpmExecResult {
|
|
10
|
+
stdout: string;
|
|
11
|
+
stderr: string;
|
|
12
|
+
error?: Error;
|
|
13
|
+
exitCode?: number;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Check if npm registry is available by running `npm ping`
|
|
17
|
+
* @param timeoutMs - Timeout in milliseconds (default 10000ms)
|
|
18
|
+
* @returns true if npm registry is reachable, false otherwise
|
|
19
|
+
*/
|
|
20
|
+
export declare function checkNpmAvailability(timeoutMs?: number): Promise<boolean>;
|
|
21
|
+
/**
|
|
22
|
+
* Execute NPM command with security validation using spawn (safer than exec)
|
|
23
|
+
*/
|
|
24
|
+
export declare function executeNpmCommand(command: NpmCommand, args: string[], options?: NpmExecOptions): Promise<NpmExecResult>;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { NpmPackageResult } from './package.js';
|
|
2
|
+
/**
|
|
3
|
+
* Attempts to infer the GitHub repository for an npm package
|
|
4
|
+
* when the npm registry doesn't have the repository field.
|
|
5
|
+
*
|
|
6
|
+
* Uses heuristics and known mappings - no API calls required.
|
|
7
|
+
*/
|
|
8
|
+
export declare function tryInferRepoUrl(packageName: string, existingResult: NpmPackageResult): NpmPackageResult;
|
|
9
|
+
/**
|
|
10
|
+
* Add a new known package to repo mapping at runtime.
|
|
11
|
+
* Useful for caching discovered mappings.
|
|
12
|
+
*/
|
|
13
|
+
export declare function addKnownPackageRepo(packageName: string, repoUrl: string): void;
|
|
14
|
+
/**
|
|
15
|
+
* Get the GitHub organization for a given npm scope.
|
|
16
|
+
*/
|
|
17
|
+
export declare function getOrgForScope(scope: string): string | undefined;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { PackageSearchAPIResult, PackageSearchError, DeprecationInfo } from './package.js';
|
|
2
|
+
export declare function searchNpmPackage(packageName: string, limit: number, fetchMetadata: boolean): Promise<PackageSearchAPIResult | PackageSearchError>;
|
|
3
|
+
export declare function checkNpmDeprecation(packageName: string): Promise<DeprecationInfo | null>;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { checkNpmDeprecation } from './npmPackage.js';
|
|
2
|
+
export interface PackageSearchInput {
|
|
3
|
+
ecosystem: 'npm' | 'python';
|
|
4
|
+
name: string;
|
|
5
|
+
searchLimit?: number;
|
|
6
|
+
npmFetchMetadata?: boolean;
|
|
7
|
+
pythonFetchMetadata?: boolean;
|
|
8
|
+
mainResearchGoal?: string;
|
|
9
|
+
researchGoal?: string;
|
|
10
|
+
reasoning?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface MinimalPackageResult {
|
|
13
|
+
name: string;
|
|
14
|
+
repository: string | null;
|
|
15
|
+
}
|
|
16
|
+
export interface NpmPackageResult {
|
|
17
|
+
repoUrl: string | null;
|
|
18
|
+
path: string;
|
|
19
|
+
version: string;
|
|
20
|
+
mainEntry: string | null;
|
|
21
|
+
typeDefinitions: string | null;
|
|
22
|
+
lastPublished?: string;
|
|
23
|
+
}
|
|
24
|
+
export interface PythonPackageResult {
|
|
25
|
+
name: string;
|
|
26
|
+
version: string;
|
|
27
|
+
description: string | null;
|
|
28
|
+
keywords: string[];
|
|
29
|
+
repository: string | null;
|
|
30
|
+
homepage?: string;
|
|
31
|
+
author?: string;
|
|
32
|
+
license?: string;
|
|
33
|
+
lastPublished?: string;
|
|
34
|
+
}
|
|
35
|
+
export type PackageResult = MinimalPackageResult | NpmPackageResult | PythonPackageResult;
|
|
36
|
+
export interface PackageSearchAPIResult {
|
|
37
|
+
packages: PackageResult[];
|
|
38
|
+
ecosystem: 'npm' | 'python';
|
|
39
|
+
totalFound: number;
|
|
40
|
+
}
|
|
41
|
+
export interface PackageSearchError {
|
|
42
|
+
error: string;
|
|
43
|
+
hints?: string[];
|
|
44
|
+
}
|
|
45
|
+
export interface DeprecationInfo {
|
|
46
|
+
deprecated: boolean;
|
|
47
|
+
message?: string;
|
|
48
|
+
}
|
|
49
|
+
export declare function searchPackage(query: PackageSearchInput): Promise<PackageSearchAPIResult | PackageSearchError>;
|
|
50
|
+
export { checkNpmDeprecation };
|
|
@@ -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 {};
|