WpfDevPackMcp
Advanced tools
Sorry, the diff of this file is not supported yet
@@ -7,3 +7,2 @@ <?xml version="1.0" encoding="utf-8"?> | ||
| <Default Extension="json" ContentType="application/octet" /> | ||
| <Default Extension="md" ContentType="application/octet" /> | ||
| <Default Extension="nuspec" ContentType="application/octet" /> | ||
@@ -10,0 +9,0 @@ <Default Extension="pdb" ContentType="application/octet" /> |
@@ -9,3 +9,3 @@ { | ||
| ".NETCoreApp,Version=v10.0": { | ||
| "WpfDevPackMcp/0.1.1": { | ||
| "WpfDevPackMcp/0.1.0": { | ||
| "dependencies": { | ||
@@ -448,3 +448,3 @@ "Microsoft.Extensions.Hosting": "10.0.8", | ||
| "libraries": { | ||
| "WpfDevPackMcp/0.1.1": { | ||
| "WpfDevPackMcp/0.1.0": { | ||
| "type": "project", | ||
@@ -451,0 +451,0 @@ "serviceable": false, |
+4
-12
@@ -5,18 +5,10 @@ <?xml version="1.0" encoding="utf-8"?> | ||
| <id>WpfDevPackMcp</id> | ||
| <version>0.1.1</version> | ||
| <title>WpfDevPackMcp — WPF Dev Pack knowledge MCP server</title> | ||
| <authors>christian289</authors> | ||
| <license type="expression">MIT</license> | ||
| <licenseUrl>https://licenses.nuget.org/MIT</licenseUrl> | ||
| <readme>README.md</readme> | ||
| <projectUrl>https://github.com/christian289/dotnet-with-claudecode/tree/main/mcp</projectUrl> | ||
| <description>A .NET 10 stdio Model Context Protocol (MCP) server that serves the WPF Dev Pack plugin's WPF knowledge topics. It reads plain-markdown topics from a local clone of christian289/dotnet-with-claudecode (wpf-dev-pack/knowledge) and exposes list/get/search/refresh tools. Configure the local clone path via /wpf-dev-pack:set-repo-path (or the WPFDEVPACK_REPO_PATH environment variable).</description> | ||
| <releaseNotes>See the repository for changes. Knowledge content is served live from the repo, independent of this package's version.</releaseNotes> | ||
| <copyright>Copyright (c) christian289</copyright> | ||
| <tags>mcp model-context-protocol wpf dotnet-tool claude wpf-dev-pack dnx</tags> | ||
| <version>0.1.0</version> | ||
| <authors>WpfDevPackMcp</authors> | ||
| <description>Package Description</description> | ||
| <packageTypes> | ||
| <packageType name="DotnetTool" /> | ||
| </packageTypes> | ||
| <repository type="git" url="https://github.com/christian289/dotnet-with-claudecode" branch="main" commit="ab5e9768960ae4dfaa37e00f7d9b8c1b36668a97" /> | ||
| <repository type="git" commit="9a2c8fab1c09ca6e7c5050a64674d944bd429424" /> | ||
| </metadata> | ||
| </package> |
-171
| # WpfDevPackMcp — WPF Dev Pack knowledge MCP server | ||
| `WpfDevPackMcp` is a small **.NET 10 stdio MCP server** that serves the WPF | ||
| knowledge topics of the `wpf-dev-pack` plugin. The knowledge content lives as | ||
| plain Markdown under `wpf-dev-pack/knowledge/` in a **local clone** of | ||
| `christian289/dotnet-with-claudecode`; the server reads it from disk and | ||
| refreshes it with `git pull` on demand. This keeps the knowledge out of the | ||
| plugin's `skills/` loader (so it no longer consumes session context) while | ||
| letting you update it by editing Markdown — **no server rebuild or republish | ||
| needed**. | ||
| This project lives **outside the plugin** (`mcp/`, at the repo root). The | ||
| plugin references it only through `wpf-dev-pack/.mcp.json` (the same way it | ||
| references HandMirrorMcp). | ||
| ## Prerequisites | ||
| - .NET SDK **10.0.300+** | ||
| - `git` on `PATH` (used for the on-demand refresh; the repo is public, no auth) | ||
| ## Build & test | ||
| ``` | ||
| dotnet build mcp/WpfDevPackMcp.csproj | ||
| dotnet test mcp/WpfDevPackMcp.Tests | ||
| ``` | ||
| ## Two ways to produce the server | ||
| ### 1. dnx + NuGet tool — how `.mcp.json` runs it | ||
| The project is a **framework-dependent, platform-agnostic** .NET tool | ||
| (`PackAsTool=true`, no `RuntimeIdentifiers`). A single `dotnet pack` produces | ||
| one small cross-platform package (~1.3 MB, managed IL) that runs on Windows, | ||
| Linux, and macOS with the .NET 10 runtime: | ||
| ``` | ||
| dotnet pack mcp/WpfDevPackMcp.csproj -c Release -o mcp/nupkg | ||
| dotnet nuget push mcp/nupkg/WpfDevPackMcp.<ver>.nupkg \ | ||
| --source https://api.nuget.org/v3/index.json --api-key <NUGET_KEY> | ||
| ``` | ||
| `wpf-dev-pack/.mcp.json` runs it with a pinned version: | ||
| ```json | ||
| "WpfDevPackMcp": { "type": "stdio", "command": "dnx", "args": ["WpfDevPackMcp@0.1.0", "--yes"] } | ||
| ``` | ||
| **Why not self-contained / RID-specific?** The .NET runtime is free here: the | ||
| wpf-dev-pack plugin already mandates the .NET 10 SDK (its hooks are `dotnet` | ||
| file-based apps and `.mcp.json` launches via `dnx`), so every machine that runs | ||
| this server already has .NET 10. A framework-dependent tool is therefore one | ||
| tiny cross-platform package and the simplest possible publish. (.NET 10 *can* | ||
| emit self-contained per-RID tool packages — `<RuntimeIdentifiers>win-x64;…;any</RuntimeIdentifiers>` | ||
| plus a RID-conditional `<SelfContained>` — and `dnx` auto-selects them; that's | ||
| only worth it for running where .NET isn't installed, which isn't the case | ||
| here.) **Native AOT** is likewise possible in principle (the build reaches | ||
| native codegen), but the JSON config code would need System.Text.Json source | ||
| generation to be AOT-safe, AOT needs a per-OS C++ toolchain, and it brings no | ||
| benefit when the runtime is already present — so it is not used. | ||
| ### 2. Single-file, self-contained executable — publish profile (optional) | ||
| A standalone `.exe` artifact (not a NuGet tool). Useful if you want a bare | ||
| executable without NuGet/dnx. Profile: | ||
| `mcp/Properties/PublishProfiles/win-x64.pubxml`. | ||
| ``` | ||
| dotnet publish mcp/WpfDevPackMcp.csproj -p:PublishProfile=win-x64 | ||
| ``` | ||
| Output: `mcp/bin/Release/net10.0/publish/win-x64/WpfDevPackMcp.exe` — one | ||
| standalone `.exe` (~37 MB), runtime bundled. For other OSes, add a sibling | ||
| profile with the matching RID (`linux-x64`, `osx-arm64`, …). Build output | ||
| (`bin/`, `obj/`, `nupkg/`) is git-ignored. | ||
| ## Publishing a new version to NuGet (maintainer) | ||
| NuGet versions are **immutable** — every release needs a new `<Version>`. The | ||
| plugin keeps running on the currently pinned version until you update the pin | ||
| in the last step, so publish first and re-pin after. | ||
| **One-time setup** | ||
| 1. Create a NuGet API key: nuget.org → Account → **API Keys** → **Create** | ||
| (scope: **Push**, glob pattern `WpfDevPackMcp` or `*`). Copy it (shown once). | ||
| 2. Ensure the `WpfDevPackMcp` package id is available on nuget.org (the first | ||
| push registers ownership). If taken, change `<PackageId>` here **and** the | ||
| `dnx` arg in `wpf-dev-pack/.mcp.json`. | ||
| **Each release** | ||
| 1. **Verify** — `dotnet test mcp/WpfDevPackMcp.Tests`, then exercise the tools | ||
| with the MCP Inspector (see "Inspect with the MCP Inspector" below). | ||
| 2. **Bump** `<Version>` in `mcp/WpfDevPackMcp.csproj` (e.g. `0.1.1` → `0.1.2`). | ||
| 3. **Pack** — `dotnet pack mcp/WpfDevPackMcp.csproj -c Release -o mcp/nupkg` | ||
| 4. **Push** — | ||
| ``` | ||
| dotnet nuget push mcp/nupkg/WpfDevPackMcp.<ver>.nupkg \ | ||
| --source https://api.nuget.org/v3/index.json --api-key <NUGET_KEY> | ||
| ``` | ||
| 5. **Wait** for nuget.org indexing (a few minutes), then verify: | ||
| `dnx WpfDevPackMcp@<ver> --yes` | ||
| 6. **Re-pin** — update `wpf-dev-pack/.mcp.json`: `WpfDevPackMcp@<old>` → | ||
| `WpfDevPackMcp@<ver>` (only after the new version is live on nuget.org). | ||
| Keep the API key secret — never commit it. Steps 3–6 are the maintainer's; | ||
| knowledge-content edits do **not** need a republish (they are served live from | ||
| the repo). | ||
| ## Runtime configuration (required) | ||
| The server must know where the local clone is. Resolution order: | ||
| 1. `WPFDEVPACK_REPO_PATH` environment variable | ||
| 2. `~/.wpf-dev-pack-mcp/config.json` — `{ "repoPath": "...", "branch": "main" }` | ||
| Configure it from a Claude Code session: | ||
| ``` | ||
| /wpf-dev-pack:set-repo-path <path-to-local-clone> | ||
| ``` | ||
| - If neither is set, the tools return a "not configured" error — the plugin's | ||
| `RepoPathGuard` PreToolUse hook blocks the call first with guidance. | ||
| - If the configured path is empty / not a git repo, the server clones the | ||
| public repo into it on first use. | ||
| - Optional: `WPFDEVPACK_PULL_TTL_MINUTES` (default `60`) controls how often the | ||
| server pulls before serving. | ||
| ## Tools | ||
| | Tool | Description | | ||
| |------|-------------| | ||
| | `list_wpf_topics()` | All topics with a one-line summary + companion files | | ||
| | `get_wpf_topic(id, variant?)` | Full Markdown; `variant`: `default` (TOPIC.md) \| `prism` (PRISM.md) \| `advanced` (ADVANCED.md) | | ||
| | `search_wpf_topics(query, maxResults?)` | Ranked matches over id / title / summary / body | | ||
| | `refresh_wpf_knowledge()` | Force a `git pull` + rescan | | ||
| Topic files: `wpf-dev-pack/knowledge/<id>/TOPIC.md` — **no YAML frontmatter**. | ||
| Title = the first `# H1`; summary = the first `>` blockquote. Variants are the | ||
| sibling `PRISM.md` / `ADVANCED.md` files. | ||
| ## Inspect with the MCP Inspector | ||
| ``` | ||
| # List tools (against the single-file exe) | ||
| npx @modelcontextprotocol/inspector --cli \ | ||
| "mcp/bin/Release/net10.0/publish/win-x64/WpfDevPackMcp.exe" --method tools/list | ||
| # Call a tool (set the repo path first, or rely on ~/.wpf-dev-pack-mcp/config.json) | ||
| npx @modelcontextprotocol/inspector --cli "<exe>" \ | ||
| --method tools/call --tool-name list_wpf_topics | ||
| npx @modelcontextprotocol/inspector --cli "<exe>" \ | ||
| --method tools/call --tool-name get_wpf_topic \ | ||
| --tool-arg id=implementing-communitytoolkit-mvvm --tool-arg variant=prism | ||
| ``` | ||
| `stdout` carries only MCP JSON-RPC; all logs go to `stderr`. The server gives | ||
| its `git` child processes a closed `stdin`, so they never inherit/block on the | ||
| server's JSON-RPC pipe. | ||
| ## Updating knowledge content | ||
| Edit the relevant `wpf-dev-pack/knowledge/<id>/TOPIC.md` (or add a new topic | ||
| directory plus a keyword in `wpf-dev-pack/hooks/WpfKeywordDetector.cs`) and | ||
| push. The server picks it up on its next pull — **no rebuild, no republish, no | ||
| plugin version bump**. | ||
| > Korean mirror: [README.ko.md](README.ko.md) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet