Add publish-mcp.sh so the standalone MCP binary stops going stale

Aspire doesn't run or manage src/Novelly.Mcp — it's a separate stdio
process the MCP client spawns from a published binary that nothing
rebuilds automatically. It had drifted 12 days out of date and was
silently missing the service-API-key auth header, causing confusing
401s. Script wraps the existing dotnet publish command via the shared
ensure_dotnet helper; README points at it instead of the raw command.

Also registers a UserSecretsId on Novelly.Api so Auth:ServiceApiKey
can be set locally without landing in appsettings.
This commit is contained in:
James Wampler
2026-08-17 18:38:48 -07:00
parent cb66ef7343
commit c879d9bfce
3 changed files with 23 additions and 2 deletions
+6 -1
View File
@@ -185,9 +185,14 @@ its own — it is a second front end, not a second implementation.
Build it, then point your MCP client at the produced binary: Build it, then point your MCP client at the produced binary:
```bash ```bash
dotnet publish src/Novelly.Mcp -c Release -o ./mcp-server ./scripts/publish-mcp.sh
``` ```
Aspire does not run or manage this process — it's a separate stdio subprocess your MCP
client spawns directly, so nothing rebuilds it automatically. Re-run the script (and
reconnect your MCP client) after pulling changes that touch `src/Novelly.Mcp`, or it keeps
serving whatever was published last, including against a stale auth contract.
`.mcp.json` (or Claude Desktop's config): `.mcp.json` (or Claude Desktop's config):
```jsonc ```jsonc
+15
View File
@@ -0,0 +1,15 @@
#!/usr/bin/env bash
# Rebuilds the standalone Novelly.Mcp binary that Claude Code (or Claude Desktop) spawns
# per .mcp.json. Aspire does not run or manage this process, so nothing else rebuilds it —
# run this after pulling changes that touch src/Novelly.Mcp, or the MCP server silently
# keeps serving whatever was published last.
set -euo pipefail
cd "$(dirname "${BASH_SOURCE[0]}")/.." && source ./scripts/ci/lib.sh
cd "$CI_ROOT"
ensure_dotnet
log "Publishing Novelly.Mcp to ./mcp-server"
dotnet publish src/Novelly.Mcp -c Release -o ./mcp-server
log "Done. Reconnect the MCP server (e.g. /mcp in Claude Code) to pick up the new build."
+2 -1
View File
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.Web"> <Project Sdk="Microsoft.NET.Sdk.Web">
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Novelly.ServiceDefaults\Novelly.ServiceDefaults.csproj" /> <ProjectReference Include="..\Novelly.ServiceDefaults\Novelly.ServiceDefaults.csproj" />
@@ -24,6 +24,7 @@
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<LangVersion>latest</LangVersion> <LangVersion>latest</LangVersion>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<UserSecretsId>fb455630-f631-46bb-9c60-0deaf01c593e</UserSecretsId>
</PropertyGroup> </PropertyGroup>
</Project> </Project>