Skip to content

Commit a5ebe54

Browse files
committed
fix: @mcp-use/inspector back to mcp-use as an optional peer dependency
1 parent d27aff5 commit a5ebe54

File tree

3 files changed

+15
-8
lines changed

3 files changed

+15
-8
lines changed

packages/mcp-use/package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,17 @@
8888
"example:observability": "npm run build && node dist/examples/observability.js"
8989
},
9090
"peerDependencies": {
91+
"@mcp-use/inspector": "^0.1.0",
9192
"cors": "^2.8.5",
9293
"express": "^4.18.2",
9394
"langfuse": "^3.32.0",
9495
"langfuse-langchain": "^3.38.4",
9596
"react": "^18.0.0"
9697
},
9798
"peerDependenciesMeta": {
99+
"@mcp-use/inspector": {
100+
"optional": true
101+
},
98102
"cors": {
99103
"optional": true
100104
},

packages/mcp-use/src/server/mcp-server.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -316,21 +316,21 @@ export class McpServer {
316316
*/
317317
private mountInspector(): void {
318318
if (this.inspectorMounted) return
319-
320-
try {
321-
// Try to dynamically import the inspector package
322-
import('@mcp-use/inspector').then(({ mountInspector }) => {
319+
320+
// Try to dynamically import the inspector package
321+
// Using dynamic import makes it truly optional - won't fail if not installed
322+
import('@mcp-use/inspector')
323+
.then(({ mountInspector }) => {
323324
// Auto-connect to the local MCP server at /mcp
324325
const mcpServerUrl = `http://localhost:${this.serverPort}/mcp`
325326
mountInspector(this.app, '/inspector', mcpServerUrl)
326327
this.inspectorMounted = true
327-
}).catch(() => {
328+
console.log(`[INSPECTOR] UI available at http://localhost:${this.serverPort}/inspector`)
329+
})
330+
.catch(() => {
328331
// Inspector package not installed, skip mounting silently
329332
// This allows the server to work without the inspector in production
330333
})
331-
} catch {
332-
// Inspector not available, skip
333-
}
334334
}
335335

336336
/**

pnpm-lock.yaml

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)