deepwiki-mcp-slim 0.0.0-stage → 0.1.3

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/README.md CHANGED
@@ -1,3 +1,254 @@
1
- # Temporary Holding Version
1
+ # DeepWiki MCP Slim
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ A small, unofficial [Model Context Protocol (MCP)](https://modelcontextprotocol.io/) proxy for [DeepWiki](https://deepwiki.com/). It exposes the three public DeepWiki wiki tools while removing instructions about unavailable private-mode and Devin tools.
4
+
5
+ **Keep the useful DeepWiki instructions, without advertising tools the agent cannot use.**
6
+
7
+ ## Why this exists
8
+
9
+ DeepWiki's public MCP endpoint exposes three wiki tools, but its server initialization instructions can mention additional tools that are not available through that endpoint. Coding agents may receive those instructions even though the tools are absent from their tool list.
10
+
11
+ This proxy gives an MCP client a smaller, consistent view:
12
+
13
+ | | Direct DeepWiki | DeepWiki MCP Slim |
14
+ | --- | --- | --- |
15
+ | Public wiki tools | 3 | Same 3 |
16
+ | General DeepWiki instructions | Included | Preserved |
17
+ | `devin_*` references | May be included | Removed |
18
+ | `list_wiki_repos` and `generate_wiki` references | May be included | Removed |
19
+ | Tool arguments and responses | From DeepWiki | Forwarded unchanged |
20
+
21
+ The proxy **does not run DeepWiki locally**. It connects to `https://mcp.deepwiki.com/mcp` for every local MCP server process.
22
+
23
+ ## How it works
24
+
25
+ ```text
26
+ Coding agent (OpenCode / Claude Code / OMP / another MCP client)
27
+ |
28
+ | MCP over stdio
29
+ v
30
+ deepwiki-mcp-slim (local Node.js process)
31
+ | - allowlist public tools
32
+ | - filter initialization instructions
33
+ | - forward tool calls and responses
34
+ |
35
+ | MCP over Streamable HTTP
36
+ v
37
+ https://mcp.deepwiki.com/mcp
38
+ ```
39
+
40
+ On startup, the proxy connects to DeepWiki, reads its initialization instructions, removes lines referring to unavailable tools, and advertises the remaining instructions to the local MCP client. It then forwards requests for these three tools:
41
+
42
+ | Tool | Purpose |
43
+ | --- | --- |
44
+ | `ask_wiki_question` | Ask a question about a repository |
45
+ | `read_wiki_contents` | Read repository wiki content |
46
+ | `read_wiki_structure` | Explore the structure of a repository's wiki |
47
+
48
+ The filter currently removes any instruction **line** containing a `devin_*` name, `list_wiki_repos`, or `generate_wiki`. It also removes the observed Devin OAuth/organization preface because that line refers to `devin_*`.
49
+
50
+ This is a **fixed tool allowlist**, not automatic discovery of all future public DeepWiki tools.
51
+
52
+ ## Requirements
53
+
54
+ - Node.js **20 or newer** and npm
55
+ - Network access to `https://mcp.deepwiki.com/mcp`
56
+ - An MCP client that can launch a **stdio** server
57
+
58
+ No DeepWiki API key is required for the public endpoint used by this project. This proxy does not implement private-mode or upstream OAuth authentication.
59
+
60
+ ## Installation
61
+
62
+ **After the package is first published to npm**, you do not need to clone this repository on each machine. Choose one of the following approaches.
63
+
64
+ ### Option A: Global install
65
+
66
+ Recommended when you prefer quick, predictable startup:
67
+
68
+ ```bash
69
+ npm install -g deepwiki-mcp-slim
70
+ deepwiki-mcp-slim
71
+ ```
72
+
73
+ The command starts a stdio MCP server and waits for a client to connect. **It is normal for it to print nothing**; stop it with Ctrl+C if you launched it manually. In your harness configuration, use the command `deepwiki-mcp-slim` without launching it yourself.
74
+
75
+ Upgrade intentionally with:
76
+
77
+ ```bash
78
+ npm install -g deepwiki-mcp-slim@latest
79
+ ```
80
+
81
+ ### Option B: Run with npx
82
+
83
+ No global install or clone required:
84
+
85
+ ```bash
86
+ npx -y deepwiki-mcp-slim@0.1.3
87
+ ```
88
+
89
+ This installs the requested package into npm's cache when needed, then starts the MCP server. Use that command in the harness configuration instead of running it manually.
90
+
91
+ **Version pinning is recommended for coding agents.** Without the explicit `@0.1.3` version, a later launch can resolve a newer release unexpectedly. `-y` disables npm's install confirmation prompt, so use it only for a package you trust.
92
+
93
+ | | Global install | npx with pinned version |
94
+ | --- | --- | --- |
95
+ | One-time installation | Required on each machine | Not required |
96
+ | Launch overhead | Lower | npm startup and package resolution/cache checks |
97
+ | Offline reliability | Installed command works; DeepWiki still needs network | Also requires the package to be present in the npm cache |
98
+ | Updates | You choose when to reinstall | You choose when to change the version in config |
99
+ | Best fit | Frequently launched local agents | Shared, portable MCP configurations |
100
+
101
+ Neither method removes the proxy's requirement to contact DeepWiki's upstream HTTPS service. The package must be available on npm before either of these commands will work.
102
+
103
+ ### Install from source (development)
104
+
105
+ ```bash
106
+ git clone https://github.com/capyBearista/deepwiki-mcp-slim.git
107
+ cd deepwiki-mcp-slim
108
+ npm ci
109
+ npm test
110
+ npm link
111
+ ```
112
+
113
+ `npm link` makes the local checkout's executable available to harnesses using the same Node/npm installation.
114
+
115
+ ### Notes on environments
116
+
117
+ Node.js 20+ and npm must be installed in **each environment where your coding harness runs** (for example, native Windows and WSL are separate environments). Ensure the harness can find `npx` or `deepwiki-mcp-slim` on its `PATH`. You can inspect the resolved command with `command -v` on Linux/macOS or `where.exe` on Windows.
118
+
119
+ If a source checkout reports `spawn deepwiki-mcp-slim EACCES` on Linux, check the executable bit:
120
+
121
+ ```bash
122
+ ls -l src/index.mjs
123
+ chmod +x src/index.mjs
124
+ ```
125
+
126
+ The repository tracks `src/index.mjs` as executable. Published npm CLI binaries receive npm's platform-specific executable linking/shims.
127
+
128
+ ## Configure a coding harness
129
+
130
+ Configure **`deepwiki-mcp-slim` as a local/stdio server named `deepwiki`**. Replace any existing DeepWiki connection rather than registering both, or your agent may still receive the unfiltered server instructions.
131
+
132
+ For **npx** instead of a global install, replace the command with `["npx", "-y", "deepwiki-mcp-slim@0.1.3"]` in OpenCode, or use `"command": "npx", "args": ["-y", "deepwiki-mcp-slim@0.1.3"]` in other stdio MCP clients. In either case, make sure the harness can find the executable on `PATH`.
133
+
134
+ ### OpenCode V2
135
+
136
+ In `opencode.jsonc`, replace the `deepwiki` entry under **`mcp.servers`**:
137
+
138
+ ```jsonc
139
+ {
140
+ "mcp": {
141
+ "servers": {
142
+ "deepwiki": {
143
+ "type": "local",
144
+ "command": ["deepwiki-mcp-slim"]
145
+ }
146
+ }
147
+ }
148
+ }
149
+ ```
150
+
151
+ Merge this into your existing configuration; do not replace unrelated MCP servers. Retaining the `deepwiki` server name also preserves references to that server in agent-specific MCP assignments.
152
+
153
+ See the [OpenCode V2 MCP documentation](https://opencode.ai/v2/docs/mcp-servers).
154
+
155
+ ### Claude Code (including plugins)
156
+
157
+ For a regular MCP configuration or a plugin's `.mcp.json`, replace the existing `deepwiki` entry:
158
+
159
+ ```json
160
+ {
161
+ "mcpServers": {
162
+ "deepwiki": {
163
+ "type": "stdio",
164
+ "command": "deepwiki-mcp-slim",
165
+ "args": []
166
+ }
167
+ }
168
+ }
169
+ ```
170
+
171
+ If DeepWiki is supplied by a **Claude Code plugin**, change the plugin's own `.mcp.json`; editing an unrelated user-level MCP entry won't replace the plugin-bundled server. Each machine running the plugin must also have the executable installed. Repository tests or validation scripts that require all MCPs to be HTTP must be updated to permit this stdio server.
172
+
173
+ See [Claude Code documentation](https://code.claude.com/docs/).
174
+
175
+ ### Oh My Pi (OMP)
176
+
177
+ In `~/.omp/agent/mcp.json`:
178
+
179
+ ```json
180
+ {
181
+ "mcpServers": {
182
+ "deepwiki": {
183
+ "type": "stdio",
184
+ "command": "deepwiki-mcp-slim",
185
+ "args": []
186
+ }
187
+ }
188
+ }
189
+ ```
190
+
191
+ OMP also supports `instructions: false` on a direct HTTP DeepWiki connection, **but that removes all server instructions**, not just the irrelevant ones. Use this proxy if you want to retain the useful instructions. Check `/mcp list` to ensure OMP selected the intended server when multiple configuration sources exist.
192
+
193
+ See [OMP MCP configuration](https://github.com/can1357/oh-my-pi/blob/main/docs/mcp-config.md).
194
+
195
+ ### Other environments
196
+
197
+ Any MCP client supporting local stdio servers can launch the same executable. The essential settings are:
198
+
199
+ - **Transport:** stdio
200
+ - **Command:** `deepwiki-mcp-slim`
201
+ - **Server name:** `deepwiki` (recommended for compatibility)
202
+
203
+ No always-running daemon or separate HTTP port is needed. The coding harness starts and stops its own local proxy process.
204
+
205
+ ## Verification
206
+
207
+ First, run the unit tests:
208
+
209
+ ```bash
210
+ npm test
211
+ ```
212
+
213
+ These test the instruction filter only. To inspect the running MCP server:
214
+
215
+ ```bash
216
+ npx @modelcontextprotocol/inspector deepwiki-mcp-slim
217
+ ```
218
+
219
+ Connect through the Inspector and check:
220
+
221
+ 1. `tools/list` contains exactly `ask_wiki_question`, `read_wiki_contents`, and `read_wiki_structure`.
222
+ 2. Server initialization instructions still contain useful wiki guidance, with no `devin_*`, `list_wiki_repos`, or `generate_wiki` references.
223
+ 3. Calling one public wiki tool returns a response from DeepWiki.
224
+
225
+ **The live end-to-end behavior has not been verified by the repository's unit tests.** The Inspector check is an integration test you should run after installation.
226
+
227
+ ## Limitations
228
+
229
+ - **Tools only:** MCP prompts, resources, server-to-client notifications, cancellation, and upstream authentication are not transparently proxied.
230
+ - **Text-based filter:** The filter removes matching instruction lines, not semantic paragraphs. If DeepWiki changes its instruction format, irrelevant text could remain or a useful matching line could be removed.
231
+ - **Fixed allowlist:** New DeepWiki tools will not appear automatically. Review and explicitly add them when appropriate.
232
+ - **Upstream dependency:** Connection and tool execution depend on the availability and behavior of DeepWiki's public MCP endpoint.
233
+ - **Not an access-control boundary:** This project removes unwanted tool exposure and guidance; it does not sandbox or verify content returned by DeepWiki.
234
+
235
+ ## Development
236
+
237
+ ```bash
238
+ npm ci
239
+ npm test
240
+ node --check src/index.mjs
241
+ ```
242
+
243
+ The local MCP server reads its version from `package.json` instead of a separate hardcoded value.
244
+
245
+ | File | Responsibility |
246
+ | --- | --- |
247
+ | `src/index.mjs` | Connects to DeepWiki, registers the local MCP server, and forwards allowlisted tools |
248
+ | `src/filter-instructions.mjs` | Filters unavailable-tool instructions |
249
+ | `test/filter-instructions.test.mjs` | Regression tests for instruction filtering |
250
+ | `test/package.test.mjs` | Checks npm package metadata and the CLI entrypoint |
251
+
252
+ The executable uses stdout for the MCP JSON-RPC protocol. If you add diagnostic logging, send it to **stderr**, never stdout.
253
+
254
+ This project is not affiliated with DeepWiki or Devin.
package/package.json CHANGED
@@ -1,6 +1,45 @@
1
1
  {
2
2
  "name": "deepwiki-mcp-slim",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.3",
4
+ "description": "DeepWiki MCP proxy that preserves public wiki instructions and filters unavailable tools.",
5
+ "keywords": [
6
+ "deepwiki",
7
+ "mcp",
8
+ "model-context-protocol",
9
+ "mcp-server",
10
+ "mcp-proxy",
11
+ "ai-agents",
12
+ "claude-code",
13
+ "opencode",
14
+ "oh-my-pi"
15
+ ],
16
+ "type": "module",
17
+ "bin": {
18
+ "deepwiki-mcp-slim": "./src/index.mjs"
19
+ },
20
+ "files": [
21
+ "src/"
22
+ ],
23
+ "engines": {
24
+ "node": ">=20"
25
+ },
26
+ "repository": {
27
+ "type": "git",
28
+ "url": "git+https://github.com/capyBearista/deepwiki-mcp-slim.git"
29
+ },
30
+ "homepage": "https://github.com/capyBearista/deepwiki-mcp-slim#readme",
31
+ "bugs": {
32
+ "url": "https://github.com/capyBearista/deepwiki-mcp-slim/issues"
33
+ },
34
+ "publishConfig": {
35
+ "access": "public"
36
+ },
37
+ "scripts": {
38
+ "test": "node --test",
39
+ "prepublishOnly": "npm test"
40
+ },
41
+ "dependencies": {
42
+ "@modelcontextprotocol/client": "2.4.0",
43
+ "@modelcontextprotocol/server": "2.4.0"
44
+ }
45
+ }
@@ -0,0 +1,15 @@
1
+ // Retain DeepWiki guidance while omitting tools unavailable through its public MCP.
2
+ // The observed server instructions contain one line per tool, plus a Devin-only
3
+ // organization/OAuth preface mentioning devin_*.
4
+ const UNAVAILABLE_TOOL = /(?:^|[^\w])(?:devin_(?:\*|[a-z0-9_]+)|list_wiki_repos|generate_wiki)(?!\w)/i;
5
+
6
+ export function filterUnavailableToolInstructions(instructions) {
7
+ if (!instructions) return undefined;
8
+ const filtered = instructions
9
+ .split(/\r?\n/)
10
+ .filter((line) => !UNAVAILABLE_TOOL.test(line))
11
+ .join("\n")
12
+ .replace(/\n(?:[ \t]*\n){2,}/g, "\n\n")
13
+ .trim();
14
+ return filtered || undefined;
15
+ }
package/src/index.mjs ADDED
@@ -0,0 +1,48 @@
1
+ #!/usr/bin/env node
2
+ import { readFileSync } from "node:fs";
3
+ import { Client, StreamableHTTPClientTransport } from "@modelcontextprotocol/client";
4
+ import { McpServer } from "@modelcontextprotocol/server";
5
+ import { StdioServerTransport } from "@modelcontextprotocol/server/stdio";
6
+ import { filterUnavailableToolInstructions } from "./filter-instructions.mjs";
7
+
8
+ const { version } = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8"));
9
+
10
+ const allowed = new Set([
11
+ "ask_wiki_question",
12
+ "read_wiki_contents",
13
+ "read_wiki_structure",
14
+ ]);
15
+
16
+ // Preserve DeepWiki instructions, excluding guidance for unavailable tools.
17
+ const upstream = new Client({ name: "deepwiki-mcp-slim", version });
18
+ await upstream.connect(
19
+ new StreamableHTTPClientTransport(new URL("https://mcp.deepwiki.com/mcp")),
20
+ );
21
+
22
+ // Forward the selectively filtered upstream instructions during initialization.
23
+ const instructions = filterUnavailableToolInstructions(upstream.getInstructions());
24
+ const mcp = new McpServer(
25
+ { name: "deepwiki-mcp-slim", version },
26
+ { instructions },
27
+ );
28
+ // Use the documented underlying protocol server for precise tool forwarding.
29
+ const server = mcp.server;
30
+ server.registerCapabilities({ tools: {} });
31
+
32
+ server.setRequestHandler("tools/list", async () => {
33
+ const { tools } = await upstream.listTools();
34
+ return { tools: tools.filter((tool) => allowed.has(tool.name)) };
35
+ });
36
+
37
+ server.setRequestHandler("tools/call", async ({ params }) => {
38
+ if (!allowed.has(params.name)) {
39
+ throw new Error(`Tool not exposed: ${params.name}`);
40
+ }
41
+ return upstream.callTool({
42
+ name: params.name,
43
+ arguments: params.arguments ?? {},
44
+ });
45
+ });
46
+
47
+ await server.connect(new StdioServerTransport());
48
+ server.onclose = () => { void upstream.close(); };