@youdotcom-oss/mcp 1.1.4

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.
Files changed (4) hide show
  1. package/README.md +601 -0
  2. package/bin/stdio +11 -0
  3. package/dist/stdio.js +17374 -0
  4. package/package.json +65 -0
package/README.md ADDED
@@ -0,0 +1,601 @@
1
+ # You.com MCP Server
2
+
3
+ A Model Context Protocol (MCP) server that provides web search functionality using the You.com Search API. Built with Bun runtime for optimal performance and supports multiple transport protocols for compatibility with different MCP clients.
4
+
5
+ ## Features
6
+
7
+ - **Web and News Search**: Comprehensive search using You.com's unified Search API with advanced search operators
8
+ - **Multiple Transport Protocols**: Stdio and Streamable HTTP support
9
+ - **Bearer Token Authentication**: Secure API access in HTTP mode
10
+ - **TypeScript Support**: Full type safety with Zod schemas
11
+ - **Advanced Search Parameters**: Site filtering, file type filtering, language filtering, exact terms, and exclude terms
12
+
13
+ ## Adding to your MCP client
14
+
15
+ This server can be integrated with MCP clients in two ways:
16
+
17
+ - **Option 1: Remote Server (Recommended)** - No installation required, uses hosted server at `https://api.you.com/mcp` with HTTP transport and API key authentication
18
+ - **Option 2: Local NPM Package** - Install via `npx @youdotcom-oss/mcp` with stdio transport, environment variable authentication, and runs locally on your machine
19
+
20
+ ### Standard Configuration Templates
21
+
22
+ **Remote Server (Recommended):**
23
+ ```json
24
+ {
25
+ "mcpServers": {
26
+ "ydc-search": {
27
+ "type": "http",
28
+ "url": "https://api.you.com/mcp",
29
+ "headers": {
30
+ "Authorization": "Bearer <you-api-key>"
31
+ }
32
+ }
33
+ }
34
+ }
35
+ ```
36
+
37
+ **Local NPM Package:**
38
+ ```json
39
+ {
40
+ "mcpServers": {
41
+ "ydc-search": {
42
+ "command": "npx",
43
+ "args": ["@youdotcom-oss/mcp"],
44
+ "env": {
45
+ "YDC_API_KEY": "<you-api-key>"
46
+ }
47
+ }
48
+ }
49
+ }
50
+ ```
51
+
52
+ <details>
53
+ <summary><strong>Claude Code</strong></summary>
54
+
55
+ **Quick Setup:**
56
+ ```bash
57
+ # Add using Claude Code CLI (if available)
58
+ claude mcp add ydc-search npx @youdotcom-oss/mcp
59
+ ```
60
+
61
+ **Manual Setup:**
62
+ 1. Follow the [Claude Code setup guide](https://docs.anthropic.com/en/docs/claude-code/setup)
63
+ 2. Create or update `.mcp.json` in your workspace root using the standard configuration template above
64
+ 3. For remote server: add `"type": "http"` to the configuration
65
+ 4. For local package: add `"type": "stdio"` to the configuration
66
+
67
+ </details>
68
+
69
+ <details>
70
+ <summary><strong>Claude Desktop</strong></summary>
71
+
72
+ **Setup:**
73
+ Use the standard configuration template above in your Claude Desktop MCP configuration.
74
+
75
+ **Installation:**
76
+ Follow the [Claude Desktop MCP guide](https://docs.anthropic.com/en/docs/build-with-claude/computer-use) for setup.
77
+
78
+ [Download Claude Desktop](https://claude.ai/download)
79
+
80
+ </details>
81
+
82
+ <details>
83
+ <summary><strong>Codex</strong></summary>
84
+
85
+ **Setup:**
86
+ Edit `~/.codex/config.toml`:
87
+
88
+ ```toml
89
+ [mcp_servers.ydc-search]
90
+ command = "npx"
91
+ args = ["@youdotcom-oss/mcp"]
92
+
93
+ [mcp_servers.ydc-search.env]
94
+ YDC_API_KEY = "<you-api-key>"
95
+ ```
96
+
97
+ [Download Codex](https://github.com/openai/codex)
98
+
99
+ </details>
100
+
101
+ <details>
102
+ <summary><strong>Cursor IDE</strong></summary>
103
+
104
+ **GUI Setup (Easiest):**
105
+ 1. Go to Cursor Settings > Features > MCP
106
+ 2. Click "+ Add New MCP Server"
107
+ 3. For remote: Select "Streamable HTTP" transport, URL: `https://api.you.com/mcp`
108
+ 4. For local: Select "stdio" transport, Command: `npx`, Args: `@youdotcom-oss/mcp`
109
+
110
+ **Manual Setup:**
111
+ Create `.cursor/mcp.json` in your project directory or `~/.cursor/mcp.json` globally using the standard configuration template above.
112
+
113
+ **Note:** Remove the `"type"` field from the remote server configuration for Cursor.
114
+
115
+ [Documentation](https://docs.cursor.com/en/context/mcp) | [Download Cursor](https://cursor.com)
116
+
117
+ </details>
118
+
119
+ <details>
120
+ <summary><strong>Gemini CLI</strong></summary>
121
+
122
+ **Setup:**
123
+ Use the standard configuration template above in your Gemini CLI MCP server configuration.
124
+
125
+ **Installation:**
126
+ 1. Install [Gemini CLI](https://google-gemini.github.io/gemini-cli/)
127
+ 2. Follow the [MCP server setup guide](https://google-gemini.github.io/gemini-cli/docs/tools/mcp-server.html)
128
+
129
+ [Documentation](https://google-gemini.github.io/gemini-cli/docs/tools/mcp-server.html) | [Download Gemini CLI](https://google-gemini.github.io/gemini-cli/)
130
+
131
+ </details>
132
+
133
+ <details>
134
+ <summary><strong>Goose</strong></summary>
135
+
136
+ **Quick Setup:**
137
+ Go to "Advanced settings" → "Extensions" → "Add custom extension"
138
+
139
+ **Manual Setup:**
140
+ Use the standard configuration template above in your Goose extensions configuration.
141
+
142
+ [Installation Guide](https://block.github.io/goose/docs/getting-started/installation) | [Download Goose](https://block.github.io/goose/)
143
+
144
+ </details>
145
+
146
+ <details>
147
+ <summary><strong>JetBrains IDEs</strong></summary>
148
+
149
+ **Setup:**
150
+ Configure in your IDE settings using the local NPM package configuration from the standard template above.
151
+
152
+ **For Remote Server:**
153
+ Use [mcp-remote](https://www.npmjs.com/package/mcp-remote) since JetBrains only supports stdio transport:
154
+ ```json
155
+ {
156
+ "mcpServers": {
157
+ "ydc-search": {
158
+ "command": "npx",
159
+ "args": ["mcp-remote", "https://api.you.com/mcp", "--header", "Authorization: Bearer ${YDC_API_KEY}"],
160
+ "env": { "YDC_API_KEY": "<you-api-key>" }
161
+ }
162
+ }
163
+ }
164
+ ```
165
+
166
+ **Supported IDEs:** IntelliJ IDEA, PyCharm, WebStorm, etc. (requires AI Assistant enabled)
167
+
168
+ [Documentation](https://www.jetbrains.com/help/ai-assistant/mcp.html)
169
+
170
+ </details>
171
+
172
+ <details>
173
+ <summary><strong>LM Studio</strong></summary>
174
+
175
+ **Setup:**
176
+ Edit `mcp.json` in LM Studio settings using the standard configuration template above.
177
+
178
+ **Installation:**
179
+ Configure through program settings or edit configuration file manually.
180
+
181
+ [Download LM Studio](https://lmstudio.ai/)
182
+
183
+ </details>
184
+
185
+ <details>
186
+ <summary><strong>opencode</strong></summary>
187
+
188
+ **Setup:**
189
+ Edit `~/.config/opencode/opencode.json`:
190
+
191
+ ```json
192
+ {
193
+ "$schema": "https://opencode.ai/config.json",
194
+ "mcp": {
195
+ "ydc-search": {
196
+ "type": "local",
197
+ "command": ["npx", "@youdotcom-oss/mcp"],
198
+ "enabled": true,
199
+ "env": { "YDC_API_KEY": "<you-api-key>" }
200
+ }
201
+ }
202
+ }
203
+ ```
204
+
205
+ **For Remote Server:**
206
+ ```json
207
+ {
208
+ "$schema": "https://opencode.ai/config.json",
209
+ "mcp": {
210
+ "ydc-search": {
211
+ "type": "local",
212
+ "command": ["npx", "mcp-remote", "https://api.you.com/mcp", "--header", "Authorization: Bearer ${YDC_API_KEY}"],
213
+ "enabled": true,
214
+ "env": { "YDC_API_KEY": "<you-api-key>" }
215
+ }
216
+ }
217
+ }
218
+ ```
219
+
220
+ [Documentation](https://opencode.ai/docs)
221
+
222
+ </details>
223
+
224
+ <details>
225
+ <summary><strong>Qodo Gen</strong></summary>
226
+
227
+ **Setup:**
228
+ 1. Open Qodo Gen chat panel in VSCode or IntelliJ
229
+ 2. Click "Connect more tools" → "+ Add new MCP"
230
+ 3. Paste the standard config above
231
+ 4. Click Save
232
+
233
+ [Documentation](https://docs.qodo.ai/qodo-documentation/qodo-gen)
234
+
235
+ </details>
236
+
237
+ <details>
238
+ <summary><strong>VS Code</strong></summary>
239
+
240
+ **Quick Setup (Command Line):**
241
+ ```bash
242
+ # Add MCP server
243
+ code --add-mcp "{\"name\":\"ydc-search\",\"command\":\"npx\",\"args\":[\"@youdotcom-oss/mcp\"],\"env\":{\"YDC_API_KEY\":\"<you-api-key>\"}}"
244
+ ```
245
+
246
+ **Manual Setup:**
247
+ Create `mcp.json` file in your workspace (`.vscode/mcp.json`) or user profile using the standard configuration template above, but replace `"mcpServers"` with `"servers"`.
248
+
249
+ **Secure Setup with Input Prompts:**
250
+ ```json
251
+ {
252
+ "inputs": [
253
+ {
254
+ "type": "promptString",
255
+ "id": "ydc-api-key",
256
+ "description": "You.com API Key",
257
+ "password": true
258
+ }
259
+ ],
260
+ "servers": {
261
+ "ydc-search": {
262
+ "command": "npx",
263
+ "args": ["@youdotcom-oss/mcp"],
264
+ "env": { "YDC_API_KEY": "${input:ydc-api-key}" }
265
+ }
266
+ }
267
+ }
268
+ ```
269
+
270
+ **Requirements:** GitHub Copilot extension must be installed
271
+
272
+ [Documentation](https://code.visualstudio.com/docs/copilot/customization/mcp-servers#_commandline-configuration) | [Download VS Code](https://code.visualstudio.com/)
273
+
274
+ </details>
275
+
276
+ <details>
277
+ <summary><strong>Windsurf</strong></summary>
278
+
279
+ **Setup:**
280
+ Use the standard configuration template above.
281
+
282
+ **Installation:**
283
+ Follow MCP documentation for Windsurf-specific setup instructions.
284
+
285
+ [Documentation](https://docs.windsurf.com/windsurf/cascade/mcp) | [Download Windsurf](https://docs.windsurf.com/windsurf/getting-started)
286
+
287
+ </details>
288
+
289
+ <details>
290
+ <summary><strong>Zed Editor</strong></summary>
291
+
292
+ **Setup:**
293
+ Add to your Zed `settings.json` using `"context_servers"` instead of `"mcpServers"`:
294
+
295
+ ```json
296
+ {
297
+ "context_servers": {
298
+ "ydc-search": {
299
+ "source": "custom",
300
+ "command": "npx",
301
+ "args": ["@youdotcom-oss/mcp"],
302
+ "env": {
303
+ "YDC_API_KEY": "<you-api-key>"
304
+ }
305
+ }
306
+ }
307
+ }
308
+ ```
309
+
310
+ **For Remote Server:**
311
+ Use [mcp-remote](https://www.npmjs.com/package/mcp-remote) to bridge HTTP to stdio:
312
+ ```json
313
+ {
314
+ "context_servers": {
315
+ "ydc-search": {
316
+ "source": "custom",
317
+ "command": "npx",
318
+ "args": ["mcp-remote", "https://api.you.com/mcp", "--header", "Authorization: Bearer ${YDC_API_KEY}"],
319
+ "env": { "YDC_API_KEY": "<you-api-key>" }
320
+ }
321
+ }
322
+ }
323
+ ```
324
+
325
+ [Setup Instructions](https://zed.dev/docs/ai/mcp) | [Download Zed](https://zed.dev)
326
+
327
+ </details>
328
+
329
+ ### General Configuration Notes
330
+
331
+ - **Remote Server:** Recommended for most users - no installation required, just API key
332
+ - **NPM Package:** Alternative for local usage or when you prefer running locally
333
+ - **HTTP Transport:** Use for remote server connections and web applications
334
+ - **Stdio Transport:** Use for local npm package installations and development
335
+ - **API Key:** Always required - either as environment variable (stdio) or in headers (http)
336
+ - **Docker/Local Development:** See sections below for advanced local development setups
337
+
338
+ See the [Transport Protocols](#transport-protocols) section for detailed protocol information.
339
+
340
+ ## Building and Running Locally
341
+
342
+ ### Prerequisites
343
+
344
+ - **Bun 1.2.21 or higher** (replaces Node.js)
345
+ - You.com API key (get one at [api.you.com](https://api.you.com))
346
+
347
+ ### Local Workspace Setup
348
+
349
+ Since this package is not published to npm (marked as private), you need to clone and set it up locally:
350
+
351
+ ```bash
352
+ # Clone the repository
353
+ git clone <repository-url>
354
+ cd you-mcp-server
355
+
356
+ # Install dependencies
357
+ bun install
358
+
359
+ # Set up your environment file with your You.com API key (optional)
360
+ echo "export YDC_API_KEY=<you-api-key>" > .env
361
+ ```
362
+
363
+ ### Building
364
+
365
+ ```bash
366
+ # Build is optional for development, required for production bin executables
367
+ bun run build # Builds only stdio.ts to dist/stdio.js
368
+ ```
369
+
370
+ **For MCP Client Integration:**
371
+ Use the full path to your local server installation in your `.mcp.json`:
372
+
373
+ ```json
374
+ {
375
+ "mcpServers": {
376
+ "ydc-search": {
377
+ "type": "stdio",
378
+ "command": "bun",
379
+ "args": ["/full/path/to/you-mcp-server/src/stdio.ts"],
380
+ "env": {
381
+ "YDC_API_KEY": "<you-api-key>"
382
+ }
383
+ }
384
+ }
385
+ }
386
+ ```
387
+
388
+ **Alternative using built executable:**
389
+ ```json
390
+ {
391
+ "mcpServers": {
392
+ "ydc-search": {
393
+ "type": "stdio",
394
+ "command": "node",
395
+ "args": ["/full/path/to/you-mcp-server/bin/stdio"],
396
+ "env": {
397
+ "YDC_API_KEY": "<you-api-key>"
398
+ }
399
+ }
400
+ }
401
+ }
402
+ ```
403
+
404
+ ### Configuration
405
+
406
+ Set up your environment file with your You.com API key:
407
+
408
+ ```bash
409
+ echo "export YDC_API_KEY=<you-api-key>" > .env
410
+ source .env
411
+ ```
412
+
413
+ Replace `<you-api-key>` with your actual API key:
414
+ ```bash
415
+ echo "export YDC_API_KEY=your-actual-api-key-here" > .env
416
+ source .env
417
+ ```
418
+
419
+ Alternatively, set it as an environment variable:
420
+
421
+ ```bash
422
+ export YDC_API_KEY="your-api-key-here"
423
+ ```
424
+
425
+ ### Available Scripts
426
+
427
+ - `bun run dev` - Start server in stdio mode for development
428
+ - `bun run build` - Build stdio.ts to dist/ for production
429
+ - `bun start` - Start HTTP server on port 4000 (or PORT env var)
430
+ - `bun run test` - Run test suite
431
+ - `bun run check` - Run Biome linting and formatting checks
432
+
433
+ ### Executable Scripts
434
+
435
+ The project includes executable scripts in `bin/`:
436
+ - `./bin/stdio` - Stdio transport server (requires `bun run build` first)
437
+ - `./bin/http` - HTTP transport server (runs directly from source)
438
+
439
+ ### Running the Server
440
+
441
+ **Stdio Mode (Recommended for MCP Clients)** - For local workspace integration:
442
+ ```bash
443
+ # Development mode (direct source)
444
+ bun run dev
445
+ # or
446
+ bun src/stdio.ts
447
+
448
+ # Production mode (built distribution)
449
+ bun run build # Build first
450
+ ./bin/stdio # Run built version
451
+ ```
452
+
453
+ **HTTP Mode** - For web applications and remote clients:
454
+ ```bash
455
+ # Default port 4000
456
+ bun start
457
+ # or
458
+ ./bin/http
459
+
460
+ # Custom port
461
+ PORT=8080 bun start
462
+ # or
463
+ PORT=8080 ./bin/http
464
+ ```
465
+
466
+ ### Docker Deployment
467
+
468
+ **Build and run with Docker:**
469
+
470
+ ```bash
471
+ # Build the optimized Docker image (243MB final size)
472
+ docker build -t youdotcom-mcp-server .
473
+
474
+ # Run the container
475
+ docker run -d -p 4000:4000 --name youdotcom-mcp youdotcom-mcp-server
476
+ ```
477
+
478
+ **Optimization Features:**
479
+ - **Multi-stage build**: Uses standalone binary compilation with `bun build --compile`
480
+ - **Minimal base image**: Ubuntu 22.04 with no additional packages
481
+ - **Size optimized**: 243MB final image
482
+ - **Self-contained**: Includes Bun runtime in compiled binary
483
+ - **Security**: Runs as non-root user, minimal attack surface
484
+
485
+ **Using Docker Compose:**
486
+
487
+ Create a `docker-compose.yml` file:
488
+ ```yaml
489
+ version: '3.8'
490
+ services:
491
+ you-mcp-server:
492
+ build: .
493
+ ports:
494
+ - "4000:4000"
495
+ environment:
496
+ - YDC_API_KEY=${YDC_API_KEY}
497
+ - PORT=4000
498
+ restart: unless-stopped
499
+ ```
500
+
501
+ Then run:
502
+ ```bash
503
+ docker-compose up -d
504
+ ```
505
+
506
+ ### Claude Code Setup with Docker
507
+
508
+ To use this MCP server with Claude Code via Docker:
509
+
510
+ 1. **Start the Docker container:**
511
+ ```bash
512
+ docker run -d -p 4000:4000 --name youdotcom-mcp youdotcom-mcp-server
513
+ ```
514
+
515
+ 2. **Configure Claude Code:**
516
+ - Copy `.mcp.example.json` to `.mcp.json`
517
+ - Replace `<you.com api key>` with your actual You.com API key
518
+
519
+ ```bash
520
+ cp .mcp.example.json .mcp.json
521
+ ```
522
+
523
+ Your `.mcp.json` should look like:
524
+ ```json
525
+ {
526
+ "mcpServers": {
527
+ "ydc-search": {
528
+ "type": "http",
529
+ "url": "http://localhost:4000/mcp",
530
+ "headers": {
531
+ "Authorization": "Bearer <you-api-key>"
532
+ }
533
+ }
534
+ }
535
+ }
536
+ ```
537
+
538
+ 3. **Verify the setup:**
539
+ - The server will be available at `http://localhost:4000/mcp`
540
+ - Health check endpoint: `http://localhost:4000/mcp-health`
541
+
542
+ ## API Reference
543
+
544
+ ### you-search
545
+
546
+ Performs a comprehensive web and news search using the You.com Search API.
547
+
548
+ **Parameters:**
549
+ - `query` (string, required): The base search query to send to the You.com API. This will be combined with additional filters like site, fileType, and language to create the final search query. You can also use operators directly: + (exact term, e.g., "Enron +GAAP"), - (exclude term, e.g., "guitar -prs"), site: (domain, e.g., "site:uscourts.gov"), filetype: (e.g., "filetype:pdf"), lang: (e.g., "lang:es"). Use parentheses for multi-word phrases (e.g., "+(machine learning)", "-(social media)").
550
+ - `site` (string, optional): Search within a specific website domain (e.g., 'github.com')
551
+ - `fileType` (string, optional): Filter by a specific file type (e.g., 'pdf', 'doc', 'txt')
552
+ - `language` (string, optional): Filter by a specific language using ISO 639-1 code (e.g., 'en', 'es', 'fr')
553
+ - `exactTerms` (string, optional): Exact terms with logical operators: 'python AND|tutorial|NOT beginner' (pipe-separated, add AND/OR after terms, default OR). Use parentheses for multi-word phrases (e.g., '(machine learning)|typescript')
554
+ - `excludeTerms` (string, optional): Terms to exclude with logical operators: 'spam AND|ads|NOT relevant' (pipe-separated, add AND/OR after terms, default OR). Use parentheses for multi-word phrases (e.g., '(social media)|ads'). Cannot be used with exactTerms.
555
+ - `count` (integer, optional): Maximum number of results to return per section. Range: 1-20.
556
+ - `freshness` (string, optional): Freshness of results. Options: `day`, `week`, `month`, `year`.
557
+ - `offset` (integer, optional): Offset for pagination (calculated in multiples of count). Range: 0-9.
558
+ - `country` (string, optional): Country code for localized results. Examples: `US`, `GB`, `DE`, `FR`, `JP`, `CA`, `AU`, etc.
559
+ - `safesearch` (string, optional): Content filtering level. Options: `off`, `moderate` (default), `strict`.
560
+
561
+ **Returns:**
562
+ ```json
563
+ {
564
+ "content": [
565
+ {
566
+ "type": "text",
567
+ "text": "Search Results for \"machine learning\":\n\nWEB RESULTS:\n\nTitle: Introduction to Machine Learning\nURL: https://github.com/ml-tutorials/intro\nDescription: A comprehensive guide to machine learning fundamentals\nSnippets:\n- Learn the basics of supervised and unsupervised learning\n- Practical examples with Python and TensorFlow\n\n---\n\nTitle: Machine Learning Course\nURL: https://coursera.org/ml-course\nDescription: Stanford's machine learning course materials\nSnippets:\n- Mathematical foundations of ML algorithms\n- Hands-on programming assignments\n\n==================================================\n\nNEWS RESULTS:\n\nTitle: AI Breakthrough in Medical Diagnosis\nURL: https://techcrunch.com/ai-medical-breakthrough\nDescription: New machine learning model achieves 95% accuracy\nPublished: 2024-01-15T10:30:00"
568
+ }
569
+ ],
570
+ "structuredContent": {
571
+ "results": {
572
+ "web": [
573
+ {
574
+ "url": "https://github.com/ml-tutorials/intro",
575
+ "title": "Introduction to Machine Learning",
576
+ "description": "A comprehensive guide to machine learning fundamentals",
577
+ "snippets": [
578
+ "Learn the basics of supervised and unsupervised learning",
579
+ "Practical examples with Python and TensorFlow"
580
+ ],
581
+ "page_age": "2024-01-10T14:20:00",
582
+ "authors": ["ML Tutorial Team"]
583
+ }
584
+ ],
585
+ "news": [
586
+ {
587
+ "url": "https://techcrunch.com/ai-medical-breakthrough",
588
+ "title": "AI Breakthrough in Medical Diagnosis",
589
+ "description": "New machine learning model achieves 95% accuracy",
590
+ "page_age": "2024-01-15T10:30:00"
591
+ }
592
+ ]
593
+ },
594
+ "metadata": {
595
+ "query": "machine learning",
596
+ "request_uuid": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
597
+ "latency": 0.247
598
+ }
599
+ }
600
+ }
601
+ ```
package/bin/stdio ADDED
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env node
2
+
3
+ console.log('Starting You.com MCP Server in Stdio mode...');
4
+ console.log('Protocol: JSON-RPC over stdin/stdout');
5
+ console.log('Authentication: YDC_API_KEY environment variable');
6
+
7
+ // Import and run the built stdio server
8
+ import('../dist/stdio.js').catch((error) => {
9
+ console.error('Failed to start stdio server:', error);
10
+ process.exit(1);
11
+ });