# @wordbricks/fetch-mcp

A Model Context Protocol (MCP) server for fetching data from the web. This server provides AI models with the ability to fetch and process web content.

## Features

- Fetch web pages and APIs
- Multiple transport modes (stdio, HTTP)
- Easy integration with MCP-compatible AI tools
- Command-line interface for standalone usage

## Usage

### Basic Usage

Start the MCP server with default stdio transport:

```bash
bunx @wordbricks/fetch-mcp@latest
```

### HTTP Mode

Start the server in HTTP mode:

```bash
bunx @wordbricks/fetch-mcp@latest --transport=http --port=3000
```

### Command Line Options

```
Usage: npx @wordbricks/fetch-mcp [options]

Options:
  --transport=<type>  Transport type: stdio, http (default: stdio)
  --port=<number>     Port for HTTP transport (default: 11891)
  --help, -h          Show this help message

Examples:
  npx @wordbricks/fetch-mcp
  npx @wordbricks/fetch-mcp --transport=stdio
  npx @wordbricks/fetch-mcp --transport=http --port=3000
```

## Integration with AI Tools

This MCP server can be integrated with various AI tools that support the Model Context Protocol. Configure your AI tool to connect to this server using the appropriate transport method.

### Claude Desktop Integration

Add to your Claude Desktop configuration:

```json
{
  "mcpServers": {
    "fetch": {
      "command": "bunx",
      "args": ["@wordbricks/fetch-mcp@latest"]
    }
  }
}
```

## Development

### Prerequisites

- [Bun](https://bun.sh) v1.2.15 or later

### Setup

```bash
bun install
```

### Development Mode

```bash
bun run dev
```

### Build

```bash
bun run build
```

### Testing

```bash
bun test
```

## Publishing to npm

### Automated Releases (Recommended)

This project uses GitHub Actions for automated releases. When you push a version change to the `main` branch, it will automatically:

1. Build and test the package
2. Publish to npm
3. Create a GitHub release

To trigger an automated release:

1. Update the version in `package.json`:

   ```bash
   # For a patch release
   npm version patch

   # For a minor release
   npm version minor

   # For a major release
   npm version major
   ```

2. Push to main:
   ```bash
   git push origin main --follow-tags
   ```

**Prerequisites for automated releases:**

- Set the `NPM_TOKEN` secret in your GitHub repository settings
- The token should have publish permissions for the `@wordbricks` scope

### Manual Publishing

1. Ensure you're logged into npm:

   ```bash
   npm login
   ```

2. Update the version in `package.json`

3. Build and publish:
   ```bash
   bun run build
   npm publish --access public
   ```

The `prepublishOnly` script will automatically build the package before publishing.

**Note:** The `--access public` flag is required for scoped packages (packages starting with `@`) to make them publicly accessible. This is also configured in `package.json` under `publishConfig`.

## License

MIT

## Contributing

Contributions are welcome! Please feel free to submit a Pull Request.
