@jahales/mcp-zoekt 2.2.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.
- package/LICENSE +190 -0
- package/README.md +400 -0
- package/dist/config.d.ts +17 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +83 -0
- package/dist/config.js.map +1 -0
- package/dist/errors/codes.d.ts +28 -0
- package/dist/errors/codes.d.ts.map +1 -0
- package/dist/errors/codes.js +161 -0
- package/dist/errors/codes.js.map +1 -0
- package/dist/formatting/repoList.d.ts +14 -0
- package/dist/formatting/repoList.d.ts.map +1 -0
- package/dist/formatting/repoList.js +55 -0
- package/dist/formatting/repoList.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +88 -0
- package/dist/index.js.map +1 -0
- package/dist/logger.d.ts +8 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/logger.js +36 -0
- package/dist/logger.js.map +1 -0
- package/dist/pagination/cursor.d.ts +103 -0
- package/dist/pagination/cursor.d.ts.map +1 -0
- package/dist/pagination/cursor.js +136 -0
- package/dist/pagination/cursor.js.map +1 -0
- package/dist/server.d.ts +12 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +468 -0
- package/dist/server.js.map +1 -0
- package/dist/tools/find-references.d.ts +53 -0
- package/dist/tools/find-references.d.ts.map +1 -0
- package/dist/tools/find-references.js +284 -0
- package/dist/tools/find-references.js.map +1 -0
- package/dist/tools/get-health.d.ts +37 -0
- package/dist/tools/get-health.d.ts.map +1 -0
- package/dist/tools/get-health.js +128 -0
- package/dist/tools/get-health.js.map +1 -0
- package/dist/tools/search-files.d.ts +58 -0
- package/dist/tools/search-files.d.ts.map +1 -0
- package/dist/tools/search-files.js +139 -0
- package/dist/tools/search-files.js.map +1 -0
- package/dist/tools/search-symbols.d.ts +49 -0
- package/dist/tools/search-symbols.d.ts.map +1 -0
- package/dist/tools/search-symbols.js +235 -0
- package/dist/tools/search-symbols.js.map +1 -0
- package/dist/zoekt/client.d.ts +51 -0
- package/dist/zoekt/client.d.ts.map +1 -0
- package/dist/zoekt/client.js +262 -0
- package/dist/zoekt/client.js.map +1 -0
- package/dist/zoekt/types.d.ts +208 -0
- package/dist/zoekt/types.d.ts.map +1 -0
- package/dist/zoekt/types.js +6 -0
- package/dist/zoekt/types.js.map +1 -0
- package/package.json +66 -0
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stateless pagination cursor implementation
|
|
3
|
+
*
|
|
4
|
+
* Cursors encode query hash + offset for stateless pagination.
|
|
5
|
+
* They never expire but are only valid for the same query.
|
|
6
|
+
*
|
|
7
|
+
* ## Public API (for tool handlers)
|
|
8
|
+
* - `validateCursor()` - Validate and decode a cursor
|
|
9
|
+
* - `generateNextCursor()` - Generate cursor for next page
|
|
10
|
+
*
|
|
11
|
+
* ## Internal API (not for external use)
|
|
12
|
+
* - `encodeCursor()` - Internal: encode cursor payload
|
|
13
|
+
* - `decodeCursor()` - Internal: decode cursor payload
|
|
14
|
+
* - `hashQuery()` - Internal: hash query string
|
|
15
|
+
*
|
|
16
|
+
* @module pagination/cursor
|
|
17
|
+
*/
|
|
18
|
+
import { createHash } from 'crypto';
|
|
19
|
+
/**
|
|
20
|
+
* Encode a pagination cursor as a base64 string.
|
|
21
|
+
*
|
|
22
|
+
* @internal This is an internal function. Use `generateNextCursor()` instead.
|
|
23
|
+
*
|
|
24
|
+
* @param query - The search query string
|
|
25
|
+
* @param offset - Number of results already returned
|
|
26
|
+
* @returns Base64-encoded cursor string
|
|
27
|
+
*
|
|
28
|
+
* @deprecated Since v1.1.0 - Use `generateNextCursor()` for cursor generation.
|
|
29
|
+
* This function may be made private in a future version.
|
|
30
|
+
*/
|
|
31
|
+
export function encodeCursor(query, offset) {
|
|
32
|
+
const queryHash = hashQuery(query);
|
|
33
|
+
const json = JSON.stringify({ q: queryHash, o: offset });
|
|
34
|
+
return Buffer.from(json).toString('base64');
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Decode a pagination cursor from a base64 string.
|
|
38
|
+
* Supports legacy cursors that include limit field (ignored).
|
|
39
|
+
*
|
|
40
|
+
* @internal This is an internal function. Use `validateCursor()` instead.
|
|
41
|
+
*
|
|
42
|
+
* @param cursor - Base64-encoded cursor string
|
|
43
|
+
* @returns Decoded cursor or null if invalid
|
|
44
|
+
*
|
|
45
|
+
* @deprecated Since v1.1.0 - Use `validateCursor()` which includes validation.
|
|
46
|
+
* This function may be made private in a future version.
|
|
47
|
+
*/
|
|
48
|
+
export function decodeCursor(cursor) {
|
|
49
|
+
try {
|
|
50
|
+
const json = Buffer.from(cursor, 'base64').toString('utf-8');
|
|
51
|
+
const data = JSON.parse(json);
|
|
52
|
+
if (typeof data.q !== 'string' ||
|
|
53
|
+
typeof data.o !== 'number') {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
// Note: data.l (limit) is intentionally ignored for backward compatibility
|
|
57
|
+
return {
|
|
58
|
+
queryHash: data.q,
|
|
59
|
+
offset: data.o,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
catch {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Validate a cursor against the current query.
|
|
68
|
+
*
|
|
69
|
+
* This is the primary public API for cursor validation in tool handlers.
|
|
70
|
+
*
|
|
71
|
+
* @param cursor - Base64-encoded cursor string
|
|
72
|
+
* @param query - Current search query to validate against
|
|
73
|
+
* @returns Validation result with decoded cursor if valid
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* ```typescript
|
|
77
|
+
* const result = validateCursor(cursor, query);
|
|
78
|
+
* if (!result.valid) {
|
|
79
|
+
* return { error: result.error };
|
|
80
|
+
* }
|
|
81
|
+
* const offset = result.cursor.offset;
|
|
82
|
+
* ```
|
|
83
|
+
*/
|
|
84
|
+
export function validateCursor(cursor, query) {
|
|
85
|
+
const decoded = decodeCursor(cursor);
|
|
86
|
+
if (!decoded) {
|
|
87
|
+
return { valid: false, error: 'Invalid cursor format' };
|
|
88
|
+
}
|
|
89
|
+
const currentHash = hashQuery(query);
|
|
90
|
+
if (decoded.queryHash !== currentHash) {
|
|
91
|
+
return {
|
|
92
|
+
valid: false,
|
|
93
|
+
error: 'Cursor does not match current query. Cursors are only valid for the same query.'
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
if (decoded.offset < 0) {
|
|
97
|
+
return { valid: false, error: 'Invalid cursor: negative offset' };
|
|
98
|
+
}
|
|
99
|
+
return { valid: true, cursor: decoded };
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Create a hash of the query string for cursor validation.
|
|
103
|
+
*
|
|
104
|
+
* @internal This is an internal function.
|
|
105
|
+
*
|
|
106
|
+
* @deprecated Since v1.1.0 - Internal implementation detail.
|
|
107
|
+
* This function may be made private in a future version.
|
|
108
|
+
*/
|
|
109
|
+
export function hashQuery(query) {
|
|
110
|
+
return createHash('sha256').update(query).digest('hex').substring(0, 16);
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Calculate if there are more results and generate nextCursor.
|
|
114
|
+
*
|
|
115
|
+
* This is the primary public API for cursor generation in tool handlers.
|
|
116
|
+
*
|
|
117
|
+
* @param query - The search query
|
|
118
|
+
* @param currentOffset - Current offset (results already returned)
|
|
119
|
+
* @param limit - Page size
|
|
120
|
+
* @param totalResults - Total number of results available
|
|
121
|
+
* @returns Next cursor string or undefined if no more results
|
|
122
|
+
*
|
|
123
|
+
* @example
|
|
124
|
+
* ```typescript
|
|
125
|
+
* const nextCursor = generateNextCursor(query, offset, limit, totalItems);
|
|
126
|
+
* // Returns cursor string or undefined if no more pages
|
|
127
|
+
* ```
|
|
128
|
+
*/
|
|
129
|
+
export function generateNextCursor(query, currentOffset, limit, totalResults) {
|
|
130
|
+
const nextOffset = currentOffset + limit;
|
|
131
|
+
if (nextOffset >= totalResults) {
|
|
132
|
+
return undefined;
|
|
133
|
+
}
|
|
134
|
+
return encodeCursor(query, nextOffset);
|
|
135
|
+
}
|
|
136
|
+
//# sourceMappingURL=cursor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cursor.js","sourceRoot":"","sources":["../../src/pagination/cursor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAiBpC;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,YAAY,CAAC,KAAa,EAAE,MAAc;IACxD,MAAM,SAAS,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC;IACnC,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;IACzD,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AAC9C,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,YAAY,CAAC,MAAc;IACzC,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QAC7D,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAA2C,CAAC;QAExE,IAAI,OAAO,IAAI,CAAC,CAAC,KAAK,QAAQ;YAC1B,OAAO,IAAI,CAAC,CAAC,KAAK,QAAQ,EAAE,CAAC;YAC/B,OAAO,IAAI,CAAC;QACd,CAAC;QAED,2EAA2E;QAC3E,OAAO;YACL,SAAS,EAAE,IAAI,CAAC,CAAC;YACjB,MAAM,EAAE,IAAI,CAAC,CAAC;SACf,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED;;;;;;;;;;;;;;;;;G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ontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import type { McpServerConfig } from './config.js';
|
|
3
|
+
import type { Logger } from './logger.js';
|
|
4
|
+
/**
|
|
5
|
+
* Create and configure the MCP server with all tools
|
|
6
|
+
*/
|
|
7
|
+
export declare function createMcpServer(config: McpServerConfig, logger: Logger): McpServer;
|
|
8
|
+
/**
|
|
9
|
+
* Start the MCP server with the configured transport
|
|
10
|
+
*/
|
|
11
|
+
export declare function startServer(server: McpServer, config: McpServerConfig, logger: Logger): Promise<void>;
|
|
12
|
+
//# sourceMappingURL=server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAMpE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAS1C;;GAEG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,eAAe,EACvB,MAAM,EAAE,MAAM,GACb,SAAS,CA+BX;AA+aD;;GAEG;AACH,wBAAsB,WAAW,CAC/B,MAAM,EAAE,SAAS,EACjB,MAAM,EAAE,eAAe,EACvB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,IAAI,CAAC,CASf"}
|
package/dist/server.js
ADDED
|
@@ -0,0 +1,468 @@
|
|
|
1
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
3
|
+
import { SSEServerTransport } from '@modelcontextprotocol/sdk/server/sse.js';
|
|
4
|
+
import { randomUUID } from 'crypto';
|
|
5
|
+
import { createServer } from 'http';
|
|
6
|
+
import { z } from 'zod';
|
|
7
|
+
import { ZoektClient, ZoektError } from './zoekt/client.js';
|
|
8
|
+
import { formatRepoList, formatEmptyResponse } from './formatting/repoList.js';
|
|
9
|
+
import { createSearchSymbolsHandler } from './tools/search-symbols.js';
|
|
10
|
+
import { createSearchFilesHandler } from './tools/search-files.js';
|
|
11
|
+
import { createFindReferencesHandler } from './tools/find-references.js';
|
|
12
|
+
import { createGetHealthHandler } from './tools/get-health.js';
|
|
13
|
+
/**
|
|
14
|
+
* Create and configure the MCP server with all tools
|
|
15
|
+
*/
|
|
16
|
+
export function createMcpServer(config, logger) {
|
|
17
|
+
const server = new McpServer({
|
|
18
|
+
name: 'zoekt-mcp',
|
|
19
|
+
version: '1.0.0',
|
|
20
|
+
});
|
|
21
|
+
const zoektClient = new ZoektClient(config.zoektUrl, config.timeoutMs);
|
|
22
|
+
const toolLogger = logger.child({ module: 'tools' });
|
|
23
|
+
// Register search tool
|
|
24
|
+
registerSearchTool(server, zoektClient, toolLogger);
|
|
25
|
+
// Register list_repos tool
|
|
26
|
+
registerListReposTool(server, zoektClient, toolLogger);
|
|
27
|
+
// Register file_content tool
|
|
28
|
+
registerFileContentTool(server, zoektClient, toolLogger);
|
|
29
|
+
// Register search_symbols tool
|
|
30
|
+
registerSearchSymbolsTool(server, zoektClient, toolLogger);
|
|
31
|
+
// Register search_files tool
|
|
32
|
+
registerSearchFilesTool(server, zoektClient, toolLogger);
|
|
33
|
+
// Register find_references tool
|
|
34
|
+
registerFindReferencesTool(server, zoektClient, toolLogger);
|
|
35
|
+
// Register get_health tool
|
|
36
|
+
registerGetHealthTool(server, zoektClient, toolLogger);
|
|
37
|
+
return server;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Register the search tool
|
|
41
|
+
*/
|
|
42
|
+
function registerSearchTool(server, client, logger) {
|
|
43
|
+
server.tool('search', 'Search code across indexed repositories using Zoekt query syntax', {
|
|
44
|
+
query: z.string().describe('Zoekt search query. Supports regex, file filters (file:, lang:), repo filters (repo:), symbol search (sym:), and boolean operators (and, or, not).'),
|
|
45
|
+
limit: z.number().int().min(1).max(100).default(30).describe('Maximum number of file matches to return'),
|
|
46
|
+
contextLines: z.number().int().min(0).max(10).default(3).describe('Number of context lines to include around each match'),
|
|
47
|
+
}, async ({ query, limit, contextLines }) => {
|
|
48
|
+
const startTime = Date.now();
|
|
49
|
+
logger.info({ query, limit, contextLines }, 'search request');
|
|
50
|
+
try {
|
|
51
|
+
const response = await client.search(query, { limit, contextLines });
|
|
52
|
+
const duration = Date.now() - startTime;
|
|
53
|
+
const fileMatches = response.result?.FileMatches ?? [];
|
|
54
|
+
const stats = response.result?.Stats;
|
|
55
|
+
logger.info({ query, duration, matchCount: stats?.MatchCount ?? 0, fileCount: fileMatches.length }, 'search complete');
|
|
56
|
+
if (fileMatches.length === 0) {
|
|
57
|
+
return {
|
|
58
|
+
content: [{ type: 'text', text: `## Results for: \`${query}\`\n\nNo matches found.` }],
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
const formattedResults = formatSearchResults(query, fileMatches, stats);
|
|
62
|
+
return {
|
|
63
|
+
content: [{ type: 'text', text: formattedResults }],
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
catch (error) {
|
|
67
|
+
const duration = Date.now() - startTime;
|
|
68
|
+
logger.error({ query, duration, err: error }, 'search error');
|
|
69
|
+
return {
|
|
70
|
+
content: [{ type: 'text', text: formatError(error) }],
|
|
71
|
+
isError: true,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Register the list_repos tool
|
|
78
|
+
*/
|
|
79
|
+
function registerListReposTool(server, client, logger) {
|
|
80
|
+
server.tool('list_repos', 'List all indexed repositories or filter by name pattern', {
|
|
81
|
+
filter: z.string().optional().describe('Optional filter pattern to match repository names (regex supported)'),
|
|
82
|
+
}, async ({ filter }) => {
|
|
83
|
+
const startTime = Date.now();
|
|
84
|
+
logger.info({ filter }, 'list_repos request');
|
|
85
|
+
try {
|
|
86
|
+
const repos = await client.listRepos(filter);
|
|
87
|
+
const duration = Date.now() - startTime;
|
|
88
|
+
logger.info({ filter, duration, count: repos.length }, 'list_repos complete');
|
|
89
|
+
if (repos.length === 0) {
|
|
90
|
+
return {
|
|
91
|
+
content: [{ type: 'text', text: formatEmptyResponse(filter) }],
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
const formatted = formatRepoList(repos, filter);
|
|
95
|
+
return {
|
|
96
|
+
content: [{ type: 'text', text: formatted }],
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
catch (error) {
|
|
100
|
+
const duration = Date.now() - startTime;
|
|
101
|
+
logger.error({ filter, duration, err: error }, 'list_repos error');
|
|
102
|
+
return {
|
|
103
|
+
content: [{ type: 'text', text: formatError(error) }],
|
|
104
|
+
isError: true,
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Register the file_content tool
|
|
111
|
+
*/
|
|
112
|
+
function registerFileContentTool(server, client, logger) {
|
|
113
|
+
server.tool('file_content', 'Retrieve the full contents of a file from an indexed repository', {
|
|
114
|
+
repository: z.string().describe("Full repository name (e.g., 'github.com/org/repo')"),
|
|
115
|
+
path: z.string().describe('Path to the file within the repository'),
|
|
116
|
+
branch: z.string().optional().describe('Branch name (optional, defaults to HEAD or working tree)'),
|
|
117
|
+
}, async ({ repository, path, branch }) => {
|
|
118
|
+
const startTime = Date.now();
|
|
119
|
+
logger.info({ repository, path, branch }, 'file_content request');
|
|
120
|
+
try {
|
|
121
|
+
const content = await client.getFileContent(repository, path, branch);
|
|
122
|
+
const duration = Date.now() - startTime;
|
|
123
|
+
logger.info({ repository, path, branch, duration, size: content.length }, 'file_content complete');
|
|
124
|
+
const language = detectLanguage(path);
|
|
125
|
+
const formatted = formatFileContent(repository, path, branch, content, language);
|
|
126
|
+
return {
|
|
127
|
+
content: [{ type: 'text', text: formatted }],
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
catch (error) {
|
|
131
|
+
const duration = Date.now() - startTime;
|
|
132
|
+
logger.error({ repository, path, branch, duration, err: error }, 'file_content error');
|
|
133
|
+
return {
|
|
134
|
+
content: [{ type: 'text', text: formatError(error) }],
|
|
135
|
+
isError: true,
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Register the search_symbols tool
|
|
142
|
+
*/
|
|
143
|
+
function registerSearchSymbolsTool(server, client, logger) {
|
|
144
|
+
const handler = createSearchSymbolsHandler(client, logger);
|
|
145
|
+
server.tool('search_symbols', 'Search for symbol names (functions, classes, methods, variables) across indexed repositories. Automatically uses Zoekt sym: query prefix.', {
|
|
146
|
+
query: z.string().describe(`Symbol search query. Examples:
|
|
147
|
+
- handleRequest - Find symbols named "handleRequest"
|
|
148
|
+
- /^get.*/ - Symbols starting with "get" (regex)
|
|
149
|
+
- handler lang:typescript - TypeScript symbols matching "handler"
|
|
150
|
+
- UserService repo:myorg/myrepo - Symbol in specific repo`),
|
|
151
|
+
limit: z.number().int().min(1).max(100).default(30).describe('Maximum number of symbols to return'),
|
|
152
|
+
contextLines: z.number().int().min(0).max(10).default(3).describe('Number of context lines to include around each match'),
|
|
153
|
+
cursor: z.string().optional().describe('Pagination cursor from previous response'),
|
|
154
|
+
}, async ({ query, limit, contextLines, cursor }) => {
|
|
155
|
+
return handler({ query, limit, contextLines, cursor });
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Register the search_files tool
|
|
160
|
+
*/
|
|
161
|
+
function registerSearchFilesTool(server, client, logger) {
|
|
162
|
+
const handler = createSearchFilesHandler(client, logger);
|
|
163
|
+
server.tool('search_files', 'Search for files by filename pattern across indexed repositories. Returns file paths only, not content.', {
|
|
164
|
+
query: z.string().describe(`File name search query. Examples:
|
|
165
|
+
- package.json - Exact filename match
|
|
166
|
+
- /.*\\.test\\.ts$/ - TypeScript test files (regex)
|
|
167
|
+
- README.md repo:myorg/myrepo - README in specific repo
|
|
168
|
+
- config lang:yaml - YAML config files`),
|
|
169
|
+
limit: z.number().int().min(1).max(100).default(30).describe('Maximum number of files to return'),
|
|
170
|
+
cursor: z.string().optional().describe('Pagination cursor from previous response'),
|
|
171
|
+
}, async ({ query, limit, cursor }) => {
|
|
172
|
+
return handler({ query, limit, cursor });
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Register the find_references tool
|
|
177
|
+
*/
|
|
178
|
+
function registerFindReferencesTool(server, client, logger) {
|
|
179
|
+
const handler = createFindReferencesHandler(client, logger);
|
|
180
|
+
server.tool('find_references', 'Find all definitions and usages of a symbol across indexed repositories. Returns both where the symbol is defined and where it is used.', {
|
|
181
|
+
symbol: z.string().describe(`Symbol to find references for. Examples:
|
|
182
|
+
- handleRequest - Find all references to "handleRequest"
|
|
183
|
+
- UserService - Find class definition and usages
|
|
184
|
+
- validateInput - Find function definition and call sites`),
|
|
185
|
+
filters: z.string().optional().describe(`Additional query filters. Examples:
|
|
186
|
+
- lang:typescript - Limit to TypeScript files
|
|
187
|
+
- repo:myorg/myrepo - Limit to specific repository
|
|
188
|
+
- lang:go repo:backend - Multiple filters`),
|
|
189
|
+
limit: z.number().int().min(1).max(100).default(30).describe('Maximum number of references to return'),
|
|
190
|
+
contextLines: z.number().int().min(0).max(10).default(3).describe('Number of context lines to include around each match'),
|
|
191
|
+
cursor: z.string().optional().describe('Pagination cursor from previous response'),
|
|
192
|
+
}, async ({ symbol, filters, limit, contextLines, cursor }) => {
|
|
193
|
+
return handler({ symbol, filters, limit, contextLines, cursor });
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Register the get_health tool
|
|
198
|
+
*/
|
|
199
|
+
function registerGetHealthTool(server, client, logger) {
|
|
200
|
+
const handler = createGetHealthHandler(client, logger);
|
|
201
|
+
server.tool('get_health', 'Check health status of the MCP server and Zoekt backend. Returns connectivity status, server version, and index statistics.', {
|
|
202
|
+
// No parameters required
|
|
203
|
+
}, async () => {
|
|
204
|
+
return handler({});
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Format search results as readable text
|
|
209
|
+
*/
|
|
210
|
+
function formatSearchResults(query, fileMatches, stats) {
|
|
211
|
+
let output = `## Results for: \`${query}\`\n\n`;
|
|
212
|
+
for (const match of fileMatches) {
|
|
213
|
+
const repoName = match.Repo ?? match.Repository ?? 'Unknown';
|
|
214
|
+
output += `### ${repoName} - ${match.FileName}\n`;
|
|
215
|
+
output += `Language: ${match.Language || 'Unknown'} | Branch: ${match.Branches?.[0] || 'HEAD'}\n\n`;
|
|
216
|
+
// Handle ChunkMatches (newer format)
|
|
217
|
+
if (match.ChunkMatches && match.ChunkMatches.length > 0) {
|
|
218
|
+
for (const chunk of match.ChunkMatches) {
|
|
219
|
+
const content = decodeBase64(chunk.Content);
|
|
220
|
+
const startLine = chunk.ContentStart.LineNumber;
|
|
221
|
+
output += `\`\`\`${match.Language?.toLowerCase() || ''}\n`;
|
|
222
|
+
output += content;
|
|
223
|
+
output += `\`\`\`\n`;
|
|
224
|
+
output += `Line ${startLine}\n\n`;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
// Handle LineMatches (older format)
|
|
228
|
+
else if (match.LineMatches && match.LineMatches.length > 0) {
|
|
229
|
+
for (const line of match.LineMatches) {
|
|
230
|
+
const content = decodeBase64(line.Line);
|
|
231
|
+
output += `Line ${line.LineNumber}: ${content.trim()}\n`;
|
|
232
|
+
}
|
|
233
|
+
output += '\n';
|
|
234
|
+
}
|
|
235
|
+
output += '---\n\n';
|
|
236
|
+
}
|
|
237
|
+
if (stats) {
|
|
238
|
+
const durationMs = stats.Duration / 1_000_000; // nanoseconds to ms
|
|
239
|
+
output += `Stats: ${stats.MatchCount} matches in ${stats.FileCount} files (${durationMs.toFixed(0)}ms)\n`;
|
|
240
|
+
}
|
|
241
|
+
return output;
|
|
242
|
+
}
|
|
243
|
+
// formatRepoList, formatBytesCompact, and formatEmptyResponse are imported from './formatting/repoList.js'
|
|
244
|
+
/**
|
|
245
|
+
* Format file content response
|
|
246
|
+
*/
|
|
247
|
+
function formatFileContent(repository, path, branch, content, language) {
|
|
248
|
+
let output = `## ${repository}/${path}\n\n`;
|
|
249
|
+
output += `Branch: ${branch || 'HEAD'}\n\n`;
|
|
250
|
+
output += `\`\`\`${language}\n`;
|
|
251
|
+
output += content;
|
|
252
|
+
if (!content.endsWith('\n')) {
|
|
253
|
+
output += '\n';
|
|
254
|
+
}
|
|
255
|
+
output += `\`\`\`\n`;
|
|
256
|
+
return output;
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Format error for MCP response
|
|
260
|
+
*/
|
|
261
|
+
function formatError(error) {
|
|
262
|
+
if (error instanceof ZoektError) {
|
|
263
|
+
return `Error: ${error.message}`;
|
|
264
|
+
}
|
|
265
|
+
if (error instanceof Error) {
|
|
266
|
+
return `Error: ${error.message}`;
|
|
267
|
+
}
|
|
268
|
+
return 'An unknown error occurred';
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* Detect language from file extension
|
|
272
|
+
*/
|
|
273
|
+
function detectLanguage(path) {
|
|
274
|
+
const ext = path.split('.').pop()?.toLowerCase();
|
|
275
|
+
const languageMap = {
|
|
276
|
+
ts: 'typescript',
|
|
277
|
+
tsx: 'typescript',
|
|
278
|
+
js: 'javascript',
|
|
279
|
+
jsx: 'javascript',
|
|
280
|
+
py: 'python',
|
|
281
|
+
go: 'go',
|
|
282
|
+
rs: 'rust',
|
|
283
|
+
java: 'java',
|
|
284
|
+
kt: 'kotlin',
|
|
285
|
+
rb: 'ruby',
|
|
286
|
+
php: 'php',
|
|
287
|
+
c: 'c',
|
|
288
|
+
cpp: 'cpp',
|
|
289
|
+
h: 'c',
|
|
290
|
+
hpp: 'cpp',
|
|
291
|
+
cs: 'csharp',
|
|
292
|
+
swift: 'swift',
|
|
293
|
+
sh: 'bash',
|
|
294
|
+
bash: 'bash',
|
|
295
|
+
zsh: 'bash',
|
|
296
|
+
json: 'json',
|
|
297
|
+
yaml: 'yaml',
|
|
298
|
+
yml: 'yaml',
|
|
299
|
+
md: 'markdown',
|
|
300
|
+
sql: 'sql',
|
|
301
|
+
html: 'html',
|
|
302
|
+
css: 'css',
|
|
303
|
+
scss: 'scss',
|
|
304
|
+
less: 'less',
|
|
305
|
+
xml: 'xml',
|
|
306
|
+
toml: 'toml',
|
|
307
|
+
};
|
|
308
|
+
return languageMap[ext ?? ''] ?? '';
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* Decode base64 content from Zoekt response
|
|
312
|
+
*/
|
|
313
|
+
function decodeBase64(encoded) {
|
|
314
|
+
try {
|
|
315
|
+
return Buffer.from(encoded, 'base64').toString('utf-8');
|
|
316
|
+
}
|
|
317
|
+
catch {
|
|
318
|
+
return encoded; // Return as-is if not base64
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
* Start the MCP server with the configured transport
|
|
323
|
+
*/
|
|
324
|
+
export async function startServer(server, config, logger) {
|
|
325
|
+
if (config.transport === 'stdio') {
|
|
326
|
+
const transport = new StdioServerTransport();
|
|
327
|
+
await server.connect(transport);
|
|
328
|
+
logger.info({ transport: 'stdio' }, 'MCP server started');
|
|
329
|
+
}
|
|
330
|
+
else {
|
|
331
|
+
// HTTP/SSE transport for remote access
|
|
332
|
+
await startHttpServer(server, config, logger);
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
/**
|
|
336
|
+
* Start HTTP server with SSE transport for remote MCP access
|
|
337
|
+
*/
|
|
338
|
+
async function startHttpServer(server, config, logger) {
|
|
339
|
+
const host = config.host ?? '0.0.0.0';
|
|
340
|
+
const port = config.port ?? 3001;
|
|
341
|
+
const httpLogger = logger.child({ module: 'http' });
|
|
342
|
+
// Track active SSE transports per session
|
|
343
|
+
const transports = new Map();
|
|
344
|
+
const httpServer = createServer(async (req, res) => {
|
|
345
|
+
// Do not trust the Host header for URL parsing; we only need path + query.
|
|
346
|
+
const url = new URL(req.url ?? '/', 'http://localhost');
|
|
347
|
+
const requestIdHeader = req.headers['x-request-id'];
|
|
348
|
+
const requestIdRaw = Array.isArray(requestIdHeader) ? requestIdHeader[0] : requestIdHeader;
|
|
349
|
+
const requestIdCandidate = requestIdRaw?.trim();
|
|
350
|
+
const requestId = requestIdCandidate && requestIdCandidate.length <= 128 ? requestIdCandidate : randomUUID();
|
|
351
|
+
const startTime = process.hrtime.bigint();
|
|
352
|
+
const method = req.method ?? 'GET';
|
|
353
|
+
const path = url.pathname;
|
|
354
|
+
const remoteAddress = getClientIp(req);
|
|
355
|
+
const userAgentHeader = req.headers['user-agent'];
|
|
356
|
+
const userAgent = Array.isArray(userAgentHeader) ? userAgentHeader[0] : userAgentHeader;
|
|
357
|
+
const reqLogger = httpLogger.child({
|
|
358
|
+
requestId,
|
|
359
|
+
method,
|
|
360
|
+
path,
|
|
361
|
+
...(remoteAddress ? { remoteAddress } : {}),
|
|
362
|
+
...(userAgent ? { userAgent } : {}),
|
|
363
|
+
});
|
|
364
|
+
// Add CORS headers
|
|
365
|
+
res.setHeader('Access-Control-Allow-Origin', '*');
|
|
366
|
+
res.setHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS');
|
|
367
|
+
// Allow clients to send an inbound request id and read it back.
|
|
368
|
+
res.setHeader('Access-Control-Allow-Headers', 'Content-Type, X-Request-Id');
|
|
369
|
+
res.setHeader('Access-Control-Expose-Headers', 'X-Request-Id');
|
|
370
|
+
res.setHeader('X-Request-Id', requestId);
|
|
371
|
+
res.on('finish', () => {
|
|
372
|
+
const durationMsRaw = Number(process.hrtime.bigint() - startTime) / 1_000_000;
|
|
373
|
+
const durationMs = Math.round(durationMsRaw * 100) / 100;
|
|
374
|
+
const statusCode = res.statusCode;
|
|
375
|
+
if (statusCode >= 500) {
|
|
376
|
+
reqLogger.error({ statusCode, durationMs }, 'request completed');
|
|
377
|
+
}
|
|
378
|
+
else if (statusCode >= 400) {
|
|
379
|
+
reqLogger.warn({ statusCode, durationMs }, 'request completed');
|
|
380
|
+
}
|
|
381
|
+
else {
|
|
382
|
+
reqLogger.info({ statusCode, durationMs }, 'request completed');
|
|
383
|
+
}
|
|
384
|
+
});
|
|
385
|
+
if (req.method === 'OPTIONS') {
|
|
386
|
+
res.writeHead(204);
|
|
387
|
+
res.end();
|
|
388
|
+
return;
|
|
389
|
+
}
|
|
390
|
+
// Health check endpoint
|
|
391
|
+
if (url.pathname === '/health' && req.method === 'GET') {
|
|
392
|
+
reqLogger.debug({ sessions: transports.size }, 'health check');
|
|
393
|
+
res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
394
|
+
res.end(JSON.stringify({ status: 'ok', transport: 'http', sessions: transports.size }));
|
|
395
|
+
return;
|
|
396
|
+
}
|
|
397
|
+
// SSE endpoint - client connects here for server-sent events
|
|
398
|
+
if (url.pathname === '/sse' && req.method === 'GET') {
|
|
399
|
+
const transport = new SSEServerTransport('/messages', res);
|
|
400
|
+
const sessionId = randomUUID();
|
|
401
|
+
const sseLogger = reqLogger.child({ sessionId });
|
|
402
|
+
transports.set(sessionId, transport);
|
|
403
|
+
sseLogger.info('sse connection opened');
|
|
404
|
+
// Clean up on close
|
|
405
|
+
res.on('close', () => {
|
|
406
|
+
sseLogger.info('sse connection closed');
|
|
407
|
+
transports.delete(sessionId);
|
|
408
|
+
});
|
|
409
|
+
await server.connect(transport);
|
|
410
|
+
return;
|
|
411
|
+
}
|
|
412
|
+
// Messages endpoint - client posts JSON-RPC messages here
|
|
413
|
+
if (url.pathname === '/messages' && req.method === 'POST') {
|
|
414
|
+
// Find the transport from the last SSE connection
|
|
415
|
+
// In production, you'd use session IDs from headers/query params
|
|
416
|
+
const lastSession = Array.from(transports.entries()).pop();
|
|
417
|
+
const sessionId = lastSession?.[0];
|
|
418
|
+
const transport = lastSession?.[1];
|
|
419
|
+
if (!transport) {
|
|
420
|
+
res.writeHead(400, { 'Content-Type': 'application/json' });
|
|
421
|
+
res.end(JSON.stringify({ error: 'No active SSE connection' }));
|
|
422
|
+
return;
|
|
423
|
+
}
|
|
424
|
+
const sseLogger = sessionId ? reqLogger.child({ sessionId }) : reqLogger;
|
|
425
|
+
// Collect body
|
|
426
|
+
const chunks = [];
|
|
427
|
+
for await (const chunk of req) {
|
|
428
|
+
chunks.push(chunk);
|
|
429
|
+
}
|
|
430
|
+
const body = Buffer.concat(chunks).toString();
|
|
431
|
+
sseLogger.info({ bodyBytes: body.length }, 'message received');
|
|
432
|
+
try {
|
|
433
|
+
await transport.handlePostMessage(req, res, body);
|
|
434
|
+
}
|
|
435
|
+
catch (error) {
|
|
436
|
+
sseLogger.error({ err: error }, 'Error handling message');
|
|
437
|
+
if (!res.headersSent) {
|
|
438
|
+
res.writeHead(500, { 'Content-Type': 'application/json' });
|
|
439
|
+
res.end(JSON.stringify({ error: 'Internal server error' }));
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
return;
|
|
443
|
+
}
|
|
444
|
+
// 404 for unknown routes
|
|
445
|
+
reqLogger.warn('route not found');
|
|
446
|
+
res.writeHead(404, { 'Content-Type': 'application/json' });
|
|
447
|
+
res.end(JSON.stringify({ error: 'Not found' }));
|
|
448
|
+
});
|
|
449
|
+
return new Promise((resolve, reject) => {
|
|
450
|
+
httpServer.on('error', reject);
|
|
451
|
+
httpServer.listen(port, host, () => {
|
|
452
|
+
logger.info({ transport: 'http', host, port, url: `http://${host}:${port}` }, 'MCP HTTP server started');
|
|
453
|
+
resolve();
|
|
454
|
+
});
|
|
455
|
+
});
|
|
456
|
+
}
|
|
457
|
+
function getClientIp(req) {
|
|
458
|
+
const forwardedForHeader = req.headers['x-forwarded-for'];
|
|
459
|
+
const forwardedFor = Array.isArray(forwardedForHeader) ? forwardedForHeader[0] : forwardedForHeader;
|
|
460
|
+
if (forwardedFor) {
|
|
461
|
+
const first = forwardedFor.split(',')[0]?.trim();
|
|
462
|
+
if (first) {
|
|
463
|
+
return first;
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
return req.socket.remoteAddress ?? undefined;
|
|
467
|
+
}
|
|
468
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAC7E,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,YAAY,EAA6C,MAAM,MAAM,CAAC;AAC/E,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE5D,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/E,OAAO,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AACvE,OAAO,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAE/D;;GAEG;AACH,MAAM,UAAU,eAAe,CAC7B,MAAuB,EACvB,MAAc;IAEd,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC;QAC3B,IAAI,EAAE,WAAW;QACjB,OAAO,EAAE,OAAO;KACjB,CAAC,CAAC;IAEH,MAAM,WAAW,GAAG,IAAI,WAAW,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,SAAS,CAAC,CAAC;IACvE,MAAM,UAAU,GAAG,MAAM,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC;IAErD,uBAAuB;IACvB,kBAAkB,CAAC,MAAM,EAAE,WAAW,EAAE,U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