mcp
v0.15.0MCP server that exposes Loupe comments to Claude Code as an actionable, fully-contextualized backlog.
@loupekit/mcp is an MCP (Model Context Protocol) server for Loupe. It gives a coding agent, such as Claude Code, the visual feedback that people pin on your site. For each comment the agent gets the request, the target element's HTML and computed styles, and the screenshot. The server talks to your MCP client over stdio: the client starts the server as a child process and exchanges messages with it over standard input and output. Or install it globally. This adds the loupe-mcp command:
Summary extracted from the README.
@loupekit/mcp
@loupekit/mcp is an MCP (Model Context Protocol) server for Loupe. It gives a coding agent, such as Claude Code, the visual feedback that people pin on your site. For each comment the agent gets the request, the target element's HTML and computed styles, and the screenshot.
The server talks to your MCP client over stdio: the client starts the server as a child process and exchanges messages with it over standard input and output.
Contents
- Prerequisites
- Install
- Configure your MCP client
- Verify
- Tools at a glance
- Environment
- The bridge and the /monitor page
- Troubleshooting
- Links
- License
Prerequisites
- Node.js 24 or later. The package is built for Node.js 24. It does not declare an
enginesfield, so npm does not warn you on an older version. - A running Loupe server. This is the backend that stores comments and serves the API the MCP server calls, for example the Node server
@loupekit/server. To run one on your machine, see Run the local server and dashboard. - A project key and its project secret. A project is the unit Loupe groups comments under. It has a public project key, such as
pk_demo_acme, and a private project secret. The project secret is the admin key: the server accepts it in theX-Loupe-Adminheader. For the demo project thatnpm run seedcreates, the key ispk_demo_acmeand the seed prints the secret asadmin key. - An MCP client, such as Claude Code.
- npm, which includes
npx. To run the server from a source checkout instead, you also need git.
Install
Install from npm
Run it without installing:
npx -y @loupekit/mcp
Or install it globally. This adds the loupe-mcp command:
npm install -g @loupekit/mcp
Note: Fixed in 0.14.1. The published 0.14.0 package fails at start with
ERR_MODULE_NOT_FOUNDfor@loupekit/shared. On 0.14.0, run the server from a source checkout.
Install from a source checkout
Use this method to run the server from the repository, for example while you work on Loupe itself.
-
Clone the repository:
git clone https://github.com/mohamed-ashraf-elsaed/loupe.gitYou should see a new
loupefolder. -
Go into the folder:
cd loupe -
Install the dependencies:
npm installThe command finishes without errors and creates
node_modules. -
Build the shared package:
npm run build:sharedYou should see
tsc -p tsconfig.jsonin the output, and the command exits without errors. -
Print the full path of the folder:
pwdYou should see an absolute path that ends in
/loupe. You use it as<ABSOLUTE_PATH_TO_LOUPE>when you configure your client. Node.js 24 runs the TypeScript entrypackages/mcp/index.tsdirectly, so you do not need to build the MCP package.
Configure your MCP client
Add a loupe server to your client's MCP configuration. For Claude Code, this is .mcp.json in your project root.
{
"mcpServers": {
"loupe": {
"command": "npx",
"args": ["-y", "@loupekit/mcp"],
"env": {
"LOUPE_API": "<API_URL>",
"LOUPE_PROJECT_KEY": "<PROJECT_KEY>",
"LOUPE_ADMIN_KEY": "<PROJECT_SECRET>"
}
}
}
}
For a source checkout, set "command": "node" and "args": ["<ABSOLUTE_PATH_TO_LOUPE>/packages/mcp/index.ts"] instead, where <ABSOLUTE_PATH_TO_LOUPE> is the path that pwd printed in step 5 of the install.
Replace the placeholders:
<API_URL>: the base URL of your Loupe server, for examplehttp://localhost:8787.<PROJECT_KEY>: the project whose comments the agent works on, for examplepk_demo_acme.<PROJECT_SECRET>: that project's secret.LOUPE_ADMIN_KEYholds the project secret, and the server sends it as theX-Loupe-Adminheader. Keep the file out of version control if it holds a real secret.
For other MCP clients, see Connect Claude Code and other MCP clients.
Verify
-
Start the server by hand, with the same values as your client configuration:
LOUPE_API=<API_URL> LOUPE_PROJECT_KEY=<PROJECT_KEY> LOUPE_ADMIN_KEY=<PROJECT_SECRET> npx -y @loupekit/mcpFor a source checkout, replace
npx -y @loupekit/mcpwithnode <ABSOLUTE_PATH_TO_LOUPE>/packages/mcp/index.ts.You should see this line on standard error:
[loupe-mcp] connected · project=<PROJECT_KEY> · api=<API_URL> · bridge=http://127.0.0.1:9800The line ends in
bridge=disabledwhenLOUPE_BRIDGE_PORTis0or the port is busy. PressCtrl+Cto stop the server, so the client's own copy can use port 9800. -
Start your client. In Claude Code, run
/mcp.You should see
loupelisted as connected, with 19 tools. -
Ask your agent:
List my Loupe comments.You should see the agent call
list_commentsand reply with a line such as3 comment(s):, then one line per comment. If the project has no matching comments, you seeNo comments match.
Tools at a glance
The server exposes 19 tools.
| Purpose | Tools |
|---|---|
| Comments (the feedback backlog) | list_comments, get_comment, update_status, propose_change |
| Selections and element context | get_latest_selection, get_selection_history, get_element_context, find_source_for_selection |
| Companion chat with the person watching | get_companion_messages, reply_to_companion |
| Agent activity | get_activity_summary, get_recent_events, get_files_touched, get_dashboard_url, install_agent_hooks |
| Threads and pull requests | get_thread_conversation, add_thread_message, mark_thread_addressed, create_pr_for_thread |
Terms used in the table:
- Companion chat: messages that the person watching the page sends to the agent from the widget's Chat tab, and the agent's replies.
- Thread: the conversation on a piece of feedback: the original request, then every reply with its author.
create_pr_for_thread needs a GitHub token in GITHUB_TOKEN or GH_TOKEN, or a signed-in gh CLI.
install_agent_hooks edits your user-level Claude Code settings, $HOME/.claude/settings.json, unless you set LOUPE_CLAUDE_SETTINGS or pass a path. Before it writes, it copies the existing file to settings.json.loupe-backup in the same folder. It leaves other hook entries alone. To undo it, restore the backup:
cp "$HOME/.claude/settings.json.loupe-backup" "$HOME/.claude/settings.json"
For each tool's arguments and output, see the MCP reference.
Environment
The defaults point at the local demo server. Set these three variables whenever you use another server or project:
| Variable | Type | Default | Purpose | Example |
|---|---|---|---|---|
LOUPE_API |
URL | http://localhost:8787 |
Base URL of the Loupe server. | https://tracker.example.com |
LOUPE_PROJECT_KEY |
string | pk_demo_acme |
The project the agent works on. | pk_demo_acme |
LOUPE_ADMIN_KEY |
string | empty | The project secret, sent as X-Loupe-Admin. |
sk_demo_acme_0f3b9c |
Other variables control the bridge port, the workspace, the hooks and GitHub. See Environment variables.
The bridge and the /monitor page
The server also runs a local HTTP bridge on 127.0.0.1, port 9800 by default. Set LOUPE_BRIDGE_PORT to change the port, or to 0 to turn the bridge off. The comment tools work without the bridge.
The Loupe widget is the feedback panel that @loupekit/sdk adds to your page. It uses the bridge only when you configure it to:
- Set the widget's
bridgeoption to'http://127.0.0.1:9800'to send element selections and show presence, the list of people who have the page open. Without it, the widget hides the peer list. - Also set
chat: trueto turn on the Chat tab for companion chat. It is off by default.
If you run install_agent_hooks, Claude Code also reports its tool calls, prompts and sessions to the bridge. Open http://127.0.0.1:9800/monitor to watch that activity live on a read-only page.

