Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
374 commits
Select commit Hold shift + click to select a range
9b6a926
feat: MCP Prompts implementation improvements
allozaur Jan 24, 2026
52e3aad
chore: update webui build output
allozaur Jan 24, 2026
bfd742a
refactor: Cleanup
allozaur Jan 24, 2026
6825a66
refactor: Constants
allozaur Jan 24, 2026
9159236
chore: update webui build output
allozaur Jan 24, 2026
c2fe44f
refactor: Cleanup
allozaur Jan 24, 2026
721aea6
chore: update webui build output
allozaur Jan 24, 2026
9f5910b
refactor: Remove unused code
allozaur Jan 24, 2026
b79d4b1
refactor: Naming + remove redundant component
allozaur Jan 24, 2026
8af2b4c
refactor: Cleanup
allozaur Jan 24, 2026
0e7dee7
chore: update webui build output
allozaur Jan 24, 2026
3461c41
refactor: Naming & Enums
allozaur Jan 24, 2026
c577c8f
refactor: Cleanup
allozaur Jan 24, 2026
92c5bc1
chore: update webui build output
allozaur Jan 25, 2026
c44f7b1
chore: Add deprecation comment
allozaur Jan 25, 2026
c4e78be
refactor: DRY
allozaur Jan 25, 2026
087c707
chore: update webui build output
allozaur Jan 25, 2026
197413a
refactor: Types
allozaur Jan 25, 2026
3f06755
chore: update webui build output
allozaur Jan 25, 2026
fe2ae33
refactor: Simplify MCP errors
allozaur Jan 25, 2026
938d5b2
chore: update webui build output
allozaur Jan 25, 2026
b0f7c48
refactor: Cleanup
allozaur Jan 25, 2026
5ac34df
refactor: Enums
allozaur Jan 25, 2026
7ef2f8c
chore: update webui build output
allozaur Jan 25, 2026
8bbe04f
refactor: Use store methods
allozaur Jan 26, 2026
9a6268e
refactor: Utility function
allozaur Jan 26, 2026
5befd79
refactor: Componentize Chat Form Prompt Picker
allozaur Jan 26, 2026
6cd4eb1
chore: update webui build output
allozaur Jan 26, 2026
639b4e2
refactor: Cleanup
allozaur Jan 26, 2026
6065487
refactor: Components imports/exports structure & documentation
allozaur Jan 26, 2026
473257a
chore: update webui build output
allozaur Jan 26, 2026
60a0f5f
feat: Improve Code blocks rendering + add auto scroll + improve globa…
allozaur Jan 26, 2026
86172df
chore: update webui build output
allozaur Jan 26, 2026
b6a22a9
fix: Scroll issues in DropdownMenuSearchable
allozaur Jan 26, 2026
5d8db08
feat: Mcp Server Selector
allozaur Jan 26, 2026
9684892
chore: update webui build output
allozaur Jan 26, 2026
9f1fe84
refactor: Cleanup
allozaur Jan 26, 2026
3b76ee5
refactor: Cleanup
allozaur Jan 26, 2026
275d3e8
fix: Wait for all MCP Servers Health Checks to load
allozaur Jan 26, 2026
2c20e68
chore: update webui build output
allozaur Jan 26, 2026
ee9369f
refactor: Utils
allozaur Jan 27, 2026
a1ec801
refactor: Components
allozaur Jan 27, 2026
156ce33
chore: update webui build output
allozaur Jan 27, 2026
c3cf314
webui: remove unused sessionId, SDK handles it automatically
ServeurpersoCom Jan 26, 2026
934f6eb
webui: remove unused sessionId, SDK handles it automatically
ServeurpersoCom Jan 26, 2026
d379d45
chore: update webui build output
allozaur Jan 27, 2026
aff70c9
feat: UI improvements
allozaur Jan 27, 2026
41f43e0
refactor: Use Popover for Chat Form Prompt Picker
allozaur Jan 27, 2026
6fb4835
fix: Edit Mode with MCP Prompt in message
allozaur Jan 27, 2026
3f9f654
feat: Introduce clipboard types for MCP prompt attachments
allozaur Jan 27, 2026
8e9479e
feat: Implement clipboard serialization/deserialization for MCP prompts
allozaur Jan 27, 2026
219fe6c
feat: Add support for pasting MCP prompt attachments in ChatForm
allozaur Jan 27, 2026
26be624
refactor: Improve styling and overflow handling for ChatMessageMcpPro…
allozaur Jan 27, 2026
92c96d7
refactor: Components
allozaur Jan 27, 2026
fa62cb3
chore: update webui build output
allozaur Jan 27, 2026
2d9fe69
refactor: Centralize chat-wide actions in ChatMessages.svelte
allozaur Jan 27, 2026
c44251b
refactor: Encapsulate message editing state and actions in ChatMessag…
allozaur Jan 27, 2026
0af26c9
refactor: Adapt message child components to MessageEditContext
allozaur Jan 27, 2026
7c91326
chore: update webui build output
allozaur Jan 27, 2026
97aba3d
feat: Implement generic TTL cache utility
allozaur Jan 27, 2026
90e6b8b
refactor: Use TTL cache for model properties in ModelsStore
allozaur Jan 27, 2026
835e767
feat: Implement inactive chat conversation state cleanup
allozaur Jan 27, 2026
4e20503
refactor: Remove unused `getChatActionsContext` import
allozaur Jan 27, 2026
d8a6cc5
chore: update webui build output
allozaur Jan 27, 2026
bf920a0
feat: Add auto-resizing textarea to KeyValuePairs component
allozaur Jan 27, 2026
26fbe7f
feat: Disable server card toggle when in error state
allozaur Jan 27, 2026
9fdd47f
feat: Enhance ChatMessageMcpPromptContent display
allozaur Jan 27, 2026
533c370
chore: update webui build output
allozaur Jan 27, 2026
db2b089
refactor: Create shared ActiveConversationStore to avoid circular dep…
allozaur Jan 27, 2026
6dbffc5
chore: update webui build output
allozaur Jan 27, 2026
6dd88eb
refactor: Improves abort signal handling
allozaur Jan 27, 2026
e60f195
fix: Missing tool call handling
allozaur Jan 27, 2026
5e4bfcf
feat: Introduce centralized API fetch utilities
allozaur Jan 27, 2026
e466031
feat: Introduce BaseClient for common store integration
allozaur Jan 27, 2026
91496a3
refactor: Go back to simpler Stores + Services architecture
allozaur Jan 27, 2026
687fb70
fix: Sync streaming content to active messages
allozaur Jan 27, 2026
f6bafbb
chore: update webui build output
allozaur Jan 27, 2026
a681c28
refactor: Reuse MCP connections for health checks
allozaur Jan 27, 2026
eb1442d
refactor: Componentize HorizontalScrollCarousel
allozaur Jan 28, 2026
f16458f
feat: Introduce MCP Resource Types and Service Methods
allozaur Jan 28, 2026
0cd4d23
refactor: Use constants
allozaur Jan 28, 2026
ff25e06
feat: MCP Resources Svelte Store
allozaur Jan 28, 2026
e62db44
feat: Integrate Resource Store into Main MCP Store
allozaur Jan 28, 2026
16a1675
feat: MCP Resources UI
allozaur Jan 28, 2026
6a910b9
feat: Integrate Resource Attachments into Chat Form UI
allozaur Jan 28, 2026
eb11ce7
feat: Chat logic improvements
allozaur Jan 28, 2026
31ad533
refactor: Refine Chat Message Processing State Display
allozaur Jan 28, 2026
eeb0d9d
fix: Linter errors
allozaur Jan 28, 2026
9963743
chore: update webui build output
allozaur Jan 28, 2026
356231d
refactor: Cleanup
allozaur Jan 29, 2026
25e5d99
fix: Checking for capabilities from store
allozaur Jan 29, 2026
4e50365
chore: update webui build output
allozaur Jan 29, 2026
155d486
demo cors proxy
ngxson Jan 6, 2026
434f0dd
fix
ngxson Jan 6, 2026
4728dfb
download: use httplib and boringssl by default
ngxson Jan 6, 2026
d71277f
https working
ngxson Jan 6, 2026
e704674
feat: Integrate with `llama-server` proxy + improve MCP Server Edit Form
allozaur Jan 29, 2026
05a0aa8
chore: update webui build output
allozaur Jan 29, 2026
c3a98dc
refactor: Proxy utility
allozaur Jan 29, 2026
02f31c9
refactor: Use CORS Proxy for favicons calls
allozaur Jan 29, 2026
021cc96
chore: update webui build output
allozaur Jan 29, 2026
621518a
webui: adaptive model selector dropdown width
ServeurpersoCom Jan 30, 2026
4e5395b
chore: update webui build output
ServeurpersoCom Jan 30, 2026
d7489d1
fix: responsive MCP server cards for mobile viewports
ServeurpersoCom Jan 31, 2026
e8e2068
fix: responsive MCP server cards, prioritize server name over version
ServeurpersoCom Jan 31, 2026
5c85d06
chore: update webui build output
ServeurpersoCom Jan 31, 2026
dc99d7e
fix: skip sending image attachments to non-vision backends
ServeurpersoCom Feb 1, 2026
4e6d811
chore: update webui build output
ServeurpersoCom Feb 1, 2026
691c372
fix: also skip image attachments in message history for non-vision ba…
ServeurpersoCom Feb 1, 2026
995b5bc
chore: update webui build output
ServeurpersoCom Feb 1, 2026
e7da3a0
feat: render images below attachment markers in tool results
ServeurpersoCom Feb 1, 2026
88ac7d6
feat: render images inline below attachment markers in tool results
ServeurpersoCom Feb 1, 2026
0038213
chore: update webui build output
ServeurpersoCom Feb 1, 2026
beb6271
webui: incremental MDAST transform caching for streaming performance
ServeurpersoCom Feb 1, 2026
117d42a
chore: update webui build output
ServeurpersoCom Feb 1, 2026
01927dc
webui: fix UI freeze at high token rates with RAF yield
ServeurpersoCom Feb 1, 2026
91cfa80
chore: update webui build output
ServeurpersoCom Feb 1, 2026
001d222
webui: remove artificial cache limit, let GC handle cleanup on conver…
ServeurpersoCom Feb 2, 2026
f4746e0
chore: update webui build output
ServeurpersoCom Feb 2, 2026
fd5348b
webui: add early exit for unchanged content in markdown processing
ServeurpersoCom Feb 2, 2026
76d4d58
chore: update webui build output
ServeurpersoCom Feb 2, 2026
45abc7c
Update tools/server/webui/src/lib/components/app/chat/ChatAttachments…
ServeurpersoCom Feb 2, 2026
7195ca1
chore: update webui build output
ServeurpersoCom Feb 2, 2026
cf5f06e
refactor: Cleanup
allozaur Feb 2, 2026
18300bb
refactor: Cleanup
allozaur Feb 3, 2026
63f27d0
refactor: Cleanup
allozaur Feb 3, 2026
be02833
refactor: Cleanup
allozaur Feb 3, 2026
b2753c5
refactor: Cleanup
allozaur Feb 3, 2026
2cfffee
refactor: Cleanup
allozaur Feb 3, 2026
c62062c
refactor: Cleanup
allozaur Feb 3, 2026
725d24f
refactor: Cleanup
allozaur Feb 3, 2026
c586771
refactor: MarkdownContent props API
allozaur Feb 3, 2026
d0509bd
refactor: Cleanup
allozaur Feb 3, 2026
2d3fb9c
feat: Add `createBase64DataUrl` utility and `MimeTypeApplication.OCTE…
allozaur Feb 3, 2026
2947242
refactor: Use `UrlPrefix` enum for data stream parsing
allozaur Feb 3, 2026
0e6f530
refactor: Componentize MCP Resource Browser
allozaur Feb 3, 2026
3c00ced
fix: Storybook
allozaur Feb 3, 2026
63a4c2d
chore: update webui build output
allozaur Feb 3, 2026
889a571
fix: handle MCP WebSocket disconnections with auto-reconnect (SDK pro…
ServeurpersoCom Feb 4, 2026
8f64a97
webui: improve when lacking vertical space on mobile with keyboard open
ServeurpersoCom Feb 4, 2026
143c926
chore: update webui build output
ServeurpersoCom Feb 4, 2026
344eb38
fix: MCP WebSocket reconnection race conditions
ServeurpersoCom Feb 5, 2026
274e3ba
chore: update webui build output
ServeurpersoCom Feb 5, 2026
144a00b
feat: Improve Stop button UI
allozaur Feb 5, 2026
ac443ec
feat: Add McpServersSettings to Chat Settings "MCP" section
allozaur Feb 5, 2026
b45fbd4
refactor: Constants
allozaur Feb 5, 2026
266139d
feat: Enable added MCP Server by default
allozaur Feb 5, 2026
686f368
feat: Improve prompt picker keyboard navigation
allozaur Feb 5, 2026
2bb5ce3
feat: Prompt Picker and Prompt Attachment UI/UX improvements
allozaur Feb 6, 2026
7a52572
fix: UI improvements
allozaur Feb 6, 2026
9276fd7
feat: Navigation UI improvements
allozaur Feb 6, 2026
bee9a50
chore: update webui build output
allozaur Feb 6, 2026
b9f8569
fix: Context info fixes & improvements
allozaur Feb 6, 2026
4efce46
chore: update webui build output
allozaur Feb 6, 2026
1450b4d
feat: MCP Resources
allozaur Feb 7, 2026
63d01a3
fix: Syntax highlight for `svelte` and `vue`
allozaur Feb 7, 2026
65ff62e
chore: update webui build output
allozaur Feb 7, 2026
51f3607
fix: Naming
allozaur Feb 7, 2026
bf6c4ab
fix: Proper system message deletion logic
allozaur Feb 8, 2026
1fb770f
refactor: Consolidate MCP server settings into ChatSettings
allozaur Feb 8, 2026
e026919
feat: Improve MCP server selection UX in chat form dropdown
allozaur Feb 8, 2026
7e423ff
refactor: Cleanup
allozaur Feb 8, 2026
2f44ba4
feat: Minor UI tweaks
allozaur Feb 8, 2026
2ca3d0a
chore: update webui build output
allozaur Feb 8, 2026
b8bd31b
refactor: Cleanup
allozaur Feb 9, 2026
9d5fdaa
feat: Implement resource search in MCP Resource browser
allozaur Feb 9, 2026
00fb7a5
fix: MCP Resources Browser selection & attaching
allozaur Feb 9, 2026
db98bdf
fix: Improve word wrapping in resource preview
allozaur Feb 9, 2026
07b6523
chore: update webui build output
allozaur Feb 9, 2026
e1c3038
chore: Formatting & linting
allozaur Feb 9, 2026
518a57e
chore: update webui build output
allozaur Feb 9, 2026
9dfc32f
refactor: Cleanup
allozaur Feb 9, 2026
6ee8b29
refactor: Cleanup
allozaur Feb 9, 2026
1a479f6
refactor: Redesign DropdownMenuSearchable as content provider
allozaur Feb 9, 2026
ddb80be
feat: Enable MCP prompt button in chat message edit form
allozaur Feb 9, 2026
b8ae88f
docs: Centralize and enhance service documentation
allozaur Feb 9, 2026
f8fd671
chore: update webui build output
allozaur Feb 9, 2026
7f7ae52
feat: UI improvements
allozaur Feb 9, 2026
c6bd0f0
refactor: Move MCP health checks to background process from core layout
allozaur Feb 9, 2026
85a53a3
refactor: Cleanup
allozaur Feb 9, 2026
a47b0dd
chore: update webui build output
allozaur Feb 10, 2026
9e51894
chore: Update packages with `npm audit fix`
allozaur Feb 10, 2026
6f0d9ee
chore: update webui build output
allozaur Feb 10, 2026
ddde7fc
fix: UI
allozaur Feb 10, 2026
e7d79cc
feat: Improve agentic turn visualization and statistics
allozaur Feb 10, 2026
a202918
docs: Update diagrams
allozaur Feb 10, 2026
3922e28
chore: Formatting
allozaur Feb 10, 2026
91bd128
chore: update webui build output
allozaur Feb 10, 2026
de1eb85
refactor: Cleanup
allozaur Feb 11, 2026
8a0a17e
refactor: Consolidate MCP resource attachment components
allozaur Feb 11, 2026
67b3714
feat: Improve styling for MCP resource attachment chip
allozaur Feb 11, 2026
4b549c0
refactor: Use Svelte derived state for non-mutable reactive variables
allozaur Feb 11, 2026
ff974d0
refactor: Standardize MCP server ID generation and prefix
allozaur Feb 11, 2026
8ad749b
refactor: `ConversationSelection` initial state handling & Minor fixes
allozaur Feb 11, 2026
b6107e8
build: align CMake and CI with master while keeping CORS proxy
allozaur Feb 11, 2026
e19904e
chore: update webui build output
allozaur Feb 13, 2026
9610768
fix: Post-rebase fixes
allozaur Feb 13, 2026
a026637
chore: update webui build output
allozaur Feb 13, 2026
278316e
fix: Post-rebase fixes
allozaur Feb 18, 2026
eba444d
chore: update webui build output
allozaur Feb 18, 2026
e3d89ba
feat: Add reusable ChatFormPickerPopover component and constant
allozaur Feb 18, 2026
bf0651e
refactor: Make ActionIconRemove icon size configurable
allozaur Feb 18, 2026
8c784a6
refactor: Use ChatFormPickerPopover in ChatFormPromptPicker
allozaur Feb 18, 2026
cf3d6cd
feat: Implement inline MCP Resource Picker in ChatForm
allozaur Feb 18, 2026
af6323f
refactor: Shared chat form picker components
allozaur Feb 18, 2026
269ade1
chore: update webui build output
allozaur Feb 18, 2026
5ae0ab2
Merge remote-tracking branch 'origin/master' into allozaur/mcp-mvp
allozaur Feb 19, 2026
f467799
feat: Add onTurnComplete callback to properly display statistics duri…
allozaur Feb 19, 2026
b53a6bc
chore: update webui build output
allozaur Feb 20, 2026
f260d69
mcp: auto-recover StreamableHTTP sessions on server restart (HTTP 404)
ServeurpersoCom Feb 22, 2026
68d5453
chore: update webui build output
ServeurpersoCom Feb 22, 2026
168622e
feat: Apply input sanitization to KeyValuePairs form component
allozaur Feb 22, 2026
3a06e76
feat: Apply common panel styling for sheets
allozaur Feb 22, 2026
6239428
feat: Add mobile-optimized attachment selection sheet
allozaur Feb 22, 2026
e1d75b1
feat: Add mobile-optimized model selection sheet
allozaur Feb 22, 2026
48c993e
feat: Adapt chat UI for mobile responsiveness
allozaur Feb 22, 2026
105b973
fix: Improve tool execution error message
allozaur Feb 22, 2026
c3cfce6
fix: Improve MCP reconnect logic and robustness
allozaur Feb 22, 2026
911ae8e
chore: update webui build output
allozaur Feb 22, 2026
383d955
Merge remote-tracking branch 'origin/allozaur/mcp-mvp' into allozaur/…
allozaur Feb 22, 2026
e56c427
chore: update webui build output
allozaur Feb 22, 2026
a1dc854
webui: fallback for crypto.randomUUID in non-secure contexts (LAN HTTP)
ServeurpersoCom Feb 22, 2026
d03ccc3
chore: update webui build output
ServeurpersoCom Feb 22, 2026
2516ec7
refactor: UUID handling
allozaur Feb 23, 2026
3ff61f1
chore: update webui build output
allozaur Feb 23, 2026
10b4c19
Merge remote-tracking branch 'origin/master' into allozaur/mcp-mvp
allozaur Feb 23, 2026
94b833d
chore: update webui build output
allozaur Feb 23, 2026
e50cb83
add --webui-cors-proxy
ngxson Feb 27, 2026
0d9ed25
rename to --webui-mcp-proxy
ngxson Feb 27, 2026
4bcf69d
Merge remote-tracking branch 'origin/master' into allozaur/mcp-mvp
allozaur Mar 4, 2026
2151426
feat: MCP Server Icons with Google Favicon fallback
allozaur Mar 4, 2026
fc4b2c6
fix: System Message UI
allozaur Mar 4, 2026
f0fcf90
feat: Implement MCP Resource Templates support in MCP Resources Browser
allozaur Mar 4, 2026
698aa46
chore: update webui build output
allozaur Mar 4, 2026
11a1c2d
webui: strip agentic display markers from context sent to LLM
ServeurpersoCom Mar 4, 2026
4ad0db6
chore: format/lint/check/build
ServeurpersoCom Mar 4, 2026
f85286b
fix: Always pass MCP icons through CORS proxy
allozaur Mar 5, 2026
8c2cf15
Merge remote-tracking branch 'origin/master' into allozaur/mcp-mvp
allozaur Mar 5, 2026
af17d87
chore: update webui build output
allozaur Mar 5, 2026
bc9c806
fix: Truncate raw model name in ModelId
allozaur Mar 5, 2026
9243fa4
chore: update webui build output
allozaur Mar 5, 2026
9673dd2
fix: Mobile UI fixes
allozaur Mar 5, 2026
3110e58
feat: Update Models Selector Sheet
allozaur Mar 5, 2026
4dd95d7
chore: update webui build output
allozaur Mar 5, 2026
d0a4564
refactor: Clean up import patterns
allozaur Mar 5, 2026
cfd09e0
chore: update webui build output
allozaur Mar 5, 2026
3c1f1b8
refactor: Cleanup
allozaur Mar 5, 2026
1424e9d
chore: update webui build output
allozaur Mar 5, 2026
6782e74
fix: remove spurious slash prefix in model selector when orgName is null
ServeurpersoCom Mar 5, 2026
6d0e1e6
chore: update webui build output
ServeurpersoCom Mar 5, 2026
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
8 changes: 8 additions & 0 deletions common/arg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2827,6 +2827,14 @@ common_params_context common_params_parser_init(common_params & params, llama_ex
params.webui_config_json = read_file(value);
}
).set_examples({LLAMA_EXAMPLE_SERVER}).set_env("LLAMA_ARG_WEBUI_CONFIG_FILE"));
add_opt(common_arg(
{"--webui-mcp-proxy"},
{"--no-webui-mcp-proxy"},
string_format("experimental: whether to enable MCP CORS proxy - do not enable in untrusted environments (default: %s)", params.webui_mcp_proxy ? "enabled" : "disabled"),
[](common_params & params, bool value) {
params.webui_mcp_proxy = value;
}
).set_examples({LLAMA_EXAMPLE_SERVER}).set_env("LLAMA_ARG_WEBUI_MCP_PROXY"));
add_opt(common_arg(
{"--webui"},
{"--no-webui"},
Expand Down
1 change: 1 addition & 0 deletions common/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,7 @@ struct common_params {

// webui configs
bool webui = true;
bool webui_mcp_proxy = false;
std::string webui_config_json;

// "advanced" endpoints are disabled by default for better security
Expand Down
Binary file modified tools/server/public/index.html.gz
Binary file not shown.
56 changes: 56 additions & 0 deletions tools/server/server-cors-proxy.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#pragma once

#include "common.h"
#include "http.h"

#include <string>
#include <unordered_set>
#include <list>
#include <map>

#include "server-http.h"

static server_http_res_ptr proxy_request(const server_http_req & req, std::string method) {
std::string target_url = req.get_param("url");
common_http_url parsed_url = common_http_parse_url(target_url);

if (parsed_url.host.empty()) {
throw std::runtime_error("invalid target URL: missing host");
}

if (parsed_url.path.empty()) {
parsed_url.path = "/";
}

if (!parsed_url.password.empty()) {
throw std::runtime_error("authentication in target URL is not supported");
}

if (parsed_url.scheme != "http" && parsed_url.scheme != "https") {
throw std::runtime_error("unsupported URL scheme in target URL: " + parsed_url.scheme);
}

SRV_INF("proxying %s request to %s://%s%s\n", method.c_str(), parsed_url.scheme.c_str(), parsed_url.host.c_str(), parsed_url.path.c_str());

auto proxy = std::make_unique<server_http_proxy>(
method,
parsed_url.host,
parsed_url.scheme == "http" ? 80 : 443,
parsed_url.path,
req.headers,
req.body,
req.should_stop,
600, // timeout_read (default to 10 minutes)
600 // timeout_write (default to 10 minutes)
);

return proxy;
}

static server_http_context::handler_t proxy_handler_post = [](const server_http_req & req) -> server_http_res_ptr {
return proxy_request(req, "POST");
};

static server_http_context::handler_t proxy_handler_get = [](const server_http_req & req) -> server_http_res_ptr {
return proxy_request(req, "GET");
};
23 changes: 20 additions & 3 deletions tools/server/server-models.cpp
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ngxson can you please take a look at the CORS proxy changes? they come from your draft PR from a while ago (ngxson#76) and i think it's a good moment to take a closer look at them and address the potential security issues that they might introduce.

Original file line number Diff line number Diff line change
Expand Up @@ -1089,11 +1089,20 @@ server_http_proxy::server_http_proxy(
int32_t timeout_write
) {
// shared between reader and writer threads
auto cli = std::make_shared<httplib::Client>(host, port);
auto cli = std::make_shared<httplib::ClientImpl>(host, port);
auto pipe = std::make_shared<pipe_t<msg_t>>();

if (port == 443) {
#ifdef CPPHTTPLIB_OPENSSL_SUPPORT
cli.reset(new httplib::SSLClient(host, port));
#else
throw std::runtime_error("HTTPS requested but CPPHTTPLIB_OPENSSL_SUPPORT is not defined");
#endif
}

// setup Client
cli->set_connection_timeout(0, 200000); // 200 milliseconds
cli->set_follow_location(true);
cli->set_connection_timeout(5, 0); // 5 seconds
cli->set_write_timeout(timeout_read, 0); // reversed for cli (client) vs srv (server)
cli->set_read_timeout(timeout_write, 0);
this->status = 500; // to be overwritten upon response
Expand Down Expand Up @@ -1142,7 +1151,15 @@ server_http_proxy::server_http_proxy(
req.method = method;
req.path = path;
for (const auto & [key, value] : headers) {
req.set_header(key, value);
if (key == "Accept-Encoding") {
// disable Accept-Encoding to avoid compressed responses
continue;
}
if (key == "Host" || key == "host") {
req.set_header(key, host);
} else {
req.set_header(key, value);
}
}
req.body = body;
req.response_handler = response_handler;
Expand Down
10 changes: 10 additions & 0 deletions tools/server/server.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "server-context.h"
#include "server-http.h"
#include "server-models.h"
#include "server-cors-proxy.h"

#include "arg.h"
#include "common.h"
Expand Down Expand Up @@ -201,6 +202,15 @@ int main(int argc, char ** argv) {
// Save & load slots
ctx_http.get ("/slots", ex_wrapper(routes.get_slots));
ctx_http.post("/slots/:id_slot", ex_wrapper(routes.post_slots));
// CORS proxy (EXPERIMENTAL, only used by the Web UI for MCP)
if (params.webui_mcp_proxy) {
SRV_WRN("%s", "-----------------\n");
SRV_WRN("%s", "CORS proxy is enabled, do not expose server to untrusted environments\n");
SRV_WRN("%s", "This feature is EXPERIMENTAL and may be removed or changed in future versions\n");
SRV_WRN("%s", "-----------------\n");
ctx_http.get ("/cors-proxy", ex_wrapper(proxy_handler_get));
ctx_http.post("/cors-proxy", ex_wrapper(proxy_handler_post));
}

//
// Start the server
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,13 @@ flowchart TB
C_Form["ChatForm"]
C_Messages["ChatMessages"]
C_Message["ChatMessage"]
C_ChatMessageAgenticContent["ChatMessageAgenticContent"]
C_MessageEditForm["ChatMessageEditForm"]
C_ModelsSelector["ModelsSelector"]
C_Settings["ChatSettings"]
C_McpSettings["McpServersSettings"]
C_McpResourceBrowser["McpResourceBrowser"]
C_McpServersSelector["McpServersSelector"]
end

subgraph Hooks["🪝 Hooks"]
Expand All @@ -24,10 +28,13 @@ flowchart TB

subgraph Stores["🗄️ Stores"]
S1["chatStore<br/><i>Chat interactions & streaming</i>"]
S2["conversationsStore<br/><i>Conversation data & messages</i>"]
SA["agenticStore<br/><i>Multi-turn agentic loop orchestration</i>"]
S2["conversationsStore<br/><i>Conversation data, messages & MCP overrides</i>"]
S3["modelsStore<br/><i>Model selection & loading</i>"]
S4["serverStore<br/><i>Server props & role detection</i>"]
S5["settingsStore<br/><i>User configuration</i>"]
S5["settingsStore<br/><i>User configuration incl. MCP</i>"]
S6["mcpStore<br/><i>MCP servers, tools, prompts</i>"]
S7["mcpResourceStore<br/><i>MCP resources & attachments</i>"]
end

subgraph Services["⚙️ Services"]
Expand All @@ -36,11 +43,12 @@ flowchart TB
SV3["PropsService"]
SV4["DatabaseService"]
SV5["ParameterSyncService"]
SV6["MCPService<br/><i>protocol operations</i>"]
end

subgraph Storage["💾 Storage"]
ST1["IndexedDB<br/><i>conversations, messages</i>"]
ST2["LocalStorage<br/><i>config, userOverrides</i>"]
ST2["LocalStorage<br/><i>config, userOverrides, mcpServers</i>"]
end

subgraph APIs["🌐 llama-server API"]
Expand All @@ -50,15 +58,27 @@ flowchart TB
API4["/v1/models"]
end

subgraph ExternalMCP["🔌 External MCP Servers"]
EXT1["MCP Server 1<br/><i>WebSocket/HTTP/SSE</i>"]
EXT2["MCP Server N"]
end

%% Routes → Components
R1 & R2 --> C_Screen
RL --> C_Sidebar

%% Layout runs MCP health checks
RL --> S6

%% Component hierarchy
C_Screen --> C_Form & C_Messages & C_Settings
C_Messages --> C_Message
C_Message --> C_ChatMessageAgenticContent
C_Message --> C_MessageEditForm
C_Form & C_MessageEditForm --> C_ModelsSelector
C_Form --> C_McpServersSelector
C_Settings --> C_McpSettings
C_McpSettings --> C_McpResourceBrowser

%% Components → Hooks → Stores
C_Form & C_Messages --> H1 & H2
Expand All @@ -70,13 +90,24 @@ flowchart TB
C_Sidebar --> S2
C_ModelsSelector --> S3 & S4
C_Settings --> S5
C_McpSettings --> S6
C_McpResourceBrowser --> S6 & S7
C_McpServersSelector --> S6
C_Form --> S6

%% chatStore → agenticStore → mcpStore (agentic loop)
S1 --> SA
SA --> SV1
SA --> S6

%% Stores → Services
S1 --> SV1 & SV4
S2 --> SV4
S3 --> SV2 & SV3
S4 --> SV3
S5 --> SV5
S6 --> SV6
S7 --> SV6

%% Services → Storage
SV4 --> ST1
Expand All @@ -87,6 +118,9 @@ flowchart TB
SV2 --> API3 & API4
SV3 --> API2

%% MCP → External Servers
SV6 --> EXT1 & EXT2

%% Styling
classDef routeStyle fill:#e1f5fe,stroke:#01579b,stroke-width:2px
classDef componentStyle fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px
Expand All @@ -95,12 +129,17 @@ flowchart TB
classDef serviceStyle fill:#e8f5e9,stroke:#2e7d32,stroke-width:2px
classDef storageStyle fill:#fce4ec,stroke:#c2185b,stroke-width:2px
classDef apiStyle fill:#e3f2fd,stroke:#1565c0,stroke-width:2px
classDef mcpStyle fill:#e0f2f1,stroke:#00695c,stroke-width:2px
classDef agenticStyle fill:#e8eaf6,stroke:#283593,stroke-width:2px
classDef externalStyle fill:#f3e5f5,stroke:#6a1b9a,stroke-width:2px,stroke-dasharray: 5 5

class R1,R2,RL routeStyle
class C_Sidebar,C_Screen,C_Form,C_Messages,C_Message,C_MessageEditForm,C_ModelsSelector,C_Settings componentStyle
class C_Sidebar,C_Screen,C_Form,C_Messages,C_Message,C_ChatMessageAgenticContent,C_MessageEditForm,C_ModelsSelector,C_Settings componentStyle
class C_McpSettings,C_McpResourceBrowser,C_McpServersSelector componentStyle
class H1,H2 hookStyle
class S1,S2,S3,S4,S5 storeStyle
class SV1,SV2,SV3,SV4,SV5 serviceStyle
class S1,S2,S3,S4,S5,SA,S6,S7 storeStyle
class SV1,SV2,SV3,SV4,SV5,SV6 serviceStyle
class ST1,ST2 storageStyle
class API1,API2,API3,API4 apiStyle
class EXT1,EXT2 externalStyle
```
Loading
Loading