Interactive setup workflow for running the Magnet MCP server locally (project-specific, magnet-app directory only). Use when user says "local setup", "run locally", "test locally", "configure MCP", or "set up local development".
This skill walks users through setting up the Magnet MCP server for local development and testing with their MCP client (Claude Code, Cursor, Claude Desktop).
Important: This setup configures the MCP server to talk to a local Magnet instance (localhost:3000), not production. The user must have the Magnet web app running locally.
Use this skill when the user requests:
Verify the development environment is ready:
# Check Node.js version (must be >= 22.2.0)
node --version
# Check pnpm is installed
pnpm --version
# Check if dependencies are installed
ls node_modules/.bin/tsc 2>/dev/null && echo "Dependencies installed" || echo "Need to install dependencies"
If dependencies are missing, install them:
pnpm install
Important: This setup configures the MCP server for the magnet-app project directory only. The MCP server will NOT be available when working in other directories.
Use AskUserQuestion to confirm the user understands:
Question: "This will configure the MCP server for your magnet-app project directory only. It will NOT be available globally in other projects. Do you understand and want to proceed?" Options:
If the user needs global setup, explain:
Check that the local Magnet web app is running:
curl -s -o /dev/null -w "%{http_code}" http://localhost:3000 || echo "Not running"
If it returns 200 (or redirects), the server is running. If not, inform the user they need to start the Magnet web app first before continuing.
Build the TypeScript project:
pnpm build
Verify the build succeeded:
ls -la dist/index.js
Check if .env file exists with API key:
if [ -f .env ]; then
echo ".env file exists"
grep -q "MAGNET_API_KEY" .env && echo "API key configured" || echo "API key missing"
else
echo "No .env file found"
fi
If no .env file, check .env.sample for template:
cat .env.sample 2>/dev/null
Use AskUserQuestion to get the Magnet API key if not already configured. Since this is a local setup, the API key must come from the local Magnet instance (not production).
Question: "Do you have an API key from your local Magnet instance?" Options:
If they provide a key, store it:
echo "MAGNET_API_KEY=<their-key>" > .env
echo "MAGNET_WEB_API_BASE_URL=http://localhost:3000" >> .env
Use AskUserQuestion to determine which MCP client they're using:
Question: "Which MCP client are you using?" Options:
.mcp.json fileImportant: The default setup location should be the user's magnet-app repo, since that's where they'll be doing development work and need the MCP tools available.
# Common locations to check for magnet-app
ls -d ~/magnet-app 2>/dev/null || \
ls -d ~/Projects/magnet-app 2>/dev/null || \
ls -d ~/Code/magnet-app 2>/dev/null || \
echo "magnet-app not found in common locations"
If not found, ask: Question: "Where is your magnet-app repository located?"
Claude Code uses .mcp.json files, NOT settings.json for MCP servers. The settings.json schema does not support the mcpServers field.
# Check for existing .mcp.json in magnet-app
cat ~/magnet-app/.mcp.json 2>/dev/null || echo "No .mcp.json found"
Cursor:
cat ~/.cursor/mcp.json 2>/dev/null
Claude Desktop (macOS):
cat ~/Library/Application\ Support/Claude/claude_desktop_config.json 2>/dev/null
Get the absolute path to the MCP server:
pwd # Should be /path/to/magnet-mcp-server
Create the .mcp.json file structure. Important: This always points to the local Magnet API at localhost:3000.
{
"mcpServers": {
"magnet-local": {
"command": "node",
"args": ["/absolute/path/to/magnet-mcp-server/dist/index.js"],
"env": {
"MAGNET_API_KEY": "<api-key-here>",
"MAGNET_WEB_API_BASE_URL": "http://localhost:3000"
}
}
}
}
For development (rebuilds before running):
{
"mcpServers": {
"magnet-local": {
"command": "pnpm",
"args": ["--dir", "/absolute/path/to/magnet-mcp-server", "dev"],
"env": {
"MAGNET_API_KEY": "<api-key-here>",
"MAGNET_WEB_API_BASE_URL": "http://localhost:3000"
}
}
}
}
Create the .mcp.json file in the user's magnet-app directory (the default location).
Ask user: Question: "How should the local server be named?" Options:
Important: The .mcp.json file is project-specific. It only makes the MCP server available when working in that directory.
Critical: The .mcp.json file contains the API key and must NOT be committed to git.
Check and update .gitignore in the magnet-app directory:
grep -E "^\.mcp\.json$" ~/magnet-app/.gitignore 2>/dev/null || echo ".mcp.json" >> ~/magnet-app/.gitignore
After updating the configuration, provide next steps:
For Claude Code:
Run /mcp to verify the magnet-local server is connected and shows its tools
If the server doesn't connect, check:
pnpm build completed successfullyCommon errors:
User: "I want to test the MCP server locally"
Actions:
pnpm install if neededpnpm build.env with MAGNET_WEB_API_BASE_URL.mcp.json in magnet-app with magnet-local config (including localhost:3000 URL).mcp.json to magnet-app's .gitignoreUser: "I need to test my changes before deploying"
Actions:
pnpm build).mcp.json in magnet-appUser: "The local MCP server isn't working"
Actions:
MAGNET_WEB_API_BASE_URL=http://localhost:3000 MAGNET_API_KEY=xxx node dist/index.js.mcp.json has MAGNET_WEB_API_BASE_URL set to http://localhost:3000.mcp.json has correct absolute path to dist/index.js.mcp.json files - NOT settings.json for MCP servers.mcp.json is project-specific - it only works when Claude Code is running in that directorypnpm dev for development builds (rebuilds before running).mcp.json to .gitignore - it contains the API key.env file in magnet-mcp-server is also gitignored and safe for storing API keysSearch for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer