LOCAL_TESTING.mdβ’2.73 kB
# Local testing with MCP inspector
This guide explains how to test your MCP server locally using the official MCP
inspector tool in both STDIO and streamable HTTP modes.
## What is MCP inspector?
[MCP inspector](https://github.com/modelcontextprotocol/inspector) is an official
debugging tool that provides a web UI for testing MCP servers.
## Testing modes
Your MCP server supports two transport modes:
- **STDIO** - Standard input/output for local subprocess communication.
- **Streamable HTTP** - HTTP-based transport for remote connections.
---
## Testing STDIO Mode
STDIO mode is used for local subprocess communication, ideal for Claude Desktop
configuration and local development.
```bash
pnpm build
pnpm run mcp-inspector:stdio
```
You don't need to launch the application separately. The MCP inspector will
launch the application as a subprocess and pass down the `MCP_TRANSPORT`
environment variable.
The inspector will automatically open your browser to `http://localhost:6274`.
Click "Connect" and, upon successful connection, "List Tools".
**Note:** STDIO mode needs the `MCP_TRANSPORT` environment variable set
to `stdio`.
**Note:** Using watch mode in stdio mode could be problematic because it pollutes
the stdout of the app.
---
## Testing Streamable HTTP Mode
Streamable HTTP mode is used for remote connections and is ideal for Claude
Desktop's "Add Custom Connector" feature.
In this mode, you do need to launch the application separately.
```bash
pnpm dev
pnpm run mcp-inspector:http
```
The inspector will automatically open your browser to `http://localhost:6274`.
Click "Connect" and, upon successful connection, "List Tools".
---
## Testing with Swagger UI
Swagger UI provides interactive API documentation where you can test all REST endpoints.
### 1. Start the server
```bash
pnpm dev
```
### 2. Access Swagger UI
Open your browser to `http://localhost:3000/api`
Or use the shortcut:
```bash
pnpm swagger
```
### 3. Authenticate
**Get JWT token:**
Click the "Log in" button in the Swagger UI topbar, or manually visit `http://localhost:3000/auth/login` in your browser.
1. Complete the OAuth2 authentication flow with your provider
2. Copy the JWT token displayed on the success page
**Set token in Swagger UI:**
1. Click the "Authorize" button (lock icon) at the top right of Swagger UI
2. In the "bearerAuth" section, enter: `Bearer YOUR_JWT_TOKEN`
3. Click "Authorize", then "Close"
### 4. Test endpoints
Now you can test any protected endpoint:
1. Expand an endpoint (e.g., `GET /timezone/regions`)
2. Click "Try it out"
3. Click "Execute"
4. View the response
**Note:** The `/health` endpoint doesn't require authentication and can be tested without a token.