tidewave 0.1.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +91 -1
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.js +14072 -955
- package/dist/core.d.ts +77 -0
- package/dist/core.js +64 -0
- package/dist/evaluation/code_executor.d.ts +2 -0
- package/dist/evaluation/code_executor.js +104 -0
- package/dist/evaluation/eval_worker.d.ts +1 -0
- package/dist/evaluation/eval_worker.js +53 -0
- package/dist/http/handlers/mcp.d.ts +2 -0
- package/dist/http/handlers/shell.d.ts +6 -0
- package/dist/http/index.d.ts +15 -0
- package/dist/http/index.js +33963 -0
- package/dist/http/security.d.ts +12 -0
- package/dist/http/security.js +132 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +117 -231
- package/dist/mcp.d.ts +2 -0
- package/dist/mcp.js +13968 -945
- package/dist/next-js.d.ts +15 -0
- package/dist/next-js.js +40304 -0
- package/dist/resolution/formatters.d.ts +5 -0
- package/dist/resolution/formatters.js +2 -0
- package/dist/resolution/index.d.ts +6 -0
- package/dist/resolution/index.js +18 -219
- package/dist/resolution/module-resolver.d.ts +8 -0
- package/dist/resolution/module-resolver.js +10 -213
- package/dist/resolution/symbol-finder.d.ts +4 -0
- package/dist/resolution/symbol-finder.js +32 -237
- package/dist/resolution/utils.d.ts +5 -0
- package/dist/resolution/utils.js +5 -211
- package/dist/tools.d.ts +58 -0
- package/dist/tools.js +4099 -0
- package/dist/vite-plugin.d.ts +3 -0
- package/dist/vite-plugin.js +33986 -0
- package/package.json +28 -2
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@ Simply configure your editor to run `tidewave` in the same directory as your
|
|
|
20
20
|
|
|
21
21
|
```bash
|
|
22
22
|
npx tidewave mcp
|
|
23
|
-
# or
|
|
23
|
+
# or with Bun
|
|
24
24
|
bunx tidewave mcp
|
|
25
25
|
# or with Deno
|
|
26
26
|
deno run npm:tidewave mcp
|
|
@@ -30,6 +30,96 @@ Available MCP options:
|
|
|
30
30
|
|
|
31
31
|
- `--prefix path` - Specify the directory to find the `package.json` file
|
|
32
32
|
|
|
33
|
+
### HTTP MCP via Vite Plugin
|
|
34
|
+
|
|
35
|
+
Tidewave also provides HTTP-based MCP access through a Vite plugin for
|
|
36
|
+
development environments. Add the plugin to your `vite.config.js`:
|
|
37
|
+
|
|
38
|
+
```javascript
|
|
39
|
+
import { defineConfig } from 'vite';
|
|
40
|
+
import tidewave from 'tidewave/vite-plugin';
|
|
41
|
+
|
|
42
|
+
export default defineConfig({
|
|
43
|
+
plugins: [tidewave()],
|
|
44
|
+
});
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
This exposes MCP endpoints at `/tidewave/mcp` and `/tidewave/shell` during
|
|
48
|
+
development.
|
|
49
|
+
|
|
50
|
+
Configuration options:
|
|
51
|
+
|
|
52
|
+
```javascript
|
|
53
|
+
tidewave({
|
|
54
|
+
allowRemoteAccess: false, // Allow access from remote IPs
|
|
55
|
+
allowedOrigins: ['localhost'], // Allowed origins: defaults to the Vite's host+port
|
|
56
|
+
});
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### HTTP MCP via Next.js Integration
|
|
60
|
+
|
|
61
|
+
Tidewave provides seamless integration with Next.js through a handler function.
|
|
62
|
+
Add the handler to your API routes **and** `middleware.ts`:
|
|
63
|
+
|
|
64
|
+
> [!WARNING] Note that the below helper functions will only work on development
|
|
65
|
+
> mode `NODE_ENV === 'development'` if the validation fails, an Error will be
|
|
66
|
+
> thrown
|
|
67
|
+
|
|
68
|
+
**Pages Router** - Create `pages/api/tidewave/[...all].ts`:
|
|
69
|
+
|
|
70
|
+
```typescript
|
|
71
|
+
import { tidewaveHandler } from 'tidewave/next-js';
|
|
72
|
+
|
|
73
|
+
export default await tidewaveHandler();
|
|
74
|
+
|
|
75
|
+
// Next.js specific config
|
|
76
|
+
export const config = {
|
|
77
|
+
runtime: 'nodejs',
|
|
78
|
+
api: {
|
|
79
|
+
bodyParser: false, // tidewave already parses the body internally
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
This exposes MCP endpoints at `/api/tidewave/mcp` and `/api/tidewave/shell`.
|
|
85
|
+
|
|
86
|
+
Then create `middleware.ts` with:
|
|
87
|
+
|
|
88
|
+
```typescript
|
|
89
|
+
import { tidewaveMiddleware } from 'tidewave/next-js';
|
|
90
|
+
|
|
91
|
+
export const middleware = tidewaveMiddleware();
|
|
92
|
+
|
|
93
|
+
export const config = {
|
|
94
|
+
matcher: '/tidewave/(.*)',
|
|
95
|
+
};
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
In case you already have an existing `middleware.ts`:
|
|
99
|
+
|
|
100
|
+
```typescript
|
|
101
|
+
import { tidewaveMiddleware } from 'tidewave/next-js';
|
|
102
|
+
|
|
103
|
+
const withTidewave = tidewaveMiddleware();
|
|
104
|
+
|
|
105
|
+
export function middleware(req: NextRequest): Promise<NextResponse> {
|
|
106
|
+
// This will return a unchanged NextResponse.next()
|
|
107
|
+
// if path doesn't match with `/tidewave`
|
|
108
|
+
// if does match it will rewrite to `/api/tidewave` instead
|
|
109
|
+
withTidewave(req, (req: NextRequest) => {
|
|
110
|
+
// your own logic
|
|
111
|
+
return NextResponse.json({ message: 'hello, world!' });
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export const config = {
|
|
116
|
+
matcher: [
|
|
117
|
+
'/tidewave/(.*)', // tidewave specific matcher
|
|
118
|
+
'/your/route/', // your specific matcher
|
|
119
|
+
],
|
|
120
|
+
};
|
|
121
|
+
```
|
|
122
|
+
|
|
33
123
|
### CLI Usage
|
|
34
124
|
|
|
35
125
|
Tidewave also provides the MCP features over a CLI tool. Use it directly via
|