Renesas FSP Smart Configurator MCP
Local development
Running against a Smart Configurator Web Service
The Smart Configurator tools talk to a locally running SCWS over REST. There is
no fixed port: the Smart Configurator UI extension starts one SCWS instance
per workspace folder that holds a configuration.xml, and this extension
discovers each instance's URL through the UI extension's exported API (see
src/smartConfigurator/scwsServiceLocator.ts). Open the project folder in the
same window and the tools find it automatically.
Connecting agents outside VS Code
Copilot finds the server by itself. Claude Code is connected automatically
once per VS Code profile (normally once per machine): when a window starts and Claude Code is installed (the
Claude Code extension, or the claude CLI on the PATH), the extension writes one user
scope entry renesas-fsp-sc for http://127.0.0.1:48080/mcp with this
user's router token (~/.renesas/mcp/fsp-sc/router-token) into Claude Code's
configuration (~/.claude.json, or .claude.json in CLAUDE_CONFIG_DIR).
The file is edited directly rather than with claude mcp add, so the token
never appears on a command line, where other users of the machine could read
it; the rest of the file is kept as it is. The entry never
changes, so it keeps working in every project and after every restart. If
adding it fails, the reason is written to the output channel and it is tried
again on the next start. Renesas FSP Smart Configurator MCP: Connect AI
Agent does the same on demand, for example to repair the entry, or after the
router token file was deleted (the entry still holds the old token). An entry
the user removes is not added again.
The URL is an HTTP URL on the loopback address, so it is also accepted where
the organisation's Claude Code settings only allow listed server URLs
(allowManagedMcpServersOnly with serverUrl entries such as
http://127.0.0.1:*/*), unlike a stdio server.
Each window writes ~/.renesas/mcp/fsp-sc/<port>.json with its URL, token,
process id and workspace folders. One window serves the agent router
(src/mcp/agentRouter.ts) on port 48080; the others try to take the port
over every few seconds, so the router moves on when that window closes. The
router asks Claude Code for its project folder (MCP roots) on the first request
of a session, then relays every message to the window that has that folder
open, with the bridge code in src/bridge/. Subfolders of an open folder
work, the router waits for a window that is still opening its folder, and if
no window or more than one window has the folder open, the agent gets an error
that says so. The tool list is the exception: when no window has the folder
open, another window answers it at once, so Claude Code started outside an
open project still shows renesas-fsp-sc as connected, and only a tool call
reports that the project is not open.
The router only runs while a VS Code window with this extension runs. A Claude
Code session that connects before that (Claude started first, or before the
extension has activated) gets "connection refused" and shows renesas-fsp-sc
as failed. Reconnect it with /mcp once VS Code runs.
Agents send the token to whatever listens on port 48080, and on a machine
with several users another user can take the port. So a window that cannot
get the port checks that the program on it is a router of this user: it sends
a new random nonce to /router-proof and expects an HMAC of it with this
user's proof key (~/.renesas/mcp/fsp-sc/router-proof-key), which, unlike
the token, never goes to an agent. If another program holds the port, the
window shows a warning, Claude Code cannot connect until that program stops,
and the window leaves ~/.renesas/mcp/fsp-sc/router-token-rotate. The router
that gets the port next (or a window that then finds a router of this user on
it) replaces the token before it answers any request, and updates the Claude
Code entry, so a token that program received from an agent is no longer
accepted. Claude Code sessions that were already running must then be
restarted.
This limits the risk on a machine with several users but does not remove it.
The token is only replaced when a window of this user sees the other program
on the port. A program that holds port 48080 only while no window of this user
checks it, and frees it again, is not seen, and a token it received from an
agent in that time stays valid. That is the time while no VS Code window of
this user runs, and the few seconds between the serving window closing and
the next window trying the port. On such machines, start VS Code before
Claude Code. A check without a clear answer (no answer in time, or a failed
connection) is repeated straight away, so a window of this user that is busy
for a moment keeps the token. Both checks only count a router of this user
that already held the port when the window tried to get it (the answer
includes the time that router got the port, covered by the proof key). A
router that got the port later may have followed another program, or have its
answer relayed by it, so it counts as no clear answer.
A check whose repeat has no clear answer either counts as another program
only after three in a row, so a busy window of this user is not reported. But
every such check leaves the rotate marker at once, and the router that serves
next, or the one serving now, replaces the token before it answers another
request. That also happens when the port was held by a window of this user
that was busy for longer, was closing, or got the port just before another
window tried it (e.g. when VS Code restores several windows), so running
Claude Code sessions then get 401 until they are restarted. A token replayed in the moment before a
running check leaves the marker (at most twice the 2 second check timeout) is
still accepted for that request; a session it opens then gets 401 on every
later request. Claude Code sessions that were already
running may have to be restarted after a token change. The token file and the
proof key are created readable by their owner only, and the extension writes
.claude.json readable by its owner only.
The bridge (~/.renesas/mcp/fsp-sc/bin/renesas-fsp-sc-mcp-bridge) is still
written for agents that start a stdio MCP server, with the folder taken from
their working directory or --folder <path>.
Windows take turns writing ~/.claude.json (lock folder
~/.renesas/mcp/fsp-sc/claude-config.lock), because windows restored together
start at the same time. A lock left by a window that died is removed after two
minutes, by one window at a time (claude-config.lock.reclaim).