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
18 changes: 17 additions & 1 deletion docs/plugins/mcp.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,30 @@ Když je port obsazený, WorkTracker při startu nebo uložení nastavení uká

## Připojení klienta

V **Nastavení → Pluginy → MCP Server** je pod konfigurací sekce **Údaje pro připojení**: kompletní adresa a hlavička s tokenem, obojí s tlačítkem pro zkopírování. Ukazuje hodnoty z formuláře, server je začne používat až po uložení se zapnutým pluginem.
V **Nastavení → Pluginy → MCP Server** je pod konfigurací sekce **Údaje pro připojení**: kompletní adresa a hlavička s tokenem, obojí s tlačítkem pro zkopírování (hlavička se jen kopíruje, nezobrazuje se). Ukazuje hodnoty z formuláře, server je začne používat až po uložení se zapnutým pluginem.

Claude Code:

```
claude mcp add --transport http worktracker http://localhost:47821/mcp --header "Authorization: Bearer <token>"
```

Claude Desktop (**Settings → Developer → Edit Config**) se k lokálnímu HTTP serveru připojí přes můstek [`mcp-remote`](https://www.npmjs.com/package/mcp-remote), který potřebuje Node.js:

```json
{
"mcpServers": {
"worktracker": {
"command": "npx",
"args": ["-y", "mcp-remote", "http://localhost:47821/mcp", "--transport", "http-only", "--header", "Authorization:${AUTH_HEADER}"],
"env": { "AUTH_HEADER": "Bearer <token>" }
}
}
}
```

Za dvojtečkou v `Authorization:${AUTH_HEADER}` mezera být nesmí, na Windows se argumenty s mezerou mohou rozbít. Po uložení Claude Desktop úplně ukonči a spusť znovu. `mcp-remote` je komunitní balíček a token prochází přes něj.

VS Code (`.vscode/mcp.json` nebo uživatelská konfigurace):

```json
Expand Down
2 changes: 1 addition & 1 deletion docs/user-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ Otevírá se kliknutím na **Nastavení** v levém dolním rohu hlavního okna.
- Verze, autor a popis pluginu.
- Checkbox **Povolit plugin**.
- **Konfigurační formulář** — dynamicky generovaný z `PluginConfigurationField` daného pluginu. Pole typu `Password` se ukládají do secure storage.
- **Údaje pro připojení** (u pluginů implementujících `IConnectionDetailsProvider`, např. MCP Server) — hodnoty, které zadáš v připojovaném programu, s tlačítkem pro zkopírování. Tajné hodnoty jsou maskované.
- **Údaje pro připojení** (u pluginů implementujících `IConnectionDetailsProvider`, např. MCP Server) — hodnoty, které zadáš v připojovaném programu, s tlačítkem pro zkopírování. Tajné hodnoty se nezobrazují, jen kopírují.
- Tlačítko **Otestovat připojení** (u pluginů implementujících `ITestablePlugin`) s textovým výstupem výsledku.
- Pokud nejsou nalezené žádné pluginy, záložka zobrazí zprávu „Nejsou k dispozici žádné pluginy“.

Expand Down
2 changes: 1 addition & 1 deletion plugins/WorkTracker.Plugin.Mcp/McpPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public IReadOnlyList<PluginConnectionDetail> GetConnectionDetails(IReadOnlyDicti

if (configuration.GetValueOrDefault(ConfigKeys.AccessToken) is { Length: > 0 } accessToken)
{
details.Add(new PluginConnectionDetail("HTTP header", $"Authorization: Bearer {accessToken}", IsSecret: true));
details.Add(new PluginConnectionDetail("HTTP header (Authorization)", $"Authorization: Bearer {accessToken}", IsSecret: true));
}

return details;
Expand Down
22 changes: 10 additions & 12 deletions src/WorkTracker.Avalonia/Views/SettingsWindow.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -518,23 +518,21 @@
<Separator />
<TextBlock Text="{markup:Localize PluginConnection}" FontSize="12" Foreground="{DynamicResource TextMuted}" />
<ItemsControl ItemsSource="{Binding Plugins.SelectedItem.ConnectionDetails}">
<ItemsControl.Styles>
<Style Selector="TextBox.secret">
<Setter Property="PasswordChar" Value="●" />
</Style>
</ItemsControl.Styles>
<ItemsControl.ItemTemplate>
<DataTemplate x:DataType="abstractions:PluginConnectionDetail">
<StackPanel Margin="0,0,0,8" Spacing="3">
<TextBlock Text="{Binding Label}" FontSize="12" FontWeight="Medium" />
<Grid ColumnDefinitions="*,Auto">
<TextBox Grid.Column="0"
Text="{Binding Value, Mode=OneWay}"
IsReadOnly="True"
Classes.secret="{Binding IsSecret}"
Classes.revealPasswordButton="{Binding IsSecret}"
FontSize="12" />
<!-- A masked TextBox doesn't allow copying, hence the button -->
<SelectableTextBlock Grid.Column="0"
IsVisible="{Binding !IsSecret}"
Text="{Binding Value}"
FontSize="12" FontFamily="{DynamicResource FontFamilyMono}"
TextWrapping="Wrap" VerticalAlignment="Center" />
<!-- A secret is only copied, never shown -->
<TextBlock Grid.Column="0"
IsVisible="{Binding IsSecret}"
Text="●●●●●●●●●●●●"
FontSize="12" VerticalAlignment="Center" />
<Button Grid.Column="1" Click="OnCopyConnectionDetailClick"
ToolTip.Tip="{markup:Localize Copy}"
AutomationProperties.Name="{markup:Localize Copy}"
Expand Down
2 changes: 1 addition & 1 deletion src/WorkTracker.Avalonia/Views/SettingsWindow.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ private static bool IsInteractiveElement(PointerPressedEventArgs e)
var source = e.Source as Visual;
while (source != null)
{
if (source is Button or TextBox or ComboBox or CheckBox or RadioButton
if (source is Button or TextBox or SelectableTextBlock or ComboBox or CheckBox or RadioButton
or ListBox or TabItem or ToggleButton or ScrollBar)
{
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ public interface IConnectionDetailsProvider : IPluginDescriptor

/// <param name="Label">What the value is</param>
/// <param name="Value">The value to enter in the other program</param>
/// <param name="IsSecret">Whether the value is masked until the user reveals it</param>
/// <param name="IsSecret">Whether the value is only copied and never shown</param>
public sealed record PluginConnectionDetail(string Label, string Value, bool IsSecret = false);
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,13 @@ public Task PluginFields_RenderAccordingToTheirType() => UiThread.Dispatch(() =>
boxes["Url"].PasswordChar.Should().Be('\0');
boxes["Url"].AcceptsReturn.Should().BeFalse();

var details = window.GetVisualDescendants().OfType<TextBox>()
var details = window.GetVisualDescendants().OfType<TextBlock>()
.Where(t => t.DataContext is PluginConnectionDetail && t.IsEffectivelyVisible)
.ToDictionary(t => ((PluginConnectionDetail)t.DataContext!).Label);
.Select(t => t.Text)
.ToList();

details["Address"].Text.Should().Be("http://localhost");
details["Address"].PasswordChar.Should().Be('\0');
details["Header"].PasswordChar.Should().NotBe('\0', "a secret must be masked");
details.Values.Should().OnlyContain(t => t.IsReadOnly);
details.Should().Contain(["Address", "http://localhost", "Header"]);
details.Should().NotContain("Bearer x", "a secret must not be shown");

window.GetVisualDescendants().OfType<TextBlock>()
.Where(t => t.IsEffectivelyVisible)
Expand Down
2 changes: 1 addition & 1 deletion tests/WorkTracker.Plugin.Mcp.Tests/McpPluginTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public void ConnectionDetails_ContainUrlAndHeader()
_plugin.GetConnectionDetails(Configuration()).Should().BeEquivalentTo(
[
new PluginConnectionDetail("URL (Streamable HTTP)", Endpoint.ToString()),
new PluginConnectionDetail("HTTP header", $"Authorization: Bearer {Token}", IsSecret: true)
new PluginConnectionDetail("HTTP header (Authorization)", $"Authorization: Bearer {Token}", IsSecret: true)
]);
}

Expand Down
Loading