kmp-api-lookup-mcp 0.1.0

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.
Files changed (38) hide show
  1. package/README.md +219 -0
  2. package/dist/config/index.d.ts +4 -0
  3. package/dist/config/index.js +33 -0
  4. package/dist/config/index.js.map +1 -0
  5. package/dist/index.d.ts +2 -0
  6. package/dist/index.js +29 -0
  7. package/dist/index.js.map +1 -0
  8. package/dist/indexer/index.d.ts +12 -0
  9. package/dist/indexer/index.js +245 -0
  10. package/dist/indexer/index.js.map +1 -0
  11. package/dist/search-utils.d.ts +10 -0
  12. package/dist/search-utils.js +81 -0
  13. package/dist/search-utils.js.map +1 -0
  14. package/dist/server/createServer.d.ts +11 -0
  15. package/dist/server/createServer.js +30 -0
  16. package/dist/server/createServer.js.map +1 -0
  17. package/dist/server/index.d.ts +2 -0
  18. package/dist/server/index.js +3 -0
  19. package/dist/server/index.js.map +1 -0
  20. package/dist/server/lookupDetail.d.ts +3 -0
  21. package/dist/server/lookupDetail.js +295 -0
  22. package/dist/server/lookupDetail.js.map +1 -0
  23. package/dist/server/lookupService.d.ts +34 -0
  24. package/dist/server/lookupService.js +822 -0
  25. package/dist/server/lookupService.js.map +1 -0
  26. package/dist/server/metadataInspector.d.ts +14 -0
  27. package/dist/server/metadataInspector.js +288 -0
  28. package/dist/server/metadataInspector.js.map +1 -0
  29. package/dist/storage/index.d.ts +58 -0
  30. package/dist/storage/index.js +554 -0
  31. package/dist/storage/index.js.map +1 -0
  32. package/dist/tools/index.d.ts +3 -0
  33. package/dist/tools/index.js +488 -0
  34. package/dist/tools/index.js.map +1 -0
  35. package/dist/types.d.ts +287 -0
  36. package/dist/types.js +2 -0
  37. package/dist/types.js.map +1 -0
  38. package/package.json +56 -0
