Skip to content

Commit 4b55a04

Browse files
committed
fix(mcp): include all 9 adapters and improve tool descriptions
- CLI mcp start now registers all 9 adapters (was missing 4) - Improved tool descriptions for better AI tool adoption - dev_search: USE THIS FIRST, better than grep - dev_map: shows component counts, better than list_dir - dev_explore: use after dev_search for similar/relationships - dev_refs: for specific symbols, use dev_search for concepts - dev_history: understand WHY code looks the way it does - dev_plan: ALL context in one call for GitHub issues - dev_gh: semantic search by meaning, not keywords - Ignore benchmark package (WIP)
1 parent 9dba999 commit 4b55a04

File tree

15 files changed

+145
-23
lines changed

15 files changed

+145
-23
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
"@lytics/dev-agent": patch
3+
"@lytics/dev-agent-cli": patch
4+
"@lytics/dev-agent-mcp": patch
5+
---
6+
7+
Fix MCP server to include all 9 adapters and improve tool descriptions for better AI tool adoption
8+
9+
**Bug Fix:**
10+
- CLI's `mcp start` command now registers all 9 adapters (was missing HealthAdapter, RefsAdapter, MapAdapter, HistoryAdapter)
11+
- Updated tool list in CLI output and install messages to show all 9 tools
12+
13+
**Tool Description Improvements:**
14+
- `dev_search`: Added "USE THIS FIRST" trigger, comparison to grep for conceptual queries
15+
- `dev_map`: Clarified it shows component counts and exports, better than list_dir
16+
- `dev_explore`: Clarified workflow - use after dev_search for "similar" and "relationships" actions
17+
- `dev_refs`: Added guidance to use for specific symbols, use dev_search for conceptual queries
18+
- `dev_history`: Added "WHY" trigger, clarified semantic search over commits
19+
- `dev_plan`: Emphasized "ALL context in one call" value prop for GitHub issues
20+
- `dev_gh`: Clarified semantic search by meaning, not just keywords
21+
22+
These description improvements help AI tools (Claude, Cursor) choose the right dev-agent tool for each task.
23+

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,6 @@ Thumbs.db
6464
# Temporary files and invalid paths
6565
temp/
6666
*-github/*.tgz
67+
68+
# Work in progress packages (not ready for commit)
69+
packages/benchmark/

packages/cli/src/commands/mcp.ts

Lines changed: 82 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,23 @@
66
import { spawn } from 'node:child_process';
77
import * as fs from 'node:fs/promises';
88
import * as path from 'node:path';
9-
import { getStorageFilePaths, getStoragePath, RepositoryIndexer } from '@lytics/dev-agent-core';
9+
import {
10+
GitIndexer,
11+
getStorageFilePaths,
12+
getStoragePath,
13+
LocalGitExtractor,
14+
RepositoryIndexer,
15+
VectorStorage,
16+
} from '@lytics/dev-agent-core';
1017
import {
1118
ExploreAdapter,
1219
GitHubAdapter,
20+
HealthAdapter,
21+
HistoryAdapter,
22+
MapAdapter,
1323
MCPServer,
1424
PlanAdapter,
25+
RefsAdapter,
1526
SearchAdapter,
1627
StatusAdapter,
1728
} from '@lytics/dev-agent-mcp';
@@ -101,13 +112,6 @@ export const mcpCommand = new Command('mcp')
101112
defaultSection: 'summary',
102113
});
103114

104-
const planAdapter = new PlanAdapter({
105-
repositoryIndexer: indexer,
106-
repositoryPath,
107-
defaultFormat: 'compact',
108-
timeout: 60000,
109-
});
110-
111115
const exploreAdapter = new ExploreAdapter({
112116
repositoryPath,
113117
repositoryIndexer: indexer,
@@ -124,7 +128,53 @@ export const mcpCommand = new Command('mcp')
124128
defaultFormat: 'compact',
125129
});
126130

127-
// Create MCP server
131+
const healthAdapter = new HealthAdapter({
132+
repositoryPath,
133+
vectorStorePath: vectors,
134+
githubStatePath: getStorageFilePaths(storagePath).githubState,
135+
});
136+
137+
const refsAdapter = new RefsAdapter({
138+
repositoryIndexer: indexer,
139+
defaultLimit: 20,
140+
});
141+
142+
const mapAdapter = new MapAdapter({
143+
repositoryIndexer: indexer,
144+
repositoryPath,
145+
defaultDepth: 2,
146+
defaultTokenBudget: 2000,
147+
});
148+
149+
// Create git extractor and indexer (needed by plan and history adapters)
150+
const gitExtractor = new LocalGitExtractor(repositoryPath);
151+
const gitVectorStorage = new VectorStorage({
152+
storePath: `${vectors}-git`,
153+
});
154+
await gitVectorStorage.initialize();
155+
156+
const gitIndexer = new GitIndexer({
157+
extractor: gitExtractor,
158+
vectorStorage: gitVectorStorage,
159+
});
160+
161+
const historyAdapter = new HistoryAdapter({
162+
gitIndexer,
163+
gitExtractor,
164+
defaultLimit: 10,
165+
defaultTokenBudget: 2000,
166+
});
167+
168+
// Update plan adapter to include git indexer
169+
const planAdapterWithGit = new PlanAdapter({
170+
repositoryIndexer: indexer,
171+
gitIndexer,
172+
repositoryPath,
173+
defaultFormat: 'compact',
174+
timeout: 60000,
175+
});
176+
177+
// Create MCP server with all 9 adapters
128178
const server = new MCPServer({
129179
serverInfo: {
130180
name: 'dev-agent',
@@ -135,7 +185,17 @@ export const mcpCommand = new Command('mcp')
135185
logLevel: logLevel as 'debug' | 'info' | 'warn' | 'error',
136186
},
137187
transport: options.transport === 'stdio' ? 'stdio' : undefined,
138-
adapters: [searchAdapter, statusAdapter, planAdapter, exploreAdapter, githubAdapter],
188+
adapters: [
189+
searchAdapter,
190+
statusAdapter,
191+
planAdapterWithGit,
192+
exploreAdapter,
193+
githubAdapter,
194+
healthAdapter,
195+
refsAdapter,
196+
mapAdapter,
197+
historyAdapter,
198+
],
139199
coordinator,
140200
});
141201

@@ -144,6 +204,7 @@ export const mcpCommand = new Command('mcp')
144204
logger.info('Shutting down MCP server...');
145205
await server.stop();
146206
await indexer.close();
207+
await gitVectorStorage.close();
147208
if (githubAdapter.githubIndexer) {
148209
await githubAdapter.githubIndexer.close();
149210
}
@@ -157,7 +218,9 @@ export const mcpCommand = new Command('mcp')
157218
await server.start();
158219

159220
logger.info(chalk.green('MCP server started successfully!'));
160-
logger.info('Available tools: dev_search, dev_status, dev_plan, dev_explore, dev_gh');
221+
logger.info(
222+
'Available tools: dev_search, dev_status, dev_plan, dev_explore, dev_gh, dev_health, dev_refs, dev_map, dev_history'
223+
);
161224

162225
if (options.transport === 'stdio') {
163226
logger.info('Server running on stdio transport (for AI tools)');
@@ -223,6 +286,10 @@ export const mcpCommand = new Command('mcp')
223286
logger.log(` ${chalk.cyan('dev_plan')} - Generate development plans`);
224287
logger.log(` ${chalk.cyan('dev_explore')} - Explore code patterns`);
225288
logger.log(` ${chalk.cyan('dev_gh')} - Search GitHub issues/PRs`);
289+
logger.log(` ${chalk.cyan('dev_health')} - Server health checks`);
290+
logger.log(` ${chalk.cyan('dev_refs')} - Find symbol references`);
291+
logger.log(` ${chalk.cyan('dev_map')} - Generate codebase map`);
292+
logger.log(` ${chalk.cyan('dev_history')} - Search git history`);
226293
logger.log('');
227294
logger.log(`Repository: ${chalk.yellow(repositoryPath)}`);
228295
logger.log(`Storage: ${chalk.yellow(storagePath)}`);
@@ -275,6 +342,10 @@ export const mcpCommand = new Command('mcp')
275342
logger.log(` ${chalk.cyan('dev_plan')} - Generate development plans`);
276343
logger.log(` ${chalk.cyan('dev_explore')} - Explore code patterns`);
277344
logger.log(` ${chalk.cyan('dev_gh')} - Search GitHub issues/PRs`);
345+
logger.log(` ${chalk.cyan('dev_health')} - Server health checks`);
346+
logger.log(` ${chalk.cyan('dev_refs')} - Find symbol references`);
347+
logger.log(` ${chalk.cyan('dev_map')} - Generate codebase map`);
348+
logger.log(` ${chalk.cyan('dev_history')} - Search git history`);
278349
logger.log('');
279350
logger.log(`Repository: ${chalk.yellow(repositoryPath)}`);
280351
logger.log(`Storage: ${chalk.yellow(storagePath)}`);

packages/mcp-server/src/adapters/__tests__/explore-adapter.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ describe('ExploreAdapter', () => {
4343
const definition = adapter.getToolDefinition();
4444

4545
expect(definition.name).toBe('dev_explore');
46-
expect(definition.description).toContain('semantic search');
46+
expect(definition.description).toContain('similar');
4747
expect(definition.inputSchema.required).toEqual(['action', 'query']);
48-
expect(definition.inputSchema.properties.action.enum).toEqual([
48+
expect(definition.inputSchema.properties?.action.enum).toEqual([
4949
'pattern',
5050
'similar',
5151
'relationships',

packages/mcp-server/src/adapters/__tests__/history-adapter.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ describe('HistoryAdapter', () => {
8585
const definition = adapter.getToolDefinition();
8686

8787
expect(definition.name).toBe('dev_history');
88-
expect(definition.description).toContain('git commit history');
88+
expect(definition.description).toContain('commits');
8989
expect(definition.inputSchema.properties).toHaveProperty('query');
9090
expect(definition.inputSchema.properties).toHaveProperty('file');
9191
expect(definition.inputSchema.properties).toHaveProperty('limit');

packages/mcp-server/src/adapters/__tests__/map-adapter.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ describe('MapAdapter', () => {
9191
const def = adapter.getToolDefinition();
9292

9393
expect(def.name).toBe('dev_map');
94-
expect(def.description).toContain('codebase structure');
94+
expect(def.description).toContain('structural overview');
9595
expect(def.inputSchema.type).toBe('object');
9696
expect(def.inputSchema.properties).toHaveProperty('depth');
9797
expect(def.inputSchema.properties).toHaveProperty('focus');

packages/mcp-server/src/adapters/__tests__/refs-adapter.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ describe('RefsAdapter', () => {
100100
const def = adapter.getToolDefinition();
101101

102102
expect(def.name).toBe('dev_refs');
103-
expect(def.description).toContain('call relationships');
103+
expect(def.description).toContain('calls');
104104
expect(def.inputSchema.type).toBe('object');
105105
expect(def.inputSchema.properties).toHaveProperty('name');
106106
expect(def.inputSchema.properties).toHaveProperty('direction');

packages/mcp-server/src/adapters/built-in/explore-adapter.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ export class ExploreAdapter extends ToolAdapter {
7272
return {
7373
name: 'dev_explore',
7474
description:
75-
'Explore code patterns and relationships using semantic search. Supports pattern search, similar code detection, and relationship mapping.',
75+
'After finding code with dev_search, use this for deeper analysis: "similar" finds other code that looks like a given file, ' +
76+
'"relationships" maps a file\'s imports and what depends on it. (Also has "pattern" which works like dev_search.)',
7677
inputSchema: {
7778
type: 'object',
7879
properties: {

packages/mcp-server/src/adapters/built-in/github-adapter.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,9 @@ export class GitHubAdapter extends ToolAdapter {
168168
return {
169169
name: 'dev_gh',
170170
description:
171-
'Search GitHub issues and pull requests using semantic search. Supports filtering by type, state, labels, and more.',
171+
'Search GitHub issues/PRs by MEANING, not just keywords - finds relevant issues even without exact terms. ' +
172+
'Actions: "search" (semantic query), "context" (full details for issue #), "related" (find similar issues). ' +
173+
'Use when exploring project history or finding past discussions about a topic.',
172174
inputSchema: {
173175
type: 'object',
174176
properties: {

packages/mcp-server/src/adapters/built-in/history-adapter.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ export class HistoryAdapter extends ToolAdapter {
7272
return {
7373
name: 'dev_history',
7474
description:
75-
'Search git commit history semantically or get history for a specific file. Use this to understand what changed and why.',
75+
'Understand WHY code looks the way it does. Search commits by concept ("auth refactor", "bug fix") or get file history. ' +
76+
'Use after finding code with dev_search to understand its evolution.',
7677
inputSchema: {
7778
type: 'object',
7879
properties: {

0 commit comments

Comments
 (0)