@youdotcom-oss/mcp 1.3.4 → 1.3.5-next.12

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 DELETED
@@ -1,730 +0,0 @@
1
- ---
2
- description: Development guidelines for You.com MCP Server using Bun runtime.
3
- globs: "*.ts, *.tsx, *.js, *.jsx, package.json"
4
- alwaysApply: false
5
- ---
6
-
7
- # You.com MCP Server Development Guide
8
-
9
- A Model Context Protocol (MCP) server that provides web search, AI agent, and content extraction capabilities through You.com's APIs.
10
-
11
- ---
12
-
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
-
15
- **This guide (AGENTS.md) is for developers, contributors, and AI coding agents** who want to:
16
-
17
- - Set up a local development environment
18
- - Understand the codebase architecture
19
- - Contribute code or bug fixes
20
- - Run tests and quality checks
21
- - Review pull requests
22
-
23
- ---
24
-
25
- ## Tech Stack
26
-
27
- - **Runtime**: Bun >= 1.2.21 (not Node.js)
28
- - **Framework**: Model Context Protocol SDK v1.24.0
29
- - **HTTP Server**: Hono v4.10.6 with @hono/mcp for HTTP transport (SSE protocol support)
30
- - **Validation**: Zod 3.25.76 for schema validation
31
- - **Testing**: Bun test (built-in test runner)
32
- - **Code Quality**: Biome 2.3.7 (linter + formatter)
33
- - **Type Checking**: TypeScript 5.9.3
34
- - **Git Hooks**: lint-staged 16.2.7
35
-
36
- ## Quick Start
37
-
38
- ### Setup Environment
39
-
40
- ```bash
41
- echo "export YDC_API_KEY=your-actual-api-key-here" > .env
42
- source .env
43
- ```
44
-
45
- ### Development Commands
46
-
47
- ```bash
48
- bun install # Install dependencies
49
- bun run dev # Start stdio server
50
- bun start # Start HTTP server on port 4000
51
- bun test # Run tests
52
- bun test:coverage # Run tests with coverage report
53
- bun test:watch # Run tests in watch mode
54
- bun run check # Run all checks (biome + types + package format)
55
- bun run check:write # Auto-fix all issues
56
- ```
57
-
58
- ## Code Style
59
-
60
- This project uses [Biome](https://biomejs.dev/) for automated code formatting and linting. Most style rules are enforced automatically via git hooks.
61
-
62
- ### Manual Adherence Required
63
-
64
- **Arrow Functions**: Always use arrow functions for declarations (not enforced by Biome)
65
-
66
- ```ts
67
- // ✅ Preferred
68
- export const fetchData = async (params: Params) => { ... };
69
-
70
- // ❌ Avoid
71
- export async function fetchData(params: Params) { ... }
72
- ```
73
-
74
- **No Unused Exports**: All exports must be actively used (Biome detects unused variables/imports, but NOT unused exports)
75
-
76
- ```bash
77
- # Before adding exports, verify usage:
78
- grep -r "ExportName" src/
79
- ```
80
-
81
- ### MCP-Specific Patterns
82
-
83
- **Schema Design**: Always use Zod for input/output validation
84
-
85
- ```ts
86
- export const MyToolInputSchema = z.object({
87
- query: z.string().min(1).describe("Search query"),
88
- limit: z.number().optional().describe("Max results"),
89
- });
90
- ```
91
-
92
- **Error Handling**: Always use try/catch with typed error handling
93
-
94
- ```ts
95
- try {
96
- const response = await apiCall();
97
- return formatResponse(response);
98
- } catch (err: unknown) {
99
- const errorMessage = err instanceof Error ? err.message : String(err);
100
- await logger({ level: "error", data: `API call failed: ${errorMessage}` });
101
- return {
102
- content: [{ type: "text", text: `Error: ${errorMessage}` }],
103
- isError: true,
104
- };
105
- }
106
- ```
107
-
108
- **Logging**: Use `getLogger(mcp)` helper, never console.log
109
-
110
- ```ts
111
- import { getLogger } from "../shared/get-logger.ts";
112
-
113
- const logger = getLogger(mcp);
114
- await logger({ level: "info", data: `Operation successful: ${result}` });
115
- await logger({ level: "error", data: `Operation failed: ${errorMessage}` });
116
- ```
117
-
118
- **Response Format**: Return both `content` and `structuredContent`
119
-
120
- ```ts
121
- return {
122
- content: [{ type: "text", text: formattedText }],
123
- structuredContent: responseData,
124
- };
125
- ```
126
-
127
- ## Development Workflow
128
-
129
- ### Git Hooks
130
-
131
- Git hooks are automatically configured after `bun install`:
132
-
133
- - **Pre-commit**: Runs Biome check and format-package on staged files
134
- - **Setup**: `bun run prepare` (runs automatically with install)
135
- - Git hooks enforce code quality standards and should never be bypassed
136
-
137
- ### MCP Inspector
138
-
139
- Test and debug MCP tools interactively:
140
-
141
- ```bash
142
- bun run inspect # Automatically loads .env variables
143
- ```
144
-
145
- - Opens interactive UI to test MCP tools
146
- - Requires `YDC_API_KEY` in `.env` file
147
- - See [MCP Inspector docs](https://modelcontextprotocol.io/docs/tools/inspector)
148
-
149
- ### Code Quality Commands
150
-
151
- ```bash
152
- # Check everything (CI command)
153
- bun run check # Runs biome + types + package format
154
-
155
- # Individual checks
156
- bun run check:biome # Lint and format check
157
- bun run check:types # TypeScript type check
158
- bun run check:package # package.json format check
159
-
160
- # Auto-fix
161
- bun run check:write # Fix all auto-fixable issues
162
- bun run lint:fix # Fix lint issues only
163
- bun run format # Format code only
164
- bun run format:package # Format package.json only
165
- ```
166
-
167
- ## Contributing
168
-
169
- For detailed contribution guidelines, including:
170
-
171
- - Bug reporting
172
- - Feature requests
173
- - Pull request workflow
174
- - Commit message conventions (Conventional Commits)
175
- - Code review process
176
-
177
- See [CONTRIBUTING.md](./CONTRIBUTING.md)
178
-
179
- ## MCP Server Patterns
180
-
181
- ### Tool Registration
182
-
183
- Use Zod schemas for tool parameter validation. See examples:
184
-
185
- - Search tool: `src/search/register-search-tool.ts:7-86`
186
- - Express tool: `src/express/register-express-tool.ts:7-66`
187
- - Contents tool: `src/contents/register-contents-tool.ts:7-89`
188
-
189
- ### Error Handling
190
-
191
- Always use try/catch with typed error handling (`err: unknown`). See tool registration files for standard pattern.
192
-
193
- ### Logging
194
-
195
- Use `getLogger(mcp)` helper, never console.log. See `src/shared/get-logger.ts:8-11` for implementation.
196
-
197
- ### Error Reporting
198
-
199
- 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.
200
-
201
- ## Testing
202
-
203
- ### Test Organization
204
-
205
- - **Unit Tests**: `src/*/tests/*.spec.ts` - Test individual utilities
206
- - **Integration Tests**: `src/tests/*.spec.ts` - Test MCP tools end-to-end
207
- - **Coverage Target**: >80% for core utilities
208
-
209
- For test patterns, see:
210
-
211
- - Unit tests: `src/search/tests/search.utils.spec.ts`
212
- - Integration tests: `src/tests/tool.spec.ts`
213
-
214
- ### Test Assertion Anti-Patterns
215
-
216
- **IMPORTANT: Avoid patterns that silently skip assertions** - they hide failures.
217
-
218
- ❌ **Early Returns** - Silently exits test, skips remaining assertions
219
-
220
- ```ts
221
- if (!item) return; // Bad: test passes even if item is undefined
222
- ```
223
-
224
- ❌ **Redundant Conditionals** - Asserts defined, then conditionally checks type
225
-
226
- ```ts
227
- expect(item?.markdown).toBeDefined();
228
- if (item?.markdown) {
229
- expect(typeof item.markdown).toBe("string"); // Redundant!
230
- }
231
- ```
232
-
233
- ✅ **Let tests fail naturally** - Use optional chaining and direct assertions:
234
-
235
- ```ts
236
- expect(item).toBeDefined();
237
- expect(item).toHaveProperty("url"); // Fails with clear error if undefined
238
- ```
239
-
240
- ### Running Tests
241
-
242
- ```bash
243
- bun test # All tests
244
- bun test:coverage # With coverage report
245
- bun test:watch # Run tests in watch mode
246
- bun test:coverage:watch # Coverage with watch mode
247
- bun test src/search/tests/ # Specific directory
248
- ```
249
-
250
- Requires `YDC_API_KEY` environment variable for API tests.
251
-
252
- ## Troubleshooting
253
-
254
- ### Common Issues
255
-
256
- #### YDC_API_KEY not found
257
-
258
- **Symptom**: Error message "YDC_API_KEY environment variable is required"
259
-
260
- **Solution**:
261
-
262
- ```bash
263
- # Set up .env file
264
- echo "export YDC_API_KEY=your-actual-api-key-here" > .env
265
- source .env
266
-
267
- # Or export directly
268
- export YDC_API_KEY="your-actual-api-key-here"
269
-
270
- # Verify it's set
271
- echo $YDC_API_KEY
272
- ```
273
-
274
- #### Build Failures
275
-
276
- **Symptom**: `bun run build` fails with TypeScript errors
277
-
278
- **Solution**:
279
-
280
- ```bash
281
- # Check TypeScript errors
282
- bun run check:types
283
-
284
- # Fix code quality issues
285
- bun run check:write
286
-
287
- # Clean and rebuild
288
- rm -rf bin/
289
- bun run build
290
- ```
291
-
292
- #### Test Failures with API Rate Limits
293
-
294
- **Symptom**: Tests fail with 429 (Too Many Requests) errors
295
-
296
- **Solution**:
297
-
298
- - Wait a few minutes before re-running tests
299
- - Run specific test suites instead of all tests at once
300
- - Use `bun test --bail` to stop after first failure
301
- - Check your API key rate limits at [api.you.com](https://api.you.com)
302
-
303
- #### Docker Permission Issues
304
-
305
- **Symptom**: Docker build fails with permission errors
306
-
307
- **Solution**:
308
-
309
- ```bash
310
- # Ensure Docker daemon is running
311
- docker info
312
-
313
- # Build with sudo if needed (Linux)
314
- sudo docker build -t youdotcom-mcp-server .
315
-
316
- # Check Docker group membership (Linux)
317
- groups $USER
318
- ```
319
-
320
- #### Biome/TypeScript Errors
321
-
322
- **Symptom**: Pre-commit hook fails or `bun run check` shows errors
323
-
324
- **Solution**:
325
-
326
- ```bash
327
- # Auto-fix most issues
328
- bun run check:write
329
-
330
- # Check specific issues
331
- bun run check:biome # Linting and formatting
332
- bun run check:types # TypeScript type errors
333
- bun run check:package # package.json formatting
334
-
335
- # Format code manually
336
- bun run format
337
-
338
- # Fix lint issues manually
339
- bun run lint:fix
340
- ```
341
-
342
- #### Import Resolution Errors
343
-
344
- **Symptom**: "Cannot find module" errors in TypeScript
345
-
346
- **Solution**:
347
-
348
- - Always use `.js` extensions in imports (even for `.ts` files)
349
- - Check that the file exists at the specified path
350
- - Use relative paths correctly (`./` for same directory, `../` for parent)
351
- - Example: `import { foo } from './utils.js'` (not `./utils`)
352
-
353
- #### MCP Client Connection Issues
354
-
355
- **Symptom**: MCP client can't connect to server
356
-
357
- **Solution for Stdio mode**:
358
-
359
- - Verify the path to `stdio.ts` or `stdio.js` is correct and absolute
360
- - Check that Bun is installed and in PATH
361
- - Test manually: `bun src/stdio.ts`
362
-
363
- **Solution for HTTP mode**:
364
-
365
- - Verify server is running: `curl http://localhost:4000/mcp-health`
366
- - Check port isn't in use: `lsof -i :4000` (macOS/Linux)
367
- - Verify Bearer token matches your API key
368
- - Check firewall settings
369
-
370
- ## API Integration
371
-
372
- ### You.com API Key
373
-
374
- This server uses a single `YDC_API_KEY` for all APIs, but they use different authentication methods:
375
-
376
- - **Search API** (`you-search`): Uses `X-API-Key` header
377
- - **Contents API** (`you-contents`): Uses `X-API-Key` header
378
- - **Agent API** (`you-express`): Uses `Authorization: Bearer` header
379
-
380
- **Important**: If you receive 401 Unauthorized errors when using the `you-express` tool, ensure your API key has permissions for agent endpoints.
381
-
382
- ### API Response Validation
383
-
384
- Always validate API responses and handle errors:
385
-
386
- ```ts
387
- // Check for error field even with 200 status
388
- checkResponseForErrors(jsonResponse);
389
-
390
- // Validate with Zod
391
- const validatedResponse = ResponseSchema.parse(jsonResponse);
392
-
393
- // Handle specific status codes
394
- if (response.status === 401) {
395
- throw new Error("Invalid or expired API key");
396
- }
397
- if (response.status === 403) {
398
- throw new Error("API key lacks permissions for this endpoint");
399
- }
400
- if (response.status === 429) {
401
- throw new Error("Rate limit exceeded");
402
- }
403
- ```
404
-
405
- ## Available MCP Tools
406
-
407
- ### 1. `you-search`
408
-
409
- Web and news search using You.com Search API
410
-
411
- - Returns web results with snippets and news articles
412
- - Supports filters: freshness, country, safesearch, file types
413
- - Authentication: `X-API-Key` header
414
-
415
- ### 2. `you-express`
416
-
417
- Fast AI responses with optional web search
418
-
419
- - Best for straightforward queries
420
- - Fast responses with real-time web information
421
- - Returns AI-synthesized answer + optional web search results
422
- - Uses non-streaming JSON responses (`stream: false`)
423
- - Authentication: `Authorization: Bearer` header
424
-
425
- ### 3. `you-contents`
426
-
427
- Content extraction from web pages
428
-
429
- - Extracts full page content in markdown or HTML format
430
- - Processes multiple URLs in a single API request
431
- - Returns both text and structured content formats
432
- - Markdown recommended for text extraction
433
- - HTML recommended for layout preservation
434
- - Authentication: `X-API-Key` header
435
-
436
- ## Architecture
437
-
438
- ### System Overview
439
-
440
- ```mermaid
441
- graph TD
442
- Clients["MCP Clients
443
- (Claude Desktop, Claude Code, Custom Clients)"]
444
-
445
- Clients -->|"Stdio (Local)"| Stdio["src/stdio.ts
446
- - Process I/O
447
- - JSON-RPC"]
448
- Clients -->|"HTTP/SSE (Remote)"| HTTP["src/http.ts (Hono + SSE)
449
- - /mcp
450
- - /mcp-health
451
- - Bearer Auth"]
452
-
453
- Stdio --> Server["src/get-mcp-server.ts
454
- MCP Server Factory
455
- - registerTool()
456
- - Tool Handlers
457
- - Logging"]
458
- HTTP --> Server
459
-
460
- Server --> Search["you-search
461
- - Validation
462
- - Query Build
463
- - Formatting"]
464
- Server --> Express["you-express
465
- - Validation
466
- - Transform
467
- - Formatting"]
468
- Server --> Contents["you-contents
469
- - Validation
470
- - Multi-URL
471
- - Formatting"]
472
-
473
- Search -->|X-API-Key| APIs["You.com APIs
474
- - Search API (ydc-index.io)
475
- - Agent API (api.you.com)
476
- - Contents API (ydc-index.io)"]
477
- Express -->|Bearer| APIs
478
- Contents -->|X-API-Key| APIs
479
- ```
480
-
481
- ### Request Flow
482
-
483
- **Stdio Transport (Local Development)**:
484
-
485
- 1. MCP Client sends JSON-RPC request via stdin
486
- 2. `stdio.ts` receives and parses request
487
- 3. Calls MCP Server with tool name + parameters
488
- 4. MCP Server validates input with Zod schemas
489
- 5. Tool handler calls You.com API
490
- 6. Response formatted for MCP
491
- 7. JSON-RPC response sent via stdout
492
-
493
- **HTTP Transport (Remote Deployment)**:
494
-
495
- 1. MCP Client connects via SSE to `/mcp`
496
- 2. Client sends tool request over SSE connection
497
- 3. `http.ts` authenticates Bearer token
498
- 4. Calls MCP Server with tool name + parameters
499
- 5. MCP Server validates input with Zod schemas
500
- 6. Tool handler calls You.com API
501
- 7. Response formatted for MCP
502
- 8. SSE event sent back to client
503
-
504
- ### Core Server Files
505
-
506
- - `src/stdio.ts` - Stdio transport entry point (used by `bun run dev`)
507
- - `src/http.ts` - HTTP transport with Bearer token auth (Hono app)
508
- - `/mcp` - Main MCP endpoint (SSE streaming)
509
- - `/mcp-health` - Health check endpoint
510
- - Bearer token authentication via `Authorization` header
511
- - `Content-Encoding: identity` header handling for compatibility
512
- - `src/get-mcp-server.ts` - MCP server factory function
513
-
514
- ### Search Tool (`you-search`)
515
-
516
- - `src/search/register-search-tool.ts` - Tool registration with validation
517
- - `src/search/search.schemas.ts` - Zod schemas for validation
518
- - `src/search/search.utils.ts` - API calls, query building, formatting
519
- - `src/search/tests/search.utils.spec.ts` - Unit tests
520
-
521
- ### Express Agent Tool (`you-express`)
522
-
523
- - `src/express/register-express-tool.ts` - Tool registration and request handling
524
- - `src/express/express.schemas.ts` - Dual schema architecture
525
- - API response validation (ExpressAgentApiResponseSchema)
526
- - Token-efficient MCP output (ExpressAgentMcpResponseSchema)
527
- - API validates full You.com response
528
- - MCP output returns only essential fields
529
- - `src/express/express.utils.ts` - API calls and response transformation
530
- - `callExpressAgent()` - Calls You.com Express API (`stream: false`)
531
- - Transforms API response to MCP format
532
- - `formatExpressAgentResponse()` - Formats MCP response
533
- - `agentThrowOnFailedStatus()` - Handles API errors
534
- - `src/express/tests/express.utils.spec.ts` - Unit tests
535
-
536
- ### Contents Tool (`you-contents`)
537
-
538
- - `src/contents/register-contents-tool.ts` - Tool registration
539
- - Calls `fetchContents()` with all URLs in single request
540
- - Formats response for text and structured output
541
- - Comprehensive error handling (401, 403, 429, 5xx)
542
- - `src/contents/contents.schemas.ts` - Zod schemas
543
- - `ContentsQuerySchema` - Input validation
544
- - `ContentsApiResponseSchema` - API response validation
545
- - `ContentsStructuredContentSchema` - MCP output format
546
- - `src/contents/contents.utils.ts` - API calls and formatting
547
- - `fetchContents()` - Single API call with all URLs
548
- - Uses `X-API-Key` header
549
- - Validates response schema
550
- - `formatContentsResponse()` - Formats for MCP output
551
- - `src/contents/tests/contents.utils.spec.ts` - Unit tests
552
-
553
- ### Shared Utilities
554
-
555
- - `src/shared/use-client-version.ts` - User-Agent generation with MCP client version info
556
- - `useGetClientVersion(mcp)` - Returns a `getUserAgent` function for creating User-Agent strings
557
- - `src/shared/get-logger.ts` - MCP server logging
558
- - `getLogger(mcp)` - Returns a logging function for MCP server notifications
559
- - `src/shared/check-response-for-errors.ts` - API response validation
560
- - `checkResponseForErrors()` - Validates API responses for error fields
561
- - `src/shared/generate-error-report-link.ts` - Error reporting utilities
562
- - `generateErrorReportLink()` - Creates mailto links for one-click error reporting
563
- - `src/shared/format-search-results-text.ts` - Search result formatting
564
- - `formatSearchResultsText()` - Formats search results for text display
565
-
566
- ### Library Export
567
-
568
- - `src/main.ts` - Public API export file for library consumers
569
- - Exports all schemas from contents, express, and search tools
570
- - Exports utility functions from contents, express, and search
571
- - Exports shared utilities (checkResponseForErrors, formatSearchResultsText)
572
- - Used when consuming this package as a library (not as MCP server)
573
-
574
- ### Integration Tests
575
-
576
- - `src/tests/http.spec.ts` - HTTP server endpoint tests
577
- - `src/tests/tool.spec.ts` - End-to-end MCP tool tests
578
-
579
- ## Deployment
580
-
581
- This section covers local development setup, self-hosting options, and production deployment strategies.
582
-
583
- ### Local development setup
584
-
585
- **Prerequisites:**
586
-
587
- - Bun >= 1.2.21 installed
588
- - You.com API key from [you.com/platform/api-keys](https://you.com/platform/api-keys)
589
-
590
- **Quick start:**
591
-
592
- ```bash
593
- # Clone repository
594
- git clone https://github.com/youdotcom-oss/youdotcom-mcp-server.git
595
- cd youdotcom-mcp-server
596
-
597
- # Install dependencies
598
- bun install
599
-
600
- # Set up environment
601
- echo "export YDC_API_KEY=your-actual-api-key-here" > .env
602
- source .env
603
-
604
- # Start development server (STDIO mode)
605
- bun run dev
606
-
607
- # Or start HTTP server on port 4000
608
- bun start
609
- ```
610
-
611
- **Verify setup:**
612
-
613
- ```bash
614
- # Test STDIO mode
615
- echo '{"jsonrpc":"2.0","method":"tools/list","id":1}' | bun src/stdio.ts
616
-
617
- # Test HTTP mode (in separate terminal)
618
- curl http://localhost:4000/mcp-health
619
- ```
620
-
621
- ### Self-hosting with Docker
622
-
623
- **Build and run:**
624
-
625
- ```bash
626
- # Build Docker image
627
- docker build -t youdotcom-mcp-server .
628
-
629
- # Run container with API key
630
- docker run -d \
631
- -p 4000:4000 \
632
- --name youdotcom-mcp \
633
- -e YDC_API_KEY=your-actual-api-key-here \
634
- youdotcom-mcp-server
635
-
636
- # Check health
637
- curl http://localhost:4000/mcp-health
638
- ```
639
-
640
- **Docker Compose:**
641
-
642
- ```yaml
643
- version: "3.8"
644
- services:
645
- youdotcom-mcp:
646
- build: .
647
- ports:
648
- - "4000:4000"
649
- environment:
650
- - YDC_API_KEY=${YDC_API_KEY}
651
- restart: unless-stopped
652
- ```
653
-
654
- ### Deployment modes
655
-
656
- | Mode | Use Case | Transport | Command |
657
- | -------------- | ------------------------------------ | --------- | ------------------------------- |
658
- | **STDIO Dev** | Local development and testing | STDIO | `bun run dev` |
659
- | **STDIO Prod** | MCP client integration (local) | STDIO | `./bin/stdio.js` |
660
- | **HTTP Dev** | Local HTTP server testing | HTTP/SSE | `bun start` |
661
- | **HTTP Prod** | Remote clients, web apps, production | HTTP/SSE | `bun run build && bun bin/http` |
662
- | **Docker** | Containerized deployment | HTTP/SSE | `docker run ...` |
663
-
664
- ### Production deployment
665
-
666
- **Building for production:**
667
-
668
- ```bash
669
- # Build optimized STDIO bundle
670
- bun run build
671
-
672
- # Outputs:
673
- # - bin/stdio.js (compiled STDIO transport)
674
- # Note: bin/http is an executable script, not compiled
675
- ```
676
-
677
- **Running in production:**
678
-
679
- ```bash
680
- # Set API key
681
- export YDC_API_KEY=your-actual-api-key-here
682
-
683
- # STDIO mode (for MCP clients)
684
- node bin/stdio.js
685
-
686
- # HTTP mode (for remote access)
687
- PORT=4000 bun bin/http
688
- ```
689
-
690
- **Environment variables:**
691
-
692
- | Variable | Required | Default | Description |
693
- | ------------- | -------- | ------- | --------------------------------- |
694
- | `YDC_API_KEY` | Yes | - | You.com API key |
695
- | `PORT` | No | 4000 | HTTP server port (HTTP mode only) |
696
-
697
- **Production considerations:**
698
-
699
- - **Security**: Never expose STDIO mode to external networks
700
- - **HTTP mode**: Use reverse proxy (nginx, Caddy) with HTTPS in production
701
- - **Rate limiting**: Consider implementing rate limiting for HTTP endpoints
702
- - **Monitoring**: Set up health check monitoring on `/mcp-health`
703
- - **Logging**: MCP server logs to stderr; configure log aggregation as needed
704
- - **API key rotation**: Restart server after rotating API keys
705
-
706
- ### MCP client configuration
707
-
708
- For connecting MCP clients to your self-hosted server, see the "Adding to your MCP client" section in [README.md](./README.md).
709
-
710
- For complete API reference documentation including parameters, response formats, and examples, see [API.md](./docs/API.md).
711
-
712
- ## Bun Runtime
713
-
714
- This project uses Bun (>= 1.2.21) instead of Node.js:
715
-
716
- ```bash
717
- bun <file> # Run TypeScript directly
718
- bun install # Install dependencies
719
- bun test # Built-in test runner
720
- ```
721
-
722
- **Import Extensions** (enforced by Biome):
723
-
724
- - Local files: `.ts` extension
725
- - NPM packages: `.js` extension
726
- - JSON files: `.json` with import assertion
727
-
728
- See `src/contents/register-contents-tool.ts:1-5` for import examples.
729
-
730
- **Build**: Build configuration is defined in `package.json` scripts. The `bun run build` command compiles `src/stdio.ts` to `bin/stdio.js` for production use.