mirror of
https://github.com/sveltejs/ai-tools.git
synced 2026-07-05 03:54:41 +08:00
Compare commits
16 Commits
ci
...
add-docker
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dab61bdb3c | ||
|
|
0719e06f6a | ||
|
|
7346b0387a | ||
|
|
3af6c887e9 | ||
|
|
d91a4f2b51 | ||
|
|
ec2e12f7f2 | ||
|
|
7805fb8a24 | ||
|
|
5280f37a05 | ||
|
|
621c6cf3c7 | ||
|
|
5772110214 | ||
|
|
b171f6a19f | ||
|
|
3882733a66 | ||
|
|
e178374683 | ||
|
|
037f830557 | ||
|
|
7c3eb030ce | ||
|
|
2ded5711fb |
@@ -11,3 +11,12 @@ pnpm dev
|
||||
```
|
||||
|
||||
1. Set the VOYAGE_API_KEY for embeddings support
|
||||
|
||||
#### Optional tools
|
||||
|
||||
```
|
||||
docker-compose up
|
||||
```
|
||||
|
||||
- MCP Inspector: http://localhost:6274/ (Connect with `http://host.docker.internal:5173/mcp` + Streamable HTTP)
|
||||
- http://localhost:8081/ - Adminer SQLite frontend
|
||||
|
||||
31
bypass.php
Normal file
31
bypass.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
function adminer_object() {
|
||||
include_once "plugins/login-sqlite.php";
|
||||
|
||||
class NoAuthSqlite extends Adminer {
|
||||
function login($login, $password) {
|
||||
return true;
|
||||
}
|
||||
|
||||
function credentials() {
|
||||
return array('/tmp/test.db', '', '');
|
||||
}
|
||||
|
||||
function database() {
|
||||
return '/tmp/test.db';
|
||||
}
|
||||
|
||||
function loginForm() {
|
||||
echo '<input type="hidden" name="auth[driver]" value="sqlite">';
|
||||
echo '<input type="hidden" name="auth[server]" value="/tmp/test.db">';
|
||||
echo '<input type="hidden" name="auth[username]" value="">';
|
||||
echo '<input type="hidden" name="auth[password]" value="">';
|
||||
echo '<input type="hidden" name="auth[db]" value="/tmp/test.db">';
|
||||
echo '<p><input type="submit" value="Connect to SQLite Database"></p>';
|
||||
}
|
||||
}
|
||||
|
||||
return new NoAuthSqlite;
|
||||
}
|
||||
|
||||
include "adminer.php";
|
||||
25
docker-compose.yml
Normal file
25
docker-compose.yml
Normal file
@@ -0,0 +1,25 @@
|
||||
services:
|
||||
mcp-inspector:
|
||||
image: ghcr.io/modelcontextprotocol/inspector:latest
|
||||
ports:
|
||||
- '6274:6274'
|
||||
- '6277:6277'
|
||||
environment:
|
||||
- DANGEROUSLY_OMIT_AUTH=true
|
||||
- HOST=0.0.0.0
|
||||
restart: unless-stopped
|
||||
container_name: mcp-inspector-sveltejs-mcp
|
||||
|
||||
adminer:
|
||||
image: adminer:4.6.2
|
||||
ports:
|
||||
- '8081:8080'
|
||||
volumes:
|
||||
- ./test.db:/tmp/test.db
|
||||
- ./bypass.php:/var/www/html/bypass.php
|
||||
environment:
|
||||
- ADMINER_DEFAULT_SERVER=sqlite:/tmp/test.db
|
||||
- ADMINER_DESIGN=hydra
|
||||
restart: unless-stopped
|
||||
container_name: adminer-sveltejs-mcp
|
||||
command: ["php", "-S", "[::]:8080", "-t", "/var/www/html", "/var/www/html/bypass.php"]
|
||||
@@ -6,7 +6,7 @@
|
||||
"main": "src/index.js",
|
||||
"scripts": {
|
||||
"start": "node src/index.js",
|
||||
"dev": "vite dev",
|
||||
"dev": "vite dev --host",
|
||||
"build": "vite build",
|
||||
"preview": "vite preview",
|
||||
"prepare": "svelte-kit sync || echo ''",
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
import { walk as _walk } from 'zimmerframe';
|
||||
import type { Autofixer } from './mcp/autofixers';
|
||||
|
||||
export type WalkParams<
|
||||
T extends {
|
||||
@@ -31,25 +30,3 @@ export function walk<
|
||||
...visitors,
|
||||
});
|
||||
}
|
||||
|
||||
export function mix_visitors(autofixers: Record<string, Autofixer>): Autofixer {
|
||||
const visitors: Autofixer = {};
|
||||
for (const key in autofixers) {
|
||||
const new_visitors = autofixers[key];
|
||||
for (const node_type in new_visitors) {
|
||||
if (node_type in visitors) {
|
||||
const existing_visitor = visitors[node_type as keyof typeof visitors]!;
|
||||
const new_visitor = new_visitors[node_type as keyof typeof visitors]!;
|
||||
visitors[node_type as keyof typeof visitors] = (node, ctx) => {
|
||||
(existing_visitor as any)(node, ctx);
|
||||
(new_visitor as any)(node, ctx);
|
||||
};
|
||||
} else {
|
||||
visitors[node_type as keyof typeof visitors] = new_visitors[
|
||||
node_type as keyof typeof visitors
|
||||
] as never;
|
||||
}
|
||||
}
|
||||
}
|
||||
return visitors;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { Node } from 'estree';
|
||||
import type { Visitors } from 'zimmerframe';
|
||||
import type { ParseResult } from '$lib/server/analyze/parse.js';
|
||||
import type { ParseResult } from '../server/analyze/parse.js';
|
||||
|
||||
export type Autofixer = Visitors<
|
||||
Node,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { mix_visitors, walk } from '$lib';
|
||||
import { walk } from '../index.js';
|
||||
import { ValibotJsonSchemaAdapter } from '@tmcp/adapter-valibot';
|
||||
import { HttpTransport } from '@tmcp/transport-http';
|
||||
import { StdioTransport } from '@tmcp/transport-stdio';
|
||||
@@ -53,7 +53,10 @@ server.tool(
|
||||
|
||||
const parsed = parse(code, filename ?? 'Component.svelte');
|
||||
|
||||
walk(parsed.ast as unknown as Node, { output: content, parsed }, mix_visitors(autofixers));
|
||||
// Run each autofixer separately to avoid interrupting logic flow
|
||||
for (const autofixer of Object.values(autofixers)) {
|
||||
walk(parsed.ast as unknown as Node, { output: content, parsed }, autofixer);
|
||||
}
|
||||
|
||||
return {
|
||||
content: [
|
||||
|
||||
@@ -18,4 +18,7 @@ export default defineConfig({
|
||||
},
|
||||
],
|
||||
},
|
||||
server: {
|
||||
allowedHosts: ['host.docker.internal'],
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user