chore: remove dead code and fix HTTP port-conflict startup (#351)
* chore: remove dead code and fix HTTP port-conflict startup - drop unused helpers, constants, schemas, and duplicated types - exit non-zero when the HTTP port is already in use - add stdio and port-conflict tests - clean dist on build, add serve:http, fix inspector:http for Inspector v2 * test: harden port-conflict test; drop unreachable listen guard - pin the child's host so BRAVE_MCP_HOST cannot bypass the conflict - bound the exit wait and reject spawn errors - remove the address() guard; 'listening' does not fire on a failed bind
This commit is contained in:
1 parent
2cf96460c1
commit
50cb919200
21 files changed
+191
-252
No files matched your search
@@ -394,29 +394,39 @@ Add a reference to your local build in `claude_desktop_config.json`:
|
||||
|
||||
### Testing via MCP Inspector
|
||||
|
||||
1. Build and start the server:
|
||||
The Inspector requires Node 22.19 or newer.
|
||||
|
||||
**STDIO** — the Inspector launches the server itself, so one terminal is enough:
|
||||
|
||||
```bash
|
||||
npm run build
|
||||
node dist/index.js
|
||||
```
|
||||
|
||||
2. In another terminal, start the MCP Inspector:
|
||||
```bash
|
||||
npx @modelcontextprotocol/inspector node dist/index.js
|
||||
```
|
||||
|
||||
STDIO is the default mode. For HTTP mode testing, add `--transport http` to the arguments in the Inspector UI.
|
||||
**HTTP** — the Inspector connects to a URL, so the server must already be listening:
|
||||
|
||||
```bash
|
||||
# terminal 1
|
||||
npm run serve:http
|
||||
|
||||
# terminal 2
|
||||
npm run inspector:http
|
||||
```
|
||||
|
||||
`serve:http` builds, binds `127.0.0.1:8080`, and reads `BRAVE_API_KEY` from `.env`.
|
||||
|
||||
### Available Scripts
|
||||
|
||||
- `npm run build`: Build the TypeScript project
|
||||
- `npm run watch`: Watch for changes and rebuild
|
||||
- `npm test`: Run the test suite
|
||||
- `npm run format`: Format code with Prettier
|
||||
- `npm run format:check`: Check code formatting
|
||||
- `npm run prepare`: Format and build (runs automatically on npm install)
|
||||
|
||||
- `npm run serve:http`: Build, then serve over HTTP at `http://127.0.0.1:8080/mcp`
|
||||
- `npm run inspector`: Launch an instance of MCP Inspector
|
||||
- `npm run inspector:stdio`: Launch a instance of MCP Inspector, configured for STDIO
|
||||
- `npm run inspector:http`: Launch MCP Inspector against `http://127.0.0.1:8080/mcp`
|
||||
|
||||
### Docker Compose
|
||||
|
||||
|
||||
Reference in new issue
Block a user