Add dev scripts for mitmproxy debugging and fix JSON-RPC error responses

- Add dev-with-mitm.sh for TUI-based traffic inspection
- Add dev-with-mitmweb.sh for web UI-based traffic inspection
- Fix missing 'id' field in JSON-RPC error responses (required by spec)
- Migrate from zod-to-json-schema to Zod v4's native z.toJSONSchema()

The mitmproxy scripts help developers debug MCP traffic by running
the server through a reverse proxy that intercepts all client requests.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Jerome Swannack 2025-12-05 13:35:29 +00:00
commit 07300e8453
No known key found for this signature in database

View file

@ -67,6 +67,7 @@ export async function handleStreamableHTTP(req: Request, res: Response) {
});
res.status(401).json({
"jsonrpc": "2.0",
"id": null,
"error": {
"code": -32002,
"message": "User ID required"
@ -87,6 +88,7 @@ export async function handleStreamableHTTP(req: Request, res: Response) {
});
res.status(401).json({
"jsonrpc": "2.0",
"id": null,
"error": {
"code": -32001,
"message": "Session not found or access denied"
@ -148,6 +150,7 @@ export async function handleStreamableHTTP(req: Request, res: Response) {
});
res.status(400).json({
"jsonrpc": "2.0",
"id": null,
"error": {
"code": -32600,
"message": "Invalid request method for existing session"
@ -167,6 +170,7 @@ export async function handleStreamableHTTP(req: Request, res: Response) {
if (!res.headersSent) {
res.status(500).json({
"jsonrpc": "2.0",
"id": null,
"error": {
"code": -32603,
"message": "Internal error during request processing"