atlas-pipeline-mcp 1.0.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 (64) hide show
  1. package/.env.example +21 -0
  2. package/LICENSE +21 -0
  3. package/README.md +175 -0
  4. package/dist/mcp.d.ts +21 -0
  5. package/dist/mcp.d.ts.map +1 -0
  6. package/dist/mcp.js +404 -0
  7. package/dist/mcp.js.map +1 -0
  8. package/dist/pipeline.d.ts +39 -0
  9. package/dist/pipeline.d.ts.map +1 -0
  10. package/dist/pipeline.js +355 -0
  11. package/dist/pipeline.js.map +1 -0
  12. package/dist/providers/index.d.ts +14 -0
  13. package/dist/providers/index.d.ts.map +1 -0
  14. package/dist/providers/index.js +13 -0
  15. package/dist/providers/index.js.map +1 -0
  16. package/dist/providers/llm-provider.d.ts +71 -0
  17. package/dist/providers/llm-provider.d.ts.map +1 -0
  18. package/dist/providers/llm-provider.js +357 -0
  19. package/dist/providers/llm-provider.js.map +1 -0
  20. package/dist/server.d.ts +27 -0
  21. package/dist/server.d.ts.map +1 -0
  22. package/dist/server.js +312 -0
  23. package/dist/server.js.map +1 -0
  24. package/dist/tools/context.d.ts +23 -0
  25. package/dist/tools/context.d.ts.map +1 -0
  26. package/dist/tools/context.js +363 -0
  27. package/dist/tools/context.js.map +1 -0
  28. package/dist/tools/critique.d.ts +40 -0
  29. package/dist/tools/critique.d.ts.map +1 -0
  30. package/dist/tools/critique.js +315 -0
  31. package/dist/tools/critique.js.map +1 -0
  32. package/dist/tools/decompose.d.ts +34 -0
  33. package/dist/tools/decompose.d.ts.map +1 -0
  34. package/dist/tools/decompose.js +328 -0
  35. package/dist/tools/decompose.js.map +1 -0
  36. package/dist/tools/git.d.ts +66 -0
  37. package/dist/tools/git.d.ts.map +1 -0
  38. package/dist/tools/git.js +333 -0
  39. package/dist/tools/git.js.map +1 -0
  40. package/dist/tools/intent.d.ts +24 -0
  41. package/dist/tools/intent.d.ts.map +1 -0
  42. package/dist/tools/intent.js +245 -0
  43. package/dist/tools/intent.js.map +1 -0
  44. package/dist/tools/ollama.d.ts +104 -0
  45. package/dist/tools/ollama.d.ts.map +1 -0
  46. package/dist/tools/ollama.js +299 -0
  47. package/dist/tools/ollama.js.map +1 -0
  48. package/dist/tools/optimize.d.ts +64 -0
  49. package/dist/tools/optimize.d.ts.map +1 -0
  50. package/dist/tools/optimize.js +302 -0
  51. package/dist/tools/optimize.js.map +1 -0
  52. package/dist/tools/variants.d.ts +49 -0
  53. package/dist/tools/variants.d.ts.map +1 -0
  54. package/dist/tools/variants.js +252 -0
  55. package/dist/tools/variants.js.map +1 -0
  56. package/dist/types.d.ts +447 -0
  57. package/dist/types.d.ts.map +1 -0
  58. package/dist/types.js +25 -0
  59. package/dist/types.js.map +1 -0
  60. package/dist/utils.d.ts +117 -0
  61. package/dist/utils.d.ts.map +1 -0
  62. package/dist/utils.js +279 -0
  63. package/dist/utils.js.map +1 -0
  64. package/package.json +77 -0
