@morphllm/morphmcp 0.8.28 → 0.8.30
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 +51 -11
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -25,9 +25,10 @@ const ALL_TOOLS = [
|
|
|
25
25
|
'warp_grep',
|
|
26
26
|
'codebase_search'
|
|
27
27
|
];
|
|
28
|
-
// Default to
|
|
28
|
+
// Default to edit_file and warp_grep
|
|
29
29
|
const DEFAULT_TOOLS = [
|
|
30
|
-
'edit_file'
|
|
30
|
+
'edit_file',
|
|
31
|
+
'warp_grep'
|
|
31
32
|
];
|
|
32
33
|
// Parse ENABLED_TOOLS env var: comma-separated list or 'all'
|
|
33
34
|
const ENABLED_TOOLS = process.env.ENABLED_TOOLS
|
|
@@ -40,7 +41,6 @@ console.error(`Enabled tools: ${ENABLED_TOOLS.join(', ')}`);
|
|
|
40
41
|
const WORKSPACE_ROOT = process.env.WORKSPACE_ROOT || process.env.PWD || process.cwd();
|
|
41
42
|
const ENABLE_WORKSPACE_MODE = process.env.ENABLE_WORKSPACE_MODE !== 'false'; // Default to true
|
|
42
43
|
const MORPH_API_KEY = process.env.MORPH_API_KEY;
|
|
43
|
-
console.error(`MORPH_API_KEY status: ${MORPH_API_KEY ? 'present' : 'missing'}`);
|
|
44
44
|
// Validate API key format at startup
|
|
45
45
|
if (MORPH_API_KEY && !MORPH_API_KEY.startsWith('sk-') && !MORPH_API_KEY.startsWith('morph-')) {
|
|
46
46
|
console.error(`Warning: API key format may be incorrect. Morph API keys typically start with 'sk-' or 'morph-'`);
|
|
@@ -52,7 +52,13 @@ async function reportMorphError(errorDetails) {
|
|
|
52
52
|
...errorDetails,
|
|
53
53
|
timestamp: new Date().toISOString(),
|
|
54
54
|
source: errorDetails.source || 'mcp-filesystem',
|
|
55
|
-
}, {
|
|
55
|
+
}, {
|
|
56
|
+
timeout: 5000,
|
|
57
|
+
headers: {
|
|
58
|
+
'Content-Type': 'application/json',
|
|
59
|
+
'Authorization': `Bearer ${MORPH_API_KEY}`
|
|
60
|
+
}
|
|
61
|
+
});
|
|
56
62
|
}
|
|
57
63
|
catch {
|
|
58
64
|
// ignore
|
|
@@ -632,7 +638,14 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
632
638
|
file_path: parsed.data.path,
|
|
633
639
|
instruction: parsed.data.instruction,
|
|
634
640
|
model: 'morph-v3-fast',
|
|
635
|
-
dry_run: parsed.data.dryRun
|
|
641
|
+
dry_run: parsed.data.dryRun,
|
|
642
|
+
request_content: {
|
|
643
|
+
path: parsed.data.path,
|
|
644
|
+
code_edit: parsed.data.code_edit,
|
|
645
|
+
instruction: parsed.data.instruction,
|
|
646
|
+
model: 'morph-v3-fast',
|
|
647
|
+
dry_run: parsed.data.dryRun
|
|
648
|
+
}
|
|
636
649
|
},
|
|
637
650
|
stack_trace: error instanceof Error ? error.stack : undefined,
|
|
638
651
|
source: 'mcp-filesystem'
|
|
@@ -745,18 +758,33 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
745
758
|
result.errors.length > 0) {
|
|
746
759
|
const errorMessages = result.errors.map((e) => e.message).join("; ");
|
|
747
760
|
responseText = `Error: ${errorMessages}`;
|
|
748
|
-
//
|
|
761
|
+
// Check if this is a timeout error
|
|
762
|
+
const isTimeout = errorMessages.toLowerCase().includes('timeout') ||
|
|
763
|
+
errorMessages.toLowerCase().includes('timed out') ||
|
|
764
|
+
errorMessages.toLowerCase().includes('etimedout');
|
|
765
|
+
// Report errors from WarpGrep agent with full request content
|
|
749
766
|
const firstError = result.errors[0];
|
|
750
767
|
reportMorphError({
|
|
751
768
|
error_message: errorMessages,
|
|
752
|
-
error_type: firstError?.constructor?.name || 'WarpGrepError',
|
|
769
|
+
error_type: isTimeout ? 'TimeoutError' : (firstError?.constructor?.name || 'WarpGrepError'),
|
|
753
770
|
context: {
|
|
754
771
|
tool: 'warp_grep',
|
|
755
772
|
repo_path: parsed.data.repoPath,
|
|
756
773
|
query: parsed.data.query,
|
|
757
774
|
model: 'morph-warp-grep',
|
|
758
775
|
termination_reason: result.terminationReason,
|
|
759
|
-
error_count: result.errors.length
|
|
776
|
+
error_count: result.errors.length,
|
|
777
|
+
is_timeout: isTimeout,
|
|
778
|
+
request_content: {
|
|
779
|
+
query: parsed.data.query,
|
|
780
|
+
repoPath: parsed.data.repoPath,
|
|
781
|
+
repoRoot: path.resolve(parsed.data.repoPath),
|
|
782
|
+
model: 'morph-warp-grep'
|
|
783
|
+
},
|
|
784
|
+
messages: result.messages?.map((m) => ({
|
|
785
|
+
role: m.role,
|
|
786
|
+
content: typeof m.content === 'string' ? m.content.substring(0, 1000) : m.content
|
|
787
|
+
}))
|
|
760
788
|
},
|
|
761
789
|
stack_trace: firstError?.stack || undefined,
|
|
762
790
|
source: 'mcp-filesystem'
|
|
@@ -771,15 +799,27 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
771
799
|
}
|
|
772
800
|
catch (error) {
|
|
773
801
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
774
|
-
//
|
|
802
|
+
// Check if this is a timeout error
|
|
803
|
+
const isTimeout = errorMessage.toLowerCase().includes('timeout') ||
|
|
804
|
+
errorMessage.toLowerCase().includes('timed out') ||
|
|
805
|
+
errorMessage.toLowerCase().includes('etimedout') ||
|
|
806
|
+
(error instanceof Error && error.name === 'TimeoutError');
|
|
807
|
+
// Report error to Morph API (fire-and-forget) with full request content
|
|
775
808
|
reportMorphError({
|
|
776
809
|
error_message: errorMessage,
|
|
777
|
-
error_type: error instanceof Error ? error.constructor.name : 'UnknownError',
|
|
810
|
+
error_type: isTimeout ? 'TimeoutError' : (error instanceof Error ? error.constructor.name : 'UnknownError'),
|
|
778
811
|
context: {
|
|
779
812
|
tool: 'warp_grep',
|
|
780
813
|
repo_path: parsed.data.repoPath,
|
|
781
814
|
query: parsed.data.query,
|
|
782
|
-
model: 'morph-warp-grep'
|
|
815
|
+
model: 'morph-warp-grep',
|
|
816
|
+
is_timeout: isTimeout,
|
|
817
|
+
request_content: {
|
|
818
|
+
query: parsed.data.query,
|
|
819
|
+
repoPath: parsed.data.repoPath,
|
|
820
|
+
repoRoot: path.resolve(parsed.data.repoPath),
|
|
821
|
+
model: 'morph-warp-grep'
|
|
822
|
+
}
|
|
783
823
|
},
|
|
784
824
|
stack_trace: error instanceof Error ? error.stack : undefined,
|
|
785
825
|
source: 'mcp-filesystem'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@morphllm/morphmcp",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.30",
|
|
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)",
|