@know-graph/mcp-server 0.4.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 (55) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +51 -0
  3. package/dist/config.d.ts +2 -0
  4. package/dist/config.d.ts.map +1 -0
  5. package/dist/config.js +26 -0
  6. package/dist/config.js.map +1 -0
  7. package/dist/db.d.ts +79 -0
  8. package/dist/db.d.ts.map +1 -0
  9. package/dist/db.js +211 -0
  10. package/dist/db.js.map +1 -0
  11. package/dist/index.d.ts +7 -0
  12. package/dist/index.d.ts.map +1 -0
  13. package/dist/index.js +27 -0
  14. package/dist/index.js.map +1 -0
  15. package/dist/server.d.ts +19 -0
  16. package/dist/server.d.ts.map +1 -0
  17. package/dist/server.js +47 -0
  18. package/dist/server.js.map +1 -0
  19. package/dist/tools/find-by-business-goal.d.ts +4 -0
  20. package/dist/tools/find-by-business-goal.d.ts.map +1 -0
  21. package/dist/tools/find-by-business-goal.js +37 -0
  22. package/dist/tools/find-by-business-goal.js.map +1 -0
  23. package/dist/tools/find-by-owner.d.ts +4 -0
  24. package/dist/tools/find-by-owner.d.ts.map +1 -0
  25. package/dist/tools/find-by-owner.js +37 -0
  26. package/dist/tools/find-by-owner.js.map +1 -0
  27. package/dist/tools/format.d.ts +18 -0
  28. package/dist/tools/format.d.ts.map +1 -0
  29. package/dist/tools/format.js +86 -0
  30. package/dist/tools/format.js.map +1 -0
  31. package/dist/tools/get-dependencies.d.ts +4 -0
  32. package/dist/tools/get-dependencies.d.ts.map +1 -0
  33. package/dist/tools/get-dependencies.js +46 -0
  34. package/dist/tools/get-dependencies.js.map +1 -0
  35. package/dist/tools/get-entity-details.d.ts +4 -0
  36. package/dist/tools/get-entity-details.d.ts.map +1 -0
  37. package/dist/tools/get-entity-details.js +58 -0
  38. package/dist/tools/get-entity-details.js.map +1 -0
  39. package/dist/tools/get-external-knowledge.d.ts +4 -0
  40. package/dist/tools/get-external-knowledge.d.ts.map +1 -0
  41. package/dist/tools/get-external-knowledge.js +47 -0
  42. package/dist/tools/get-external-knowledge.js.map +1 -0
  43. package/dist/tools/graph-overview.d.ts +15 -0
  44. package/dist/tools/graph-overview.d.ts.map +1 -0
  45. package/dist/tools/graph-overview.js +23 -0
  46. package/dist/tools/graph-overview.js.map +1 -0
  47. package/dist/tools/index.d.ts +15 -0
  48. package/dist/tools/index.d.ts.map +1 -0
  49. package/dist/tools/index.js +17 -0
  50. package/dist/tools/index.js.map +1 -0
  51. package/dist/tools/search-code.d.ts +4 -0
  52. package/dist/tools/search-code.d.ts.map +1 -0
  53. package/dist/tools/search-code.js +49 -0
  54. package/dist/tools/search-code.js.map +1 -0
  55. package/package.json +58 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 KnowGraph Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,51 @@
