@youdotcom-oss/mcp 1.3.3 → 1.3.5-next.5

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/AGENTS.md CHANGED
@@ -13,6 +13,7 @@ A Model Context Protocol (MCP) server that provides web search, AI agent, and co
13
13
  > **Note for end users**: If you want to use this MCP server (not develop or contribute), see [README.md](./README.md) for setup instructions, getting started guides, and usage examples.
14
14
 
15
15
  **This guide (AGENTS.md) is for developers, contributors, and AI coding agents** who want to:
16
+
16
17
  - Set up a local development environment
17
18
  - Understand the codebase architecture
18
19
  - Contribute code or bug fixes
@@ -24,7 +25,7 @@ A Model Context Protocol (MCP) server that provides web search, AI agent, and co
24
25
  ## Tech Stack
25
26
 
26
27
  - **Runtime**: Bun >= 1.2.21 (not Node.js)
27
- - **Framework**: Model Context Protocol SDK v1.22.0
28
+ - **Framework**: Model Context Protocol SDK v1.24.0
28
29
  - **HTTP Server**: Hono v4.10.6 with @hono/mcp for HTTP transport (SSE protocol support)
29
30
  - **Validation**: Zod 3.25.76 for schema validation
30
31
  - **Testing**: Bun test (built-in test runner)