package/.env.example ADDED
@@ -0,0 +1,21 @@
1
+ # Atlas Server - Environment Configuration
2
+ # Copy this file to .env and configure for your environment
3
+
4
+ # Server Configuration
5
+ PORT=3000
6
+ HOST=0.0.0.0
7
+ LOG_LEVEL=info
8
+
9
+ # Ollama Configuration
10
+ OLLAMA_BASE_URL=http://localhost:11434
11
+
12
+ # Model Configuration (optional)
13
+ # Leave empty to auto-detect the first available model from your Ollama installation
14
+ # Or specify a model you have installed: mistral, llama3.2, codellama, deepseek-r1, etc.
15
+ OLLAMA_MODEL=
16
+
17
+ OLLAMA_TIMEOUT_MS=120000
18
+ OLLAMA_MAX_RETRIES=3
19
+
20
+ # CORS Configuration
21
+ CORS_ENABLED=true
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Nishant (IamNishant51)
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,175 @@
1
+ # Atlas MCP Server
2
+
3
+ A powerful Model Context Protocol (MCP) server featuring a multi-stage AI pipeline for intelligent code generation. Works with **any LLM provider** (Ollama, OpenAI, Anthropic) and **any MCP-compatible IDE** (Cursor, GitHub Copilot, Claude Desktop, Windsurf, and more).
4
+
5
+ ## 🚀 Features
6
+
7
+ - **7-Stage AI Pipeline**: Intent → Context → Git → Decompose → Variants → Critique → Optimize
8
+ - **Multi-Provider Support**: Automatically detects and uses Ollama, OpenAI, or Anthropic
9
+ - **IDE Agnostic**: Works with any MCP-compatible editor
10
+ - **Git Integration**: Analyzes repository history for context-aware code generation
11
+ - **Quality Assurance**: Built-in critique and optimization stages
12
+
13
+ ## 📦 Installation
14
+
15
+ ### From GitHub (Recommended)
16
+
17
+ ```bash
18
+ # Clone the repository
19
+ git clone https://github.com/IamNishant51/atlas-mcp-server.git
20
+ cd atlas-mcp-server
21
+
22
+ # Install dependencies
23
+ npm install
24
+
25
+ # Build
26
+ npm run build
27
+ ```
28
+
29
+ ### From npm (Coming Soon)
30
+
31
+ ```bash
32
+ npm install -g atlas-mcp-server
33
+ ```
34
+
35
+ ## ⚙️ Configuration
36
+
37
+ ### Environment Variables
38
+
39
+ Create a `.env` file or set environment variables:
40
+
41
+ ```bash
42
+ # For Ollama (local, free)
43
+ OLLAMA_BASE_URL=http://localhost:11434
44
+
45
+ # For OpenAI
46
+ OPENAI_API_KEY=your-openai-key
47
+
48
+ # For Anthropic
49
+ ANTHROPIC_API_KEY=your-anthropic-key
50
+ ```
51
+
52
+ The server auto-detects available providers in this order: Anthropic → OpenAI → Ollama
53
+
54
+ ### IDE Configuration
55
+
56
+ #### Claude Desktop
57
+
58
+ Add to `claude_desktop_config.json`:
59
+
60
+ ```json
61
+ {
62
+ "mcpServers": {
63
+ "atlas": {
64
+ "command": "node",
65
+ "args": ["/path/to/atlas-mcp-server/dist/mcp.js"]
66
+ }
67
+ }
68
+ }
69
+ ```
70
+
71
+ #### Cursor
72
+
73
+ Add to `.cursor/mcp.json`:
74
+
75
+ ```json
76
+ {
77
+ "mcpServers": {
78
+ "atlas": {
79
+ "command": "node",
80
+ "args": ["/path/to/atlas-mcp-server/dist/mcp.js"]
81
+ }
82
+ }
83
+ }
84
+ ```
85
+
86
+ #### VS Code with GitHub Copilot
87
+
88
+ Add to `.vscode/mcp.json`:
89
+
90
+ ```json
91
+ {
92
+ "servers": {
93
+ "atlas": {
94
+ "command": "node",
95
+ "args": ["/path/to/atlas-mcp-server/dist/mcp.js"]
96
+ }
97
+ }
98
+ }
99
+ ```
100
+
101
+ #### Windsurf
102
+
103
+ Add to `~/.windsurf/mcp.json`:
104
+
105
+ ```json
106
+ {
107
+ "mcpServers": {
108
+ "atlas": {
109
+ "command": "node",
110
+ "args": ["/path/to/atlas-mcp-server/dist/mcp.js"]
111
+ }
112
+ }
113
+ }
114
+ ```
115
+
116
+ ## 🛠️ Available Tools
117
+
118
+ | Tool | Description |
119
+ |------|-------------|
120
+ | `atlas_intent` | Analyze user intent and extract requirements |
121
+ | `atlas_context` | Gather project context (files, dependencies, patterns) |
122
+ | `atlas_git` | Analyze git history for coding patterns |
123
+ | `atlas_decompose` | Break down tasks into subtasks |
124
+ | `atlas_variants` | Generate multiple code implementation variants |
125
+ | `atlas_critique` | Evaluate code quality and provide feedback |
126
+ | `atlas_optimize` | Optimize code based on critique feedback |
127
+ | `atlas_pipeline` | Run the complete 7-stage pipeline |
128
+ | `atlas_providers` | List available LLM providers |
129
+
130
+ ## 📊 Pipeline Stages
131
+
132
+ 1. **Intent** - Understands what you want to build
133
+ 2. **Context** - Gathers project structure, dependencies, and patterns
134
+ 3. **Git** - Analyzes commit history for coding conventions
135
+ 4. **Decompose** - Breaks complex tasks into manageable subtasks
136
+ 5. **Variants** - Generates multiple implementation approaches
137
+ 6. **Critique** - Evaluates each variant for quality and correctness
138
+ 7. **Optimize** - Refines the best variant based on feedback
139
+
140
+ ## 🏃 Running
141
+
142
+ ### MCP Mode (for IDEs)
143
+
144
+ ```bash
145
+ npm run start:mcp
146
+ # or
147
+ node dist/mcp.js
148
+ ```
149
+
150
+ ### HTTP Server Mode
151
+
152
+ ```bash
153
+ npm start
154
+ # or
155
+ node dist/server.js
156
+ ```
157
+
158
+ The HTTP server runs on port 3000 with these endpoints:
159
+ - `GET /health` - Health check
160
+ - `GET /api/info` - Server information
161
+ - `GET /api/models` - Available LLM models
162
+ - `POST /api/pipeline` - Run the full pipeline
163
+
164
+ ## 🤝 Contributing
165
+
166
+ Contributions are welcome! Please feel free to submit issues and pull requests.
167
+
168
+ ## 📄 License
169
+
170
+ MIT License - see [LICENSE](LICENSE) for details.
171
+
172
+ ## 🔗 Links
173
+
174
+ - **GitHub**: https://github.com/IamNishant51/atlas-mcp-server
175
+ - **MCP Protocol**: https://modelcontextprotocol.io
package/dist/mcp.d.ts ADDED
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Atlas MCP Server - Model Context Protocol Implementation
4
+ *
5
+ * This server exposes Atlas tools via the MCP protocol for IDE integration.
6
+ * Compatible with: Cursor, GitHub Copilot, Claude Desktop, Windsurf, etc.
7
+ *
8
+ * Usage:
9
+ * npx atlas-mcp-server
10
+ * # or
11
+ * npm run start:mcp
12
+ *
13
+ * Environment Variables:
14
+ * LLM_PROVIDER=auto|ollama|openai|anthropic
15
+ * OLLAMA_BASE_URL=http://localhost:11434
16
+ * OLLAMA_MODEL=auto (or specific model name)
17
+ * OPENAI_API_KEY=sk-...
18
+ * ANTHROPIC_API_KEY=sk-ant-...
19
+ */
20
+ import 'dotenv/config';
21
+ //# sourceMappingURL=mcp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../src/mcp.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,eAAe,CAAC"}
package/dist/mcp.js ADDED
@@ -0,0 +1,404 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Atlas MCP Server - Model Context Protocol Implementation
4
+ *
5
+ * This server exposes Atlas tools via the MCP protocol for IDE integration.
6
+ * Compatible with: Cursor, GitHub Copilot, Claude Desktop, Windsurf, etc.
7
+ *
8
+ * Usage:
9
+ * npx atlas-mcp-server
10
+ * # or
11
+ * npm run start:mcp
12
+ *
13
+ * Environment Variables:
14
+ * LLM_PROVIDER=auto|ollama|openai|anthropic
15
+ * OLLAMA_BASE_URL=http://localhost:11434
16
+ * OLLAMA_MODEL=auto (or specific model name)
17
+ * OPENAI_API_KEY=sk-...
18
+ * ANTHROPIC_API_KEY=sk-ant-...
19
+ */
20
+ import 'dotenv/config';
21
+ import { Server } from '@modelcontextprotocol/sdk/server/index.js';
22
+ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
23
+ import { CallToolRequestSchema, ListToolsRequestSchema, ErrorCode, McpError, } from '@modelcontextprotocol/sdk/types.js';
24
+ import { z } from 'zod';
25
+ import { logger, createTimer, safeStringify } from './utils.js';
26
+ import { getActiveProvider, checkProviders } from './providers/index.js';
27
+ import { analyzeIntent } from './tools/intent.js';
28
+ import { buildContext, analyzeProject } from './tools/context.js';
29
+ import { getGitContext } from './tools/git.js';
30
+ import { decomposeTask } from './tools/decompose.js';
31
+ import { generateVariants } from './tools/variants.js';
32
+ import { critiqueVariants } from './tools/critique.js';
33
+ import { optimizeVariant } from './tools/optimize.js';
34
+ import { executePipeline } from './pipeline.js';
35
+ // ============================================================================
36
+ // Tool Definitions
37
+ // ============================================================================
38
+ const TOOLS = [
39
+ {
40
+ name: 'atlas_intent',
41
+ description: 'Analyze user intent from a natural language request. Extracts action type, target, context, and constraints.',
42
+ inputSchema: {
43
+ type: 'object',
44
+ properties: {
45
+ message: { type: 'string', description: 'The user message to analyze' },
46
+ conversationHistory: {
47
+ type: 'array',
48
+ items: {
49
+ type: 'object',
50
+ properties: {
51
+ role: { type: 'string', enum: ['user', 'assistant'] },
52
+ content: { type: 'string' },
53
+ },
54
+ },
55
+ description: 'Optional conversation history for context',
56
+ },
57
+ },
58
+ required: ['message'],
59
+ },
60
+ },
61
+ {
62
+ name: 'atlas_context',
63
+ description: 'Gather context about a project or codebase. Analyzes files, dependencies, and project structure.',
64
+ inputSchema: {
65
+ type: 'object',
66
+ properties: {
67
+ projectPath: { type: 'string', description: 'Path to the project root' },
68
+ filePaths: {
69
+ type: 'array',
70
+ items: { type: 'string' },
71
+ description: 'Specific files to analyze',
72
+ },
73
+ query: { type: 'string', description: 'What context to focus on' },
74
+ },
75
+ required: ['projectPath'],
76
+ },
77
+ },
78
+ {
79
+ name: 'atlas_git',
80
+ description: 'Analyze Git history and repository state. Returns recent commits, active branches, and file change history.',
81
+ inputSchema: {
82
+ type: 'object',
83
+ properties: {
84
+ repoPath: { type: 'string', description: 'Path to the Git repository' },
85
+ maxCommits: { type: 'number', description: 'Maximum commits to analyze (default: 50)' },
86
+ filePath: { type: 'string', description: 'Specific file to get history for' },
87
+ },
88
+ required: ['repoPath'],
89
+ },
90
+ },
91
+ {
92
+ name: 'atlas_decompose',
93
+ description: 'Break down a complex task into smaller subtasks with dependencies. Creates a DAG of work items.',
94
+ inputSchema: {
95
+ type: 'object',
96
+ properties: {
97
+ task: { type: 'string', description: 'The task description to decompose' },
98
+ context: { type: 'string', description: 'Additional context about the codebase' },
99
+ maxDepth: { type: 'number', description: 'Maximum decomposition depth (default: 3)' },
100
+ },
101
+ required: ['task'],
102
+ },
103
+ },
104
+ {
105
+ name: 'atlas_variants',
106
+ description: 'Generate multiple solution variants for a coding task. Returns different approaches with pros/cons.',
107
+ inputSchema: {
108
+ type: 'object',
109
+ properties: {
110
+ task: { type: 'string', description: 'The coding task description' },
111
+ context: { type: 'string', description: 'Code context and constraints' },
112
+ numVariants: { type: 'number', description: 'Number of variants to generate (default: 3)' },
113
+ language: { type: 'string', description: 'Programming language' },
114
+ },
115
+ required: ['task'],
116
+ },
117
+ },
118
+ {
119
+ name: 'atlas_critique',
120
+ description: 'Review and critique code for quality, security, and best practices. Returns detailed feedback and scores.',
121
+ inputSchema: {
122
+ type: 'object',
123
+ properties: {
124
+ code: { type: 'string', description: 'The code to review' },
125
+ language: { type: 'string', description: 'Programming language' },
126
+ focus: {
127
+ type: 'array',
128
+ items: { type: 'string' },
129
+ description: 'Areas to focus on: security, performance, readability, maintainability',
130
+ },
131
+ },
132
+ required: ['code'],
133
+ },
134
+ },
135
+ {
136
+ name: 'atlas_optimize',
137
+ description: 'Optimize code based on critique feedback. Applies improvements while maintaining functionality.',
138
+ inputSchema: {
139
+ type: 'object',
140
+ properties: {
141
+ code: { type: 'string', description: 'The code to optimize' },
142
+ critique: { type: 'string', description: 'Critique feedback to address' },
143
+ language: { type: 'string', description: 'Programming language' },
144
+ preserveApi: { type: 'boolean', description: 'Whether to preserve the public API' },
145
+ },
146
+ required: ['code'],
147
+ },
148
+ },
149
+ {
150
+ name: 'atlas_pipeline',
151
+ description: 'Run the full Atlas pipeline: Intent → Context → Git → Decompose → Variants → Critique → Optimize',
152
+ inputSchema: {
153
+ type: 'object',
154
+ properties: {
155
+ message: { type: 'string', description: 'The user request' },
156
+ projectPath: { type: 'string', description: 'Path to the project' },
157
+ options: {
158
+ type: 'object',
159
+ properties: {
160
+ skipGit: { type: 'boolean' },
161
+ numVariants: { type: 'number' },
162
+ maxDecomposeDepth: { type: 'number' },
163
+ },
164
+ },
165
+ },
166
+ required: ['message', 'projectPath'],
167
+ },
168
+ },
169
+ {
170
+ name: 'atlas_providers',
171
+ description: 'Check available LLM providers and their status.',
172
+ inputSchema: {
173
+ type: 'object',
174
+ properties: {},
175
+ required: [],
176
+ },
177
+ },
178
+ ];
179
+ // ============================================================================
180
+ // Helper Functions for MCP Tool Adapters
181
+ // ============================================================================
182
+ /**
183
+ * Build a minimal PipelineContext from MCP tool inputs
184
+ */
185
+ async function buildMinimalContext(query, repoPath, additionalContext) {
186
+ // Analyze intent from the query
187
+ const intent = await analyzeIntent(query);
188
+ // Get project info if path provided
189
+ let projectInfo = undefined;
190
+ let codeSnippets = [];
191
+ if (repoPath) {
192
+ try {
193
+ projectInfo = await analyzeProject(repoPath);
194
+ }
195
+ catch {
196
+ // Project analysis failed, continue without it
197
+ }
198
+ }
199
+ // Add additional context as a code snippet if provided
200
+ if (additionalContext) {
201
+ codeSnippets.push({
202
+ content: additionalContext,
203
+ filePath: 'context',
204
+ language: 'text',
205
+ lineRange: { start: 1, end: 1 },
206
+ relevance: 1.0,
207
+ });
208
+ }
209
+ return {
210
+ intent,
211
+ codeSnippets,
212
+ projectInfo,
213
+ gitContext: undefined,
214
+ };
215
+ }
216
+ /**
217
+ * Create a SolutionVariant from user-provided code
218
+ */
219
+ function createVariantFromCode(code, language) {
220
+ return {
221
+ id: 'user-input',
222
+ label: 'A',
223
+ content: code,
224
+ approach: 'User-provided code',
225
+ tradeoffs: {
226
+ pros: ['Direct user input'],
227
+ cons: ['May need optimization'],
228
+ },
229
+ useCase: 'User-provided code for analysis',
230
+ };
231
+ }
232
+ /**
233
+ * Create a Critique structure from user feedback
234
+ */
235
+ function createCritiqueFromFeedback(variantId, feedback) {
236
+ return {
237
+ variantId,
238
+ qualityScore: 50,
239
+ assessment: {
240
+ correctness: 50,
241
+ performance: 50,
242
+ maintainability: 50,
243
+ security: 50,
244
+ bestPractices: 50,
245
+ },
246
+ issues: feedback
247
+ ? [{
248
+ severity: 'major',
249
+ category: 'correctness',
250
+ description: feedback,
251
+ }]
252
+ : [],
253
+ suggestions: feedback ? [feedback] : [],
254
+ isViable: true,
255
+ };
256
+ }
257
+ // ============================================================================
258
+ // Tool Handlers
259
+ // ============================================================================
260
+ async function handleTool(name, args) {
261
+ const timer = createTimer();
262
+ logger.info({ tool: name, args }, 'MCP tool invoked');
263
+ try {
264
+ switch (name) {
265
+ case 'atlas_intent': {
266
+ const message = z.string().parse(args['message']);
267
+ // analyzeIntent takes just the query string
268
+ const result = await analyzeIntent(message);
269
+ return result;
270
+ }
271
+ case 'atlas_context': {
272
+ const projectPath = z.string().parse(args['projectPath']);
273
+ const query = args['query'];
274
+ // First analyze intent, then build context
275
+ const intent = await analyzeIntent(query ?? 'analyze project context');
276
+ const gitContext = await getGitContext(projectPath);
277
+ const result = await buildContext(intent, projectPath, gitContext ?? undefined);
278
+ return result;
279
+ }
280
+ case 'atlas_git': {
281
+ const repoPath = z.string().parse(args['repoPath']);
282
+ const maxCommits = args['maxCommits'] ?? 50;
283
+ // getGitContext takes repoPath and commitLimit number
284
+ const result = await getGitContext(repoPath, maxCommits);
285
+ return result;
286
+ }
287
+ case 'atlas_decompose': {
288
+ const task = z.string().parse(args['task']);
289
+ const contextStr = args['context'];
290
+ // Build minimal context for decomposeTask
291
+ const context = await buildMinimalContext(task, undefined, contextStr);
292
+ const result = await decomposeTask(context);
293
+ return result;
294
+ }
295
+ case 'atlas_variants': {
296
+ const task = z.string().parse(args['task']);
297
+ const contextStr = args['context'];
298
+ const numVariants = args['numVariants'] ?? 3;
299
+ // Build context and decomposition for generateVariants
300
+ const context = await buildMinimalContext(task, undefined, contextStr);
301
+ const decomposition = await decomposeTask(context);
302
+ const result = await generateVariants(context, decomposition, numVariants);
303
+ return result;
304
+ }
305
+ case 'atlas_critique': {
306
+ const code = z.string().parse(args['code']);
307
+ const language = args['language'];
308
+ // Build a proper SolutionVariant structure for critiqueVariants
309
+ const variants = [createVariantFromCode(code, language)];
310
+ const result = await critiqueVariants(variants);
311
+ return result;
312
+ }
313
+ case 'atlas_optimize': {
314
+ const code = z.string().parse(args['code']);
315
+ const critiqueStr = args['critique'];
316
+ const language = args['language'];
317
+ // Build proper structures for optimizeVariant
318
+ const variant = createVariantFromCode(code, language);
319
+ const critique = createCritiqueFromFeedback(variant.id, critiqueStr);
320
+ const result = await optimizeVariant(variant, critique);
321
+ return result;
322
+ }
323
+ case 'atlas_pipeline': {
324
+ const message = z.string().parse(args['message']);
325
+ const projectPath = z.string().parse(args['projectPath']);
326
+ // executePipeline takes a PipelineRequest with repoPath (not projectPath)
327
+ const result = await executePipeline({
328
+ query: message,
329
+ repoPath: projectPath,
330
+ });
331
+ return result;
332
+ }
333
+ case 'atlas_providers': {
334
+ const status = await checkProviders();
335
+ const provider = await getActiveProvider();
336
+ return {
337
+ ...status,
338
+ currentProvider: provider.type,
339
+ currentModel: provider.model,
340
+ };
341
+ }
342
+ default:
343
+ throw new McpError(ErrorCode.MethodNotFound, `Unknown tool: ${name}`);
344
+ }
345
+ }
346
+ finally {
347
+ logger.info({ tool: name, durationMs: timer.elapsed() }, 'MCP tool completed');
348
+ }
349
+ }
350
+ // ============================================================================
351
+ // MCP Server Setup
352
+ // ============================================================================
353
+ async function main() {
354
+ const server = new Server({
355
+ name: 'atlas-mcp-server',
356
+ version: '1.0.0',
357
+ }, {
358
+ capabilities: {
359
+ tools: {},
360
+ },
361
+ });
362
+ // List available tools
363
+ server.setRequestHandler(ListToolsRequestSchema, async () => {
364
+ return { tools: TOOLS };
365
+ });
366
+ // Handle tool calls
367
+ server.setRequestHandler(CallToolRequestSchema, async (request) => {
368
+ const { name, arguments: args } = request.params;
369
+ try {
370
+ const result = await handleTool(name, (args ?? {}));
371
+ return {
372
+ content: [
373
+ {
374
+ type: 'text',
375
+ text: typeof result === 'string' ? result : safeStringify(result),
376
+ },
377
+ ],
378
+ };
379
+ }
380
+ catch (error) {
381
+ if (error instanceof McpError)
382
+ throw error;
383
+ const message = error instanceof Error ? error.message : 'Unknown error';
384
+ throw new McpError(ErrorCode.InternalError, message);
385
+ }
386
+ });
387
+ // Initialize provider before starting
388
+ try {
389
+ const provider = await getActiveProvider();
390
+ logger.info({ provider: provider.type, model: provider.model }, 'LLM provider initialized');
391
+ }
392
+ catch (error) {
393
+ logger.warn({ error }, 'No LLM provider available - some tools may fail');
394
+ }
395
+ // Start the server with stdio transport
396
+ const transport = new StdioServerTransport();
397
+ await server.connect(transport);
398
+ logger.info('Atlas MCP Server started (stdio transport)');
399
+ }
400
+ main().catch((error) => {
401
+ logger.error({ error }, 'Failed to start Atlas MCP Server');
402
+ process.exit(1);
403
+ });
404
+ //# sourceMappingURL=mcp.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp.js","sourceRoot":"","sources":["../src/mcp.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,eAAe,CAAC;AACvB,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,SAAS,EACT,QAAQ,GACT,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAClE,OAAO,EAAE,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