obscura-mcp-server 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/INSTALL.md +8 -8
- package/README.md +30 -17
- package/bun.lock +23 -0
- package/dist/index.js +2 -2
- package/lefthook.yml +11 -0
- package/package.json +13 -3
- package/src/index.ts +1 -1
- package/src/tools/fetch/index.ts +1 -1
- package/src/tools/query/fetch.ts +4 -7
- package/src/tools/query/index.ts +1 -1
- package/src/tools/query/obscura.ts +3 -3
- package/src/tools/search/index.ts +1 -1
package/INSTALL.md
CHANGED
|
@@ -6,14 +6,14 @@ This guide covers how to configure the Obscura MCP server with various AI client
|
|
|
6
6
|
|
|
7
7
|
### Method 1: Using bunx (recommended - no installation needed)
|
|
8
8
|
|
|
9
|
-
Once published to npm
|
|
9
|
+
Once published to npm:
|
|
10
10
|
|
|
11
11
|
```json
|
|
12
12
|
{
|
|
13
13
|
"mcpServers": {
|
|
14
14
|
"obscura": {
|
|
15
15
|
"command": "bunx",
|
|
16
|
-
"args": ["obscura-mcp-server"]
|
|
16
|
+
"args": ["-y", "obscura-mcp-server"]
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
}
|
|
@@ -89,7 +89,7 @@ bun install
|
|
|
89
89
|
"servers": {
|
|
90
90
|
"obscura": {
|
|
91
91
|
"command": "bunx",
|
|
92
|
-
"args": ["obscura-mcp-server"]
|
|
92
|
+
"args": ["-y", "obscura-mcp-server"]
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
95
|
}
|
|
@@ -114,7 +114,7 @@ Restart VSCode after editing.
|
|
|
114
114
|
"obscura": {
|
|
115
115
|
"type": "stdio",
|
|
116
116
|
"command": "bunx",
|
|
117
|
-
"args": ["obscura-mcp-server"]
|
|
117
|
+
"args": ["-y", "obscura-mcp-server"]
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
120
|
}
|
|
@@ -150,7 +150,7 @@ Cursor also supports UI configuration: Settings → Features → Model Context P
|
|
|
150
150
|
"mcp": {
|
|
151
151
|
"obscura": {
|
|
152
152
|
"type": "local",
|
|
153
|
-
"command": ["bunx", "obscura-mcp-server"],
|
|
153
|
+
"command": ["bunx", "-y", "obscura-mcp-server"],
|
|
154
154
|
"environment": {
|
|
155
155
|
"OBSCURA_PATH": "/usr/local/bin/obscura"
|
|
156
156
|
},
|
|
@@ -175,7 +175,7 @@ Cursor also supports UI configuration: Settings → Features → Model Context P
|
|
|
175
175
|
"mcpServers": {
|
|
176
176
|
"obscura": {
|
|
177
177
|
"command": "bunx",
|
|
178
|
-
"args": ["obscura-mcp-server"]
|
|
178
|
+
"args": ["-y", "obscura-mcp-server"]
|
|
179
179
|
}
|
|
180
180
|
}
|
|
181
181
|
}
|
|
@@ -202,7 +202,7 @@ claude mcp list
|
|
|
202
202
|
"mcpServers": {
|
|
203
203
|
"obscura": {
|
|
204
204
|
"command": "bunx",
|
|
205
|
-
"args": ["obscura-mcp-server"]
|
|
205
|
+
"args": ["-y", "obscura-mcp-server"]
|
|
206
206
|
}
|
|
207
207
|
}
|
|
208
208
|
}
|
|
@@ -227,7 +227,7 @@ Then configure the adapter to point to the Obscura MCP server:
|
|
|
227
227
|
"mcpServers": {
|
|
228
228
|
"obscura": {
|
|
229
229
|
"command": "bunx",
|
|
230
|
-
"args": ["obscura-mcp-server"]
|
|
230
|
+
"args": ["-y", "obscura-mcp-server"]
|
|
231
231
|
}
|
|
232
232
|
}
|
|
233
233
|
}
|
package/README.md
CHANGED
|
@@ -40,34 +40,47 @@ Query a webpage using CSS selectors or text search.
|
|
|
40
40
|
|
|
41
41
|
## Installation
|
|
42
42
|
|
|
43
|
+
Add to your MCP servers config:
|
|
44
|
+
|
|
45
|
+
```json
|
|
46
|
+
{
|
|
47
|
+
"mcpServers": {
|
|
48
|
+
"obscura": {
|
|
49
|
+
"command": "bunx",
|
|
50
|
+
"args": ["-y", "obscura-mcp-server"]
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
43
56
|
See [INSTALL.md](./INSTALL.md) for setup with VSCode, Cursor, OpenCode, Claude Code, Codex, and Pi.
|
|
44
57
|
|
|
45
58
|
## Architecture
|
|
46
59
|
|
|
47
60
|
```
|
|
48
61
|
┌─────────────────────────────────────────────────────────────┐
|
|
49
|
-
│
|
|
50
|
-
│
|
|
62
|
+
│ MCP Client │
|
|
63
|
+
│ Coding Agent │
|
|
51
64
|
└─────────────────────────┬───────────────────────────────────┘
|
|
52
65
|
│ JSON-RPC
|
|
53
66
|
▼
|
|
54
67
|
┌─────────────────────────────────────────────────────────────┐
|
|
55
|
-
│ Obscura MCP Server
|
|
56
|
-
│
|
|
57
|
-
│
|
|
58
|
-
│
|
|
59
|
-
│
|
|
60
|
-
│
|
|
68
|
+
│ Obscura MCP Server │
|
|
69
|
+
│ ┌─────────┐ ┌─────────┐ ┌─────────┐ │
|
|
70
|
+
│ │ fetch │ │ search │ │ query │ ← Tools │
|
|
71
|
+
│ └───┬─────┘ └───┬─────┘ └───┬─────┘ │
|
|
72
|
+
│ │ │ │ │
|
|
73
|
+
│ ▼ ▼ ▼ │
|
|
61
74
|
│ ┌─────────────────────────────────────────────────────────┐│
|
|
62
|
-
│ │
|
|
63
|
-
│
|
|
64
|
-
│
|
|
65
|
-
│
|
|
66
|
-
│
|
|
67
|
-
│
|
|
68
|
-
│
|
|
69
|
-
│
|
|
70
|
-
│
|
|
75
|
+
│ │ checkObscura() ││
|
|
76
|
+
│ └──────────────────────────┬──────────────────────────────┘│
|
|
77
|
+
│ │ │
|
|
78
|
+
│ ┌────────────┴────────────┐ │
|
|
79
|
+
│ ▼ ▼ │
|
|
80
|
+
│ ┌────────────┐ ┌────────────┐ │
|
|
81
|
+
│ │ Obscura │ │ Native │ │
|
|
82
|
+
│. │ (headless) │ │ fetch │ │
|
|
83
|
+
│ └────────────┘ └────────────┘ │
|
|
71
84
|
└─────────────────────────────────────────────────────────────┘
|
|
72
85
|
```
|
|
73
86
|
|
package/bun.lock
CHANGED
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
"@biomejs/biome": "^2.4.13",
|
|
16
16
|
"@types/bun": "latest",
|
|
17
17
|
"@types/turndown": "^5.0.6",
|
|
18
|
+
"lefthook": "^2.1.6",
|
|
18
19
|
},
|
|
19
20
|
"peerDependencies": {
|
|
20
21
|
"typescript": "^6.0.3",
|
|
@@ -172,6 +173,28 @@
|
|
|
172
173
|
|
|
173
174
|
"json-schema-typed": ["json-schema-typed@8.0.2", "", {}, "sha512-fQhoXdcvc3V28x7C7BMs4P5+kNlgUURe2jmUT1T//oBRMDrqy1QPelJimwZGo7Hg9VPV3EQV5Bnq4hbFy2vetA=="],
|
|
174
175
|
|
|
176
|
+
"lefthook": ["lefthook@2.1.6", "", { "optionalDependencies": { "lefthook-darwin-arm64": "2.1.6", "lefthook-darwin-x64": "2.1.6", "lefthook-freebsd-arm64": "2.1.6", "lefthook-freebsd-x64": "2.1.6", "lefthook-linux-arm64": "2.1.6", "lefthook-linux-x64": "2.1.6", "lefthook-openbsd-arm64": "2.1.6", "lefthook-openbsd-x64": "2.1.6", "lefthook-windows-arm64": "2.1.6", "lefthook-windows-x64": "2.1.6" }, "bin": { "lefthook": "bin/index.js" } }, "sha512-w9sBoR0mdN+kJc3SB85VzpiAAl451/rxdCRcZlwW71QLjkeH3EBQFgc4VMj5apePychYDHAlqEWTB8J8JK/j1Q=="],
|
|
177
|
+
|
|
178
|
+
"lefthook-darwin-arm64": ["lefthook-darwin-arm64@2.1.6", "", { "os": "darwin", "cpu": "arm64" }, "sha512-hyB7eeiX78BS66f70byTJacDLC/xV1vgMv9n+idFUsrM7J3Udd/ag9Ag5NP3t0eN0EqQqAtrNnt35EH01lxnRQ=="],
|
|
179
|
+
|
|
180
|
+
"lefthook-darwin-x64": ["lefthook-darwin-x64@2.1.6", "", { "os": "darwin", "cpu": "x64" }, "sha512-5Ka6cFxiH83krt+OMRQtmS6zqoZR5SLXSudLjTbZA1c3ZqF0+dqkeb4XcB6plx6WR0GFizabuc6Bi3iXPIe1eQ=="],
|
|
181
|
+
|
|
182
|
+
"lefthook-freebsd-arm64": ["lefthook-freebsd-arm64@2.1.6", "", { "os": "freebsd", "cpu": "arm64" }, "sha512-VswyOg5CVN3rMaOJ2HtnkltiMKgFHW/wouWxXsV8RxSa4tgWOKxM0EmSXi8qc2jX+LRga6B0uOY6toXS01zWxA=="],
|
|
183
|
+
|
|
184
|
+
"lefthook-freebsd-x64": ["lefthook-freebsd-x64@2.1.6", "", { "os": "freebsd", "cpu": "x64" }, "sha512-vXsCUFYuVwrVWwcypB7Zt2Hf+5pl1V1la7ZfvGYZaTRURu0zF/XUnMF/nOz/PebGv0f4x/iOWXWwP7E42xRWsg=="],
|
|
185
|
+
|
|
186
|
+
"lefthook-linux-arm64": ["lefthook-linux-arm64@2.1.6", "", { "os": "linux", "cpu": "arm64" }, "sha512-WDJiQhJdZOvKORZd+kF/ms2l6NSsXzdA9ahflyr65V90AC4jES223W8VtEMbGPUtHuGWMEZ/v/XvwlWv0Ioz9g=="],
|
|
187
|
+
|
|
188
|
+
"lefthook-linux-x64": ["lefthook-linux-x64@2.1.6", "", { "os": "linux", "cpu": "x64" }, "sha512-C18nCd7nTX1AVL4TcvwMmLAO1VI1OuGluIOTjiPkBQ746Ls1HhL5rl//jMPACmT28YmxIQJ2ZcLPNmhvEVBZvw=="],
|
|
189
|
+
|
|
190
|
+
"lefthook-openbsd-arm64": ["lefthook-openbsd-arm64@2.1.6", "", { "os": "openbsd", "cpu": "arm64" }, "sha512-mZOMxM8HiPxVFXDO3PtCUbH4GB8rkveXhsgXF27oAZTYVzQ3gO9vT6r/pxit6msqRXz3fvcwimLVJgb8eRsa8A=="],
|
|
191
|
+
|
|
192
|
+
"lefthook-openbsd-x64": ["lefthook-openbsd-x64@2.1.6", "", { "os": "openbsd", "cpu": "x64" }, "sha512-sG9ALLZSnnMOfXu+B7SmxFhJhuoAh4bqi5En5aaHJET48TqrLOcWWZuH+7ArFM6gr/U5KfSUvdmHFmY8WqCcIg=="],
|
|
193
|
+
|
|
194
|
+
"lefthook-windows-arm64": ["lefthook-windows-arm64@2.1.6", "", { "os": "win32", "cpu": "arm64" }, "sha512-lD8yFWY4Csuljd0Rqs7EQaySC0VvDf7V3rN1FhRMUISTRDHutebIom1Loc8ckQPvKYGC6mftT9k0GvipsS+Brw=="],
|
|
195
|
+
|
|
196
|
+
"lefthook-windows-x64": ["lefthook-windows-x64@2.1.6", "", { "os": "win32", "cpu": "x64" }, "sha512-q4z2n3xucLscoWiyMwFViEj3N8MDSkPulMwcJYuCYFHoPhP1h+icqNu7QRLGYj6AnVrCQweiUJY3Tb2X+GbD/A=="],
|
|
197
|
+
|
|
175
198
|
"math-intrinsics": ["math-intrinsics@1.1.0", "", {}, "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g=="],
|
|
176
199
|
|
|
177
200
|
"media-typer": ["media-typer@1.1.0", "", {}, "sha512-aisnrDP4GNe06UcKFnV5bfMNPBUw4jsLGaWwWfnH3v02GnBuXX2MCVn5RbrWo0j3pczUilYblq7fQ7Nw2t5XKw=="],
|
package/dist/index.js
CHANGED
|
@@ -52886,7 +52886,7 @@ async function queryWithObscura(url2, options) {
|
|
|
52886
52886
|
const allElements = root.querySelectorAll("p, h1, h2, h3, h4, h5, h6, li, a, span, div");
|
|
52887
52887
|
const allText = allElements.map((el) => el.text.trim()).filter((t) => t.length > 0);
|
|
52888
52888
|
const fuse = new Fuse(allText, { threshold: 0.3 });
|
|
52889
|
-
const matches = fuse.search(text);
|
|
52889
|
+
const matches = fuse.search(text || "").slice(0, 10);
|
|
52890
52890
|
return {
|
|
52891
52891
|
content: [
|
|
52892
52892
|
{
|
|
@@ -53103,7 +53103,7 @@ function registerTools(server) {
|
|
|
53103
53103
|
// src/index.ts
|
|
53104
53104
|
var server = new McpServer({
|
|
53105
53105
|
name: "obscura-mcp-server",
|
|
53106
|
-
version: "0.1.
|
|
53106
|
+
version: "0.1.2"
|
|
53107
53107
|
});
|
|
53108
53108
|
registerTools(server);
|
|
53109
53109
|
var transport = new StdioServerTransport;
|
package/lefthook.yml
ADDED
package/package.json
CHANGED
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "obscura-mcp-server",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"private": false,
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/sthbryan/obscura-mcp-server"
|
|
9
|
+
},
|
|
10
|
+
"author": {
|
|
11
|
+
"name": "sthbryan",
|
|
12
|
+
"url": "https://justcallmebryan.com"
|
|
13
|
+
},
|
|
6
14
|
"description": "MCP server for Obscura - web scraping, HTML to Markdown conversion, and URL content processing",
|
|
7
15
|
"main": "./dist/index.js",
|
|
8
16
|
"bin": {
|
|
@@ -15,12 +23,14 @@
|
|
|
15
23
|
"lint": "biome check .",
|
|
16
24
|
"lint:fix": "biome check --write .",
|
|
17
25
|
"check": "biome check --diagnostic-level=error .",
|
|
18
|
-
"prepublish": "bun run build"
|
|
26
|
+
"prepublish": "bun run build",
|
|
27
|
+
"postinstall": "[ -d .git ] && lefthook install || true"
|
|
19
28
|
},
|
|
20
29
|
"devDependencies": {
|
|
21
30
|
"@biomejs/biome": "^2.4.13",
|
|
22
31
|
"@types/bun": "latest",
|
|
23
|
-
"@types/turndown": "^5.0.6"
|
|
32
|
+
"@types/turndown": "^5.0.6",
|
|
33
|
+
"lefthook": "^2.1.6"
|
|
24
34
|
},
|
|
25
35
|
"peerDependencies": {
|
|
26
36
|
"typescript": "^6.0.3"
|
package/src/index.ts
CHANGED
package/src/tools/fetch/index.ts
CHANGED
package/src/tools/query/fetch.ts
CHANGED
|
@@ -29,10 +29,7 @@ function findBestSelector(html: string): string {
|
|
|
29
29
|
return DEFAULT_CONTENT_SELECTORS;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
export async function queryWithNative(
|
|
33
|
-
url: string,
|
|
34
|
-
options: QueryOptions
|
|
35
|
-
): Promise<CallToolResult> {
|
|
32
|
+
export async function queryWithNative(url: string, options: QueryOptions): Promise<CallToolResult> {
|
|
36
33
|
const { selector, text } = options;
|
|
37
34
|
|
|
38
35
|
if (!selector && !text) {
|
|
@@ -73,11 +70,11 @@ export async function queryWithNative(
|
|
|
73
70
|
|
|
74
71
|
const html = await response.text();
|
|
75
72
|
let resolvedSelector = selector;
|
|
76
|
-
|
|
73
|
+
|
|
77
74
|
if (!resolvedSelector) {
|
|
78
75
|
resolvedSelector = text ? DEFAULT_CONTENT_SELECTORS : findBestSelector(html);
|
|
79
76
|
}
|
|
80
|
-
|
|
77
|
+
|
|
81
78
|
const result = parseHtml(html, { selector: resolvedSelector, text });
|
|
82
79
|
|
|
83
80
|
return {
|
|
@@ -137,4 +134,4 @@ function parseHtml(html: string, options: { selector?: string; text?: string }):
|
|
|
137
134
|
}
|
|
138
135
|
|
|
139
136
|
return [];
|
|
140
|
-
}
|
|
137
|
+
}
|
package/src/tools/query/index.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { CallToolResult } from "@modelcontextprotocol/sdk/types";
|
|
2
|
-
import { parse } from "node-html-parser";
|
|
3
2
|
import Fuse from "fuse.js";
|
|
3
|
+
import { parse } from "node-html-parser";
|
|
4
4
|
import { execAsync } from "@/utils/exec";
|
|
5
5
|
|
|
6
6
|
interface QueryOptions {
|
|
@@ -79,7 +79,7 @@ export async function queryWithObscura(
|
|
|
79
79
|
const allText = allElements.map((el) => el.text.trim()).filter((t) => t.length > 0);
|
|
80
80
|
|
|
81
81
|
const fuse = new Fuse(allText, { threshold: 0.3 });
|
|
82
|
-
const matches = fuse.search(text
|
|
82
|
+
const matches = fuse.search(text || "").slice(0, 10);
|
|
83
83
|
|
|
84
84
|
return {
|
|
85
85
|
content: [
|
|
@@ -100,4 +100,4 @@ export async function queryWithObscura(
|
|
|
100
100
|
},
|
|
101
101
|
],
|
|
102
102
|
};
|
|
103
|
-
}
|
|
103
|
+
}
|