Skip to content
This repository was archived by the owner on May 21, 2026. It is now read-only.

Commit 032499e

Browse files
committed
feat(inspector): enhance MCP Inspector with new features and improvements
- Add support for new dependencies including @hono/node-server and @modelcontextprotocol/sdk - Implement OAuth authentication flow handling in the main application - Update README with detailed usage instructions and server configurations - Refactor components to utilize context for managing MCP connections - Improve UI with new animations and status indicators for server connections - Enhance error handling and retry logic for tool execution - Update package configurations and dependencies for better performance
1 parent d2cdfd4 commit 032499e

23 files changed

Lines changed: 2175 additions & 512 deletions

packages/inspector/README.md

Lines changed: 96 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,84 +1,144 @@
11
# MCP Inspector
22

3-
A web-based interface for connecting to and managing MCP (Model Context Protocol) servers.
3+
A web-based interface for connecting to and managing MCP (Model Context Protocol) servers using the `useMcp` React hook.
44

55
## Features
66

7-
- **Server Management**: Add, connect to, and manage MCP servers
8-
- **Real-time Connection**: Test connections before adding servers
9-
- **Browser-Compatible**: Works entirely in the browser using the MCP client
7+
- **Server Management**: Add, connect to, and manage multiple MCP servers simultaneously
8+
- **Real-time Connection Status**: See live connection states and errors
9+
- **OAuth Authentication**: Automatic OAuth flow handling with popup support
10+
- **Tool Execution**: Inspect and execute MCP tools directly from the UI
11+
- **Resource & Prompt Browsing**: View available resources and prompts from connected servers
12+
- **Browser-Compatible**: Works entirely in the browser using the `useMcp` React hook
1013
- **Multiple Connection Types**: Support for HTTP/SSE and WebSocket connections
14+
- **Persistent Storage**: Connections are saved to localStorage and automatically reconnect
1115

1216
## Usage
1317

1418
### Adding a New Server
1519

16-
1. Click the server selection dropdown in the top-left corner
17-
2. Click "Add Server" button
18-
3. Fill in the server details:
19-
- **Server Name**: A friendly name for your server
20-
- **Connection Type**: Choose between HTTP/SSE or WebSocket
21-
- **Server URL**: The URL to connect to (e.g., `http://localhost:3000` or `ws://localhost:3000`)
22-
- **Description** (optional): Brief description of the server
23-
4. Click "Add Server" to test the connection and add the server
20+
1. Go to the main dashboard
21+
2. In the "Add New MCP Server" section:
22+
- **Server Name** (optional): A friendly name for your server
23+
- **Server URL**: The URL to connect to (e.g., `https://mcp.linear.app/sse`)
24+
3. Click "Connect" to add the server
25+
4. The server will automatically attempt to connect
2426

25-
### Connecting to Servers
27+
### Server States
2628

27-
1. Select a server from the dropdown
28-
2. The system will automatically attempt to connect
29-
3. Once connected, you'll see a "Connected" badge
29+
The inspector displays various connection states:
30+
31+
- **discovering**: Finding the server
32+
- **connecting**: Establishing connection
33+
- **authenticating**: Going through OAuth flow (if required)
34+
- **loading**: Loading tools, resources, and prompts
35+
- **ready**: Connected and ready to use
36+
- **failed**: Connection failed (with retry option)
37+
- **pending_auth**: Waiting for OAuth authentication
38+
39+
### Authentication
40+
41+
For servers requiring OAuth (like Linear):
42+
43+
1. Click the "Authenticate" button when prompted
44+
2. Complete the OAuth flow in the popup window
45+
3. If the popup is blocked, click the "open auth page" link to authenticate manually
46+
4. Once authenticated, the connection will automatically complete
47+
48+
### Inspecting a Server
49+
50+
1. Click the "Inspect" button on any connected server
51+
2. View all available tools, resources, and prompts
52+
3. Execute tools by clicking "Execute" and providing JSON input
53+
4. Copy resource URIs to clipboard
54+
5. View detailed schema information for each tool
3055

3156
## Example Server Configurations
3257

33-
### Linear Server
58+
### Linear MCP Server
3459

35-
For connecting to a Linear MCP server:
60+
For connecting to Linear's official MCP server:
3661

3762
- **Server Name**: Linear
38-
- **Connection Type**: HTTP/SSE
39-
- **Server URL**: `https://your-linear-mcp-server.com`
40-
- **Description**: Linear project management integration
63+
- **Server URL**: `https://mcp.linear.app/sse`
64+
65+
This server requires OAuth authentication and provides tools for managing Linear issues, projects, teams, and more.
4166

4267
### Local Development Server
4368

44-
For local development:
69+
For local development using HTTP/SSE:
4570

4671
- **Server Name**: Local Dev
47-
- **Connection Type**: HTTP/SSE
48-
- **Server URL**: `http://localhost:3000`
49-
- **Description**: Local development server
72+
- **Server URL**: `http://localhost:3000/sse`
5073

5174
### WebSocket Server
5275

5376
For WebSocket-based servers:
5477

