Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*]
end_of_line = lf
insert_final_newline = true
indent_style = tab
indent_size = 2
charset = utf-8
trim_trailing_whitespace = true
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* text=auto eol=lf
/packages/**/test/** -linguist-detectable
/packages/**/fixtures/** -linguist-detectable
1 change: 1 addition & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@ jobs:
run: pnpm run check
env:
DATABASE_URL: file:test.db
DATABASE_TOKEN: dummy-key
VOYAGE_API_KEY: dummy-key
1 change: 1 addition & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,4 @@ jobs:
env:
DATABASE_URL: file:test.db
VOYAGE_API_KEY: dummy-key
DATABASE_TOKEN: dummy-key
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,11 @@ jobs:
env:
DATABASE_URL: file:test.db
VOYAGE_API_KEY: dummy-key
DATABASE_TOKEN: dummy-key

- name: Run tests
run: pnpm run test
env:
DATABASE_URL: file:test.db
VOYAGE_API_KEY: dummy-key
DATABASE_TOKEN: dummy-key
29 changes: 22 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,27 +1,42 @@
node_modules
/apps/**/node_modules
/packages/**/node_modules

# Output
.output
.vercel
.netlify
.wrangler
/.svelte-kit
/build
/apps/**/.output
/apps/**/.vercel
/apps/**/.netlify
/apps/**/.wrangler
/**/.svelte-kit
/apps/**/build
/apps/**/dist
/packages/**/dist

# OS
.DS_Store
Thumbs.db

# Env
.env
/apps/**/.env
/packages/**/.env
.env.*
/apps/**/.env.*
/packages/**/.env.*
!.env.example
/apps/**/!.env.example
/packages/**/!.env.example
!.env.test
/apps/**/!.env.test
/packages/**/!.env.test

# Vite
vite.config.js.timestamp-*
vite.config.ts.timestamp-*
/apps/**/vite.config.js.timestamp-*
/apps/**/vite.config.ts.timestamp-*

