@softtechai/quickmcp 1.0.16 → 1.1.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/dist/auth/auth-utils.d.ts +130 -0
- package/dist/auth/auth-utils.d.ts.map +1 -0
- package/dist/auth/auth-utils.js +600 -0
- package/dist/auth/auth-utils.js.map +1 -0
- package/dist/auth/jwks-provider.d.ts +9 -0
- package/dist/auth/jwks-provider.d.ts.map +1 -0
- package/dist/auth/jwks-provider.js +56 -0
- package/dist/auth/jwks-provider.js.map +1 -0
- package/dist/auth/token-utils.d.ts +40 -0
- package/dist/auth/token-utils.d.ts.map +1 -0
- package/dist/auth/token-utils.js +162 -0
- package/dist/auth/token-utils.js.map +1 -0
- package/dist/client/MCPClient.js +5 -4
- package/dist/client/MCPClient.js.map +1 -1
- package/dist/config/auth-config.d.ts +16 -0
- package/dist/config/auth-config.d.ts.map +1 -0
- package/dist/config/auth-config.js +107 -0
- package/dist/config/auth-config.js.map +1 -0
- package/dist/constant/constant.d.ts +20 -0
- package/dist/constant/constant.d.ts.map +1 -0
- package/dist/constant/constant.js +24 -0
- package/dist/constant/constant.js.map +1 -0
- package/dist/database/async-datastore.d.ts +6 -0
- package/dist/database/async-datastore.d.ts.map +1 -0
- package/dist/database/async-datastore.js +15 -0
- package/dist/database/async-datastore.js.map +1 -0
- package/dist/database/database-utils.d.ts +6 -0
- package/dist/database/database-utils.d.ts.map +1 -0
- package/dist/database/database-utils.js +29 -0
- package/dist/database/database-utils.js.map +1 -0
- package/dist/database/datastore.d.ts +164 -0
- package/dist/database/datastore.d.ts.map +1 -0
- package/dist/{parsers/types/index.js → database/datastore.js} +1 -0
- package/dist/database/datastore.js.map +1 -0
- package/dist/database/factory.d.ts +4 -0
- package/dist/database/factory.d.ts.map +1 -0
- package/dist/database/factory.js +32 -0
- package/dist/database/factory.js.map +1 -0
- package/dist/database/jdbc-manager.d.ts +49 -0
- package/dist/database/jdbc-manager.d.ts.map +1 -0
- package/dist/database/jdbc-manager.js +50 -0
- package/dist/database/jdbc-manager.js.map +1 -0
- package/dist/database/sqlite-manager.d.ts +46 -44
- package/dist/database/sqlite-manager.d.ts.map +1 -1
- package/dist/database/sqlite-manager.js +492 -42
- package/dist/database/sqlite-manager.js.map +1 -1
- package/dist/database/supabase-manager.d.ts +58 -0
- package/dist/database/supabase-manager.d.ts.map +1 -0
- package/dist/database/supabase-manager.js +432 -0
- package/dist/database/supabase-manager.js.map +1 -0
- package/dist/generators/MCPServerGenerator.d.ts +103 -20
- package/dist/generators/MCPServerGenerator.d.ts.map +1 -1
- package/dist/generators/MCPServerGenerator.js +6930 -128
- package/dist/generators/MCPServerGenerator.js.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -1
- package/dist/index.js.map +1 -1
- package/dist/integrated-mcp-server-new.d.ts +14 -2
- package/dist/integrated-mcp-server-new.d.ts.map +1 -1
- package/dist/integrated-mcp-server-new.js +270 -180
- package/dist/integrated-mcp-server-new.js.map +1 -1
- package/dist/mcp-core/McpCoreService.d.ts +63 -0
- package/dist/mcp-core/McpCoreService.d.ts.map +1 -0
- package/dist/mcp-core/McpCoreService.js +492 -0
- package/dist/mcp-core/McpCoreService.js.map +1 -0
- package/dist/parsers/CsvParser.d.ts +1 -1
- package/dist/parsers/CsvParser.d.ts.map +1 -1
- package/dist/parsers/CsvParser.js +3 -2
- package/dist/parsers/CsvParser.js.map +1 -1
- package/dist/parsers/DatabaseParser.d.ts.map +1 -1
- package/dist/parsers/DatabaseParser.js +9 -8
- package/dist/parsers/DatabaseParser.js.map +1 -1
- package/dist/parsers/ExcelParser.d.ts +15 -0
- package/dist/parsers/ExcelParser.d.ts.map +1 -1
- package/dist/parsers/ExcelParser.js +287 -21
- package/dist/parsers/ExcelParser.js.map +1 -1
- package/dist/parsers/WebPageParser.d.ts +5 -0
- package/dist/parsers/WebPageParser.d.ts.map +1 -0
- package/dist/parsers/WebPageParser.js +35 -0
- package/dist/parsers/WebPageParser.js.map +1 -0
- package/dist/parsers/index.d.ts +3 -2
- package/dist/parsers/index.d.ts.map +1 -1
- package/dist/parsers/index.js +19 -16
- package/dist/parsers/index.js.map +1 -1
- package/dist/server/api/askApi.d.ts +41 -0
- package/dist/server/api/askApi.d.ts.map +1 -0
- package/dist/server/api/askApi.js +479 -0
- package/dist/server/api/askApi.js.map +1 -0
- package/dist/server/api/authApi.d.ts +101 -0
- package/dist/server/api/authApi.d.ts.map +1 -0
- package/dist/server/api/authApi.js +1472 -0
- package/dist/server/api/authApi.js.map +1 -0
- package/dist/server/api/authProperty.d.ts +18 -0
- package/dist/server/api/authProperty.d.ts.map +1 -0
- package/dist/server/api/authProperty.js +41 -0
- package/dist/server/api/authProperty.js.map +1 -0
- package/dist/server/api/configApi.d.ts +15 -0
- package/dist/server/api/configApi.d.ts.map +1 -0
- package/dist/server/api/configApi.js +42 -0
- package/dist/server/api/configApi.js.map +1 -0
- package/dist/server/api/databaseApi.d.ts +14 -0
- package/dist/server/api/databaseApi.d.ts.map +1 -0
- package/dist/server/api/databaseApi.js +111 -0
- package/dist/server/api/databaseApi.js.map +1 -0
- package/dist/server/api/directoryApi.d.ts +9 -0
- package/dist/server/api/directoryApi.d.ts.map +1 -0
- package/dist/server/api/directoryApi.js +103 -0
- package/dist/server/api/directoryApi.js.map +1 -0
- package/dist/server/api/generateApi.d.ts +24 -0
- package/dist/server/api/generateApi.d.ts.map +1 -0
- package/dist/server/api/generateApi.js +457 -0
- package/dist/server/api/generateApi.js.map +1 -0
- package/dist/server/api/healthApi.d.ts +9 -0
- package/dist/server/api/healthApi.d.ts.map +1 -0
- package/dist/server/api/healthApi.js +15 -0
- package/dist/server/api/healthApi.js.map +1 -0
- package/dist/server/api/indexApi.d.ts +21 -0
- package/dist/server/api/indexApi.d.ts.map +1 -0
- package/dist/server/api/indexApi.js +61 -0
- package/dist/server/api/indexApi.js.map +1 -0
- package/dist/server/api/logsApi.d.ts +12 -0
- package/dist/server/api/logsApi.d.ts.map +1 -0
- package/dist/server/api/logsApi.js +37 -0
- package/dist/server/api/logsApi.js.map +1 -0
- package/dist/server/api/mcpApi.d.ts +20 -0
- package/dist/server/api/mcpApi.d.ts.map +1 -0
- package/dist/server/api/mcpApi.js +120 -0
- package/dist/server/api/mcpApi.js.map +1 -0
- package/dist/server/api/nameApi.d.ts +21 -0
- package/dist/server/api/nameApi.d.ts.map +1 -0
- package/dist/server/api/nameApi.js +42 -0
- package/dist/server/api/nameApi.js.map +1 -0
- package/dist/server/api/parseApi.d.ts +9 -0
- package/dist/server/api/parseApi.d.ts.map +1 -0
- package/dist/server/api/parseApi.js +3245 -0
- package/dist/server/api/parseApi.js.map +1 -0
- package/dist/server/api/serverApi.d.ts +44 -0
- package/dist/server/api/serverApi.d.ts.map +1 -0
- package/dist/server/api/serverApi.js +417 -0
- package/dist/server/api/serverApi.js.map +1 -0
- package/dist/{dynamic-mcp-executor.d.ts → server/dynamic-mcp-executor.d.ts} +4 -5
- package/dist/server/dynamic-mcp-executor.d.ts.map +1 -0
- package/dist/server/dynamic-mcp-executor.js +62 -0
- package/dist/server/dynamic-mcp-executor.js.map +1 -0
- package/dist/server/port-utils.d.ts +14 -0
- package/dist/server/port-utils.d.ts.map +1 -0
- package/dist/server/port-utils.js +31 -0
- package/dist/server/port-utils.js.map +1 -0
- package/dist/server/server-utils.d.ts +13 -0
- package/dist/server/server-utils.d.ts.map +1 -0
- package/dist/server/server-utils.js +72 -0
- package/dist/server/server-utils.js.map +1 -0
- package/dist/{web → server}/server.d.ts +1 -0
- package/dist/server/server.d.ts.map +1 -0
- package/dist/server/server.js +535 -0
- package/dist/server/server.js.map +1 -0
- package/dist/server/tool-executer.d.ts +101 -0
- package/dist/server/tool-executer.d.ts.map +1 -0
- package/dist/server/tool-executer.js +6198 -0
- package/dist/server/tool-executer.js.map +1 -0
- package/dist/types/index.d.ts +1197 -4
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +1028 -0
- package/dist/types/index.js.map +1 -1
- package/dist/upload/upload-utils.d.ts +4 -0
- package/dist/upload/upload-utils.d.ts.map +1 -0
- package/dist/upload/upload-utils.js +29 -0
- package/dist/upload/upload-utils.js.map +1 -0
- package/dist/utils/deployment-util.d.ts +14 -0
- package/dist/utils/deployment-util.d.ts.map +1 -0
- package/dist/utils/deployment-util.js +46 -0
- package/dist/utils/deployment-util.js.map +1 -0
- package/dist/utils/logger.d.ts +15 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +56 -0
- package/dist/utils/logger.js.map +1 -0
- package/package.json +18 -6
- package/quickmcp-direct-stdio.js +176 -187
- package/src/web/public/app.js +15370 -1471
- package/src/web/public/authorization.html +868 -0
- package/src/web/public/database-tables.html +283 -547
- package/src/web/public/how-to-use.html +446 -462
- package/src/web/public/how-to-use.js +4 -4
- package/src/web/public/images/app/activepieces.png +0 -0
- package/src/web/public/images/app/airtable.png +0 -0
- package/src/web/public/images/app/androidstudio.png +0 -0
- package/src/web/public/images/app/antigravity.png +0 -0
- package/src/web/public/images/app/applenotes.png +0 -0
- package/src/web/public/images/app/applereminders.png +0 -0
- package/src/web/public/images/app/asana.png +0 -0
- package/src/web/public/images/app/azureai.png +0 -0
- package/src/web/public/images/app/bash.png +0 -0
- package/src/web/public/images/app/bearnotes.png +0 -0
- package/src/web/public/images/app/bitbucket.png +0 -0
- package/src/web/public/images/app/claude.png +0 -0
- package/src/web/public/images/app/cli.png +0 -0
- package/src/web/public/images/app/clickup.png +0 -0
- package/src/web/public/images/app/cohere.png +0 -0
- package/src/web/public/images/app/confluence.png +0 -0
- package/src/web/public/images/app/confluence2.png +0 -0
- package/src/web/public/images/app/curl.png +0 -0
- package/src/web/public/images/app/curl_mini.png +0 -0
- package/src/web/public/images/app/cursor.png +0 -0
- package/src/web/public/images/app/db2.png +0 -0
- package/src/web/public/images/app/deepseek.png +0 -0
- package/src/web/public/images/app/discord.png +0 -0
- package/src/web/public/images/app/docker.png +0 -0
- package/src/web/public/images/app/dockerhub.png +0 -0
- package/src/web/public/images/app/dropbox.png +0 -0
- package/src/web/public/images/app/elasticsearch.png +0 -0
- package/src/web/public/images/app/facebook.png +0 -0
- package/src/web/public/images/app/falai.png +0 -0
- package/src/web/public/images/app/fireworks.png +0 -0
- package/src/web/public/images/app/gdrive.png +0 -0
- package/src/web/public/images/app/gemini.png +0 -0
- package/src/web/public/images/app/github.png +0 -0
- package/src/web/public/images/app/githubcopilot.png +0 -0
- package/src/web/public/images/app/gitlab.png +0 -0
- package/src/web/public/images/app/gmail.png +0 -0
- package/src/web/public/images/app/googlecalender.png +0 -0
- package/src/web/public/images/app/googledocs.png +0 -0
- package/src/web/public/images/app/googlesheets.png +0 -0
- package/src/web/public/images/app/gradle.png +0 -0
- package/src/web/public/images/app/grafana.png +0 -0
- package/src/web/public/images/app/graphql.png +0 -0
- package/src/web/public/images/app/grok.png +0 -0
- package/src/web/public/images/app/groq.png +0 -0
- package/src/web/public/images/app/hazelcast.png +0 -0
- package/src/web/public/images/app/huggingface.png +0 -0
- package/src/web/public/images/app/imessage.png +0 -0
- package/src/web/public/images/app/instagram.png +0 -0
- package/src/web/public/images/app/intellij.png +0 -0
- package/src/web/public/images/app/jenkins.png +0 -0
- package/src/web/public/images/app/jira.png +0 -0
- package/src/web/public/images/app/kafka.png +0 -0
- package/src/web/public/images/app/kubernetes.png +0 -0
- package/src/web/public/images/app/linear.png +0 -0
- package/src/web/public/images/app/linkedin.png +0 -0
- package/src/web/public/images/app/llama.png +0 -0
- package/src/web/public/images/app/make.png +0 -0
- package/src/web/public/images/app/maven.png +0 -0
- package/src/web/public/images/app/mcp.png +0 -0
- package/src/web/public/images/app/microsoftteams.png +0 -0
- package/src/web/public/images/app/mistral.png +0 -0
- package/src/web/public/images/app/monday.png +0 -0
- package/src/web/public/images/app/mongodb.png +0 -0
- package/src/web/public/images/app/mssql.png +0 -0
- package/src/web/public/images/app/mysql.png +0 -0
- package/src/web/public/images/app/n8n.png +0 -0
- package/src/web/public/images/app/notion.png +0 -0
- package/src/web/public/images/app/npm.png +0 -0
- package/src/web/public/images/app/nuget.png +0 -0
- package/src/web/public/images/app/obsidian.png +0 -0
- package/src/web/public/images/app/openai.png +0 -0
- package/src/web/public/images/app/openrouter.png +0 -0
- package/src/web/public/images/app/opensearch.png +0 -0
- package/src/web/public/images/app/openshift.png +0 -0
- package/src/web/public/images/app/oracle.png +0 -0
- package/src/web/public/images/app/perplexity.png +0 -0
- package/src/web/public/images/app/pipedream.png +0 -0
- package/src/web/public/images/app/postgresql.png +0 -0
- package/src/web/public/images/app/powershell.png +0 -0
- package/src/web/public/images/app/prometheus.png +0 -0
- package/src/web/public/images/app/reddit.png +0 -0
- package/src/web/public/images/app/redis.png +0 -0
- package/src/web/public/images/app/rss.png +0 -0
- package/src/web/public/images/app/signal.png +0 -0
- package/src/web/public/images/app/slack.png +0 -0
- package/src/web/public/images/app/soap.png +0 -0
- package/src/web/public/images/app/sqlite.png +0 -0
- package/src/web/public/images/app/supabase.png +0 -0
- package/src/web/public/images/app/telegram.png +0 -0
- package/src/web/public/images/app/things3.png +0 -0
- package/src/web/public/images/app/threads.png +0 -0
- package/src/web/public/images/app/tiktok.png +0 -0
- package/src/web/public/images/app/together.png +0 -0
- package/src/web/public/images/app/trello.png +0 -0
- package/src/web/public/images/app/vscode.png +0 -0
- package/src/web/public/images/app/webhook.png +0 -0
- package/src/web/public/images/app/webpage.png +0 -0
- package/src/web/public/images/app/whatsappbusiness.png +0 -0
- package/src/web/public/images/app/windsorf.png +0 -0
- package/src/web/public/images/app/x.png +0 -0
- package/src/web/public/images/app/youtube.png +0 -0
- package/src/web/public/images/app/zapier.png +0 -0
- package/src/web/public/images/app/zededitor.png +0 -0
- package/src/web/public/images/app/zoom.png +0 -0
- package/src/web/public/images/avatar-anon.svg +4 -0
- package/src/web/public/images/favicon.png +0 -0
- package/src/web/public/images/install/chatgpt-web/step0.png +0 -0
- package/src/web/public/images/install/chatgpt-web/step1.png +0 -0
- package/src/web/public/images/install/chatgpt-web/step2.png +0 -0
- package/src/web/public/images/install/chatgpt-web/step3.png +0 -0
- package/src/web/public/images/install/chatgpt-web/step4.png +0 -0
- package/src/web/public/images/install/chatgpt-web/step5.png +0 -0
- package/src/web/public/images/readme/1-generate-servers.png +0 -0
- package/src/web/public/images/readme/2-database-connection.png +0 -0
- package/src/web/public/images/readme/2-file-upload.png +0 -0
- package/src/web/public/images/readme/3-data-preview.png +0 -0
- package/src/web/public/images/readme/4-data-preview2.png +0 -0
- package/src/web/public/images/readme/5-server-configuration.png +0 -0
- package/src/web/public/images/readme/6-server-generated-modal.png +0 -0
- package/src/web/public/images/readme/7-generated-servers.png +0 -0
- package/src/web/public/images/readme/8-generated-servers-view-details.png +0 -0
- package/src/web/public/images/readme/Screenshot 2025-10-09 at 20.23.51.png +0 -0
- package/src/web/public/images/readme/Screenshot 2025-10-09 at 20.24.59.png +0 -0
- package/src/web/public/images/readme/Screenshot 2025-10-09 at 20.25.05.png +0 -0
- package/src/web/public/images/readme/Screenshot 2025-10-09 at 20.25.14.png +0 -0
- package/src/web/public/images/readme/Screenshot 2025-10-09 at 20.25.21.png +0 -0
- package/src/web/public/images/readme/Screenshot 2025-10-09 at 20.25.36.png +0 -0
- package/src/web/public/index.html +4685 -488
- package/src/web/public/landing.html +1638 -0
- package/src/web/public/logger.js +31 -0
- package/src/web/public/login.html +372 -0
- package/src/web/public/manage-servers.html +121 -188
- package/src/web/public/pricing.html +537 -0
- package/src/web/public/quick-ask.html +133 -0
- package/src/web/public/quickmcp-styles.css +708 -0
- package/src/web/public/roles.html +177 -0
- package/src/web/public/shared.js +736 -3
- package/src/web/public/sidebar.js +414 -0
- package/src/web/public/test-servers.html +605 -221
- package/src/web/public/users.html +191 -0
- package/dist/client/MCPClientUnified.d.ts +0 -31
- package/dist/client/MCPClientUnified.d.ts.map +0 -1
- package/dist/client/MCPClientUnified.js +0 -275
- package/dist/client/MCPClientUnified.js.map +0 -1
- package/dist/client/MCPTestRunnerUnified.d.ts +0 -48
- package/dist/client/MCPTestRunnerUnified.d.ts.map +0 -1
- package/dist/client/MCPTestRunnerUnified.js +0 -183
- package/dist/client/MCPTestRunnerUnified.js.map +0 -1
- package/dist/database/json-manager.d.ts +0 -55
- package/dist/database/json-manager.d.ts.map +0 -1
- package/dist/database/json-manager.js +0 -128
- package/dist/database/json-manager.js.map +0 -1
- package/dist/dynamic-mcp-executor.d.ts.map +0 -1
- package/dist/dynamic-mcp-executor.js +0 -274
- package/dist/dynamic-mcp-executor.js.map +0 -1
- package/dist/generators/MCPServerGenerator-new.d.ts +0 -37
- package/dist/generators/MCPServerGenerator-new.d.ts.map +0 -1
- package/dist/generators/MCPServerGenerator-new.js +0 -287
- package/dist/generators/MCPServerGenerator-new.js.map +0 -1
- package/dist/generators/database/sqlite-manager.d.ts +0 -52
- package/dist/generators/database/sqlite-manager.js +0 -143
- package/dist/generators/generators/MCPServerGenerator.d.ts +0 -37
- package/dist/generators/generators/MCPServerGenerator.js +0 -396
- package/dist/integrated-mcp-server.d.ts +0 -25
- package/dist/integrated-mcp-server.d.ts.map +0 -1
- package/dist/integrated-mcp-server.js +0 -541
- package/dist/integrated-mcp-server.js.map +0 -1
- package/dist/mcp-inspector-server.d.ts +0 -3
- package/dist/mcp-inspector-server.d.ts.map +0 -1
- package/dist/mcp-inspector-server.js +0 -119
- package/dist/mcp-inspector-server.js.map +0 -1
- package/dist/mcp-sdk-server.d.ts +0 -3
- package/dist/mcp-sdk-server.d.ts.map +0 -1
- package/dist/mcp-sdk-server.js +0 -90
- package/dist/mcp-sdk-server.js.map +0 -1
- package/dist/mcp-server.d.ts +0 -3
- package/dist/mcp-server.d.ts.map +0 -1
- package/dist/mcp-server.js +0 -300
- package/dist/mcp-server.js.map +0 -1
- package/dist/parsers/parsers/ExcelParser.js +0 -118
- package/dist/quickmcp-unified-bridge.d.ts +0 -13
- package/dist/quickmcp-unified-bridge.d.ts.map +0 -1
- package/dist/quickmcp-unified-bridge.js +0 -176
- package/dist/quickmcp-unified-bridge.js.map +0 -1
- package/dist/sqlite-manager.js +0 -145
- package/dist/test-app.d.ts +0 -2
- package/dist/test-app.d.ts.map +0 -1
- package/dist/test-app.js +0 -119
- package/dist/test-app.js.map +0 -1
- package/dist/transport/base-transport.d.ts +0 -21
- package/dist/transport/base-transport.d.ts.map +0 -1
- package/dist/transport/base-transport.js +0 -16
- package/dist/transport/base-transport.js.map +0 -1
- package/dist/transport/index.d.ts +0 -10
- package/dist/transport/index.d.ts.map +0 -1
- package/dist/transport/index.js +0 -12
- package/dist/transport/index.js.map +0 -1
- package/dist/transport/sse-transport.d.ts +0 -13
- package/dist/transport/sse-transport.d.ts.map +0 -1
- package/dist/transport/sse-transport.js +0 -106
- package/dist/transport/sse-transport.js.map +0 -1
- package/dist/transport/stdio-transport.d.ts +0 -8
- package/dist/transport/stdio-transport.d.ts.map +0 -1
- package/dist/transport/stdio-transport.js +0 -53
- package/dist/transport/stdio-transport.js.map +0 -1
- package/dist/transport/streamable-http-transport.d.ts +0 -15
- package/dist/transport/streamable-http-transport.d.ts.map +0 -1
- package/dist/transport/streamable-http-transport.js +0 -151
- package/dist/transport/streamable-http-transport.js.map +0 -1
- package/dist/web/client/MCPClient.js +0 -348
- package/dist/web/client/MCPTestRunner.js +0 -317
- package/dist/web/database/json-manager.js +0 -124
- package/dist/web/database/sqlite-manager.js +0 -146
- package/dist/web/dynamic-mcp-executor.js +0 -443
- package/dist/web/generators/MCPServerGenerator-new.js +0 -284
- package/dist/web/generators/MCPServerGenerator.js +0 -566
- package/dist/web/integrated-mcp-server-new.js +0 -394
- package/dist/web/parsers/CsvParser.js +0 -144
- package/dist/web/parsers/DatabaseParser.js +0 -637
- package/dist/web/parsers/ExcelParser.js +0 -180
- package/dist/web/parsers/index.js +0 -152
- package/dist/web/server.d.ts.map +0 -1
- package/dist/web/server.js +0 -790
- package/dist/web/server.js.map +0 -1
- package/dist/web/types/index.js +0 -2
- package/dist/web/web/server.js +0 -860
- package/src/web/public/modern-styles.css +0 -946
- package/src/web/public/shared-styles.css +0 -2091
- /package/src/web/public/images/{1-claude-quickmcp-stdio.png → readme/1-claude-quickmcp-stdio.png} +0 -0
- /package/src/web/public/images/{2-claude-tools.png → readme/2-claude-tools.png} +0 -0
- /package/src/web/public/images/{3-claude-developer-settings.png → readme/3-claude-developer-settings.png} +0 -0
- /package/src/web/public/images/{4-claude-config.png → readme/4-claude-config.png} +0 -0
- /package/src/web/public/images/{5-claude-config-edit.png → readme/5-claude-config-edit.png} +0 -0
|
@@ -9,8 +9,6 @@ const path_1 = __importDefault(require("path"));
|
|
|
9
9
|
const fs_1 = __importDefault(require("fs"));
|
|
10
10
|
class SQLiteManager {
|
|
11
11
|
constructor() {
|
|
12
|
-
// Resolve data directory relative to the project root (not process.cwd())
|
|
13
|
-
// This prevents attempts to write to "/data" when the process CWD is '/'.
|
|
14
12
|
const projectRoot = path_1.default.resolve(__dirname, '..', '..');
|
|
15
13
|
const configuredDir = process.env.QUICKMCP_DATA_DIR;
|
|
16
14
|
const dbDir = configuredDir
|
|
@@ -26,17 +24,22 @@ class SQLiteManager {
|
|
|
26
24
|
this.initializeTables();
|
|
27
25
|
}
|
|
28
26
|
initializeTables() {
|
|
29
|
-
// Servers table
|
|
30
27
|
this.db.exec(`
|
|
31
28
|
CREATE TABLE IF NOT EXISTS servers (
|
|
32
29
|
id TEXT PRIMARY KEY,
|
|
33
30
|
name TEXT NOT NULL,
|
|
34
|
-
|
|
31
|
+
version TEXT NOT NULL DEFAULT '1.0.0',
|
|
32
|
+
owner_username TEXT NOT NULL DEFAULT 'guest',
|
|
33
|
+
source_config TEXT NOT NULL,
|
|
35
34
|
created_at TEXT NOT NULL,
|
|
36
35
|
updated_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP
|
|
37
36
|
)
|
|
38
37
|
`);
|
|
39
|
-
|
|
38
|
+
const serverCols = this.db.prepare(`PRAGMA table_info(servers)`).all();
|
|
39
|
+
const hasVersion = serverCols.some((col) => col.name === 'version');
|
|
40
|
+
if (!hasVersion) {
|
|
41
|
+
this.db.exec(`ALTER TABLE servers ADD COLUMN version TEXT NOT NULL DEFAULT '1.0.0'`);
|
|
42
|
+
}
|
|
40
43
|
this.db.exec(`
|
|
41
44
|
CREATE TABLE IF NOT EXISTS tools (
|
|
42
45
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
@@ -51,7 +54,6 @@ class SQLiteManager {
|
|
|
51
54
|
UNIQUE(server_id, name)
|
|
52
55
|
)
|
|
53
56
|
`);
|
|
54
|
-
// Resources table
|
|
55
57
|
this.db.exec(`
|
|
56
58
|
CREATE TABLE IF NOT EXISTS resources (
|
|
57
59
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
@@ -65,56 +67,209 @@ class SQLiteManager {
|
|
|
65
67
|
UNIQUE(server_id, name)
|
|
66
68
|
)
|
|
67
69
|
`);
|
|
68
|
-
|
|
70
|
+
this.db.exec(`
|
|
71
|
+
CREATE TABLE IF NOT EXISTS refresh_tokens (
|
|
72
|
+
token_hash TEXT PRIMARY KEY,
|
|
73
|
+
username TEXT NOT NULL,
|
|
74
|
+
expires_at TEXT NOT NULL,
|
|
75
|
+
created_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
76
|
+
revoked_at TEXT
|
|
77
|
+
)
|
|
78
|
+
`);
|
|
79
|
+
this.db.exec(`
|
|
80
|
+
CREATE TABLE IF NOT EXISTS users (
|
|
81
|
+
username TEXT PRIMARY KEY,
|
|
82
|
+
workspace_id TEXT NOT NULL DEFAULT 'default',
|
|
83
|
+
password_hash TEXT NOT NULL,
|
|
84
|
+
role TEXT NOT NULL CHECK (role IN ('admin', 'user')),
|
|
85
|
+
created_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
86
|
+
updated_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP
|
|
87
|
+
)
|
|
88
|
+
`);
|
|
89
|
+
const userCols = this.db.prepare(`PRAGMA table_info(users)`).all();
|
|
90
|
+
const hasWorkspaceId = userCols.some((col) => col.name === 'workspace_id');
|
|
91
|
+
if (!hasWorkspaceId) {
|
|
92
|
+
this.db.exec(`ALTER TABLE users ADD COLUMN workspace_id TEXT NOT NULL DEFAULT 'default'`);
|
|
93
|
+
}
|
|
94
|
+
this.db.exec(`UPDATE users SET workspace_id = username WHERE workspace_id IS NULL OR workspace_id = '' OR workspace_id = 'default'`);
|
|
95
|
+
this.db.exec(`
|
|
96
|
+
CREATE TABLE IF NOT EXISTS server_auth_config (
|
|
97
|
+
server_id TEXT PRIMARY KEY,
|
|
98
|
+
require_mcp_token INTEGER NOT NULL DEFAULT 1,
|
|
99
|
+
updated_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
100
|
+
FOREIGN KEY (server_id) REFERENCES servers (id) ON DELETE CASCADE
|
|
101
|
+
)
|
|
102
|
+
`);
|
|
103
|
+
this.db.exec(`
|
|
104
|
+
CREATE TABLE IF NOT EXISTS mcp_tokens (
|
|
105
|
+
id TEXT PRIMARY KEY,
|
|
106
|
+
token_name TEXT NOT NULL DEFAULT '',
|
|
107
|
+
workspace_id TEXT NOT NULL,
|
|
108
|
+
subject_username TEXT NOT NULL,
|
|
109
|
+
created_by TEXT NOT NULL,
|
|
110
|
+
token_hash TEXT NOT NULL UNIQUE,
|
|
111
|
+
token_value TEXT NOT NULL,
|
|
112
|
+
allow_all_servers INTEGER NOT NULL DEFAULT 1,
|
|
113
|
+
allow_all_tools INTEGER NOT NULL DEFAULT 1,
|
|
114
|
+
allow_all_resources INTEGER NOT NULL DEFAULT 1,
|
|
115
|
+
server_ids_json TEXT NOT NULL DEFAULT '[]',
|
|
116
|
+
allowed_tools_json TEXT NOT NULL DEFAULT '[]',
|
|
117
|
+
allowed_resources_json TEXT NOT NULL DEFAULT '[]',
|
|
118
|
+
server_rules_json TEXT NOT NULL DEFAULT '{}',
|
|
119
|
+
tool_rules_json TEXT NOT NULL DEFAULT '{}',
|
|
120
|
+
resource_rules_json TEXT NOT NULL DEFAULT '{}',
|
|
121
|
+
never_expires INTEGER NOT NULL DEFAULT 0,
|
|
122
|
+
expires_at TEXT,
|
|
123
|
+
created_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
124
|
+
revoked_at TEXT
|
|
125
|
+
)
|
|
126
|
+
`);
|
|
127
|
+
this.db.exec(`
|
|
128
|
+
CREATE TABLE IF NOT EXISTS mcp_token_policies (
|
|
129
|
+
scope_type TEXT NOT NULL CHECK (scope_type IN ('global', 'user', 'server', 'tool')),
|
|
130
|
+
scope_id TEXT NOT NULL,
|
|
131
|
+
require_mcp_token INTEGER NOT NULL CHECK (require_mcp_token IN (0, 1)),
|
|
132
|
+
updated_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
133
|
+
PRIMARY KEY (scope_type, scope_id)
|
|
134
|
+
)
|
|
135
|
+
`);
|
|
136
|
+
const mcpCols = this.db.prepare(`PRAGMA table_info(mcp_tokens)`).all();
|
|
137
|
+
const hasTokenName = mcpCols.some((col) => col.name === 'token_name');
|
|
138
|
+
const hasAllowAllTools = mcpCols.some((col) => col.name === 'allow_all_tools');
|
|
139
|
+
const hasAllowAllResources = mcpCols.some((col) => col.name === 'allow_all_resources');
|
|
140
|
+
const hasAllowedTools = mcpCols.some((col) => col.name === 'allowed_tools_json');
|
|
141
|
+
const hasAllowedResources = mcpCols.some((col) => col.name === 'allowed_resources_json');
|
|
142
|
+
const hasServerRules = mcpCols.some((col) => col.name === 'server_rules_json');
|
|
143
|
+
const hasToolRules = mcpCols.some((col) => col.name === 'tool_rules_json');
|
|
144
|
+
const hasResourceRules = mcpCols.some((col) => col.name === 'resource_rules_json');
|
|
145
|
+
if (!hasTokenName)
|
|
146
|
+
this.db.exec(`ALTER TABLE mcp_tokens ADD COLUMN token_name TEXT NOT NULL DEFAULT ''`);
|
|
147
|
+
if (!hasAllowAllTools)
|
|
148
|
+
this.db.exec(`ALTER TABLE mcp_tokens ADD COLUMN allow_all_tools INTEGER NOT NULL DEFAULT 1`);
|
|
149
|
+
if (!hasAllowAllResources)
|
|
150
|
+
this.db.exec(`ALTER TABLE mcp_tokens ADD COLUMN allow_all_resources INTEGER NOT NULL DEFAULT 1`);
|
|
151
|
+
if (!hasAllowedTools)
|
|
152
|
+
this.db.exec(`ALTER TABLE mcp_tokens ADD COLUMN allowed_tools_json TEXT NOT NULL DEFAULT '[]'`);
|
|
153
|
+
if (!hasAllowedResources)
|
|
154
|
+
this.db.exec(`ALTER TABLE mcp_tokens ADD COLUMN allowed_resources_json TEXT NOT NULL DEFAULT '[]'`);
|
|
155
|
+
if (!hasServerRules)
|
|
156
|
+
this.db.exec(`ALTER TABLE mcp_tokens ADD COLUMN server_rules_json TEXT NOT NULL DEFAULT '{}'`);
|
|
157
|
+
if (!hasToolRules)
|
|
158
|
+
this.db.exec(`ALTER TABLE mcp_tokens ADD COLUMN tool_rules_json TEXT NOT NULL DEFAULT '{}'`);
|
|
159
|
+
if (!hasResourceRules)
|
|
160
|
+
this.db.exec(`ALTER TABLE mcp_tokens ADD COLUMN resource_rules_json TEXT NOT NULL DEFAULT '{}'`);
|
|
161
|
+
this.db.exec(`
|
|
162
|
+
CREATE TABLE IF NOT EXISTS app_logs (
|
|
163
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
164
|
+
username TEXT NOT NULL DEFAULT '',
|
|
165
|
+
severity TEXT NOT NULL CHECK (severity IN ('trace', 'debug', 'info', 'warn', 'error')),
|
|
166
|
+
message TEXT NOT NULL,
|
|
167
|
+
datetime TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
168
|
+
additional_info TEXT
|
|
169
|
+
)
|
|
170
|
+
`);
|
|
171
|
+
const hasQuickAskState = this.db
|
|
172
|
+
.prepare(`SELECT name FROM sqlite_master WHERE type = 'table' AND name = 'quick_ask_state'`)
|
|
173
|
+
.get();
|
|
174
|
+
const hasChatState = this.db
|
|
175
|
+
.prepare(`SELECT name FROM sqlite_master WHERE type = 'table' AND name = 'chat_state'`)
|
|
176
|
+
.get();
|
|
177
|
+
if (!hasChatState && hasQuickAskState) {
|
|
178
|
+
this.db.exec(`ALTER TABLE quick_ask_state RENAME TO chat_state`);
|
|
179
|
+
}
|
|
180
|
+
this.db.exec(`
|
|
181
|
+
CREATE TABLE IF NOT EXISTS chat_state (
|
|
182
|
+
workspace_id TEXT PRIMARY KEY,
|
|
183
|
+
chats_json TEXT NOT NULL DEFAULT '[]',
|
|
184
|
+
current_chat_id TEXT NOT NULL DEFAULT '',
|
|
185
|
+
updated_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP
|
|
186
|
+
)
|
|
187
|
+
`);
|
|
188
|
+
this.db.exec(`CREATE INDEX IF NOT EXISTS idx_servers_owner ON servers(owner_username)`);
|
|
189
|
+
this.db.exec(`CREATE INDEX IF NOT EXISTS idx_refresh_tokens_user ON refresh_tokens(username)`);
|
|
190
|
+
this.db.exec(`CREATE INDEX IF NOT EXISTS idx_users_role ON users(role)`);
|
|
191
|
+
this.db.exec(`CREATE INDEX IF NOT EXISTS idx_users_workspace ON users(workspace_id)`);
|
|
192
|
+
this.db.exec(`CREATE INDEX IF NOT EXISTS idx_server_auth_required ON server_auth_config(require_mcp_token)`);
|
|
193
|
+
this.db.exec(`CREATE INDEX IF NOT EXISTS idx_mcp_tokens_workspace ON mcp_tokens(workspace_id)`);
|
|
194
|
+
this.db.exec(`CREATE INDEX IF NOT EXISTS idx_mcp_tokens_hash ON mcp_tokens(token_hash)`);
|
|
195
|
+
this.db.exec(`CREATE INDEX IF NOT EXISTS idx_mcp_token_policies_scope ON mcp_token_policies(scope_type)`);
|
|
196
|
+
this.db.exec(`CREATE INDEX IF NOT EXISTS idx_app_logs_severity ON app_logs(severity)`);
|
|
197
|
+
this.db.exec(`CREATE INDEX IF NOT EXISTS idx_app_logs_datetime ON app_logs(datetime)`);
|
|
198
|
+
this.db.exec(`CREATE INDEX IF NOT EXISTS idx_app_logs_username ON app_logs(username)`);
|
|
69
199
|
}
|
|
70
|
-
|
|
71
|
-
saveServer(server) {
|
|
200
|
+
async saveServer(server) {
|
|
72
201
|
const stmt = this.db.prepare(`
|
|
73
|
-
INSERT
|
|
74
|
-
VALUES (?, ?, ?, ?, CURRENT_TIMESTAMP)
|
|
202
|
+
INSERT INTO servers (id, name, version, owner_username, source_config, created_at, updated_at)
|
|
203
|
+
VALUES (?, ?, ?, ?, ?, ?, CURRENT_TIMESTAMP)
|
|
204
|
+
ON CONFLICT(id) DO UPDATE SET
|
|
205
|
+
name = excluded.name,
|
|
206
|
+
version = excluded.version,
|
|
207
|
+
owner_username = excluded.owner_username,
|
|
208
|
+
source_config = excluded.source_config,
|
|
209
|
+
created_at = excluded.created_at,
|
|
210
|
+
updated_at = CURRENT_TIMESTAMP
|
|
75
211
|
`);
|
|
76
|
-
stmt.run(server.id, server.name, JSON.stringify(server.
|
|
212
|
+
stmt.run(server.id, server.name, server.version || '1.0.0', server.ownerUsername, JSON.stringify(server.sourceConfig), server.createdAt);
|
|
77
213
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
214
|
+
mapServerRow(row) {
|
|
215
|
+
let parsedConfig = {};
|
|
216
|
+
try {
|
|
217
|
+
parsedConfig = JSON.parse(row.source_config);
|
|
218
|
+
}
|
|
219
|
+
catch {
|
|
220
|
+
parsedConfig = {};
|
|
221
|
+
}
|
|
83
222
|
return {
|
|
84
223
|
id: row.id,
|
|
85
224
|
name: row.name,
|
|
86
|
-
|
|
225
|
+
version: row.version || '1.0.0',
|
|
226
|
+
ownerUsername: row.owner_username || 'guest',
|
|
227
|
+
sourceConfig: parsedConfig,
|
|
87
228
|
createdAt: row.created_at
|
|
88
229
|
};
|
|
89
230
|
}
|
|
90
|
-
|
|
231
|
+
async getServer(serverId) {
|
|
232
|
+
const stmt = this.db.prepare('SELECT * FROM servers WHERE id = ?');
|
|
233
|
+
const row = stmt.get(serverId);
|
|
234
|
+
return row ? this.mapServerRow(row) : null;
|
|
235
|
+
}
|
|
236
|
+
async getServerForOwner(serverId, ownerUsername) {
|
|
237
|
+
const stmt = this.db.prepare('SELECT * FROM servers WHERE id = ? AND owner_username = ?');
|
|
238
|
+
const row = stmt.get(serverId, ownerUsername);
|
|
239
|
+
return row ? this.mapServerRow(row) : null;
|
|
240
|
+
}
|
|
241
|
+
async getAllServers() {
|
|
91
242
|
const stmt = this.db.prepare('SELECT * FROM servers ORDER BY created_at DESC');
|
|
92
243
|
const rows = stmt.all();
|
|
93
|
-
return rows.map(row => (
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
244
|
+
return rows.map((row) => this.mapServerRow(row));
|
|
245
|
+
}
|
|
246
|
+
async getAllServersByOwner(ownerUsername) {
|
|
247
|
+
const stmt = this.db.prepare('SELECT * FROM servers WHERE owner_username = ? ORDER BY created_at DESC');
|
|
248
|
+
const rows = stmt.all(ownerUsername);
|
|
249
|
+
return rows.map((row) => this.mapServerRow(row));
|
|
99
250
|
}
|
|
100
|
-
|
|
251
|
+
async serverNameExistsForOwner(serverName, ownerUsername) {
|
|
252
|
+
const stmt = this.db.prepare('SELECT COUNT(*) as count FROM servers WHERE name = ? AND owner_username = ?');
|
|
253
|
+
const row = stmt.get(serverName, ownerUsername);
|
|
254
|
+
return (row?.count || 0) > 0;
|
|
255
|
+
}
|
|
256
|
+
async deleteServer(serverId) {
|
|
101
257
|
const stmt = this.db.prepare('DELETE FROM servers WHERE id = ?');
|
|
102
258
|
stmt.run(serverId);
|
|
103
259
|
}
|
|
104
|
-
|
|
105
|
-
saveTools(tools) {
|
|
260
|
+
async saveTools(tools) {
|
|
106
261
|
const stmt = this.db.prepare(`
|
|
107
262
|
INSERT OR REPLACE INTO tools (server_id, name, description, input_schema, sql_query, operation)
|
|
108
263
|
VALUES (?, ?, ?, ?, ?, ?)
|
|
109
264
|
`);
|
|
110
|
-
const transaction = this.db.transaction((
|
|
111
|
-
for (const tool of
|
|
265
|
+
const transaction = this.db.transaction((items) => {
|
|
266
|
+
for (const tool of items) {
|
|
112
267
|
stmt.run(tool.server_id, tool.name, tool.description, JSON.stringify(tool.inputSchema), tool.sqlQuery, tool.operation);
|
|
113
268
|
}
|
|
114
269
|
});
|
|
115
270
|
transaction(tools);
|
|
116
271
|
}
|
|
117
|
-
getToolsForServer(serverId) {
|
|
272
|
+
async getToolsForServer(serverId) {
|
|
118
273
|
const stmt = this.db.prepare('SELECT * FROM tools WHERE server_id = ?');
|
|
119
274
|
const rows = stmt.all(serverId);
|
|
120
275
|
return rows.map(row => ({
|
|
@@ -126,7 +281,7 @@ class SQLiteManager {
|
|
|
126
281
|
operation: row.operation
|
|
127
282
|
}));
|
|
128
283
|
}
|
|
129
|
-
getAllTools() {
|
|
284
|
+
async getAllTools() {
|
|
130
285
|
const stmt = this.db.prepare('SELECT * FROM tools ORDER BY server_id, name');
|
|
131
286
|
const rows = stmt.all();
|
|
132
287
|
return rows.map(row => ({
|
|
@@ -138,20 +293,19 @@ class SQLiteManager {
|
|
|
138
293
|
operation: row.operation
|
|
139
294
|
}));
|
|
140
295
|
}
|
|
141
|
-
|
|
142
|
-
saveResources(resources) {
|
|
296
|
+
async saveResources(resources) {
|
|
143
297
|
const stmt = this.db.prepare(`
|
|
144
298
|
INSERT OR REPLACE INTO resources (server_id, name, description, uri_template, sql_query)
|
|
145
299
|
VALUES (?, ?, ?, ?, ?)
|
|
146
300
|
`);
|
|
147
|
-
const transaction = this.db.transaction((
|
|
148
|
-
for (const resource of
|
|
301
|
+
const transaction = this.db.transaction((items) => {
|
|
302
|
+
for (const resource of items) {
|
|
149
303
|
stmt.run(resource.server_id, resource.name, resource.description, resource.uri_template, resource.sqlQuery);
|
|
150
304
|
}
|
|
151
305
|
});
|
|
152
306
|
transaction(resources);
|
|
153
307
|
}
|
|
154
|
-
getResourcesForServer(serverId) {
|
|
308
|
+
async getResourcesForServer(serverId) {
|
|
155
309
|
const stmt = this.db.prepare('SELECT * FROM resources WHERE server_id = ?');
|
|
156
310
|
const rows = stmt.all(serverId);
|
|
157
311
|
return rows.map(row => ({
|
|
@@ -162,7 +316,7 @@ class SQLiteManager {
|
|
|
162
316
|
sqlQuery: row.sql_query
|
|
163
317
|
}));
|
|
164
318
|
}
|
|
165
|
-
getAllResources() {
|
|
319
|
+
async getAllResources() {
|
|
166
320
|
const stmt = this.db.prepare('SELECT * FROM resources ORDER BY server_id, name');
|
|
167
321
|
const rows = stmt.all();
|
|
168
322
|
return rows.map(row => ({
|
|
@@ -173,12 +327,308 @@ class SQLiteManager {
|
|
|
173
327
|
sqlQuery: row.sql_query
|
|
174
328
|
}));
|
|
175
329
|
}
|
|
176
|
-
|
|
177
|
-
|
|
330
|
+
async saveRefreshToken(tokenHash, username, expiresAt) {
|
|
331
|
+
const stmt = this.db.prepare(`
|
|
332
|
+
INSERT OR REPLACE INTO refresh_tokens (token_hash, username, expires_at, created_at, revoked_at)
|
|
333
|
+
VALUES (?, ?, ?, CURRENT_TIMESTAMP, NULL)
|
|
334
|
+
`);
|
|
335
|
+
stmt.run(tokenHash, username, expiresAt);
|
|
336
|
+
}
|
|
337
|
+
async getRefreshToken(tokenHash) {
|
|
338
|
+
const stmt = this.db.prepare('SELECT * FROM refresh_tokens WHERE token_hash = ?');
|
|
339
|
+
const row = stmt.get(tokenHash);
|
|
340
|
+
if (!row) {
|
|
341
|
+
return null;
|
|
342
|
+
}
|
|
343
|
+
return {
|
|
344
|
+
tokenHash: row.token_hash,
|
|
345
|
+
username: row.username,
|
|
346
|
+
expiresAt: row.expires_at,
|
|
347
|
+
createdAt: row.created_at,
|
|
348
|
+
revokedAt: row.revoked_at || null
|
|
349
|
+
};
|
|
350
|
+
}
|
|
351
|
+
async revokeRefreshToken(tokenHash) {
|
|
352
|
+
const stmt = this.db.prepare(`
|
|
353
|
+
UPDATE refresh_tokens
|
|
354
|
+
SET revoked_at = COALESCE(revoked_at, CURRENT_TIMESTAMP)
|
|
355
|
+
WHERE token_hash = ?
|
|
356
|
+
`);
|
|
357
|
+
stmt.run(tokenHash);
|
|
358
|
+
}
|
|
359
|
+
async revokeAllRefreshTokensForUser(username) {
|
|
360
|
+
const stmt = this.db.prepare(`
|
|
361
|
+
UPDATE refresh_tokens
|
|
362
|
+
SET revoked_at = COALESCE(revoked_at, CURRENT_TIMESTAMP)
|
|
363
|
+
WHERE username = ? AND revoked_at IS NULL
|
|
364
|
+
`);
|
|
365
|
+
stmt.run(username);
|
|
366
|
+
}
|
|
367
|
+
async getUser(username) {
|
|
368
|
+
const stmt = this.db.prepare('SELECT * FROM users WHERE username = ?');
|
|
369
|
+
const row = stmt.get(username);
|
|
370
|
+
if (!row) {
|
|
371
|
+
return null;
|
|
372
|
+
}
|
|
373
|
+
return {
|
|
374
|
+
username: row.username,
|
|
375
|
+
workspaceId: row.workspace_id || row.username,
|
|
376
|
+
passwordHash: row.password_hash,
|
|
377
|
+
role: row.role,
|
|
378
|
+
createdAt: row.created_at,
|
|
379
|
+
updatedAt: row.updated_at
|
|
380
|
+
};
|
|
381
|
+
}
|
|
382
|
+
async getUserInWorkspace(username, workspaceId) {
|
|
383
|
+
const stmt = this.db.prepare('SELECT * FROM users WHERE username = ? AND workspace_id = ?');
|
|
384
|
+
const row = stmt.get(username, workspaceId);
|
|
385
|
+
if (!row) {
|
|
386
|
+
return null;
|
|
387
|
+
}
|
|
388
|
+
return {
|
|
389
|
+
username: row.username,
|
|
390
|
+
workspaceId: row.workspace_id || row.username,
|
|
391
|
+
passwordHash: row.password_hash,
|
|
392
|
+
role: row.role,
|
|
393
|
+
createdAt: row.created_at,
|
|
394
|
+
updatedAt: row.updated_at
|
|
395
|
+
};
|
|
396
|
+
}
|
|
397
|
+
async getAllUsers() {
|
|
398
|
+
const stmt = this.db.prepare('SELECT username, workspace_id, role, created_at, updated_at FROM users ORDER BY username');
|
|
399
|
+
const rows = stmt.all();
|
|
400
|
+
return rows.map((row) => ({
|
|
401
|
+
username: row.username,
|
|
402
|
+
workspaceId: row.workspace_id || row.username,
|
|
403
|
+
role: row.role,
|
|
404
|
+
createdAt: row.created_at,
|
|
405
|
+
updatedAt: row.updated_at
|
|
406
|
+
}));
|
|
407
|
+
}
|
|
408
|
+
async getAllUsersByWorkspace(workspaceId) {
|
|
409
|
+
const stmt = this.db.prepare('SELECT username, workspace_id, role, created_at, updated_at FROM users WHERE workspace_id = ? ORDER BY username');
|
|
410
|
+
const rows = stmt.all(workspaceId);
|
|
411
|
+
return rows.map((row) => ({
|
|
412
|
+
username: row.username,
|
|
413
|
+
workspaceId: row.workspace_id || row.username,
|
|
414
|
+
role: row.role,
|
|
415
|
+
createdAt: row.created_at,
|
|
416
|
+
updatedAt: row.updated_at
|
|
417
|
+
}));
|
|
418
|
+
}
|
|
419
|
+
async createUser(username, passwordHash, role, workspaceId) {
|
|
420
|
+
const stmt = this.db.prepare(`
|
|
421
|
+
INSERT INTO users (username, workspace_id, password_hash, role, created_at, updated_at)
|
|
422
|
+
VALUES (?, ?, ?, ?, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP)
|
|
423
|
+
`);
|
|
424
|
+
stmt.run(username, workspaceId, passwordHash, role);
|
|
425
|
+
}
|
|
426
|
+
async upsertUser(username, passwordHash, role, workspaceId) {
|
|
427
|
+
const stmt = this.db.prepare(`
|
|
428
|
+
INSERT INTO users (username, workspace_id, password_hash, role, created_at, updated_at)
|
|
429
|
+
VALUES (?, ?, ?, ?, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP)
|
|
430
|
+
ON CONFLICT(username) DO UPDATE SET
|
|
431
|
+
workspace_id = excluded.workspace_id,
|
|
432
|
+
password_hash = excluded.password_hash,
|
|
433
|
+
role = excluded.role,
|
|
434
|
+
updated_at = CURRENT_TIMESTAMP
|
|
435
|
+
`);
|
|
436
|
+
stmt.run(username, workspaceId, passwordHash, role);
|
|
437
|
+
}
|
|
438
|
+
async updateUserRole(username, workspaceId, role) {
|
|
439
|
+
const stmt = this.db.prepare(`
|
|
440
|
+
UPDATE users
|
|
441
|
+
SET role = ?, updated_at = CURRENT_TIMESTAMP
|
|
442
|
+
WHERE username = ? AND workspace_id = ?
|
|
443
|
+
`);
|
|
444
|
+
stmt.run(role, username, workspaceId);
|
|
445
|
+
}
|
|
446
|
+
async getServerAuthConfig(serverId) {
|
|
447
|
+
const policy = await this.getMcpTokenPolicy('server', serverId);
|
|
448
|
+
if (policy) {
|
|
449
|
+
return {
|
|
450
|
+
serverId,
|
|
451
|
+
requireMcpToken: policy.requireMcpToken,
|
|
452
|
+
updatedAt: policy.updatedAt
|
|
453
|
+
};
|
|
454
|
+
}
|
|
455
|
+
const stmt = this.db.prepare('SELECT server_id, require_mcp_token, updated_at FROM server_auth_config WHERE server_id = ?');
|
|
456
|
+
const row = stmt.get(serverId);
|
|
457
|
+
if (!row) {
|
|
458
|
+
return null;
|
|
459
|
+
}
|
|
460
|
+
return {
|
|
461
|
+
serverId: row.server_id,
|
|
462
|
+
requireMcpToken: Number(row.require_mcp_token) === 1,
|
|
463
|
+
updatedAt: row.updated_at
|
|
464
|
+
};
|
|
465
|
+
}
|
|
466
|
+
async setServerAuthConfig(serverId, requireMcpToken) {
|
|
467
|
+
const stmt = this.db.prepare(`
|
|
468
|
+
INSERT INTO server_auth_config (server_id, require_mcp_token, updated_at)
|
|
469
|
+
VALUES (?, ?, CURRENT_TIMESTAMP)
|
|
470
|
+
ON CONFLICT(server_id) DO UPDATE SET
|
|
471
|
+
require_mcp_token = excluded.require_mcp_token,
|
|
472
|
+
updated_at = CURRENT_TIMESTAMP
|
|
473
|
+
`);
|
|
474
|
+
stmt.run(serverId, requireMcpToken ? 1 : 0);
|
|
475
|
+
this.setMcpTokenPolicy('server', serverId, requireMcpToken);
|
|
476
|
+
}
|
|
477
|
+
mapMcpTokenPolicyRow(row) {
|
|
478
|
+
return {
|
|
479
|
+
scopeType: row.scope_type,
|
|
480
|
+
scopeId: String(row.scope_id),
|
|
481
|
+
requireMcpToken: Number(row.require_mcp_token) === 1,
|
|
482
|
+
updatedAt: String(row.updated_at)
|
|
483
|
+
};
|
|
484
|
+
}
|
|
485
|
+
async getMcpTokenPolicy(scopeType, scopeId) {
|
|
486
|
+
const stmt = this.db.prepare(`
|
|
487
|
+
SELECT scope_type, scope_id, require_mcp_token, updated_at
|
|
488
|
+
FROM mcp_token_policies
|
|
489
|
+
WHERE scope_type = ? AND scope_id = ?
|
|
490
|
+
`);
|
|
491
|
+
const row = stmt.get(scopeType, scopeId);
|
|
492
|
+
return row ? this.mapMcpTokenPolicyRow(row) : null;
|
|
493
|
+
}
|
|
494
|
+
async listMcpTokenPolicies(scopeType) {
|
|
495
|
+
const stmt = scopeType
|
|
496
|
+
? this.db.prepare(`
|
|
497
|
+
SELECT scope_type, scope_id, require_mcp_token, updated_at
|
|
498
|
+
FROM mcp_token_policies
|
|
499
|
+
WHERE scope_type = ?
|
|
500
|
+
ORDER BY updated_at DESC
|
|
501
|
+
`)
|
|
502
|
+
: this.db.prepare(`
|
|
503
|
+
SELECT scope_type, scope_id, require_mcp_token, updated_at
|
|
504
|
+
FROM mcp_token_policies
|
|
505
|
+
ORDER BY updated_at DESC
|
|
506
|
+
`);
|
|
507
|
+
const rows = (scopeType ? stmt.all(scopeType) : stmt.all());
|
|
508
|
+
return rows.map((row) => this.mapMcpTokenPolicyRow(row));
|
|
509
|
+
}
|
|
510
|
+
async setMcpTokenPolicy(scopeType, scopeId, requireMcpToken) {
|
|
511
|
+
if (!scopeId)
|
|
512
|
+
return;
|
|
513
|
+
if (requireMcpToken === null) {
|
|
514
|
+
const del = this.db.prepare('DELETE FROM mcp_token_policies WHERE scope_type = ? AND scope_id = ?');
|
|
515
|
+
del.run(scopeType, scopeId);
|
|
516
|
+
return;
|
|
517
|
+
}
|
|
518
|
+
const upsert = this.db.prepare(`
|
|
519
|
+
INSERT INTO mcp_token_policies (scope_type, scope_id, require_mcp_token, updated_at)
|
|
520
|
+
VALUES (?, ?, ?, CURRENT_TIMESTAMP)
|
|
521
|
+
ON CONFLICT(scope_type, scope_id) DO UPDATE SET
|
|
522
|
+
require_mcp_token = excluded.require_mcp_token,
|
|
523
|
+
updated_at = CURRENT_TIMESTAMP
|
|
524
|
+
`);
|
|
525
|
+
upsert.run(scopeType, scopeId, requireMcpToken ? 1 : 0);
|
|
526
|
+
}
|
|
527
|
+
mapMcpTokenRow(row) {
|
|
528
|
+
return {
|
|
529
|
+
id: row.id,
|
|
530
|
+
tokenName: row.token_name || '',
|
|
531
|
+
workspaceId: row.workspace_id,
|
|
532
|
+
subjectUsername: row.subject_username,
|
|
533
|
+
createdBy: row.created_by,
|
|
534
|
+
tokenHash: row.token_hash,
|
|
535
|
+
tokenValue: row.token_value,
|
|
536
|
+
allowAllServers: Number(row.allow_all_servers) === 1,
|
|
537
|
+
allowAllTools: Number(row.allow_all_tools) === 1,
|
|
538
|
+
allowAllResources: Number(row.allow_all_resources) === 1,
|
|
539
|
+
serverIds: JSON.parse(row.server_ids_json || '[]'),
|
|
540
|
+
allowedTools: JSON.parse(row.allowed_tools_json || '[]'),
|
|
541
|
+
allowedResources: JSON.parse(row.allowed_resources_json || '[]'),
|
|
542
|
+
serverRules: JSON.parse(row.server_rules_json || '{}'),
|
|
543
|
+
toolRules: JSON.parse(row.tool_rules_json || '{}'),
|
|
544
|
+
resourceRules: JSON.parse(row.resource_rules_json || '{}'),
|
|
545
|
+
neverExpires: Number(row.never_expires) === 1,
|
|
546
|
+
expiresAt: row.expires_at || null,
|
|
547
|
+
createdAt: row.created_at,
|
|
548
|
+
revokedAt: row.revoked_at || null
|
|
549
|
+
};
|
|
550
|
+
}
|
|
551
|
+
async createMcpToken(input) {
|
|
552
|
+
const stmt = this.db.prepare(`
|
|
553
|
+
INSERT INTO mcp_tokens (
|
|
554
|
+
id, token_name, workspace_id, subject_username, created_by, token_hash, token_value,
|
|
555
|
+
allow_all_servers, allow_all_tools, allow_all_resources,
|
|
556
|
+
server_ids_json, allowed_tools_json, allowed_resources_json,
|
|
557
|
+
server_rules_json, tool_rules_json, resource_rules_json,
|
|
558
|
+
never_expires, expires_at, created_at, revoked_at
|
|
559
|
+
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, CURRENT_TIMESTAMP, NULL)
|
|
560
|
+
`);
|
|
561
|
+
stmt.run(input.id, input.tokenName, input.workspaceId, input.subjectUsername, input.createdBy, input.tokenHash, input.tokenValue, input.allowAllServers ? 1 : 0, input.allowAllTools ? 1 : 0, input.allowAllResources ? 1 : 0, JSON.stringify(input.serverIds || []), JSON.stringify(input.allowedTools || []), JSON.stringify(input.allowedResources || []), JSON.stringify(input.serverRules || {}), JSON.stringify(input.toolRules || {}), JSON.stringify(input.resourceRules || {}), input.neverExpires ? 1 : 0, input.expiresAt);
|
|
562
|
+
}
|
|
563
|
+
async getMcpTokenByHash(tokenHash) {
|
|
564
|
+
const stmt = this.db.prepare('SELECT * FROM mcp_tokens WHERE token_hash = ?');
|
|
565
|
+
const row = stmt.get(tokenHash);
|
|
566
|
+
return row ? this.mapMcpTokenRow(row) : null;
|
|
567
|
+
}
|
|
568
|
+
async getMcpTokenById(id) {
|
|
569
|
+
const stmt = this.db.prepare('SELECT * FROM mcp_tokens WHERE id = ?');
|
|
570
|
+
const row = stmt.get(id);
|
|
571
|
+
return row ? this.mapMcpTokenRow(row) : null;
|
|
572
|
+
}
|
|
573
|
+
async getMcpTokensByWorkspace(workspaceId) {
|
|
574
|
+
const stmt = this.db.prepare('SELECT * FROM mcp_tokens WHERE workspace_id = ? ORDER BY created_at DESC');
|
|
575
|
+
const rows = stmt.all(workspaceId);
|
|
576
|
+
return rows.map((row) => this.mapMcpTokenRow(row));
|
|
577
|
+
}
|
|
578
|
+
async revokeMcpToken(id) {
|
|
579
|
+
const stmt = this.db.prepare(`
|
|
580
|
+
UPDATE mcp_tokens
|
|
581
|
+
SET revoked_at = COALESCE(revoked_at, CURRENT_TIMESTAMP)
|
|
582
|
+
WHERE id = ?
|
|
583
|
+
`);
|
|
584
|
+
stmt.run(id);
|
|
585
|
+
}
|
|
586
|
+
async getWorkspaceAiConfig(_workspaceId) {
|
|
587
|
+
return null;
|
|
588
|
+
}
|
|
589
|
+
async getQuickAskState(workspaceId) {
|
|
590
|
+
const stmt = this.db.prepare('SELECT workspace_id, chats_json, current_chat_id, updated_at FROM chat_state WHERE workspace_id = ?');
|
|
591
|
+
const row = stmt.get(workspaceId);
|
|
592
|
+
if (!row)
|
|
593
|
+
return null;
|
|
594
|
+
let chats = [];
|
|
595
|
+
try {
|
|
596
|
+
chats = JSON.parse(row.chats_json || '[]');
|
|
597
|
+
if (!Array.isArray(chats))
|
|
598
|
+
chats = [];
|
|
599
|
+
}
|
|
600
|
+
catch {
|
|
601
|
+
chats = [];
|
|
602
|
+
}
|
|
603
|
+
return {
|
|
604
|
+
workspaceId: String(row.workspace_id || workspaceId),
|
|
605
|
+
chats,
|
|
606
|
+
currentChatId: String(row.current_chat_id || ''),
|
|
607
|
+
updatedAt: String(row.updated_at || new Date().toISOString())
|
|
608
|
+
};
|
|
609
|
+
}
|
|
610
|
+
async saveQuickAskState(workspaceId, chats, currentChatId) {
|
|
611
|
+
const stmt = this.db.prepare(`
|
|
612
|
+
INSERT INTO chat_state (workspace_id, chats_json, current_chat_id, updated_at)
|
|
613
|
+
VALUES (?, ?, ?, CURRENT_TIMESTAMP)
|
|
614
|
+
ON CONFLICT(workspace_id) DO UPDATE SET
|
|
615
|
+
chats_json = excluded.chats_json,
|
|
616
|
+
current_chat_id = excluded.current_chat_id,
|
|
617
|
+
updated_at = CURRENT_TIMESTAMP
|
|
618
|
+
`);
|
|
619
|
+
stmt.run(workspaceId, JSON.stringify(Array.isArray(chats) ? chats : []), String(currentChatId || ''));
|
|
620
|
+
}
|
|
621
|
+
async writeLog(entry) {
|
|
622
|
+
const stmt = this.db.prepare(`
|
|
623
|
+
INSERT INTO app_logs (username, severity, message, datetime, additional_info)
|
|
624
|
+
VALUES (?, ?, ?, ?, ?)
|
|
625
|
+
`);
|
|
626
|
+
stmt.run(entry.username, entry.severity, entry.message, entry.datetime, entry.additionalInfo ?? null);
|
|
627
|
+
}
|
|
628
|
+
async close() {
|
|
178
629
|
this.db.close();
|
|
179
630
|
}
|
|
180
|
-
|
|
181
|
-
getStats() {
|
|
631
|
+
async getStats() {
|
|
182
632
|
const serversCount = this.db.prepare('SELECT COUNT(*) as count FROM servers').get();
|
|
183
633
|
const toolsCount = this.db.prepare('SELECT COUNT(*) as count FROM tools').get();
|
|
184
634
|
const resourcesCount = this.db.prepare('SELECT COUNT(*) as count FROM resources').get();
|