diff --git a/src/duckduckgo/README.md b/src/duckduckgo/README.md index fb6ae376..74e25193 100644 --- a/src/duckduckgo/README.md +++ b/src/duckduckgo/README.md @@ -1,39 +1,37 @@ # DuckDuckGo MCP Server + MCP server providing search functionality via DuckDuckGo's HTML interface. -## Core Concepts +## Components + ### Resources -Single resource endpoint for search results: +Single resource endpoint for search interface: ```duckduckgo://search``` ### Tools -Search tool with configurable result count: -```json -{ - "name": "search", - "arguments": { - "query": "your search query", - "numResults": 5 // optional, defaults to 5 - } -} -``` - -## Implementation Details -- HTML scraping via JSDOM -- Clean result formatting with titles, snippets, and URLs -- Error handling for network/parsing issues -- Request rate limiting built-in via DuckDuckGo's interface +- **duckduckgo_search** + - Performs a search using DuckDuckGo and returns the top search results + - Inputs: + - `query` (string, required): The search query to look up + - `numResults` (number, optional): Number of results to return (default: 10) + - Returns titles, snippets, and URLs of the search results ## Usage Example -```typescript -// Search tool response format +```javascript +// Example tool call { - content: [{ - type: "text", - text: "Title: Example Result\nSnippet: Result description...\nURL: https://..." + "name": "duckduckgo_search", + "arguments": { + "query": "your search query", + "numResults": 10 + } +} + +// Example response format: +{ + "content": [{ + "type": "text", + "text": "Title: Result Title\nSnippet: Result description...\nURL: https://example.com\n\nTitle: Another Result\n..." }] } ``` - -## Development -Requires Node.js and npm. Uses ES modules. diff --git a/src/duckduckgo/index.ts b/src/duckduckgo/index.ts index 7125ce02..c1d316ac 100644 --- a/src/duckduckgo/index.ts +++ b/src/duckduckgo/index.ts @@ -16,7 +16,8 @@ const SEARCH_TOOL: Tool = { name: "duckduckgo_search", description: "Performs a search using DuckDuckGo and returns the top search results. " + - "Returns titles, snippets, and URLs of the search results. ", + "Returns titles, snippets, and URLs of the search results. " + + "Use this tool to search for current information on the internet.", inputSchema: { type: "object", properties: { diff --git a/src/duckduckgo/package.json b/src/duckduckgo/package.json index 89a30463..a09297ea 100644 --- a/src/duckduckgo/package.json +++ b/src/duckduckgo/package.json @@ -10,7 +10,9 @@ "bin": { "mcp-server-duckduckgo": "dist/index.js" }, - "files": ["dist"], + "files": [ + "dist" + ], "scripts": { "build": "tsc && shx chmod +x dist/*.js", "prepare": "npm run build", @@ -18,13 +20,13 @@ }, "dependencies": { "@modelcontextprotocol/sdk": "0.5.0", - "jsdom": "^24.0.0", + "jsdom": "^24.1.3", "node-fetch": "^3.3.2" }, "devDependencies": { - "shx": "^0.3.4", - "typescript": "^5.6.2", "@types/jsdom": "^21.1.6", - "@types/node": "^20.10.0" + "@types/node": "^20.10.0", + "shx": "^0.3.4", + "typescript": "^5.6.2" } } diff --git a/src/filesystem/README.md b/src/filesystem/README.md index 214e6d7e..3c23f956 100644 --- a/src/filesystem/README.md +++ b/src/filesystem/README.md @@ -10,20 +10,6 @@ Node.js server implementing Model Context Protocol (MCP) for filesystem operatio - Search files - Get file metadata -## Usage - -1. Install dependencies: - ``` - npm install @modelcontextprotocol/sdk - ``` - -2. Run server: - ``` - node index.js - ``` - -3. Server runs on stdio, communicate using MCP. - ## API ### Resources @@ -32,24 +18,66 @@ Node.js server implementing Model Context Protocol (MCP) for filesystem operatio ### Tools -1. `read_file`: Read file contents -2. `read_multiple_files`: Read multiple files -3. `write_file`: Create/overwrite file -4. `create_directory`: Create directory -5. `list_directory`: List directory contents -6. `delete_file`: Delete file/directory -7. `move_file`: Move/rename file/directory -8. `search_files`: Search files/directories -9. `get_file_info`: Get file metadata +- **read_file** + - Read complete contents of a file + - Input: `path` (string) + - Reads complete file contents with UTF-8 encoding -## Implementation +- **read_multiple_files** + - Read multiple files simultaneously + - Input: `paths` (string[]) + - Failed reads won't stop the entire operation -- Uses `@modelcontextprotocol/sdk` -- Async file operations with `fs/promises` -- Type guards for argument validation -- Error handling and detailed descriptions +- **write_file** + - Create new file or overwrite existing + - Inputs: + - `path` (string): File location + - `content` (string): File content + +- **create_directory** + - Create new directory or ensure it exists + - Input: `path` (string) + - Creates parent directories if needed + - Succeeds silently if directory exists + +- **list_directory** + - List directory contents with [FILE] or [DIR] prefixes + - Input: `path` (string) + +- **delete_file** + - Remove files or directories + - Inputs: + - `path` (string) + - `recursive` (boolean, optional): For directory deletion + - Use with caution - deletions are permanent + +- **move_file** + - Move or rename files and directories + - Inputs: + - `source` (string) + - `destination` (string) + - Fails if destination exists + +- **search_files** + - Recursively search for files/directories + - Inputs: + - `path` (string): Starting directory + - `pattern` (string): Search pattern + - Case-insensitive matching + - Returns full paths to matches + +- **get_file_info** + - Get detailed file/directory metadata + - Input: `path` (string) + - Returns: + - Size + - Creation time + - Modified time + - Access time + - Type (file/directory) + - Permissions ## Notes -- Careful with `delete_file` and `write_file` (overwrites existing) +- Exercise caution with `delete_file` (deletes files permanently) and `write_file` (overwrites existing files) - File paths can be absolute or relative diff --git a/src/filesystem/index.ts b/src/filesystem/index.ts index 2a2de0c4..dcff5af0 100644 --- a/src/filesystem/index.ts +++ b/src/filesystem/index.ts @@ -153,7 +153,6 @@ server.setRequestHandler(ListToolsRequestSchema, async () => { name: "write_file", description: "Create a new file or completely overwrite an existing file with new content. " + - "This tool will create any necessary parent directories automatically. " + "Use with caution as it will overwrite existing files without warning. " + "Handles text content with proper encoding.", inputSchema: {