Skip to content

Commit 276f12d

Browse files
committed
Update to user-wide Claude MCP configuration
1 parent 5b989c0 commit 276f12d

File tree

6 files changed

+72
-89
lines changed

6 files changed

+72
-89
lines changed

.mcp.json

Lines changed: 0 additions & 11 deletions
This file was deleted.

README.md

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,21 @@ npm install -g @mcp-pointer/server
2828
npx @mcp-pointer/server start
2929
```
3030

31-
### 2. Install Chrome Extension
31+
### 2. Configure with Claude Code
32+
33+
**Recommended (User-wide configuration):**
34+
```bash
35+
# Configure MCP Pointer for all your projects
36+
claude mcp add pointer -s user --env MCP_POINTER_PORT=7007 -- mcp-pointer start
37+
```
38+
39+
**Alternative (Project-specific configuration):**
40+
```bash
41+
# Configure MCP Pointer for current project only
42+
claude mcp add pointer --env MCP_POINTER_PORT=7007 -- mcp-pointer start
43+
```
44+
45+
### 3. Install Chrome Extension
3246

3347
**For end users** (when available):
3448
- Install from Chrome Web Store (coming soon)
@@ -43,9 +57,9 @@ npx @mcp-pointer/server start
4357
3. Open Chrome → Extensions → Developer mode → Load Unpacked
4458
4. Select `packages/chrome-extension/dist/` folder
4559

46-
### 3. Start Using
60+
### 4. Start Using
4761

48-
1. **Start the server**: `mcp-pointer start`
62+
1. **Start the server**: `mcp-pointer start` (or let Claude Code start it automatically)
4963
2. **Navigate to any webpage**
5064
3. **Option+Click** any element to select it
5165
4. **Ask your AI** to analyze the targeted element!
@@ -56,7 +70,7 @@ npx @mcp-pointer/server start
5670

5771
```bash
5872
mcp-pointer start # 👆 Start pointing at elements (start server)
59-
mcp-pointer configure # Auto-configure AI tools
73+
mcp-pointer configure # Show Claude MCP configuration command
6074
mcp-pointer show-config # Show manual configuration
6175
```
6276

@@ -124,28 +138,39 @@ packages/
124138

125139
## 🔧 Configuration
126140

127-
### Auto Configuration
141+
### Recommended Configuration
128142

129143
```bash
130-
mcp-pointer configure
144+
# User-wide configuration (recommended)
145+
claude mcp add pointer -s user --env MCP_POINTER_PORT=7007 -- mcp-pointer start
146+
147+
# Project-specific configuration
148+
claude mcp add pointer --env MCP_POINTER_PORT=7007 -- mcp-pointer start
131149
```
132150

133151
### Manual Configuration
134152

135-
Add to your AI tool's MCP settings (e.g., `~/.claude/settings.json`):
153+
For non-Claude MCP tools, add to your AI tool's MCP settings (e.g., `~/.claude/settings.json`):
136154

137155
```json
138156
{
139157
"mcpServers": {
140158
"@mcp-pointer/server": {
141159
"command": "mcp-pointer",
142160
"args": ["start"],
143-
"env": {}
161+
"env": {
162+
"MCP_POINTER_PORT": "7007"
163+
}
144164
}
145165
}
146166
}
147167
```
148168

169+
Get this configuration by running:
170+
```bash
171+
mcp-pointer show-config
172+
```
173+
149174
## 🎯 How It Works
150175

151176
1. **Element Selection**: Content script captures Option+Click events

SETUP_FOR_TESTERS.md

Lines changed: 13 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -43,41 +43,25 @@ pnpm -C packages/chrome-extension build
4343
3. Select the `packages/chrome-extension/dist/` folder
4444
4. The MCP Pointer extension should appear in your extensions list
4545

46-
### 3. Configure Your Working Project
46+
### 3. Configure Claude Code for Testing
4747

48-
Navigate to any project where you want to use MCP Pointer:
48+
**For Contributors/Testers** (after linking the MCP server):
4949

5050
```bash
51-
cd /path/to/your/frontend-project
52-
53-
# Auto-configure Claude Code for this project
54-
mcp-pointer configure
55-
56-
# This creates a .mcp.json file in your project
51+
# Configure MCP Pointer user-wide for testing
52+
claude mcp add pointer -s user --env MCP_POINTER_PORT=7007 -- mcp-pointer start
5753
```
5854

59-
The `.mcp.json` will look like:
60-
```json
61-
{
62-
"mcpServers": {
63-
"@mcp-pointer/server": {
64-
"command": "mcp-pointer",
65-
"args": ["start"],
66-
"env": {
67-
"MCP_POINTER_PORT": "7007"
68-
}
69-
}
70-
}
71-
}
72-
```
55+
**Important for Contributors:**
56+
- Since you linked the MCP server globally in step 1, this will use your local development build
57+
- The configuration is user-wide, so it works across all your projects
58+
- No need to create `.mcp.json` files in individual projects
7359

7460
### 4. Start Using MCP Pointer
7561

7662
```bash
77-
# In your working project, start the MCP server
63+
# Start the MCP server (Claude Code will start it automatically when needed)
7864
mcp-pointer start
79-
80-
# Or let Claude Code start it automatically
8165
```
8266

8367
Now you can:
@@ -104,8 +88,8 @@ pnpm -C packages/chrome-extension build
10488
# Remove the global link
10589
npm unlink -g @mcp-pointer/server
10690

107-
# Remove from your projects
108-
rm .mcp.json # In each project that used it
91+
# Remove from Claude Code
92+
claude mcp remove pointer
10993
```
11094

