@pickjonathan/loopwatch-middleware
v1.0.13
Published
Loopwatch Express middleware to intercept MCP tool call requests and enforce policies via Loopwatch Core.
Readme
Loopwatch Express Middleware
This package provides an Express middleware to intercept MCP tool call requests and enforce policies via Loopwatch Core.
Installation
cd loopwatch-middleware
npm installUsage
import express from 'express';
import { mcpInterceptor } from 'loopwatch-middleware';
const app = express();
app.use(express.json());
// Apply the middleware to your MCP tool invocation route
app.post('/tools',
mcpInterceptor({ coreUrl: 'http://localhost:3000' }),
(req, res) => {
// Your tool execution logic
res.json({ result: 'Tool executed' });
}
);Options
coreUrl: Base URL of the Loopwatch Core service (e.g.,http://localhost:3000).timeoutMs: HTTP request timeout in milliseconds (default: 5000).
Build
npm run buildDevelopment
npm run dev