5578
- **Server Name**: WebSocket Server
56-
- **Connection Type**: WebSocket
5779
- **Server URL**: `ws://localhost:8080`
58-
- **Description**: WebSocket-based MCP server
5980

6081
## Technical Details
6182

62-
The inspector uses the browser-compatible MCP client from `mcp-use/browser`, which supports:
83+
The inspector is built using:
84+
85+
- **React**: UI framework
86+
- **useMcp Hook**: From `mcp-use/react` for managing MCP connections
87+
- **React Router**: For navigation between dashboard and server detail views
88+
- **Tailwind CSS**: For styling
89+
- **shadcn/ui**: UI component library
6390

64-
- HTTP/SSE connections
65-
- WebSocket connections
66-
- OAuth authentication (when configured)
91+
### Architecture
6792

68-
The client automatically handles:
93+
- **McpContext**: Context provider that manages multiple MCP connections using `useMcp` hooks
94+
- **InspectorDashboard**: Main dashboard showing all connections and stats
95+
- **ServerList**: List view of all servers with detailed information
96+
- **ServerDetail**: Detailed view of a single server with tool execution capabilities
6997

70-
- Connection testing before adding servers
71-
- Session management
72-
- Error handling and reporting
98+
The `useMcp` hook automatically handles:
99+
100+
- Connection lifecycle management
101+
- OAuth authentication flows
102+
- Tool, resource, and prompt discovery
103+
- Error handling and retry logic
104+
- Session persistence via localStorage
73105

74106
## Development
75107

76108
To run the inspector in development mode:
77109

78110
```bash
79-
cd inspector
111+
cd packages/inspector
80112
yarn install
81113
yarn dev
82114
```
83115

84116
The inspector will be available at `http://localhost:5173`.
117+
118+
### Project Structure
119+
120+
```
121+
src/
122+
├── client/
123+
│ ├── components/
124+
│ │ ├── InspectorDashboard.tsx # Main dashboard
125+
│ │ ├── ServerList.tsx # Server list view
126+
│ │ ├── ServerDetail.tsx # Server detail view
127+
│ │ └── Layout.tsx # App layout
128+
│ ├── context/
129+
│ │ └── McpContext.tsx # MCP connection context
130+
│ ├── App.tsx # Root app component
131+
│ └── main.tsx # Entry point
132+
└── components/
133+
└── ui/ # shadcn/ui components
134+
```
135+
136+
## Building
137+
138+
To build the inspector for production:
139+
140+
```bash
141+
yarn build
142+
```
143+
144+
The built files will be in the `dist/` directory.

packages/inspector/components.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,7 @@
1818
"lib": "@/lib",
1919
"hooks": "@/hooks"
2020
},
21-
"registries": {}
21+
"registries": {
22+
"@magicui": "https://magicui.design/r/{name}.json"
23+
}
2224
}

packages/inspector/package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
"lint:pnpm": "pnpm lint:fix"
3131
},
3232
"dependencies": {
33+
"@hono/node-server": "^1.19.5",
34+
"@modelcontextprotocol/sdk": "1.12.1",
3335
"@radix-ui/react-alert-dialog": "^1.1.15",
3436
"@radix-ui/react-dialog": "^1.1.15",
3537
"@radix-ui/react-dropdown-menu": "^2.1.16",
@@ -38,6 +40,7 @@
3840
"@radix-ui/react-tooltip": "^1.2.8",
3941
"@tailwindcss/cli": "^4.1.14",
4042
"@tailwindcss/vite": "^4.1.14",
43+
"@types/react-syntax-highlighter": "^15.5.13",
4144
"class-variance-authority": "^0.7.1",
4245
"clsx": "^2.1.1",
4346
"framer-motion": "^12.23.22",
@@ -48,6 +51,7 @@
4851
"react": "^19.2.0",
4952
"react-dom": "^19.2.0",
5053
"react-router-dom": "^7.9.3",
54+
"react-syntax-highlighter": "^15.6.6",
5155
"tailwind-merge": "^3.3.1"
5256
},
5357
"devDependencies": {

packages/inspector/src/client/App.tsx

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,21 @@ import { InspectorDashboard } from './components/InspectorDashboard'
33
import { Layout } from './components/Layout'
44
import { ServerDetail } from './components/ServerDetail'
55
import { ServerList } from './components/ServerList'
6+
import { McpProvider } from './context/McpContext'
67

78
function App() {
89
return (
9-
<Router>
10-
<Layout>
11-
<Routes>
12-
<Route path="/" element={<InspectorDashboard />} />
13-
<Route path="/servers" element={<ServerList />} />
14-
<Route path="/servers/:serverId" element={<ServerDetail />} />
15-
</Routes>
16-
</Layout>
17-
</Router>
10+
<McpProvider>
11+
<Router>
12+
<Layout>
13+
<Routes>
14+
<Route path="/" element={<InspectorDashboard />} />
15+
<Route path="/servers" element={<ServerList />} />
16+
<Route path="/servers/:serverId" element={<ServerDetail />} />
17+
</Routes>
18+
</Layout>
19+
</Router>
20+
</McpProvider>
1821
)
1922
}
2023

0 commit comments

Comments
 (0)