11195
## 🐛 Troubleshooting
@@ -143,8 +127,8 @@ mcp-pointer start --log-level debug
143127
### Claude Code Integration
144128

145129
1. **Tools not appearing:**
146-
- Restart Claude Code after running `mcp-pointer configure`
147-
- Check that `.mcp.json` exists in your project root
130+
- Restart Claude Code after configuring the MCP server
131+
- Check that the MCP server is configured with `claude mcp list`
148132
- Verify MCP server is running
149133

150134
2. **"Command not found: mcp-pointer":**
@@ -163,7 +147,6 @@ mcp-pointer/
163147
│ │ ├── dist/ # Built extension (created by pnpm build)
164148
│ │ └── src/ # Source code
165149
│ └── shared/ # Shared TypeScript types
166-
└── .mcp.json # Local MCP configuration (created by mcp-pointer configure)
167150
```
168151

169152
## 🎯 Testing Checklist

packages/server/src/configure.ts

Lines changed: 10 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,16 @@
1-
import { readFileSync, writeFileSync } from 'fs';
2-
import { join } from 'path';
31
import logger from './logger';
42

53
async function configure() {
6-
try {
7-
const mcpConfigPath = join(process.cwd(), '.mcp.json');
8-
let config: any = {};
9-
10-
try {
11-
const existingConfig = readFileSync(mcpConfigPath, 'utf8');
12-
config = JSON.parse(existingConfig);
13-
} catch {
14-
config = {};
15-
}
16-
17-
if (!config.mcpServers) {
18-
config.mcpServers = {};
19-
}
20-
21-
config.mcpServers['@mcp-pointer/server'] = {
22-
command: 'mcp-pointer',
23-
args: ['start'],
24-
env: {
25-
MCP_POINTER_PORT: '7007',
26-
},
27-
};
28-
29-
writeFileSync(mcpConfigPath, JSON.stringify(config, null, 2));
30-
logger.info('✅ MCP Pointer configured for Claude Code in current project!');
31-
logger.info('Created .mcp.json with pointer configuration.');
32-
} catch (error) {
33-
logger.error('Failed to configure Claude Code:', error);
34-
process.exit(1);
35-
}
4+
logger.info('🔧 To configure MCP Pointer with Claude Code, run this command:');
5+
logger.info('');
6+
logger.info('claude mcp add pointer -s user --env MCP_POINTER_PORT=7007 -- mcp-pointer start');
7+
logger.info('');
8+
logger.info('This will configure MCP Pointer user-wide across all your projects.');
9+
logger.info('');
10+
logger.info('Alternative: For project-specific configuration, use:');
11+
logger.info('claude mcp add pointer --env MCP_POINTER_PORT=7007 -- mcp-pointer start');
12+
logger.info('');
13+
logger.info('💡 You can customize the port by changing MCP_POINTER_PORT=7007 to your preferred port.');
3614
}
3715

3816
export default configure;

packages/server/src/mcp-handler.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { version } from 'process';
88
import type PointerWebSocketServer from './websocket-server';
99

1010
enum MCPToolName {
11-
GET_TARGETED_ELEMENT = 'get-targeted-element',
11+
GET_POINTED_ELEMENT = 'get-pointed-element',
1212
}
1313

1414
enum MCPServerName {
@@ -46,8 +46,8 @@ export default class MCPHandler {
4646
return {
4747
tools: [
4848
{
49-
name: MCPToolName.GET_TARGETED_ELEMENT,
50-
description: 'Get information about the currently targeted DOM element from the browser extension, in order to let you see a specific element the user is pointing on his/her the browser.',
49+
name: MCPToolName.GET_POINTED_ELEMENT,
50+
description: 'Get information about the currently pointed/shown DOM element from the browser extension, in order to let you see a specific element the user is showing you on his/her the browser.',
5151
inputSchema: {
5252
type: 'object',
5353
properties: {},
@@ -59,7 +59,7 @@ export default class MCPHandler {
5959
}
6060

6161
private async handleCallTool(request: any) {
62-
if (request.params.name === MCPToolName.GET_TARGETED_ELEMENT) {
62+
if (request.params.name === MCPToolName.GET_POINTED_ELEMENT) {
6363
return this.getTargetedElement();
6464
}
6565

@@ -74,8 +74,8 @@ export default class MCPHandler {
7474
content: [
7575
{
7676
type: 'text',
77-
text: 'No element is currently targeted. '
78-
+ 'The user needs to select an element in their browser using Option+Click.',
77+
text: 'No element is currently pointed. '
78+
+ 'The user needs to point an element in their browser using Option+Click.',
7979
},
8080
],
8181
};

packages/server/src/show-config.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,19 @@ export default function showConfig() {
77
'@mcp-pointer/server': {
88
command: 'mcp-pointer',
99
args: [CLICommand.START],
10-
env: {},
10+
env: {
11+
MCP_POINTER_PORT: '7007',
12+
},
1113
},
1214
},
1315
};
1416

15-
logger.info('Add this to your AI tool\'s MCP settings:');
17+
logger.info('📋 Manual MCP configuration for your AI tool:');
18+
logger.info('');
19+
logger.info('Add this to your AI tool\'s MCP settings (e.g., ~/.claude/settings.json):');
20+
logger.info('');
1621
logger.info(JSON.stringify(config, null, 2));
22+
logger.info('');
23+
logger.info('💡 Recommended: Use Claude MCP CLI instead:');
24+
logger.info('claude mcp add pointer -s user --env MCP_POINTER_PORT=7007 -- mcp-pointer start');
1725
}

0 commit comments

Comments
 (0)