# SQLite
*.db
dist
/apps/**/*.db
/packages/**/*.db
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ bun.lockb
# Miscellaneous
/static/
/drizzle/
/**/.svelte-kit/*
File renamed without changes.
File renamed without changes.
69 changes: 69 additions & 0 deletions apps/mcp-remote/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{
"name": "@sveltejs/mcp-remote",
"version": "0.0.1",
"description": "The official Svelte MCP server implementation",
"type": "module",
"main": "src/index.js",
"bin": {
"svelte-mcp": "./dist/lib/stdio.js"
},
"scripts": {
"start": "node src/index.js",
"dev": "vite dev",
"build": "vite build",
"build:mcp": "tsc --project tsconfig.build.json",
"prepublishOnly": "pnpm build:mcp",
"preview": "vite preview",
"prepare": "svelte-kit sync || echo ''",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"format": "prettier --write .",
"lint": "prettier --check . && eslint .",
"lint:fix": "prettier --write . && eslint . --fix",
"test:unit": "vitest",
"test": "npm run test:unit -- --run",
"test:watch": "npm run test:unit -- --watch",
"db:push": "drizzle-kit push",
"db:generate": "drizzle-kit generate",
"db:migrate": "drizzle-kit migrate",
"db:studio": "drizzle-kit studio",
"inspect": "pnpm mcp-inspector"
},
"keywords": [
"svelte",
"tmcp",
"mcp",
"server"
],
"private": true,
"devDependencies": {
"@eslint/compat": "^1.3.2",
"@eslint/js": "^9.36.0",
"@libsql/client": "^0.14.0",
"@modelcontextprotocol/inspector": "^0.16.7",
"@sveltejs/adapter-vercel": "^5.6.3",
"@sveltejs/kit": "^2.22.0",
"@sveltejs/vite-plugin-svelte": "^6.0.0",
"@types/node": "^24.3.1",
"@typescript-eslint/parser": "^8.44.0",
"drizzle-kit": "^0.30.2",
"drizzle-orm": "^0.40.0",
"eslint-config-prettier": "^10.0.1",
"eslint-plugin-svelte": "^3.12.3",
"globals": "^16.0.0",
"prettier": "^3.4.2",
"prettier-plugin-svelte": "^3.3.3",
"svelte": "^5.0.0",
"svelte-check": "^4.0.0",
"svelte-eslint-parser": "^1.3.2",
"typescript": "^5.0.0",
"vite": "^7.0.4",
"vite-plugin-devtools-json": "^1.0.0",
"vitest": "^3.2.3"
},
"dependencies": {
"@sveltejs/mcp-schema": "workspace:^",
"@sveltejs/mcp-server": "workspace:^",
"@tmcp/transport-http": "^0.6.2"
}
}
File renamed without changes.
File renamed without changes.
5 changes: 4 additions & 1 deletion src/hooks.server.ts → apps/mcp-remote/src/hooks.server.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { http_transport } from '$lib/mcp/index.js';
import { db } from '$lib/server/db/index.js';

export async function handle({ event, resolve }) {
const mcp_response = await http_transport.respond(event.request);
const mcp_response = await http_transport.respond(event.request, {
db,
});
// we are deploying on vercel the SSE connection will timeout after 5 minutes...for
// the moment we are not sending back any notifications (logs, or list changed notifications)
// so it's a waste of resources to keep a connection open that will error
Expand Down
Empty file.
6 changes: 6 additions & 0 deletions apps/mcp-remote/src/lib/mcp/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { server } from '@sveltejs/mcp-server';
import { HttpTransport } from '@tmcp/transport-http';

export const http_transport = new HttpTransport(server, {
cors: true,
});
15 changes: 15 additions & 0 deletions apps/mcp-remote/src/lib/server/db/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { createClient } from '@libsql/client';
import { drizzle } from 'drizzle-orm/libsql';
import * as schema from './schema.js';
// let's disable it for the moment...i can't figure out a way to make it wotk with eslint
// eslint-disable-next-line import/extensions
import { DATABASE_TOKEN, DATABASE_URL } from '$env/static/private';
if (!DATABASE_URL) throw new Error('DATABASE_URL is not set');
if (!DATABASE_TOKEN) throw new Error('DATABASE_TOKEN is not set');

const client = createClient({
url: DATABASE_URL,
authToken: DATABASE_TOKEN,
});

export const db = drizzle(client, { schema, logger: true });
2 changes: 2 additions & 0 deletions apps/mcp-remote/src/lib/server/db/schema.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// we need to re-export from here to allow for the drizzle config to pick them up for migrations
export * from '@sveltejs/mcp-schema/schema';
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
19 changes: 19 additions & 0 deletions apps/mcp-remote/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"extends": "./.svelte-kit/tsconfig.json",
"compilerOptions": {
"allowJs": true,
"checkJs": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"sourceMap": true,
"strict": true,
"moduleResolution": "bundler"
}
// Path aliases are handled by https://svelte.dev/docs/kit/configuration#alias
// except $lib which is handled by https://svelte.dev/docs/kit/configuration#files
//
// To make changes to top-level options such as include and exclude, we recommend extending
// the generated config; see https://svelte.dev/docs/kit/configuration#typescript
}
22 changes: 22 additions & 0 deletions apps/mcp-remote/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import devtoolsJson from 'vite-plugin-devtools-json';
import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vite';

export default defineConfig({
plugins: [sveltekit(), devtoolsJson()],
// we don't have tests yet so we just comment this out for now
// test: {
// expect: { requireAssertions: true },
// projects: [
// {
// extends: './vite.config.ts',
// test: {
// name: 'server',
// environment: 'node',
// include: ['src/**/*.{test,spec}.{js,ts}'],
// exclude: ['src/**/*.svelte.{test,spec}.{js,ts}'],
// },
// },
// ],
// },
});
34 changes: 3 additions & 31 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import svelte from 'eslint-plugin-svelte';
import globals from 'globals';
import { fileURLToPath } from 'node:url';
import ts from 'typescript-eslint';
import svelteConfig from './svelte.config.js';
import svelteConfig from './apps/mcp-remote/svelte.config.js';
import eslint_plugin_import from 'eslint-plugin-import';

const gitignore_path = fileURLToPath(new URL('./.gitignore', import.meta.url));

