MCP: persistent port/token + mcp-remote shim recipe for Claude Code
Port (default 47821) and bearer token now persist to mcp.json with OS-picked fallback if the port is taken; new Regenerate button in the panel rotates the token and restarts the running server. rmcp's DNS-rebinding host allowlist is disabled so WSL gateway IPs can connect (bearer-auth handles the gatekeeping); the auth middleware only enforces on /mcp paths so OAuth-discovery clients don't see a Bearer challenge on /.well-known/* probes. Claude Code's HTTP-MCP client currently tries OAuth and ignores static `headers` auth (anthropics/claude-code#17152, #46879), so the panel + README config snippet now uses `npx mcp-remote` as a stdio shim that proxies the HTTP endpoint with the bearer baked in.
This commit is contained in:
parent
352aa8c281
commit
799f507c3c
8 changed files with 290 additions and 46 deletions
16
src/App.tsx
16
src/App.tsx
|
|
@ -10,6 +10,7 @@ import {
|
|||
mcpStart,
|
||||
mcpStop,
|
||||
mcpStatus as mcpStatusCmd,
|
||||
mcpRegenerateToken,
|
||||
mcpUpdateState,
|
||||
writeToPane,
|
||||
killPane,
|
||||
|
|
@ -343,6 +344,20 @@ export default function App() {
|
|||
}
|
||||
}, [notify]);
|
||||
|
||||
const regenerateMcpToken = useCallback(async () => {
|
||||
try {
|
||||
const st = await mcpRegenerateToken();
|
||||
setMcpStatus(st);
|
||||
notify(
|
||||
st.running
|
||||
? "MCP token regenerated — update your client config"
|
||||
: "MCP token regenerated",
|
||||
);
|
||||
} catch (e) {
|
||||
notify(`MCP token regen failed: ${e}`);
|
||||
}
|
||||
}, [notify]);
|
||||
|
||||
// On mount, sync our local mcpStatus with whatever's already running
|
||||
// (the backend persists state across HMR reloads).
|
||||
useEffect(() => {
|
||||
|
|
@ -1051,6 +1066,7 @@ export default function App() {
|
|||
status={mcpStatus}
|
||||
onStart={startMcp}
|
||||
onStop={stopMcp}
|
||||
onRegenerateToken={regenerateMcpToken}
|
||||
onClose={() => setMcpPanelOpen(false)}
|
||||
allowedPaneCount={allowedPaneCount}
|
||||
totalPaneCount={leafCount(tree)}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue