@morphllm/morphmcp 0.8.32 → 0.8.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +21 -22
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
3
3
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
|
-
import { CallToolRequestSchema, ListToolsRequestSchema,
|
|
4
|
+
import { CallToolRequestSchema, ListToolsRequestSchema, RootsListChangedNotificationSchema, } from "@modelcontextprotocol/sdk/types.js";
|
|
5
5
|
import fs from "fs/promises";
|
|
6
6
|
import path from "path";
|
|
7
7
|
import os from 'os';
|
|
@@ -234,8 +234,8 @@ const MorphEditFileArgsSchema = z.object({
|
|
|
234
234
|
dryRun: z.boolean().default(false).describe('Preview changes without applying them.')
|
|
235
235
|
});
|
|
236
236
|
const WarpGrepArgsSchema = z.object({
|
|
237
|
-
|
|
238
|
-
|
|
237
|
+
repo_path: z.string().describe("Path to the repository root"),
|
|
238
|
+
search_string: z.string().describe("Natural language query describing the code context needed"),
|
|
239
239
|
});
|
|
240
240
|
const CodebaseSearchArgsSchema = z.object({
|
|
241
241
|
query: z.string().describe('Natural language query to search for code'),
|
|
@@ -245,7 +245,6 @@ const CodebaseSearchArgsSchema = z.object({
|
|
|
245
245
|
target_directories: z.array(z.string()).default([]).describe('Filter to specific directories, empty for all'),
|
|
246
246
|
limit: z.number().optional().default(10).describe('Max results to return')
|
|
247
247
|
});
|
|
248
|
-
const ToolInputSchema = ToolSchema.shape.inputSchema;
|
|
249
248
|
// Server setup
|
|
250
249
|
const server = new Server({
|
|
251
250
|
name: "morph-mcp",
|
|
@@ -658,10 +657,10 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
658
657
|
};
|
|
659
658
|
}
|
|
660
659
|
try {
|
|
661
|
-
const repoRoot = path.resolve(parsed.data.
|
|
660
|
+
const repoRoot = path.resolve(parsed.data.repo_path);
|
|
662
661
|
const provider = new LocalRipgrepProvider(repoRoot);
|
|
663
662
|
const result = await runWarpGrep({
|
|
664
|
-
query: parsed.data.
|
|
663
|
+
query: parsed.data.search_string,
|
|
665
664
|
repoRoot,
|
|
666
665
|
model: "morph-warp-grep",
|
|
667
666
|
apiKey: MORPH_API_KEY,
|
|
@@ -720,7 +719,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
720
719
|
// 4. XML formatted file contents
|
|
721
720
|
const xmlBlocks = [];
|
|
722
721
|
for (const file of files) {
|
|
723
|
-
const filePath = path.resolve(parsed.data.
|
|
722
|
+
const filePath = path.resolve(parsed.data.repo_path, file.path);
|
|
724
723
|
try {
|
|
725
724
|
const content = await fs.readFile(filePath, { encoding: "utf-8" });
|
|
726
725
|
const lines = content.split(/\r?\n/);
|
|
@@ -753,16 +752,16 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
753
752
|
error_type: 'FileReadError',
|
|
754
753
|
context: {
|
|
755
754
|
tool: 'warpgrep_codebase_search',
|
|
756
|
-
repo_path: parsed.data.
|
|
757
|
-
query: parsed.data.
|
|
755
|
+
repo_path: parsed.data.repo_path,
|
|
756
|
+
query: parsed.data.search_string,
|
|
758
757
|
model: 'morph-warp-grep',
|
|
759
758
|
termination_reason: 'completed_with_file_errors',
|
|
760
759
|
error_count: fileReadErrors.length,
|
|
761
760
|
is_timeout: false,
|
|
762
761
|
request_content: {
|
|
763
|
-
query: parsed.data.
|
|
764
|
-
|
|
765
|
-
repoRoot: path.resolve(parsed.data.
|
|
762
|
+
query: parsed.data.search_string,
|
|
763
|
+
repo_path: parsed.data.repo_path,
|
|
764
|
+
repoRoot: path.resolve(parsed.data.repo_path),
|
|
766
765
|
model: 'morph-warp-grep'
|
|
767
766
|
},
|
|
768
767
|
files_requested: files.map((f) => f.path)
|
|
@@ -786,16 +785,16 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
786
785
|
error_type: isTimeout ? 'TimeoutError' : (firstError?.constructor?.name || 'WarpGrepError'),
|
|
787
786
|
context: {
|
|
788
787
|
tool: 'warpgrep_codebase_search',
|
|
789
|
-
repo_path: parsed.data.
|
|
790
|
-
query: parsed.data.
|
|
788
|
+
repo_path: parsed.data.repo_path,
|
|
789
|
+
query: parsed.data.search_string,
|
|
791
790
|
model: 'morph-warp-grep',
|
|
792
791
|
termination_reason: result.terminationReason,
|
|
793
792
|
error_count: result.errors.length,
|
|
794
793
|
is_timeout: isTimeout,
|
|
795
794
|
request_content: {
|
|
796
|
-
query: parsed.data.
|
|
797
|
-
|
|
798
|
-
repoRoot: path.resolve(parsed.data.
|
|
795
|
+
query: parsed.data.search_string,
|
|
796
|
+
repo_path: parsed.data.repo_path,
|
|
797
|
+
repoRoot: path.resolve(parsed.data.repo_path),
|
|
799
798
|
model: 'morph-warp-grep'
|
|
800
799
|
},
|
|
801
800
|
messages: result.messages?.map((m) => ({
|
|
@@ -827,14 +826,14 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
827
826
|
error_type: isTimeout ? 'TimeoutError' : (error instanceof Error ? error.constructor.name : 'UnknownError'),
|
|
828
827
|
context: {
|
|
829
828
|
tool: 'warpgrep_codebase_search',
|
|
830
|
-
repo_path: parsed.data.
|
|
831
|
-
query: parsed.data.
|
|
829
|
+
repo_path: parsed.data.repo_path,
|
|
830
|
+
query: parsed.data.search_string,
|
|
832
831
|
model: 'morph-warp-grep',
|
|
833
832
|
is_timeout: isTimeout,
|
|
834
833
|
request_content: {
|
|
835
|
-
query: parsed.data.
|
|
836
|
-
|
|
837
|
-
repoRoot: path.resolve(parsed.data.
|
|
834
|
+
query: parsed.data.search_string,
|
|
835
|
+
repo_path: parsed.data.repo_path,
|
|
836
|
+
repoRoot: path.resolve(parsed.data.repo_path),
|
|
838
837
|
model: 'morph-warp-grep'
|
|
839
838
|
}
|
|
840
839
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@morphllm/morphmcp",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.33",
|
|
4
4
|
"description": "Fast & accurate MCP server with AI-powered file editing and intelligent code search. Prevents context pollution and saves time for a better user experience.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Morph (https://morphllm.com)",
|