export default ts.config(
export default /** @type {import("eslint").Linter.Config} */ ([
includeIgnoreFile(gitignore_path),
js.configs.recommended,
...ts.configs.recommended,
Expand Down Expand Up @@ -49,34 +49,6 @@ export default ts.config(
],
},
},
{
files: ['./src/lib/**/*'],
rules: {
'import/extensions': [
'error',
'ignorePackages',
{
js: 'always',
mjs: 'always',
cjs: 'always',
ts: 'always',
svelte: 'always',
},
],
'no-restricted-imports': [
'error',
{
patterns: [
{
group: ['$lib'],
message:
"Since we will build the mcp server with typescript we can't use `$lib` imports here, please import with relative paths",
},
],
},
],
},
},
{
files: ['**/*.svelte', '**/*.svelte.ts', '**/*.svelte.js'],
languageOptions: {
Expand All @@ -88,4 +60,4 @@ export default ts.config(
},
},
},
);
]);
56 changes: 8 additions & 48 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,32 +1,17 @@
{
"name": "@sveltejs/mcp",
"name": "@sveltejs/mcp-mono",
"version": "0.0.1",
"description": "The official Svelte MCP server implementation",
"type": "module",
"main": "src/index.js",
"bin": {
"svelte-mcp": "./dist/lib/stdio.js"
},
"scripts": {
"start": "node src/index.js",
"dev": "vite dev",
"build": "vite build",
"build:mcp": "tsc --project tsconfig.build.json",
"prepublishOnly": "pnpm build:mcp",
"preview": "vite preview",
"prepare": "svelte-kit sync || echo ''",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"build": "pnpm -r run build",
"check": "pnpm -r run check",
"format": "prettier --write .",
"lint": "prettier --check . && eslint .",
"lint:fix": "prettier --write . && eslint . --fix",
"test:unit": "vitest",
"test": "npm run test:unit -- --run",
"test:watch": "npm run test:unit -- --watch",
"db:push": "drizzle-kit push",
"db:generate": "drizzle-kit generate",
"db:migrate": "drizzle-kit migrate",
"db:studio": "drizzle-kit studio",
"inspect": "pnpm mcp-inspector"
},
"keywords": [
Expand All @@ -37,45 +22,20 @@
],
"private": true,
"devDependencies": {
"@libsql/client": "^0.14.0",
"@eslint/compat": "^1.3.2",
"@eslint/js": "^9.36.0",
"@modelcontextprotocol/inspector": "^0.16.7",
"@sveltejs/adapter-vercel": "^5.6.3",
"@sveltejs/kit": "^2.22.0",
"@sveltejs/vite-plugin-svelte": "^6.0.0",
"@types/eslint-scope": "^8.3.2",
"@types/estree": "^1.0.8",
"@types/node": "^24.3.1",
"@typescript-eslint/types": "^8.43.0",
"dotenv": "^17.2.2",
"drizzle-kit": "^0.30.2",
"drizzle-orm": "^0.40.0",
"eslint": "^9.36.0",
"eslint-config-prettier": "^10.0.1",
"eslint-plugin-import": "^2.32.0",
"eslint-plugin-svelte": "^3.12.3",
"globals": "^16.0.0",
"prettier": "^3.4.2",
"prettier-plugin-svelte": "^3.3.3",
"svelte": "^5.0.0",
"svelte-check": "^4.0.0",
"typescript": "^5.0.0",
"vite": "^7.0.4",
"vite-plugin-devtools-json": "^1.0.0",
"typescript-eslint": "^8.44.1",
"vitest": "^3.2.3"
},
"dependencies": {
"@eslint/compat": "^1.2.5",
"@eslint/js": "^9.18.0",
"@tmcp/adapter-valibot": "^0.1.4",
"@tmcp/transport-http": "^0.6.2",
"@tmcp/transport-stdio": "^0.2.0",
"@typescript-eslint/parser": "^8.43.0",
"eslint": "^9.36.0",
"eslint-plugin-svelte": "^3.12.3",
"svelte-eslint-parser": "^1.3.2",
"tmcp": "^1.13.0",
"typescript-eslint": "^8.20.0",
"valibot": "^1.1.0",
"zimmerframe": "^1.1.4"
},
"pnpm": {
"onlyBuiltDependencies": [
"esbuild"
Expand Down
Loading