# MCP Server - Tool Usage Examples
This directory contains example configurations and usage demonstrations for the MCP Server tools.
## Available Tools
### 1. WebSearch Tool
Search the web using multiple search engines with advanced filtering.
**Example Configuration:**
```json
{
"query": "TypeScript MCP server tutorial",
"engine": "serpapi",
"limit": 10,
"filters": {
"fileType": "pdf",
"language": "en",
"dateRange": "month"
}
}
```
**Supported Engines:**
- `duckduckgo` (default, no API key required)
- `brave` (requires BRAVE_API_KEY)
- `google` (requires GOOGLE_API_KEY and GOOGLE_SEARCH_ENGINE_ID)
- `bing` (requires BING_API_KEY)
- `serpapi` (requires SERP_API_KEY) - **Recommended for production use**
**Why SerpAPI?**
- Aggregates results from Google, Bing, Yahoo, and more
- More reliable than scraping
- Better rate limits and performance
- Consistent JSON responses
- No need to manage multiple API keys
### 2. WebFetch Tool
Fetch and parse HTML content from any URL.
**Example Configuration:**
```json
{
"url": "https://example.com",
"extract": ["text", "headings", "links", "metadata", "images"],
"selectors": {
"mainContent": "article.main",
"sidebar": "aside.sidebar"
},
"options": {
"timeout": 10000,
"followRedirects": true
}
}
```
**Extraction Types:**
- `text` - Full page text content
- `headings` - All h1-h6 elements
- `links` - All links with href attributes
- `metadata` - Meta tags and title
- `images` - Images with src and alt
- Custom CSS selectors via `selectors` parameter
### 3. TypeConversion Tool
Convert data between different formats.
**Example Configuration:**
```json
{
"input": "{\"name\": \"John\", \"age\": 30}",
"fromFormat": "json",
"toFormat": "yaml",
"options": {
"pretty": true,
"indent": 2
}
}
```
**Supported Formats:**
- `json` - JavaScript Object Notation
- `xml` - Extensible Markup Language
- `yaml` - YAML Ain't Markup Language
- `csv` - Comma-Separated Values
- `toml` - Tom's Obvious Minimal Language
**Conversion Options:**
- `pretty` - Pretty print output (default: true)
- `indent` - Indentation spaces (default: 2)
- `csvDelimiter` - CSV delimiter (default: ",")
- `csvHeaders` - CSV has headers (default: true)
## Integration with AI Clients
### Cursor AI Configuration
Add to your Cursor settings:
```json
{
"mcpServers": {
"custom-tools": {
"command": "node",
"args": ["/absolute/path/to/mcp-server/dist/index.js"],
"env": {
"BRAVE_API_KEY": "your_brave_api_key",
"GOOGLE_API_KEY": "your_google_api_key",
"GOOGLE_SEARCH_ENGINE_ID": "your_search_engine_id",
"BING_API_KEY": "your_bing_api_key"
}
}
}
}
```
### Claude Desktop Configuration
Add to `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) or equivalent:
```json
{
"mcpServers": {
"custom-tools": {
"command": "node",
"args": ["/absolute/path/to/mcp-server/dist/index.js"],
"env": {
"BRAVE_API_KEY": "your_brave_api_key"
}
}
}
}
```
## Testing Tools Locally
You can test the tools by running the MCP server directly:
```bash
# Build the project
npm run build
# Run the server
npm start
```
The server will communicate via STDIO, so you'll need an MCP client to interact with it.
## Environment Variables
Copy `.env.example` to `.env` and fill in your API keys:
```bash
cp .env.example .env
```
**Note:** DuckDuckGo search works without any API keys, making it perfect for testing!