1
+ # @know-graph/mcp-server
2
+
3
+ MCP (Model Context Protocol) server for [KnowGraph](https://github.com/idosams/know-know) — connect your code knowledge graph to AI assistants.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install -g @know-graph/cli
9
+ # The MCP server is included with the CLI
10
+ ```
11
+
12
+ Or install standalone:
13
+
14
+ ```bash
15
+ npm install @know-graph/mcp-server
16
+ ```
17
+
18
+ ## Usage with Claude Desktop
19
+
20
+ Add to your Claude Desktop configuration (`claude_desktop_config.json`):
21
+
22
+ ```json
23
+ {
24
+ "mcpServers": {
25
+ "knowgraph": {
26
+ "command": "knowgraph",
27
+ "args": ["serve", "--db", "/path/to/project/.knowgraph/knowgraph.db"]
28
+ }
29
+ }
30
+ }
31
+ ```
32
+
33
+ ## MCP Tools
34
+
35
+ | Tool | Description |
36
+ |------|-------------|
37
+ | `search_code` | Full-text search across entity names, descriptions, and tags |
38
+ | `find_by_owner` | Find all entities owned by a specific team or person |
39
+ | `find_by_business_goal` | Discover entities related to a business objective |
40
+ | `get_dependencies` | Map dependencies for an entity (services, APIs, databases) |
41
+ | `get_entity_details` | Get complete metadata for a specific entity |
42
+ | `get_external_knowledge` | Find linked external resources (Notion, Jira, dashboards) |
43
+ | `graph_overview` | Get high-level statistics about the indexed codebase |
44
+
45
+ ## Documentation
46
+
47
+ See the [main repository](https://github.com/idosams/know-know) for full documentation, annotation format, and examples.
48
+
49
+ ## License
50
+
51
+ MIT
@@ -0,0 +1,2 @@
1
+ export declare function generateClaudeDesktopConfig(projectPath: string): object;
2
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAaA,wBAAgB,2BAA2B,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAevE"}
package/dist/config.js ADDED
@@ -0,0 +1,26 @@
1
+ /**
2
+ * @knowgraph
3
+ * type: module
4
+ * description: Claude Desktop MCP configuration generator
5
+ * owner: knowgraph-mcp
6
+ * status: stable
7
+ * tags: [mcp, config, claude-desktop]
8
+ * context:
9
+ * business_goal: Simplify MCP server setup for Claude Desktop users
10
+ * domain: mcp-server
11
+ */
12
+ import path from 'node:path';
13
+ export function generateClaudeDesktopConfig(projectPath) {
14
+ return {
15
+ mcpServers: {
16
+ knowgraph: {
17
+ command: 'node',
18
+ args: [
19
+ path.join(projectPath, 'node_modules/@know-graph/mcp-server/dist/index.js'),
20
+ path.join(projectPath, '.knowgraph/knowgraph.db'),
21
+ ],
22
+ },
23
+ },
24
+ };
25
+ }
26
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,MAAM,UAAU,2BAA2B,CAAC,WAAmB;IAC7D,OAAO;QACL,UAAU,EAAE;YACV,SAAS,EAAE;gBACT,OAAO,EAAE,MAAM;gBACf,IAAI,EAAE;oBACJ,IAAI,CAAC,IAAI,CACP,WAAW,EACX,mDAAmD,CACpD;oBACD,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,yBAAyB,CAAC;iBAClD;aACF;SACF;KACF,CAAC;AACJ,CAAC"}
package/dist/db.d.ts ADDED
@@ -0,0 +1,79 @@
1
+ /**
2
+ * @knowgraph
3
+ * type: module
4
+ * description: Read-only SQLite database layer for MCP server queries
5
+ * owner: knowgraph-mcp
6
+ * status: stable
7
+ * tags: [mcp, database, sqlite, readonly]
8
+ * context:
9
+ * business_goal: Provide efficient read-only access to the code knowledge graph
10
+ * domain: mcp-server
11
+ */
12
+ import Database from 'better-sqlite3';
13
+ export interface EntityRow {
14
+ readonly id: string;
15
+ readonly name: string;
16
+ readonly file_path: string;
17
+ readonly line: number;
18
+ readonly column: number;
19
+ readonly language: string;
20
+ readonly entity_type: string;
21
+ readonly description: string;
22
+ readonly owner: string | null;
23
+ readonly status: string | null;
24
+ readonly tags: string | null;
25
+ readonly links: string | null;
26
+ readonly signature: string | null;
27
+ readonly parent: string | null;
28
+ readonly raw_docstring: string | null;
29
+ readonly business_goal: string | null;
30
+ readonly funnel_stage: string | null;
31
+ readonly revenue_impact: string | null;
32
+ readonly dependencies: string | null;
33
+ readonly compliance: string | null;
34
+ readonly operational: string | null;
35
+ }
36
+ export interface LinkRow {
37
+ readonly entity_id: string;
38
+ readonly type: string | null;
39
+ readonly url: string;
40
+ readonly title: string | null;
41
+ }
42
+ export interface DependencyRow {
43
+ readonly source_id: string;
44
+ readonly target_id: string;
45
+ readonly dependency_type: string;
46
+ }
47
+ export interface GraphStats {
48
+ readonly totalEntities: number;
49
+ readonly entityTypes: ReadonlyArray<{
50
+ readonly type: string;
51
+ readonly count: number;
52
+ }>;
53
+ readonly totalLinks: number;
54
+ readonly totalDependencies: number;
55
+ readonly owners: ReadonlyArray<string>;
56
+ readonly languages: ReadonlyArray<string>;
57
+ }
58
+ export interface SearchFilters {
59
+ readonly type?: string;
60
+ readonly owner?: string;
61
+ readonly tags?: readonly string[];
62
+ readonly limit?: number;
63
+ }
64
+ export interface McpDatabase {
65
+ search(query: string, filters?: SearchFilters): readonly EntityRow[];
66
+ getById(id: string): EntityRow | undefined;
67
+ getByOwner(owner: string): readonly EntityRow[];
68
+ getDependencies(entityId: string, depth?: number): readonly DependencyRow[];
69
+ getLinks(entityId?: string): readonly LinkRow[];
70
+ getByBusinessGoal(goal: string): readonly EntityRow[];
71
+ getStats(): GraphStats;
72
+ close(): void;
73
+ }
74
+ export declare function openDatabase(dbPath: string): McpDatabase;
75
+ export declare function createInMemoryDatabase(): {
76
+ readonly db: McpDatabase;
77
+ readonly rawDb: Database.Database;
78
+ };
79
+ //# sourceMappingURL=db.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"db.d.ts","sourceRoot":"","sources":["../src/db.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,QAAQ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CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,aAAa,EAAE,CAAC;IAC5E,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,OAAO,EAAE,CAAC;IAChD,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,SAAS,EAAE,CAAC;IACtD,QAAQ,IAAI,UAAU,CAAC;IACvB,KAAK,IAAI,IAAI,CAAC;CACf;AAiND,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW,CAIxD;AAED,wBAAgB,sBAAsB,IAAI;IACxC,QAAQ,CAAC,EAAE,EAAE,WAAW,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,QAAQ,CAAC;CACnC,CAoDA"}
package/dist/db.js ADDED
@@ -0,0 +1,211 @@
1
+ /**
2
+ * @knowgraph
3
+ * type: module
4
+ * description: Read-only SQLite database layer for MCP server queries
5
+ * owner: knowgraph-mcp
6
+ * status: stable
7
+ * tags: [mcp, database, sqlite, readonly]
8
+ * context:
9
+ * business_goal: Provide efficient read-only access to the code knowledge graph
10
+ * domain: mcp-server
11
+ */
12
+ import Database from 'better-sqlite3';
13
+ function buildFilterClause(filters) {
14
+ const conditions = [];
15
+ const params = [];
16
+ if (filters?.type) {
17
+ conditions.push('e.entity_type = ?');
18
+ params.push(filters.type);
19
+ }
20
+ if (filters?.owner) {
21
+ conditions.push('e.owner = ?');
22
+ params.push(filters.owner);
23
+ }
24
+ if (filters?.tags && filters.tags.length > 0) {
25
+ const tagConditions = filters.tags.map(() => 'e.tags LIKE ?');
26
+ conditions.push(`(${tagConditions.join(' AND ')})`);
27
+ for (const tag of filters.tags) {
28
+ params.push(`%${tag}%`);
29
+ }
30
+ }
31
+ const where = conditions.length > 0 ? ` AND ${conditions.join(' AND ')}` : '';
32
+ return { where, params };
33
+ }
34
+ function hasFtsTable(db) {
35
+ try {
36
+ const row = db
37
+ .prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='entities_fts'")
38
+ .get();
39
+ return row !== undefined;
40
+ }
41
+ catch {
42
+ return false;
43
+ }
44
+ }
45
+ function createDatabaseApi(db, ftsEnabled) {
46
+ const search = (query, filters) => {
47
+ const limit = filters?.limit ?? 20;
48
+ const { where: filterWhere, params: filterParams } = buildFilterClause(filters);
49
+ if (ftsEnabled && query.trim().length > 0) {
50
+ try {
51
+ const stmt = db.prepare(`
52
+ SELECT e.* FROM entities e
53
+ WHERE e.rowid IN (SELECT rowid FROM entities_fts WHERE entities_fts MATCH ?)${filterWhere}
54
+ LIMIT ?
55
+ `);
56
+ return stmt.all(query, ...filterParams, limit);
57
+ }
58
+ catch {
59
+ // Fall through to LIKE search if FTS query syntax is invalid
60
+ }
61
+ }
62
+ const stmt = db.prepare(`
63
+ SELECT * FROM entities e
64
+ WHERE (e.name LIKE ? OR e.description LIKE ?)${filterWhere}
65
+ LIMIT ?
66
+ `);
67
+ const pattern = `%${query}%`;
68
+ return stmt.all(pattern, pattern, ...filterParams, limit);
69
+ };
70
+ const getById = (id) => {
71
+ return db.prepare('SELECT * FROM entities WHERE id = ?').get(id);
72
+ };
73
+ const getByOwner = (owner) => {
74
+ return db
75
+ .prepare('SELECT * FROM entities WHERE owner = ?')
76
+ .all(owner);
77
+ };
78
+ const getDependencies = (entityId, depth = 1) => {
79
+ if (depth <= 1) {
80
+ return db
81
+ .prepare('SELECT * FROM dependencies WHERE source_id = ? OR target_id = ?')
82
+ .all(entityId, entityId);
83
+ }
84
+ const visited = new Set();
85
+ const result = [];
86
+ const queue = [{ id: entityId, currentDepth: 0 }];
87
+ const stmt = db.prepare('SELECT * FROM dependencies WHERE source_id = ? OR target_id = ?');
88
+ while (queue.length > 0) {
89
+ const current = queue.shift();
90
+ if (visited.has(current.id) || current.currentDepth >= depth) {
91
+ continue;
92
+ }
93
+ visited.add(current.id);
94
+ const deps = stmt.all(current.id, current.id);
95
+ for (const dep of deps) {
96
+ result.push(dep);
97
+ const nextId = dep.source_id === current.id ? dep.target_id : dep.source_id;
98
+ if (!visited.has(nextId)) {
99
+ queue.push({ id: nextId, currentDepth: current.currentDepth + 1 });
100
+ }
101
+ }
102
+ }
103
+ return result;
104
+ };
105
+ const getLinks = (entityId) => {
106
+ if (entityId) {
107
+ return db
108
+ .prepare('SELECT * FROM links WHERE entity_id = ?')
109
+ .all(entityId);
110
+ }
111
+ return db.prepare('SELECT * FROM links').all();
112
+ };
113
+ const getByBusinessGoal = (goal) => {
114
+ const pattern = `%${goal}%`;
115
+ return db
116
+ .prepare('SELECT * FROM entities WHERE business_goal LIKE ? OR description LIKE ?')
117
+ .all(pattern, pattern);
118
+ };
119
+ const getStats = () => {
120
+ const totalEntities = db.prepare('SELECT COUNT(*) as count FROM entities').get().count;
121
+ const entityTypes = db
122
+ .prepare('SELECT entity_type as type, COUNT(*) as count FROM entities GROUP BY entity_type')
123
+ .all();
124
+ const totalLinks = db.prepare('SELECT COUNT(*) as count FROM links').get().count;
125
+ const totalDependencies = db.prepare('SELECT COUNT(*) as count FROM dependencies').get().count;
126
+ const ownerRows = db
127
+ .prepare('SELECT DISTINCT owner FROM entities WHERE owner IS NOT NULL')
128
+ .all();
129
+ const languageRows = db
130
+ .prepare('SELECT DISTINCT language FROM entities')
131
+ .all();
132
+ return {
133
+ totalEntities,
134
+ entityTypes,
135
+ totalLinks,
136
+ totalDependencies,
137
+ owners: ownerRows.map((r) => r.owner),
138
+ languages: languageRows.map((r) => r.language),
139
+ };
140
+ };
141
+ const close = () => {
142
+ db.close();
143
+ };
144
+ return {
145
+ search,
146
+ getById,
147
+ getByOwner,
148
+ getDependencies,
149
+ getLinks,
150
+ getByBusinessGoal,
151
+ getStats,
152
+ close,
153
+ };
154
+ }
155
+ export function openDatabase(dbPath) {
156
+ const db = new Database(dbPath, { readonly: true, fileMustExist: true });
157
+ db.pragma('journal_mode = WAL');
158
+ return createDatabaseApi(db, hasFtsTable(db));
159
+ }
160
+ export function createInMemoryDatabase() {
161
+ const rawDb = new Database(':memory:');
162
+ rawDb.exec(`
163
+ CREATE TABLE entities (
164
+ id TEXT PRIMARY KEY,
165
+ name TEXT NOT NULL,
166
+ file_path TEXT NOT NULL,
167
+ line INTEGER NOT NULL,
168
+ column INTEGER NOT NULL,
169
+ language TEXT NOT NULL,
170
+ entity_type TEXT NOT NULL,
171
+ description TEXT NOT NULL,
172
+ owner TEXT,
173
+ status TEXT,
174
+ tags TEXT,
175
+ links TEXT,
176
+ signature TEXT,
177
+ parent TEXT,
178
+ raw_docstring TEXT,
179
+ business_goal TEXT,
180
+ funnel_stage TEXT,
181
+ revenue_impact TEXT,
182
+ dependencies TEXT,
183
+ compliance TEXT,
184
+ operational TEXT
185
+ );
186
+
187
+ CREATE TABLE links (
188
+ entity_id TEXT NOT NULL,
189
+ type TEXT,
190
+ url TEXT NOT NULL,
191
+ title TEXT,
192
+ FOREIGN KEY (entity_id) REFERENCES entities(id)
193
+ );
194
+
195
+ CREATE TABLE dependencies (
196
+ source_id TEXT NOT NULL,
197
+ target_id TEXT NOT NULL,
198
+ dependency_type TEXT NOT NULL,
199
+ FOREIGN KEY (source_id) REFERENCES entities(id),
200
+ FOREIGN KEY (target_id) REFERENCES entities(id)
201
+ );
202
+
203
+ CREATE VIRTUAL TABLE entities_fts USING fts5(
204
+ name, description, tags, business_goal,
205
+ content='entities',
206
+ content_rowid='rowid'
207
+ );
208
+ `);
209
+ return { db: createDatabaseApi(rawDb, true), rawDb };
210
+ }
211
+ //# sourceMappingURL=db.js.map
package/dist/db.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"db.js","sourceRoot":"","sources":["../src/db.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AAqEtC,SAAS,iBAAiB,CAAC,OAAuB;IAIhD,MAAM,UAAU,GAAa,EAAE,CAAC;IAChC,MAAM,MAAM,GAAc,EAAE,CAAC;IAE7B,IAAI,OAAO,EAAE,IA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C,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;YACrC,SAAS,EAAE,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC;SAC/C,CAAC;IACJ,CAAC,CAAC;IAEF,MAAM,KAAK,GAAG,GAAS,EAAE;QACvB,EAAE,CAAC,KAAK,EAAE,CAAC;IACb,CAAC,CAAC;IAEF,OAAO;QACL,MAAM;QACN,OAAO;QACP,UAAU;QACV,eAAe;QACf,QAAQ;QACR,iBAAiB;QACjB,QAAQ;QACR,KAAK;KACN,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,MAAc;IACzC,MAAM,EAAE,GAAG,IAAI,QAAQ,CAAC,MAAM,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;IACzE,EAAE,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC;IAChC,OAAO,iBAAiB,CAAC,EAAE,EAAE,WAAW,CAAC,EAAE,CAAC,CAAC,CAAC;AAChD,CAAC;AAED,MAAM,UAAU,sBAAsB;IAIpC,MAAM,KAAK,GAAG,IAAI,QAAQ,CAAC,UAAU,CAAC,CAAC;IAEvC,KAAK,CAAC,IAAI,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CV,CAAC,CAAC;IAEH,OAAO,EAAE,EAAE,EAAE,iBAAiB,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE,KAAK,EAAE,CAAC;AACvD,CAAC"}
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env node
2
+ export { createServer, startServer } from './server.js';
3
+ export type { ServerOptions } from './server.js';
4
+ export { openDatabase, createInMemoryDatabase } from './db.js';
5
+ export type { McpDatabase, EntityRow, LinkRow, DependencyRow, GraphStats, SearchFilters, } from './db.js';
6
+ export { generateClaudeDesktopConfig } from './config.js';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAcA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACxD,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAC/D,YAAY,EACV,WAAW,EACX,SAAS,EACT,OAAO,EACP,aAAa,EACb,UAAU,EACV,aAAa,GACd,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,2BAA2B,EAAE,MAAM,aAAa,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * @knowgraph
4
+ * type: module
5
+ * description: MCP server entrypoint with exports and direct-run capability
6
+ * owner: knowgraph-mcp
7
+ * status: stable
8
+ * tags: [mcp, entrypoint, exports]
9
+ * context:
10
+ * business_goal: Provide the main entry point for the MCP server package
11
+ * domain: mcp-server
12
+ */
13
+ import { startServer } from './server.js';
14
+ export { createServer, startServer } from './server.js';
15
+ export { openDatabase, createInMemoryDatabase } from './db.js';
16
+ export { generateClaudeDesktopConfig } from './config.js';
17
+ const isDirectRun = process.argv[1]?.endsWith('mcp-server/dist/index.js') ||
18
+ process.argv[1]?.endsWith('mcp-server/src/index.ts');
19
+ if (isDirectRun) {
20
+ const dbPath = process.argv[2] || '.knowgraph/knowgraph.db';
21
+ const verbose = process.argv.includes('--verbose');
22
+ startServer({ dbPath, verbose }).catch((error) => {
23
+ console.error('Failed to start MCP server:', error);
24
+ process.exit(1);
25
+ });
26
+ }
27
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAExD,OAAO,EAAE,YAAY,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAS/D,OAAO,EAAE,2BAA2B,EAAE,MAAM,aAAa,CAAC;AAE1D,MAAM,WAAW,GACf,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,0BAA0B,CAAC;IACrD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,yBAAyB,CAAC,CAAC;AAEvD,IAAI,WAAW,EAAE,CAAC;IAChB,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,yBAAyB,CAAC;IAC5D,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;IAEnD,WAAW,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;QAC/C,OAAO,CAAC,KAAK,CAAC,6BAA6B,EAAE,KAAK,CAAC,CAAC;QACpD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * @knowgraph
3
+ * type: service
4
+ * description: MCP server factory and stdio transport initialization
5
+ * owner: knowgraph-mcp
6
+ * status: stable
7
+ * tags: [mcp, server, transport, stdio]
8
+ * context:
9
+ * business_goal: Expose code graph data to AI assistants via MCP protocol
10
+ * domain: mcp-server
11
+ */
12
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
13
+ export interface ServerOptions {
14
+ readonly dbPath: string;
15
+ readonly verbose?: boolean;
16
+ }
17
+ export declare function createServer(options: ServerOptions): McpServer;
18
+ export declare function startServer(options: ServerOptions): Promise<void>;
19
+ //# sourceMappingURL=server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAKpE,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE,aAAa,GAAG,SAAS,CAgC9D;AAED,wBAAsB,WAAW,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAIvE"}
package/dist/server.js ADDED
@@ -0,0 +1,47 @@
1
+ /**
2
+ * @knowgraph
3
+ * type: service
4
+ * description: MCP server factory and stdio transport initialization
5
+ * owner: knowgraph-mcp
6
+ * status: stable
7
+ * tags: [mcp, server, transport, stdio]
8
+ * context:
9
+ * business_goal: Expose code graph data to AI assistants via MCP protocol
10
+ * domain: mcp-server
11
+ */
12
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
13
+ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
14
+ import { openDatabase } from './db.js';
15
+ import { registerAllTools } from './tools/index.js';
16
+ export function createServer(options) {
17
+ const server = new McpServer({
18
+ name: 'knowgraph',
19
+ version: '0.1.0',
20
+ });
21
+ try {
22
+ const db = openDatabase(options.dbPath);
23
+ registerAllTools(server, db);
24
+ }
25
+ catch (error) {
26
+ if (options.verbose) {
27
+ console.error(`Failed to open database at ${options.dbPath}:`, error);
28
+ }
29
+ // Register a single tool that reports the database error
30
+ server.tool('get_graph_overview', 'Get statistics and overview of the indexed codebase', {}, async () => ({
31
+ content: [
32
+ {
33
+ type: 'text',
34
+ text: `Database not available at ${options.dbPath}. Run 'knowgraph index' to create it.`,
35
+ },
36
+ ],
37
+ isError: true,
38
+ }));
39
+ }
40
+ return server;
41
+ }
42
+ export async function startServer(options) {
43
+ const server = createServer(options);
44
+ const transport = new StdioServerTransport();
45
+ await server.connect(transport);
46
+ }
47
+ //# sourceMappingURL=server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAOpD,MAAM,UAAU,YAAY,CAAC,OAAsB;IACjD,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC;QAC3B,IAAI,EAAE,WAAW;QACjB,OAAO,EAAE,OAAO;KACjB,CAAC,CAAC;IAEH,IAAI,CAAC;QACH,MAAM,EAAE,GAAG,YAAY,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACxC,gBAAgB,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAC/B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;YACpB,OAAO,CAAC,KAAK,CAAC,8BAA8B,OAAO,CAAC,MAAM,GAAG,EAAE,KAAK,CAAC,CAAC;QACxE,CAAC;QAED,yDAAyD;QACzD,MAAM,CAAC,IAAI,CACT,oBAAoB,EACpB,qDAAqD,EACrD,EAAE,EACF,KAAK,IAAI,EAAE,CAAC,CAAC;YACX,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,6BAA6B,OAAO,CAAC,MAAM,uCAAuC;iBACzF;aACF;YACD,OAAO,EAAE,IAAI;SACd,CAAC,CACH,CAAC;IACJ,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,OAAsB;IACtD,MAAM,MAAM,GAAG,YAAY,CAAC,OAAO,CAAC,CAAC;IACrC,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AAClC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ import type { McpDatabase } from '../db.js';
3
+ export declare function registerFindByBusinessGoal(server: McpServer, db: McpDatabase): void;
4
+ //# sourceMappingURL=find-by-business-goal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"find-by-business-goal.d.ts","sourceRoot":"","sources":["../../src/tools/find-by-business-goal.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAG5C,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,SAAS,EACjB,EAAE,EAAE,WAAW,GACd,IAAI,CA2BN"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * @knowgraph
3
+ * type: function
4
+ * description: MCP tool that finds code entities linked to a business objective
5
+ * owner: knowgraph-mcp
6
+ * status: stable
7
+ * tags: [mcp, tool, business, goal]
8
+ * context:
9
+ * business_goal: Bridge business objectives to code ownership for AI assistants
10
+ * domain: mcp-tools
11
+ */
12
+ import { z } from 'zod';
13
+ import { formatEntityList } from './format.js';
14
+ export function registerFindByBusinessGoal(server, db) {
15
+ server.tool('find_code_by_business_goal', 'Find code entities related to a specific business goal or context', {
16
+ goal: z.string().describe('Business goal or context to search for'),
17
+ }, async (params) => {
18
+ try {
19
+ const results = db.getByBusinessGoal(params.goal);
20
+ return {
21
+ content: [{ type: 'text', text: formatEntityList(results) }],
22
+ };
23
+ }
24
+ catch (error) {
25
+ return {
26
+ content: [
27
+ {
28
+ type: 'text',
29
+ text: `Error finding by business goal: ${String(error)}`,
30
+ },
31
+ ],
32
+ isError: true,
33
+ };
34
+ }
35
+ });
36
+ }
37
+ //# sourceMappingURL=find-by-business-goal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"find-by-business-goal.js","sourceRoot":"","sources":["../../src/tools/find-by-business-goal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,MAAM,UAAU,0BAA0B,CACxC,MAAiB,EACjB,EAAe;IAEf,MAAM,CAAC,IAAI,CACT,4BAA4B,EAC5B,mEAAmE,EACnE;QACE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,wCAAwC,CAAC;KACpE,EACD,KAAK,EAAE,MAAM,EAAE,EAAE;QACf,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,EAAE,CAAC,iBAAiB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YAElD,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,gBAAgB,CAAC,OAAO,CAAC,EAAE,CAAC;aACtE,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAe;wBACrB,IAAI,EAAE,mCAAmC,MAAM,CAAC,KAAK,CAAC,EAAE;qBACzD;iBACF;gBACD,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ import type { McpDatabase } from '../db.js';
3
+ export declare function registerFindByOwner(server: McpServer, db: McpDatabase): void;
4
+ //# sourceMappingURL=find-by-owner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"find-by-owner.d.ts","sourceRoot":"","sources":["../../src/tools/find-by-owner.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAG5C,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,SAAS,EAAE,EAAE,EAAE,WAAW,GAAG,IAAI,CA2B5E"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * @knowgraph
3
+ * type: function
4
+ * description: MCP tool that finds code entities belonging to a specific team or owner
5
+ * owner: knowgraph-mcp
6
+ * status: stable
7
+ * tags: [mcp, tool, owner, team]
8
+ * context:
9
+ * business_goal: Enable AI assistants to find code by team ownership
10
+ * domain: mcp-tools
11
+ */
12
+ import { z } from 'zod';
13
+ import { formatEntityList } from './format.js';
14
+ export function registerFindByOwner(server, db) {
15
+ server.tool('find_code_by_owner', 'Find all code entities owned by a specific team or person', {
16
+ owner: z.string().describe('Owner name or team to search for'),
17
+ }, async (params) => {
18
+ try {
19
+ const results = db.getByOwner(params.owner);
20
+ return {
21
+ content: [{ type: 'text', text: formatEntityList(results) }],
22
+ };
23
+ }
24
+ catch (error) {
25
+ return {
26
+ content: [
27
+ {
28
+ type: 'text',
29
+ text: `Error finding by owner: ${String(error)}`,
30
+ },
31
+ ],
32
+ isError: true,
33
+ };
34
+ }
35
+ });
36
+ }
37
+ //# sourceMappingURL=find-by-owner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"find-by-owner.js","sourceRoot":"","sources":["../../src/tools/find-by-owner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,MAAM,UAAU,mBAAmB,CAAC,MAAiB,EAAE,EAAe;IACpE,MAAM,CAAC,IAAI,CACT,oBAAoB,EACpB,2DAA2D,EAC3D;QACE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,kCAAkC,CAAC;KAC/D,EACD,KAAK,EAAE,MAAM,EAAE,EAAE;QACf,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YAE5C,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,gBAAgB,CAAC,OAAO,CAAC,EAAE,CAAC;aACtE,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAe;wBACrB,IAAI,EAAE,2BAA2B,MAAM,CAAC,KAAK,CAAC,EAAE;qBACjD;iBACF;gBACD,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * @knowgraph
3
+ * type: module
4
+ * description: Formatting utilities for MCP tool responses (entities, dependencies, links, stats)
5
+ * owner: knowgraph-mcp
6
+ * status: stable
7
+ * tags: [mcp, formatting, output, markdown]
8
+ * context:
9
+ * business_goal: Present code graph data in clean, readable formats for AI consumption
10
+ * domain: mcp-tools
11
+ */
12
+ import type { EntityRow, DependencyRow, LinkRow, GraphStats } from '../db.js';
13
+ export declare function formatEntity(entity: EntityRow): string;
14
+ export declare function formatEntityList(entities: readonly EntityRow[]): string;
15
+ export declare function formatDependencies(entityId: string, deps: readonly DependencyRow[]): string;
16
+ export declare function formatLinks(links: readonly LinkRow[]): string;
17
+ export declare function formatStats(stats: GraphStats): string;
18
+ //# sourceMappingURL=format.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../src/tools/format.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAE9E,wBAAgB,YAAY,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM,CAoBtD;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,SAAS,SAAS,EAAE,GAAG,MAAM,CAKvE;AAED,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,SAAS,aAAa,EAAE,GAC7B,MAAM,CAyBR;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,SAAS,OAAO,EAAE,GAAG,MAAM,CAY7D;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAyBrD"}
@@ -0,0 +1,86 @@
1
+ export function formatEntity(entity) {
2
+ const lines = [
3
+ `## ${entity.name} (${entity.entity_type})`,
4
+ `**File:** ${entity.file_path}:${entity.line}`,
5
+ `**Description:** ${entity.description}`,
6
+ ];
7
+ if (entity.owner)
8
+ lines.push(`**Owner:** ${entity.owner}`);
9
+ if (entity.status)
10
+ lines.push(`**Status:** ${entity.status}`);
11
+ if (entity.language)
12
+ lines.push(`**Language:** ${entity.language}`);
13
+ if (entity.signature)
14
+ lines.push(`**Signature:** \`${entity.signature}\``);
15
+ if (entity.tags)
16
+ lines.push(`**Tags:** ${entity.tags}`);
17
+ if (entity.business_goal)
18
+ lines.push(`**Business Goal:** ${entity.business_goal}`);
19
+ if (entity.funnel_stage)
20
+ lines.push(`**Funnel Stage:** ${entity.funnel_stage}`);
21
+ if (entity.revenue_impact)
22
+ lines.push(`**Revenue Impact:** ${entity.revenue_impact}`);
23
+ return lines.join('\n');
24
+ }
25
+ export function formatEntityList(entities) {
26
+ if (entities.length === 0) {
27
+ return 'No entities found.';
28
+ }
29
+ return entities.map(formatEntity).join('\n\n---\n\n');
30
+ }
31
+ export function formatDependencies(entityId, deps) {
32
+ if (deps.length === 0) {
33
+ return `No dependencies found for entity: ${entityId}`;
34
+ }
35
+ const outgoing = deps.filter((d) => d.source_id === entityId);
36
+ const incoming = deps.filter((d) => d.target_id === entityId);
37
+ const lines = [`## Dependencies for ${entityId}`];
38
+ if (outgoing.length > 0) {
39
+ lines.push('\n### Depends On');
40
+ for (const dep of outgoing) {
41
+ lines.push(`- ${dep.target_id} (${dep.dependency_type})`);
42
+ }
43
+ }
44
+ if (incoming.length > 0) {
45
+ lines.push('\n### Depended On By');
46
+ for (const dep of incoming) {
47
+ lines.push(`- ${dep.source_id} (${dep.dependency_type})`);
48
+ }
49
+ }
50
+ return lines.join('\n');
51
+ }
52
+ export function formatLinks(links) {
53
+ if (links.length === 0) {
54
+ return 'No external links found.';
55
+ }
56
+ return links
57
+ .map((link) => {
58
+ const title = link.title ?? link.url;
59
+ const type = link.type ? ` [${link.type}]` : '';
60
+ return `- ${title}${type}: ${link.url} (entity: ${link.entity_id})`;
61
+ })
62
+ .join('\n');
63
+ }
64
+ export function formatStats(stats) {
65
+ const lines = [
66
+ '## KnowGraph Overview',
67
+ '',
68
+ `**Total Entities:** ${stats.totalEntities}`,
69
+ `**Total Links:** ${stats.totalLinks}`,
70
+ `**Total Dependencies:** ${stats.totalDependencies}`,
71
+ ];
72
+ if (stats.entityTypes.length > 0) {
73
+ lines.push('\n### Entity Types');
74
+ for (const et of stats.entityTypes) {
75
+ lines.push(`- ${et.type}: ${et.count}`);
76
+ }
77
+ }
78
+ if (stats.owners.length > 0) {
79
+ lines.push(`\n### Owners\n${stats.owners.join(', ')}`);
80
+ }
81
+ if (stats.languages.length > 0) {
82
+ lines.push(`\n### Languages\n${stats.languages.join(', ')}`);
83
+ }
84
+ return lines.join('\n');
85
+ }
86
+ //# sourceMappingURL=format.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format.js","sourceRoot":"","sources":["../../src/tools/format.ts"],"names":[],"mappings":"AAaA,MAAM,UAAU,YAAY,CAAC,MAAiB;IAC5C,MAAM,KAAK,GAAa;QACtB,MAAM,MAAM,CAAC,IAAI,KAAK,MAAM,CAAC,WAAW,GAAG;QAC3C,aAAa,MAAM,CAAC,SAAS,IAA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,EAAE,CAAC,CAAC;IAC/D,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ import type { McpDatabase } from '../db.js';
3
+ export declare function registerGetDependencies(server: McpServer, db: McpDatabase): void;
4
+ //# sourceMappingURL=get-dependencies.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-dependencies.d.ts","sourceRoot":"","sources":["../../src/tools/get-dependencies.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAG5C,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,SAAS,EACjB,EAAE,EAAE,WAAW,GACd,IAAI,CAoCN"}
@@ -0,0 +1,46 @@
1
+ /**
2
+ * @knowgraph
3
+ * type: function
4
+ * description: MCP tool that retrieves dependency graph for a code entity
5
+ * owner: knowgraph-mcp
6
+ * status: stable
7
+ * tags: [mcp, tool, dependencies, graph]
8
+ * context:
9
+ * business_goal: Enable AI assistants to understand code relationships and impact
10
+ * domain: mcp-tools
11
+ */
12
+ import { z } from 'zod';
13
+ import { formatDependencies } from './format.js';
14
+ export function registerGetDependencies(server, db) {
15
+ server.tool('get_code_dependencies', 'Get the dependency tree for a specific code entity', {
16
+ entity_id: z.string().describe('The entity ID to get dependencies for'),
17
+ depth: z
18
+ .number()
19
+ .optional()
20
+ .describe('How many levels deep to traverse (default 1)'),
21
+ }, async (params) => {
22
+ try {
23
+ const deps = db.getDependencies(params.entity_id, params.depth);
24
+ return {
25
+ content: [
26
+ {
27
+ type: 'text',
28
+ text: formatDependencies(params.entity_id, deps),
29
+ },
30
+ ],
31
+ };
32
+ }
33
+ catch (error) {
34
+ return {
35
+ content: [
36
+ {
37
+ type: 'text',
38
+ text: `Error getting dependencies: ${String(error)}`,
39
+ },
40
+ ],
41
+ isError: true,
42
+ };
43
+ }
44
+ });
45
+ }
46
+ //# sourceMappingURL=get-dependencies.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-dependencies.js","sourceRoot":"","sources":["../../src/tools/get-dependencies.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjD,MAAM,UAAU,uBAAuB,CACrC,MAAiB,EACjB,EAAe;IAEf,MAAM,CAAC,IAAI,CACT,uBAAuB,EACvB,oDAAoD,EACpD;QACE,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,uCAAuC,CAAC;QACvE,KAAK,EAAE,CAAC;aACL,MAAM,EAAE;aACR,QAAQ,EAAE;aACV,QAAQ,CAAC,8CAA8C,CAAC;KAC5D,EACD,KAAK,EAAE,MAAM,EAAE,EAAE;QACf,IAAI,CAAC;YACH,MAAM,IAAI,GAAG,EAAE,CAAC,eAAe,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;YAEhE,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAe;wBACrB,IAAI,EAAE,kBAAkB,CAAC,MAAM,CAAC,SAAS,EAAE,IAAI,CAAC;qBACjD;iBACF;aACF,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAe;wBACrB,IAAI,EAAE,+BAA+B,MAAM,CAAC,KAAK,CAAC,EAAE;qBACrD;iBACF;gBACD,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ import type { McpDatabase } from '../db.js';
3
+ export declare function registerGetEntityDetails(server: McpServer, db: McpDatabase): void;
4
+ //# sourceMappingURL=get-entity-details.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-entity-details.d.ts","sourceRoot":"","sources":["../../src/tools/get-entity-details.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAG5C,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,SAAS,EACjB,EAAE,EAAE,WAAW,GACd,IAAI,CAmDN"}
@@ -0,0 +1,58 @@
1
+ /**
2
+ * @knowgraph
3
+ * type: function
4
+ * description: MCP tool that returns full metadata for a specific code entity
5
+ * owner: knowgraph-mcp
6
+ * status: stable
7
+ * tags: [mcp, tool, details, metadata]
8
+ * context:
9
+ * business_goal: Provide comprehensive entity information to AI assistants
10
+ * domain: mcp-tools
11
+ */
12
+ import { z } from 'zod';
13
+ import { formatEntity, formatLinks, formatDependencies } from './format.js';
14
+ export function registerGetEntityDetails(server, db) {
15
+ server.tool('get_entity_details', 'Get full metadata for a specific code entity including links and dependencies', {
16
+ entity_id: z.string().describe('The entity ID to look up'),
17
+ }, async (params) => {
18
+ try {
19
+ const entity = db.getById(params.entity_id);
20
+ if (!entity) {
21
+ return {
22
+ content: [
23
+ {
24
+ type: 'text',
25
+ text: `Entity not found: ${params.entity_id}`,
26
+ },
27
+ ],
28
+ isError: true,
29
+ };
30
+ }
31
+ const links = db.getLinks(params.entity_id);
32
+ const deps = db.getDependencies(params.entity_id);
33
+ const sections = [
34
+ formatEntity(entity),
35
+ '',
36
+ '### External Links',
37
+ formatLinks(links),
38
+ '',
39
+ formatDependencies(params.entity_id, deps),
40
+ ];
41
+ return {
42
+ content: [{ type: 'text', text: sections.join('\n') }],
43
+ };
44
+ }
45
+ catch (error) {
46
+ return {
47
+ content: [
48
+ {
49
+ type: 'text',
50
+ text: `Error getting entity details: ${String(error)}`,
51
+ },
52
+ ],
53
+ isError: true,
54
+ };
55
+ }
56
+ });
57
+ }
58
+ //# sourceMappingURL=get-entity-details.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-entity-details.js","sourceRoot":"","sources":["../../src/tools/get-entity-details.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAE5E,MAAM,UAAU,wBAAwB,CACtC,MAAiB,EACjB,EAAe;IAEf,MAAM,CAAC,IAAI,CACT,oBAAoB,EACpB,+EAA+E,EAC/E;QACE,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,0BAA0B,CAAC;KAC3D,EACD,KAAK,EAAE,MAAM,EAAE,EAAE;QACf,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;YAE5C,IAAI,CAAC,MAAM,EAAE,CAAC;gBACZ,OAAO;oBACL,OAAO,EAAE;wBACP;4BACE,IAAI,EAAE,MAAe;4BACrB,IAAI,EAAE,qBAAqB,MAAM,CAAC,SAAS,EAAE;yBAC9C;qBACF;oBACD,OAAO,EAAE,IAAI;iBACd,CAAC;YACJ,CAAC;YAED,MAAM,KAAK,GAAG,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;YAC5C,MAAM,IAAI,GAAG,EAAE,CAAC,eAAe,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;YAElD,MAAM,QAAQ,GAAG;gBACf,YAAY,CAAC,MAAM,CAAC;gBACpB,EAAE;gBACF,oBAAoB;gBACpB,WAAW,CAAC,KAAK,CAAC;gBAClB,EAAE;gBACF,kBAAkB,CAAC,MAAM,CAAC,SAAS,EAAE,IAAI,CAAC;aAC3C,CAAC;YAEF,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;aAChE,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAe;wBACrB,IAAI,EAAE,iCAAiC,MAAM,CAAC,KAAK,CAAC,EAAE;qBACvD;iBACF;gBACD,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ import type { McpDatabase } from '../db.js';
3
+ export declare function registerGetExternalKnowledge(server: McpServer, db: McpDatabase): void;
4
+ //# sourceMappingURL=get-external-knowledge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-external-knowledge.d.ts","sourceRoot":"","sources":["../../src/tools/get-external-knowledge.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAG5C,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,SAAS,EACjB,EAAE,EAAE,WAAW,GACd,IAAI,CAsCN"}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * @knowgraph
3
+ * type: function
4
+ * description: MCP tool that retrieves external documentation links for entities
5
+ * owner: knowgraph-mcp
6
+ * status: stable
7
+ * tags: [mcp, tool, links, documentation]
8
+ * context:
9
+ * business_goal: Connect code to external knowledge sources for AI assistants
10
+ * domain: mcp-tools
11
+ */
12
+ import { z } from 'zod';
13
+ import { formatLinks } from './format.js';
14
+ export function registerGetExternalKnowledge(server, db) {
15
+ server.tool('get_external_knowledge', 'Get external links (Notion, Jira, etc.) for an entity or all entities', {
16
+ entity_id: z
17
+ .string()
18
+ .optional()
19
+ .describe('Entity ID to get links for (omit for all)'),
20
+ type: z
21
+ .string()
22
+ .optional()
23
+ .describe('Link type filter (notion, jira, linear, etc.)'),
24
+ }, async (params) => {
25
+ try {
26
+ const allLinks = db.getLinks(params.entity_id);
27
+ const filtered = params.type
28
+ ? allLinks.filter((link) => link.type === params.type)
29
+ : allLinks;
30
+ return {
31
+ content: [{ type: 'text', text: formatLinks(filtered) }],
32
+ };
33
+ }
34
+ catch (error) {
35
+ return {
36
+ content: [
37
+ {
38
+ type: 'text',
39
+ text: `Error getting external knowledge: ${String(error)}`,
40
+ },
41
+ ],
42
+ isError: true,
43
+ };
44
+ }
45
+ });
46
+ }
47
+ //# sourceMappingURL=get-external-knowledge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-external-knowledge.js","sourceRoot":"","sources":["../../src/tools/get-external-knowledge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,MAAM,UAAU,4BAA4B,CAC1C,MAAiB,EACjB,EAAe;IAEf,MAAM,CAAC,IAAI,CACT,wBAAwB,EACxB,uEAAuE,EACvE;QACE,SAAS,EAAE,CAAC;aACT,MAAM,EAAE;aACR,QAAQ,EAAE;aACV,QAAQ,CAAC,2CAA2C,CAAC;QACxD,IAAI,EAAE,CAAC;aACJ,MAAM,EAAE;aACR,QAAQ,EAAE;aACV,QAAQ,CAAC,+CAA+C,CAAC;KAC7D,EACD,KAAK,EAAE,MAAM,EAAE,EAAE;QACf,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;YAE/C,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI;gBAC1B,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,MAAM,CAAC,IAAI,CAAC;gBACtD,CAAC,CAAC,QAAQ,CAAC;YAEb,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,WAAW,CAAC,QAAQ,CAAC,EAAE,CAAC;aAClE,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAe;wBACrB,IAAI,EAAE,qCAAqC,MAAM,CAAC,KAAK,CAAC,EAAE;qBAC3D;iBACF;gBACD,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * @knowgraph
3
+ * type: function
4
+ * description: MCP tool that provides codebase-wide statistics and summary
5
+ * owner: knowgraph-mcp
6
+ * status: stable
7
+ * tags: [mcp, tool, overview, statistics]
8
+ * context:
9
+ * business_goal: Give AI assistants a high-level view of the codebase
10
+ * domain: mcp-tools
11
+ */
12
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
13
+ import type { McpDatabase } from '../db.js';
14
+ export declare function registerGraphOverview(server: McpServer, db: McpDatabase): void;
15
+ //# sourceMappingURL=graph-overview.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graph-overview.d.ts","sourceRoot":"","sources":["../../src/tools/graph-overview.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAG5C,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,SAAS,EACjB,EAAE,EAAE,WAAW,GACd,IAAI,CAyBN"}
@@ -0,0 +1,23 @@
1
+ import { formatStats } from './format.js';
2
+ export function registerGraphOverview(server, db) {
3
+ server.tool('get_graph_overview', 'Get statistics and overview of the indexed codebase', {}, async () => {
4
+ try {
5
+ const stats = db.getStats();
6
+ return {
7
+ content: [{ type: 'text', text: formatStats(stats) }],
8
+ };
9
+ }
10
+ catch (error) {
11
+ return {
12
+ content: [
13
+ {
14
+ type: 'text',
15
+ text: `Error getting graph overview: ${String(error)}`,
16
+ },
17
+ ],
18
+ isError: true,
19
+ };
20
+ }
21
+ });
22
+ }
23
+ //# sourceMappingURL=graph-overview.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graph-overview.js","sourceRoot":"","sources":["../../src/tools/graph-overview.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,MAAM,UAAU,qBAAqB,CACnC,MAAiB,EACjB,EAAe;IAEf,MAAM,CAAC,IAAI,CACT,oBAAoB,EACpB,qDAAqD,EACrD,EAAE,EACF,KAAK,IAAI,EAAE;QACT,IAAI,CAAC;YACH,MAAM,KAAK,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC;YAE5B,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,WAAW,CAAC,KAAK,CAAC,EAAE,CAAC;aAC/D,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAe;wBACrB,IAAI,EAAE,iCAAiC,MAAM,CAAC,KAAK,CAAC,EAAE;qBACvD;iBACF;gBACD,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * @knowgraph
3
+ * type: module
4
+ * description: Tool registry that registers all MCP tools with the server
5
+ * owner: knowgraph-mcp
6
+ * status: stable
7
+ * tags: [mcp, tools, registry, aggregator]
8
+ * context:
9
+ * business_goal: Centralize MCP tool registration for clean server initialization
10
+ * domain: mcp-tools
11
+ */
12
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
13
+ import type { McpDatabase } from '../db.js';
14
+ export declare function registerAllTools(server: McpServer, db: McpDatabase): void;
15
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAS5C,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,SAAS,EAAE,EAAE,EAAE,WAAW,GAAG,IAAI,CAQzE"}
@@ -0,0 +1,17 @@
1
+ import { registerSearchCode } from './search-code.js';
2
+ import { registerFindByOwner } from './find-by-owner.js';
3
+ import { registerFindByBusinessGoal } from './find-by-business-goal.js';
4
+ import { registerGetDependencies } from './get-dependencies.js';
5
+ import { registerGetEntityDetails } from './get-entity-details.js';
6
+ import { registerGetExternalKnowledge } from './get-external-knowledge.js';
7
+ import { registerGraphOverview } from './graph-overview.js';
8
+ export function registerAllTools(server, db) {
9
+ registerSearchCode(server, db);
10
+ registerFindByOwner(server, db);
11
+ registerFindByBusinessGoal(server, db);
12
+ registerGetDependencies(server, db);
13
+ registerGetEntityDetails(server, db);
14
+ registerGetExternalKnowledge(server, db);
15
+ registerGraphOverview(server, db);
16
+ }
17
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,4BAA4B,EAAE,MAAM,6BAA6B,CAAC;AAC3E,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAE5D,MAAM,UAAU,gBAAgB,CAAC,MAAiB,EAAE,EAAe;IACjE,kBAAkB,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAC/B,mBAAmB,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAChC,0BAA0B,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACvC,uBAAuB,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACpC,wBAAwB,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACrC,4BAA4B,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACzC,qBAAqB,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AACpC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ import type { McpDatabase } from '../db.js';
3
+ export declare function registerSearchCode(server: McpServer, db: McpDatabase): void;
4
+ //# sourceMappingURL=search-code.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"search-code.d.ts","sourceRoot":"","sources":["../../src/tools/search-code.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAG5C,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,EAAE,EAAE,EAAE,WAAW,GAAG,IAAI,CAuC3E"}
@@ -0,0 +1,49 @@
1
+ /**
2
+ * @knowgraph
3
+ * type: function
4
+ * description: MCP tool that provides full-text search across code entities
5
+ * owner: knowgraph-mcp
6
+ * status: stable
7
+ * tags: [mcp, tool, search, fts5]
8
+ * context:
9
+ * business_goal: Enable AI assistants to search codebases by keyword
10
+ * domain: mcp-tools
11
+ */
12
+ import { z } from 'zod';
13
+ import { formatEntityList } from './format.js';
14
+ export function registerSearchCode(server, db) {
15
+ server.tool('search_code', 'Search for code entities by description, name, or tags', {
16
+ query: z.string().describe('Search query text'),
17
+ type: z
18
+ .string()
19
+ .optional()
20
+ .describe('Entity type filter (e.g., function, class, module)'),
21
+ owner: z.string().optional().describe('Owner/team filter'),
22
+ tags: z.array(z.string()).optional().describe('Tag filters'),
23
+ limit: z.number().optional().describe('Max results (default 20)'),
24
+ }, async (params) => {
25
+ try {
26
+ const results = db.search(params.query, {
27
+ type: params.type,
28
+ owner: params.owner,
29
+ tags: params.tags,
30
+ limit: params.limit,
31
+ });
32
+ return {
33
+ content: [{ type: 'text', text: formatEntityList(results) }],
34
+ };
35
+ }
36
+ catch (error) {
37
+ return {
38
+ content: [
39
+ {
40
+ type: 'text',
41
+ text: `Error searching code: ${String(error)}`,
42
+ },
43
+ ],
44
+ isError: true,
45
+ };
46
+ }
47
+ });
48
+ }
49
+ //# sourceMappingURL=search-code.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"search-code.js","sourceRoot":"","sources":["../../src/tools/search-code.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,MAAM,UAAU,kBAAkB,CAAC,MAAiB,EAAE,EAAe;IACnE,MAAM,CAAC,IAAI,CACT,aAAa,EACb,wDAAwD,EACxD;QACE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,mBAAmB,CAAC;QAC/C,IAAI,EAAE,CAAC;aACJ,MAAM,EAAE;aACR,QAAQ,EAAE;aACV,QAAQ,CAAC,oDAAoD,CAAC;QACjE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,mBAAmB,CAAC;QAC1D,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,aAAa,CAAC;QAC5D,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,0BAA0B,CAAC;KAClE,EACD,KAAK,EAAE,MAAM,EAAE,EAAE;QACf,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE;gBACtC,IAAI,EAAE,MAAM,CAAC,IAAI;gBACjB,KAAK,EAAE,MAAM,CAAC,KAAK;gBACnB,IAAI,EAAE,MAAM,CAAC,IAAI;gBACjB,KAAK,EAAE,MAAM,CAAC,KAAK;aACpB,CAAC,CAAC;YAEH,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,gBAAgB,CAAC,OAAO,CAAC,EAAE,CAAC;aACtE,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAe;wBACrB,IAAI,EAAE,yBAAyB,MAAM,CAAC,KAAK,CAAC,EAAE;qBAC/C;iBACF;gBACD,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
package/package.json ADDED
@@ -0,0 +1,58 @@
1
+ {
2
+ "name": "@know-graph/mcp-server",
3
+ "version": "0.4.0",
4
+ "description": "MCP server for KnowGraph",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/idosams/know-know.git",
10
+ "directory": "packages/mcp-server"
11
+ },
12
+ "homepage": "https://github.com/idosams/know-know#readme",
13
+ "bugs": {
14
+ "url": "https://github.com/idosams/know-know/issues"
15
+ },
16
+ "keywords": [
17
+ "knowgraph",
18
+ "mcp",
19
+ "model-context-protocol",
20
+ "ai",
21
+ "code-knowledge"
22
+ ],
23
+ "files": [
24
+ "dist",
25
+ "README.md",
26
+ "LICENSE"
27
+ ],
28
+ "exports": {
29
+ ".": {
30
+ "types": "./dist/index.d.ts",
31
+ "import": "./dist/index.js"
32
+ }
33
+ },
34
+ "main": "dist/index.js",
35
+ "types": "dist/index.d.ts",
36
+ "bin": {
37
+ "knowgraph-mcp": "dist/index.js"
38
+ },
39
+ "publishConfig": {
40
+ "access": "public"
41
+ },
42
+ "dependencies": {
43
+ "@modelcontextprotocol/sdk": "^1.0.0",
44
+ "better-sqlite3": "^11.0.0",
45
+ "zod": "^3.24.0",
46
+ "@know-graph/core": "0.4.0"
47
+ },
48
+ "devDependencies": {
49
+ "@types/better-sqlite3": "^7.6.0"
50
+ },
51
+ "scripts": {
52
+ "build": "tsc",
53
+ "test": "vitest run",
54
+ "lint": "eslint src/",
55
+ "typecheck": "tsc --noEmit",
56
+ "clean": "rm -rf dist"
57
+ }
58
+ }