Troubleshooting
| Symptom | Cause | Fix |
|---|---|---|
The server exits at start with ERR_MODULE_NOT_FOUND for @loupekit/shared. |
You run @loupekit/mcp 0.14.0, which does not declare @loupekit/shared as a runtime dependency. |
Use 0.14.1 or later (npx -y @loupekit/mcp@latest), or install from a source checkout. |
A tool fails with an error such as GET /v1/comments?projectKey=pk_demo_acme → 401. |
LOUPE_ADMIN_KEY is empty or is not the project secret. |
Set LOUPE_ADMIN_KEY to the project secret, then restart the client. |
The log shows [loupe] bridge port 9800 is busy after 6 attempts — continuing without it. |
Another process, often a second Loupe MCP server, holds port 9800. | Stop the other process, or set LOUPE_BRIDGE_PORT to a free port. The comment tools work either way. |
Claude Code does not list loupe in /mcp. |
.mcp.json is not in the folder where you started Claude Code, or you declined the trust prompt. |
Start Claude Code from the project root and approve the server. |
For more cases, see Troubleshooting in Connect Claude Code and other MCP clients.
Links
- Loupe on GitHub
- Website and guide
- Connect Claude Code and other MCP clients
- MCP reference
- Changelog
@loupekit/sdk, the widget that captures the feedback- Report an issue
License
MIT © Mohamed Ashraf Elsaed