Compare commits

..

16 Commits

Author SHA1 Message Date
Stanislav Khromov
dab61bdb3c Update README.md 2025-09-17 01:40:43 +02:00
Stanislav Khromov
0719e06f6a Update README.md 2025-09-17 01:40:31 +02:00
Stanislav Khromov
7346b0387a Update bypass.php 2025-09-17 01:39:04 +02:00
Stanislav Khromov
3af6c887e9 Update bypass.php 2025-09-17 01:38:10 +02:00
Stanislav Khromov
d91a4f2b51 wip 2025-09-17 01:36:54 +02:00
Stanislav Khromov
ec2e12f7f2 Update docker-compose.yml 2025-09-17 01:10:21 +02:00
Stanislav Khromov
7805fb8a24 set up mcp-inspector 2025-09-17 01:06:18 +02:00
Stanislav Khromov
5280f37a05 Update docker-compose.yml 2025-09-17 01:02:02 +02:00
Stanislav Khromov
621c6cf3c7 Update package.json 2025-09-17 00:57:45 +02:00
Stanislav Khromov
5772110214 Update docker-compose.yml 2025-09-17 00:54:32 +02:00
Stanislav Khromov
b171f6a19f Update docker-compose.yml 2025-09-17 00:50:13 +02:00
Stanislav Khromov
3882733a66 Update docker-compose.yml 2025-09-17 00:44:15 +02:00
Stanislav Khromov
e178374683 Create docker-compose.yml 2025-09-17 00:43:23 +02:00
Stanislav Khromov
037f830557 Merge pull request #3 from sveltejs/ci
Add GitHub Actions for type checking and linting
2025-09-17 00:03:03 +02:00
paoloricciuti
7c3eb030ce fix: run autofixers in separate walks to avoid messing with the tree traverse flow 2025-09-16 22:51:07 +02:00
paoloricciuti
2ded5711fb chore: use .js imports 2025-09-16 21:55:08 +02:00
8 changed files with 75 additions and 27 deletions

View File

@@ -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
View 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
View 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"]

View File

@@ -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 ''",

View File

@@ -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;
}

View File

@@ -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,

View File

@@ -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: [

View File

@@ -18,4 +18,7 @@ export default defineConfig({
},
],
},
server: {
allowedHosts: ['host.docker.internal'],
},
});