@@ -61,6 +62,7 @@ This project uses [Biome](https://biomejs.dev/) for automated code formatting an
61
62
  ### Manual Adherence Required
62
63
 
63
64
  **Arrow Functions**: Always use arrow functions for declarations (not enforced by Biome)
65
+
64
66
  ```ts
65
67
  // ✅ Preferred
66
68
  export const fetchData = async (params: Params) => { ... };
@@ -70,6 +72,7 @@ export async function fetchData(params: Params) { ... }
70
72
  ```
71
73
 
72
74
  **No Unused Exports**: All exports must be actively used (Biome detects unused variables/imports, but NOT unused exports)
75
+
73
76
  ```bash
74
77
  # Before adding exports, verify usage:
75
78
  grep -r "ExportName" src/
@@ -78,38 +81,45 @@ grep -r "ExportName" src/
78
81
  ### MCP-Specific Patterns
79
82
 
80
83
  **Schema Design**: Always use Zod for input/output validation
84
+
81
85
  ```ts
82
86
  export const MyToolInputSchema = z.object({
83
- query: z.string().min(1).describe('Search query'),
84
- limit: z.number().optional().describe('Max results'),
87
+ query: z.string().min(1).describe("Search query"),
88
+ limit: z.number().optional().describe("Max results"),
85
89
  });
86
90
  ```
87
91
 
88
92
  **Error Handling**: Always use try/catch with typed error handling
93
+
89
94
  ```ts
90
95
  try {
91
96
  const response = await apiCall();
92
97
  return formatResponse(response);
93
98
  } catch (err: unknown) {
94
99
  const errorMessage = err instanceof Error ? err.message : String(err);
95
- await logger({ level: 'error', data: `API call failed: ${errorMessage}` });
96
- return { content: [{ type: 'text', text: `Error: ${errorMessage}` }], isError: true };
100
+ await logger({ level: "error", data: `API call failed: ${errorMessage}` });
101
+ return {
102
+ content: [{ type: "text", text: `Error: ${errorMessage}` }],
103
+ isError: true,
104
+ };
97
105
  }
98
106
  ```
99
107
 
100
108
  **Logging**: Use `getLogger(mcp)` helper, never console.log
109
+
101
110
  ```ts
102
- import { getLogger } from '../shared/get-logger.ts';
111
+ import { getLogger } from "../shared/get-logger.ts";
103
112
 
104
113
  const logger = getLogger(mcp);
105
- await logger({ level: 'info', data: `Operation successful: ${result}` });
106
- await logger({ level: 'error', data: `Operation failed: ${errorMessage}` });
114
+ await logger({ level: "info", data: `Operation successful: ${result}` });
115
+ await logger({ level: "error", data: `Operation failed: ${errorMessage}` });
107
116
  ```
108
117
 
109
118
  **Response Format**: Return both `content` and `structuredContent`
119
+
110
120
  ```ts
111
121
  return {
112
- content: [{ type: 'text', text: formattedText }],
122
+ content: [{ type: "text", text: formattedText }],
113
123
  structuredContent: responseData,
114
124
  };
115
125
  ```
@@ -157,6 +167,7 @@ bun run format:package # Format package.json only
157
167
  ## Contributing
158
168
 
159
169
  For detailed contribution guidelines, including:
170
+
160
171
  - Bug reporting
161
172
  - Feature requests
162
173
  - Pull request workflow
@@ -165,11 +176,72 @@ For detailed contribution guidelines, including:
165
176
 
166
177
  See [CONTRIBUTING.md](./CONTRIBUTING.md)
167
178
 
179
+ ## Publishing
180
+
181
+ ### Release Process
182
+
183
+ This package is published to npm via the `.github/workflows/publish-mcp.yml` workflow in the monorepo root.
184
+
185
+ **Workflow Actions**:
186
+ 1. Updates version in `packages/mcp/package.json`
187
+ 2. Scans all workspace packages for dependencies on `@youdotcom-oss/mcp`
188
+ 3. Updates dependent packages with exact version (e.g., "1.4.0")
189
+ 4. Commits all version updates together
190
+ 5. Creates GitHub release in private repo
191
+ 6. Syncs to OSS repo via git subtree split
192
+ 7. Creates GitHub release in OSS repo
193
+ 8. Publishes to npm
194
+
195
+ **Version Format**: Exact versions only (no `^` or `~` prefixes)
196
+
197
+ ```json
198
+ {
199
+ "dependencies": {
200
+ "@youdotcom-oss/mcp": "1.3.4"
201
+ }
202
+ }
203
+ ```
204
+
205
+ **IMPORTANT**: If you add dependencies on other workspace packages, use exact version numbers. The publish workflow will automatically keep them in sync when new versions are released.
206
+
207
+ ### Version Format Convention
208
+
209
+ This package follows standard Git tagging conventions:
210
+
211
+ - **Git tags**: `v{version}` (e.g., `v1.3.4`, `v1.4.0-next.1`)
212
+ - **GitHub releases**: `v{version}` (e.g., `Release v1.3.4`)
213
+ - **package.json**: `{version}` (no "v" prefix, e.g., `1.3.4`)
214
+ - **npm package**: `{version}` (no "v" prefix, e.g., `@youdotcom-oss/mcp@1.3.4`)
215
+
216
+ **When triggering the publish workflow:**
217
+ 1. Go to: Actions → Publish mcp-server Release → Run workflow
218
+ 2. Enter version WITHOUT "v" prefix: `1.3.4` (not `v1.3.4`)
219
+ 3. The workflow automatically adds "v" for Git tags
220
+ 4. Validation checks prevent common mistakes
221
+
222
+ **Example:**
223
+ ```bash
224
+ # Workflow input
225
+ Version: 1.3.4
226
+
227
+ # Produces:
228
+ # - Git tag: v1.3.4
229
+ # - package.json: "version": "1.3.4"
230
+ # - npm: @youdotcom-oss/mcp@1.3.4
231
+ # - Release: https://github.com/.../releases/tag/v1.3.4
232
+ ```
233
+
234
+ **Validation checks in workflow:**
235
+ - Rejects input with "v" prefix
236
+ - Verifies package.json matches release version
237
+ - Ensures no "v" prefix in package.json
238
+
168
239
  ## MCP Server Patterns
169
240
 
170
241
  ### Tool Registration
171
242
 
172
243
  Use Zod schemas for tool parameter validation. See examples:
244
+
173
245
  - Search tool: `src/search/register-search-tool.ts:7-86`
174
246
  - Express tool: `src/express/register-express-tool.ts:7-66`
175
247
  - Contents tool: `src/contents/register-contents-tool.ts:7-89`
@@ -186,7 +258,6 @@ Use `getLogger(mcp)` helper, never console.log. See `src/shared/get-logger.ts:8-
186
258
 
187
259
  Include mailto links in error logs using `generateErrorReportLink()` helper (`src/shared/generate-error-report-link.ts:6-37`). This creates one-click error reporting with full diagnostic context.
188
260
 
189
-
190
261
  ## Testing
191
262
 
192
263
  ### Test Organization
@@ -196,6 +267,7 @@ Include mailto links in error logs using `generateErrorReportLink()` helper (`sr
196
267
  - **Coverage Target**: >80% for core utilities
197
268
 
198
269
  For test patterns, see:
270
+
199
271
  - Unit tests: `src/search/tests/search.utils.spec.ts`
200
272
  - Integration tests: `src/tests/tool.spec.ts`
201
273
 
@@ -204,22 +276,25 @@ For test patterns, see:
204
276
  **IMPORTANT: Avoid patterns that silently skip assertions** - they hide failures.
205
277
 
206
278
  ❌ **Early Returns** - Silently exits test, skips remaining assertions
279
+
207
280
  ```ts
208
281
  if (!item) return; // Bad: test passes even if item is undefined
209
282
  ```
210
283
 
211
284
  ❌ **Redundant Conditionals** - Asserts defined, then conditionally checks type
285
+
212
286
  ```ts
213
287
  expect(item?.markdown).toBeDefined();
214
288
  if (item?.markdown) {
215
- expect(typeof item.markdown).toBe('string'); // Redundant!
289
+ expect(typeof item.markdown).toBe("string"); // Redundant!
216
290
  }
217
291
  ```
218
292
 
219
293
  ✅ **Let tests fail naturally** - Use optional chaining and direct assertions:
294
+
220
295
  ```ts
221
296
  expect(item).toBeDefined();
222
- expect(item).toHaveProperty('url'); // Fails with clear error if undefined
297
+ expect(item).toHaveProperty("url"); // Fails with clear error if undefined
223
298
  ```
224
299
 
225
300
  ### Running Tests
@@ -243,6 +318,7 @@ Requires `YDC_API_KEY` environment variable for API tests.
243
318
  **Symptom**: Error message "YDC_API_KEY environment variable is required"
244
319
 
245
320
  **Solution**:
321
+
246
322
  ```bash
247
323
  # Set up .env file
248
324
  echo "export YDC_API_KEY=your-actual-api-key-here" > .env
@@ -260,6 +336,7 @@ echo $YDC_API_KEY
260
336
  **Symptom**: `bun run build` fails with TypeScript errors
261
337
 
262
338
  **Solution**:
339
+
263
340
  ```bash
264
341
  # Check TypeScript errors
265
342
  bun run check:types
@@ -277,32 +354,19 @@ bun run build
277
354
  **Symptom**: Tests fail with 429 (Too Many Requests) errors
278
355
 
279
356
  **Solution**:
357
+
280
358
  - Wait a few minutes before re-running tests
281
359
  - Run specific test suites instead of all tests at once
282
360
  - Use `bun test --bail` to stop after first failure
283
361
  - Check your API key rate limits at [api.you.com](https://api.you.com)
284
362
 
285
- #### Docker Permission Issues
286
-
287
- **Symptom**: Docker build fails with permission errors
288
-
289
- **Solution**:
290
- ```bash
291
- # Ensure Docker daemon is running
292
- docker info
293
-
294
- # Build with sudo if needed (Linux)
295
- sudo docker build -t youdotcom-mcp-server .
296
-
297
- # Check Docker group membership (Linux)
298
- groups $USER
299
- ```
300
363
 
301
364
  #### Biome/TypeScript Errors
302
365
 
303
366
  **Symptom**: Pre-commit hook fails or `bun run check` shows errors
304
367
 
305
368
  **Solution**:
369
+
306
370
  ```bash
307
371
  # Auto-fix most issues
308
372
  bun run check:write
@@ -324,6 +388,7 @@ bun run lint:fix
324
388
  **Symptom**: "Cannot find module" errors in TypeScript
325
389
 
326
390
  **Solution**:
391
+
327
392
  - Always use `.js` extensions in imports (even for `.ts` files)
328
393
  - Check that the file exists at the specified path
329
394
  - Use relative paths correctly (`./` for same directory, `../` for parent)
@@ -334,11 +399,13 @@ bun run lint:fix
334
399
  **Symptom**: MCP client can't connect to server
335
400
 
336
401
  **Solution for Stdio mode**:
402
+
337
403
  - Verify the path to `stdio.ts` or `stdio.js` is correct and absolute
338
404
  - Check that Bun is installed and in PATH
339
405
  - Test manually: `bun src/stdio.ts`
340
406
 
341
407
  **Solution for HTTP mode**:
408
+
342
409
  - Verify server is running: `curl http://localhost:4000/mcp-health`
343
410
  - Check port isn't in use: `lsof -i :4000` (macOS/Linux)
344
411
  - Verify Bearer token matches your API key
@@ -369,13 +436,13 @@ const validatedResponse = ResponseSchema.parse(jsonResponse);
369
436
 
370
437
  // Handle specific status codes
371
438
  if (response.status === 401) {
372
- throw new Error('Invalid or expired API key');
439
+ throw new Error("Invalid or expired API key");
373
440
  }
374
441
  if (response.status === 403) {
375
- throw new Error('API key lacks permissions for this endpoint');
442
+ throw new Error("API key lacks permissions for this endpoint");
376
443
  }
377
444
  if (response.status === 429) {
378
- throw new Error('Rate limit exceeded');
445
+ throw new Error("Rate limit exceeded");
379
446
  }
380
447
  ```
381
448
 
@@ -418,7 +485,7 @@ Content extraction from web pages
418
485
  graph TD
419
486
  Clients["MCP Clients
420
487
  (Claude Desktop, Claude Code, Custom Clients)"]
421
-
488
+
422
489
  Clients -->|"Stdio (Local)"| Stdio["src/stdio.ts
423
490
  - Process I/O
424
491
  - JSON-RPC"]
@@ -426,14 +493,14 @@ graph TD
426
493
  - /mcp
427
494
  - /mcp-health
428
495
  - Bearer Auth"]
429
-
496
+
430
497
  Stdio --> Server["src/get-mcp-server.ts
431
498
  MCP Server Factory
432
499
  - registerTool()
433
500
  - Tool Handlers
434
501
  - Logging"]
435
502
  HTTP --> Server
436
-
503
+
437
504
  Server --> Search["you-search
438
505
  - Validation
439
506
  - Query Build
@@ -446,7 +513,7 @@ graph TD
446
513
  - Validation
447
514
  - Multi-URL
448
515
  - Formatting"]
449
-
516
+
450
517
  Search -->|X-API-Key| APIs["You.com APIs
451
518
  - Search API (ydc-index.io)
452
519
  - Agent API (api.you.com)
@@ -458,6 +525,7 @@ graph TD
458
525
  ### Request Flow
459
526
 
460
527
  **Stdio Transport (Local Development)**:
528
+
461
529
  1. MCP Client sends JSON-RPC request via stdin
462
530
  2. `stdio.ts` receives and parses request
463
531
  3. Calls MCP Server with tool name + parameters
@@ -467,6 +535,7 @@ graph TD
467
535
  7. JSON-RPC response sent via stdout
468
536
 
469
537
  **HTTP Transport (Remote Deployment)**:
538
+
470
539
  1. MCP Client connects via SSE to `/mcp`
471
540
  2. Client sends tool request over SSE connection
472
541
  3. `http.ts` authenticates Bearer token
@@ -558,6 +627,7 @@ This section covers local development setup, self-hosting options, and productio
558
627
  ### Local development setup
559
628
 
560
629
  **Prerequisites:**
630
+
561
631
  - Bun >= 1.2.21 installed
562
632
  - You.com API key from [you.com/platform/api-keys](https://you.com/platform/api-keys)
563
633
 
@@ -565,8 +635,8 @@ This section covers local development setup, self-hosting options, and productio
565
635
 
566
636
  ```bash
567
637
  # Clone repository
568
- git clone https://github.com/youdotcom-oss/youdotcom-mcp-server.git
569
- cd youdotcom-mcp-server
638
+ git clone https://github.com/youdotcom-oss/mcp-server.git
639
+ cd mcp-server
570
640
 
571
641
  # Install dependencies
572
642
  bun install
@@ -583,6 +653,7 @@ bun start
583
653
  ```
584
654
 
585
655
  **Verify setup:**
656
+
586
657
  ```bash
587
658
  # Test STDIO mode
588
659
  echo '{"jsonrpc":"2.0","method":"tools/list","id":1}' | bun src/stdio.ts
@@ -591,48 +662,18 @@ echo '{"jsonrpc":"2.0","method":"tools/list","id":1}' | bun src/stdio.ts
591
662
  curl http://localhost:4000/mcp-health
592
663
  ```
593
664
 
594
- ### Self-hosting with Docker
665
+ ### Self-hosting
595
666
 
596
- **Build and run:**
597
-
598
- ```bash
599
- # Build Docker image
600
- docker build -t youdotcom-mcp-server .
601
-
602
- # Run container with API key
603
- docker run -d \
604
- -p 4000:4000 \
605
- --name youdotcom-mcp \
606
- -e YDC_API_KEY=your-actual-api-key-here \
607
- youdotcom-mcp-server
608
-
609
- # Check health
610
- curl http://localhost:4000/mcp-health
611
- ```
612
-
613
- **Docker Compose:**
614
-
615
- ```yaml
616
- version: '3.8'
617
- services:
618
- youdotcom-mcp:
619
- build: .
620
- ports:
621
- - "4000:4000"
622
- environment:
623
- - YDC_API_KEY=${YDC_API_KEY}
624
- restart: unless-stopped
625
- ```
667
+ This package supports self-hosting in STDIO or HTTP modes (see deployment modes below).
626
668
 
627
669
  ### Deployment modes
628
670
 
629
- | Mode | Use Case | Transport | Command |
630
- |------|----------|-----------|---------|
631
- | **STDIO Dev** | Local development and testing | STDIO | `bun run dev` |
632
- | **STDIO Prod** | MCP client integration (local) | STDIO | `./bin/stdio.js` |
633
- | **HTTP Dev** | Local HTTP server testing | HTTP/SSE | `bun start` |
634
- | **HTTP Prod** | Remote clients, web apps, production | HTTP/SSE | `bun run build && bun bin/http` |
635
- | **Docker** | Containerized deployment | HTTP/SSE | `docker run ...` |
671
+ | Mode | Use Case | Transport | Command |
672
+ | -------------- | ------------------------------------ | --------- | ------------------------------- |
673
+ | **STDIO Dev** | Local development and testing | STDIO | `bun run dev` |
674
+ | **STDIO Prod** | MCP client integration (local) | STDIO | `./bin/stdio.js` |
675
+ | **HTTP Dev** | Local HTTP server testing | HTTP/SSE | `bun start` |
676
+ | **HTTP Prod** | Remote clients, web apps, production | HTTP/SSE | `bun run build && bun bin/http` |
636
677
 
637
678
  ### Production deployment
638
679
 
@@ -662,10 +703,10 @@ PORT=4000 bun bin/http
662
703
 
663
704
  **Environment variables:**
664
705
 
665
- | Variable | Required | Default | Description |
666
- |----------|----------|---------|-------------|
667
- | `YDC_API_KEY` | Yes | - | You.com API key |
668
- | `PORT` | No | 4000 | HTTP server port (HTTP mode only) |
706
+ | Variable | Required | Default | Description |
707
+ | ------------- | -------- | ------- | --------------------------------- |
708
+ | `YDC_API_KEY` | Yes | - | You.com API key |
709
+ | `PORT` | No | 4000 | HTTP server port (HTTP mode only) |
669
710
 
670
711
  **Production considerations:**
671
712
 
@@ -693,6 +734,7 @@ bun test # Built-in test runner
693
734
  ```
694
735
 
695
736
  **Import Extensions** (enforced by Biome):
737
+
696
738
  - Local files: `.ts` extension
697
739
  - NPM packages: `.js` extension
698
740
  - JSON files: `.json` with import assertion
package/README.md CHANGED
@@ -277,7 +277,7 @@ If you encounter a problem, you can report it via email or GitHub:
277
277
 
278
278
  **Web support:** [You.com Support](https://you.com/support/contact-us)
279
279
 
280
- **GitHub Issues:** [Report bugs and feature requests](https://github.com/youdotcom-oss/youdotcom-mcp-server/issues)
280
+ **GitHub Issues:** [Report bugs and feature requests](https://github.com/youdotcom-oss/mcp-server/issues)
281
281
 
282
282
  **Tip:** When errors occur, check your MCP client logs - they include a pre-filled mailto link with error details for easy reporting.
283
283