A Model Context Protocol (MCP) server for accessing Hatena Bookmark RSS feeds. This server allows AI assistants to retrieve and analyze bookmarks from Hatena Bookmark users with various filtering options.
- Get Bookmarks: Retrieve bookmarks from any Hatena Bookmark user's RSS feed
- Filtering: Filter bookmarks by tag, date, or URL
- Pagination: Support for paginated results (20 bookmarks per page)
- Structured Output: Returns bookmarks in JSON format with metadata
- Error Handling: Comprehensive error handling with detailed error messages
- Logging: Structured logging with configurable levels
- Go 1.21 or later
- Git
git clone <repository-url>
cd hatena-bookmark-mcp
make buildmake test# Install dependencies
make deps
# Run in development mode
make run
# Clean build artifacts
make cleanAdd the following configuration to your MCP client settings:
{
"mcpServers": {
"hatena-bookmark": {
"command": "./bin/hatena-bookmark-mcp",
"args": [],
"env": {
"LOG_LEVEL": "info"
}
}
}
}Retrieve bookmarks from a Hatena Bookmark user's RSS feed.
Parameters:
username(required): Hatena Bookmark usernametag(optional): Filter bookmarks by tagdate(optional): Filter bookmarks by date (YYYYMMDD format)url(optional): Filter bookmarks by URLpage(optional): Page number for pagination (default: 1)
Example Usage:
{
"name": "get_hatena_bookmarks",
"arguments": {
"username": "sample",
"tag": "programming",
"page": 1
}
}Response Format:
{
"user": "sample",
"page": 1,
"total_count": 20,
"filters": {
"tag": "programming"
},
"bookmarks": [
{
"title": "Article Title",
"url": "https://example.com/article",
"bookmarked_at": "2025-01-20T10:30:00Z",
"tags": ["programming", "go"],
"comment": "User comment"
}
]
}LOG_LEVEL: Set logging level (debug,info,warn,error) - Default:info
- Maximum 20 bookmarks per page
- Public bookmarks only (private bookmarks are not accessible)
- Rate limiting is implemented client-side to respect Hatena's servers
- Username: 1-50 characters, alphanumeric and hyphens only
- Tag: Up to 100 characters, no special HTML characters
- Date: YYYYMMDD format, valid date range
- URL: Valid HTTP/HTTPS URLs only, up to 2000 characters
- Page: Positive integers up to 10,000
The server provides detailed error messages for various scenarios:
VALIDATION_ERROR: Invalid input parametersNETWORK_ERROR: Network connectivity issuesPARSING_ERROR: RSS feed parsing failuresAPI_ERROR: Hatena Bookmark API errors
hatena-bookmark-mcp/
├── cmd/main.go # Main application entry point
├── internal/
│ ├── service/bookmark.go # Bookmark service (API interactions)
│ ├── parser/rss.go # RSS feed parser
│ ├── types/bookmark.go # Type definitions
│ ├── errors/handler.go # Error handling utilities
│ └── utils/ # Utility functions
│ ├── validator.go # Input validation
├── test/ # Test files
└── Makefile # Build automation
- BookmarkService: Handles HTTP requests to Hatena Bookmark RSS feeds
- RSSParser: Parses RSS XML and converts to structured data
- Validator: Validates input parameters
- ErrorHandler: Centralized error handling and logging
- Define new tool in
cmd/main.go - Add corresponding service methods in
internal/service/ - Update type definitions in
internal/types/ - Add validation logic in
internal/utils/validator.go - Write tests in
test/
MIT License
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Ensure all tests pass
- Submit a pull request
For issues and questions:
- Check existing issues in the repository
- Create a new issue with detailed information
- Include log output when reporting bugs