@@ -0,0 +1,287 @@
1
+ export type SearchMatchMode = 'auto' | 'exact' | 'prefix' | 'fuzzy';
2
+ export type SearchMatchType = 'exact' | 'prefix' | 'fts' | 'fuzzy';
3
+ export type SymbolDeclarationForm = 'class' | 'direct_member' | 'objc_bridge_extension';
4
+ export type IndexedMemberKind = 'class' | 'constructor' | 'member';
5
+ export type LookupQueryKind = 'auto' | 'class' | 'member';
6
+ export type LookupDetailLevel = 'compact' | 'full';
7
+ export type LookupResultKind = 'class' | 'member' | 'ambiguous' | 'not_found';
8
+ export type LookupMemberKind = 'constructor' | 'function' | 'property' | 'typealias';
9
+ export type LookupClassKind = 'class' | 'interface' | 'object' | 'companion' | 'package';
10
+ export type LookupMemberScope = 'instance' | 'class' | 'top_level';
11
+ export interface DiscoveredInstallation {
12
+ readonly kotlinVersion: string;
13
+ readonly konanHome: string;
14
+ readonly klibBinaryPath: string;
15
+ readonly platformRootPath: string;
16
+ readonly availableTargets: string[];
17
+ readonly sources: string[];
18
+ }
19
+ export interface FrameworkSource {
20
+ readonly name: string;
21
+ readonly directoryPath: string;
22
+ readonly sourceMtimeMs: number;
23
+ }
24
+ export interface ParsedSignatureRecord {
25
+ readonly framework: string;
26
+ readonly packageName: string;
27
+ readonly className: string | null;
28
+ readonly memberName: string;
29
+ readonly memberSearchName: string;
30
+ readonly memberKind: IndexedMemberKind;
31
+ readonly declarationForm: SymbolDeclarationForm;
32
+ readonly objcSelector: string | null;
33
+ readonly objcSelectorNormalized: string | null;
34
+ readonly objcSelectorCompact: string | null;
35
+ readonly rawSignature: string;
36
+ readonly isMetaClass: boolean;
37
+ }
38
+ export interface LookupRequest {
39
+ readonly query: string;
40
+ readonly frameworks?: string[];
41
+ readonly kotlinVersion?: string;
42
+ readonly target?: string;
43
+ readonly queryKind?: LookupQueryKind;
44
+ readonly detail?: LookupDetailLevel;
45
+ readonly limit?: number;
46
+ }
47
+ export interface LookupSymbolSignature {
48
+ readonly name: string;
49
+ readonly kind: LookupMemberKind;
50
+ readonly scope: LookupMemberScope;
51
+ readonly declarationForm: Exclude<SymbolDeclarationForm, 'class'>;
52
+ readonly kotlinSignature: string;
53
+ readonly objcSelector: string | null;
54
+ readonly requiredImports: string[];
55
+ }
56
+ export interface LookupPropertyAccessors {
57
+ readonly getter: boolean;
58
+ readonly setter: boolean;
59
+ }
60
+ export interface LookupCompactCallableSummary {
61
+ readonly name: string;
62
+ readonly kotlinSignatures: string[];
63
+ readonly objcSelectors: string[];
64
+ readonly requiredImports: string[];
65
+ }
66
+ export interface LookupCompactPropertySummary {
67
+ readonly name: string;
68
+ readonly kotlinSignature: string;
69
+ readonly mutable: boolean;
70
+ readonly accessors: LookupPropertyAccessors;
71
+ readonly requiredImports: string[];
72
+ }
73
+ interface LookupClassCardBase {
74
+ readonly framework: string;
75
+ readonly packageName: string;
76
+ readonly name: string;
77
+ readonly qualifiedName: string;
78
+ readonly kind: LookupClassKind;
79
+ readonly kotlinSignature: string;
80
+ readonly extendsType: string | null;
81
+ readonly implementsTypes: string[];
82
+ readonly requiredImports: string[];
83
+ }
84
+ export interface LookupFullClassCard extends LookupClassCardBase {
85
+ readonly detailLevel: 'full';
86
+ readonly totalConstructors: number;
87
+ readonly totalMembers: number;
88
+ readonly totalClassMembers: number;
89
+ readonly omittedConstructors: number;
90
+ readonly omittedMembers: number;
91
+ readonly omittedClassMembers: number;
92
+ readonly constructors: LookupSymbolSignature[];
93
+ readonly members: LookupSymbolSignature[];
94
+ readonly classMembers: LookupSymbolSignature[];
95
+ }
96
+ export interface LookupCompactClassCard extends LookupClassCardBase {
97
+ readonly detailLevel: 'compact';
98
+ readonly constructors: LookupCompactCallableSummary[];
99
+ readonly properties: LookupCompactPropertySummary[];
100
+ readonly methods: LookupCompactCallableSummary[];
101
+ readonly classMethods: LookupCompactCallableSummary[];
102
+ }
103
+ export type LookupClassCard = LookupFullClassCard | LookupCompactClassCard;
104
+ interface LookupMemberCardBase {
105
+ readonly framework: string;
106
+ readonly packageName: string;
107
+ readonly ownerName: string;
108
+ readonly ownerQualifiedName: string;
109
+ readonly ownerKind: LookupClassKind;
110
+ readonly detailLevel: LookupDetailLevel;
111
+ readonly name: string;
112
+ readonly requiredImports: string[];
113
+ }
114
+ export interface LookupFullMemberCard extends LookupMemberCardBase {
115
+ readonly detailLevel: 'full';
116
+ readonly ownerKotlinSignature: string;
117
+ readonly extendsType: string | null;
118
+ readonly implementsTypes: string[];
119
+ readonly totalEntries: number;
120
+ readonly omittedEntries: number;
121
+ readonly entries: LookupSymbolSignature[];
122
+ }
123
+ export interface LookupCompactMemberCard extends LookupMemberCardBase {
124
+ readonly detailLevel: 'compact';
125
+ readonly kind: LookupMemberKind;
126
+ readonly kotlinSignatures: string[];
127
+ readonly objcSelectors: string[];
128
+ readonly accessors: LookupPropertyAccessors | null;
129
+ readonly mutable: boolean | null;
130
+ }
131
+ export type LookupMemberCard = LookupFullMemberCard | LookupCompactMemberCard;
132
+ export interface LookupAlternative {
133
+ readonly resultKind: 'class' | 'member';
134
+ readonly framework: string;
135
+ readonly packageName: string;
136
+ readonly ownerName: string | null;
137
+ readonly symbolName: string;
138
+ }
139
+ export interface LookupResponse {
140
+ readonly query: string;
141
+ readonly effectiveKotlinVersion: string;
142
+ readonly effectiveTarget: string;
143
+ readonly detailLevel: LookupDetailLevel;
144
+ readonly resultKind: LookupResultKind;
145
+ readonly classCard: LookupClassCard | null;
146
+ readonly memberCard: LookupMemberCard | null;
147
+ readonly alternatives: LookupAlternative[];
148
+ }
149
+ export interface IndexedDatasetSummary {
150
+ readonly kotlinVersion: string;
151
+ readonly konanHome: string;
152
+ readonly target: string;
153
+ readonly indexedAt: string;
154
+ readonly recordCount: number;
155
+ readonly frameworkCount: number;
156
+ readonly frameworks: string[];
157
+ }
158
+ export interface SearchRequest {
159
+ readonly query: string;
160
+ readonly frameworks?: string[];
161
+ readonly kotlinVersion?: string;
162
+ readonly target?: string;
163
+ readonly matchMode?: SearchMatchMode;
164
+ readonly limit?: number;
165
+ readonly includeMetaClasses?: boolean;
166
+ readonly includeRawSignature?: boolean;
167
+ }
168
+ export interface SearchResultItem {
169
+ readonly id: number;
170
+ readonly kotlinVersion: string;
171
+ readonly konanHome: string;
172
+ readonly target: string;
173
+ readonly framework: string;
174
+ readonly packageName: string;
175
+ readonly className: string | null;
176
+ readonly memberName: string;
177
+ readonly objcSelector: string | null;
178
+ readonly memberKind: IndexedMemberKind;
179
+ readonly declarationForm: SymbolDeclarationForm;
180
+ readonly isMetaClass: boolean;
181
+ readonly matchType: SearchMatchType;
182
+ readonly rawSignature?: string;
183
+ }
184
+ export interface SearchResponse {
185
+ readonly query: string;
186
+ readonly effectiveKotlinVersion: string;
187
+ readonly effectiveTargets: string[];
188
+ readonly availableTargets: string[];
189
+ readonly selectedFrameworks: string[];
190
+ readonly matchMode: SearchMatchMode;
191
+ readonly limit: number;
192
+ readonly includeMetaClasses: boolean;
193
+ readonly includeRawSignature: boolean;
194
+ readonly totalResults: number;
195
+ readonly noResults: boolean;
196
+ readonly results: SearchResultItem[];
197
+ }
198
+ export interface ExplainResponse {
199
+ readonly query: string;
200
+ readonly effectiveKotlinVersion: string;
201
+ readonly effectiveTargets: string[];
202
+ readonly matchMode: SearchMatchMode;
203
+ readonly includeMetaClasses: boolean;
204
+ readonly noResults: boolean;
205
+ readonly symbol: SearchResultItem | null;
206
+ }
207
+ export interface DiscoveryResponse {
208
+ readonly explicitKonanHome: string | null;
209
+ readonly installations: DiscoveredInstallation[];
210
+ }
211
+ export interface RecordCounts {
212
+ readonly datasets: number;
213
+ readonly frameworks: number;
214
+ readonly symbols: number;
215
+ }
216
+ export interface ServerConfigSummary {
217
+ readonly serverName: string;
218
+ readonly version: string;
219
+ readonly cacheDir: string;
220
+ readonly dbPath: string;
221
+ readonly metadataPath: string;
222
+ readonly konanScanRoot: string;
223
+ readonly defaultSearchLimit: number;
224
+ readonly defaultMatchMode: SearchMatchMode;
225
+ readonly defaultIncludeMetaClasses: boolean;
226
+ readonly defaultIncludeRawSignature: boolean;
227
+ readonly storageDriver: string;
228
+ readonly freshnessStrategy: string;
229
+ readonly autoIndexing: 'manual-error';
230
+ readonly searchTargetFallback: 'all-indexed-targets';
231
+ readonly searchVersionFallback: 'latest-indexed-version';
232
+ }
233
+ export interface RebuildRequest {
234
+ readonly kotlinVersion?: string;
235
+ readonly konanHome?: string;
236
+ readonly target?: string;
237
+ readonly frameworks?: string[];
238
+ readonly force?: boolean;
239
+ readonly dryRun?: boolean;
240
+ readonly cleanBefore?: boolean;
241
+ }
242
+ export interface FrameworkRebuildReport {
243
+ framework: string;
244
+ action: 'rebuild' | 'skip-fresh';
245
+ lineCount: number;
246
+ symbolCount: number;
247
+ reason?: string;
248
+ }
249
+ export interface RebuildResult {
250
+ readonly kotlinVersion: string;
251
+ readonly target: string;
252
+ readonly selectedFrameworks: string[];
253
+ readonly rebuiltFrameworks: string[];
254
+ readonly skippedFrameworks: string[];
255
+ readonly dryRun: boolean;
256
+ readonly indexedAt: string | null;
257
+ readonly totalRecordsWritten: number;
258
+ readonly reports: FrameworkRebuildReport[];
259
+ }
260
+ export interface StoredState {
261
+ readonly lastRebuildAt: string | null;
262
+ readonly lastRebuild: RebuildResult | null;
263
+ }
264
+ export interface StatusResponse {
265
+ readonly ready: boolean;
266
+ readonly discoveredInstallations: Array<{
267
+ readonly kotlinVersion: string;
268
+ readonly availableTargets: string[];
269
+ readonly sources: string[];
270
+ }>;
271
+ readonly indexedDatasets: Array<{
272
+ readonly kotlinVersion: string;
273
+ readonly target: string;
274
+ readonly indexedAt: string;
275
+ readonly recordCount: number;
276
+ readonly frameworkCount: number;
277
+ readonly frameworks: string[];
278
+ }>;
279
+ readonly recordCounts: RecordCounts;
280
+ readonly lastRebuildAt: string | null;
281
+ }
282
+ export interface ToolService {
283
+ lookup(request: LookupRequest): Promise<LookupResponse>;
284
+ getStatus(): Promise<StatusResponse>;
285
+ rebuild(request: RebuildRequest): Promise<RebuildResult>;
286
+ }
287
+ export {};
package/dist/types.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
package/package.json ADDED
@@ -0,0 +1,56 @@
1
+ {
2
+ "name": "kmp-api-lookup-mcp",
3
+ "version": "0.1.0",
4
+ "description": "MCP server for fast Kotlin/Native iOS klib API lookup",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "bin": {
8
+ "kmp-api-lookup-mcp": "./dist/index.js"
9
+ },
10
+ "files": [
11
+ "dist",
12
+ "README.md"
13
+ ],
14
+ "scripts": {
15
+ "build": "tsc -p tsconfig.build.json",
16
+ "dev": "tsx src/index.ts",
17
+ "prepublishOnly": "npm run typecheck && npm test && npm run build",
18
+ "start": "node dist/index.js",
19
+ "test": "vitest run",
20
+ "test:watch": "vitest",
21
+ "typecheck": "tsc -p tsconfig.json"
22
+ },
23
+ "keywords": [
24
+ "mcp",
25
+ "model-context-protocol",
26
+ "kotlin-native",
27
+ "klib",
28
+ "ios",
29
+ "kmp"
30
+ ],
31
+ "author": "Vladimir Nenashkin",
32
+ "license": "MIT",
33
+ "repository": {
34
+ "type": "git",
35
+ "url": "git+https://github.com/SuLG-ik/kmp-api-lookup-mcp.git"
36
+ },
37
+ "bugs": {
38
+ "url": "https://github.com/SuLG-ik/kmp-api-lookup-mcp/issues"
39
+ },
40
+ "homepage": "https://github.com/SuLG-ik/kmp-api-lookup-mcp#readme",
41
+ "engines": {
42
+ "node": ">=20"
43
+ },
44
+ "dependencies": {
45
+ "@cfworker/json-schema": "^4.1.1",
46
+ "@modelcontextprotocol/server": "^2.0.0-alpha.2",
47
+ "better-sqlite3": "^12.8.0"
48
+ },
49
+ "devDependencies": {
50
+ "@types/better-sqlite3": "^7.6.13",
51
+ "@types/node": "^25.5.2",
52
+ "tsx": "^4.21.0",
53
+ "typescript": "^6.0.2",
54
+ "vitest": "^2.1.9"
55
+ }
56
+ }