Skip to main content

Pinboard MCP Server - Read-only access to Pinboard bookmarks for LLMs

Project description

Pinboard MCP Server

CI Python 3.10+

Read-only access to Pinboard.in bookmarks for LLMs via Model Context Protocol (MCP).

Overview

This server provides LLMs with the ability to search, filter, and retrieve bookmark metadata from Pinboard.in at inference time. Built on FastMCP 2.0, it offers four core tools for bookmark interaction while respecting Pinboard's rate limits and implementing intelligent caching.

Features

  • Read-only access to Pinboard bookmarks
  • Four MCP tools: searchBookmarks, listRecentBookmarks, listBookmarksByTags, listTags
  • Smart caching with LRU cache and automatic invalidation using posts/update endpoint
  • Rate limiting respects Pinboard's 3-second guideline between API calls
  • Field mapping converts Pinboard's legacy field names to intuitive ones (description→title, extended→notes)
  • Comprehensive testing with integration test harnesses and CI validation

Installation

Via pip (recommended)

pip install pinboard-mcp-server

From source

git clone https://github.com/rossshannon/pinboard-bookmarks-mcp-server.git
cd pinboard-bookmarks-mcp-server
pip install -e .

Quick Start

  1. Get your Pinboard API token from https://pinboard.in/settings/password
  2. Set environment variable:
    export PINBOARD_TOKEN="username:1234567890ABCDEF"
    
  3. Start the server:
    pinboard-mcp-server
    

Usage with Claude Desktop

Add this configuration to your Claude Desktop settings:

{
  "mcpServers": {
    "pinboard": {
      "command": "pinboard-mcp-server",
      "env": {
        "PINBOARD_TOKEN": "your-username:your-token-here"
      }
    }
  }
}

Available Tools

1. searchBookmarks

Search bookmarks by query string across titles, notes, and tags.

Parameters:

  • query (string): Search query
  • limit (int, optional): Maximum results (default: 20, max: 100)

Example:

Search for "python testing" bookmarks

2. listRecentBookmarks

List bookmarks saved in the last N days.

Parameters:

  • days (int, optional): Days to look back (default: 7, max: 30)
  • limit (int, optional): Maximum results (default: 20, max: 100)

Example:

Show me bookmarks from the last 3 days

3. listBookmarksByTags

List bookmarks filtered by tags with optional date range.

Parameters:

  • tags (array): List of tags to filter by (1-3 tags)
  • from_date (string, optional): Start date in ISO format (YYYY-MM-DD)
  • to_date (string, optional): End date in ISO format (YYYY-MM-DD)
  • limit (int, optional): Maximum results (default: 20, max: 100)

Example:

Find bookmarks tagged with "python" and "api" from January 2024

4. listTags

List all tags with their usage counts.

Example:

What are my most used tags?

Configuration

Environment Variables

  • PINBOARD_TOKEN (required): Your Pinboard API token in format username:token

Rate Limiting

The server automatically enforces a 3-second delay between Pinboard API calls to respect their guidelines. Cached responses are returned immediately.

Caching Strategy

  • Query cache: LRU cache with 1000 entries for search results
  • Bookmark cache: Full bookmark list cached for 1 hour
  • Cache invalidation: Uses posts/update endpoint to detect changes
  • Tag cache: Tag list cached until manually refreshed

Testing

The project includes comprehensive test coverage with multiple test strategies:

Run all tests

# Activate virtual environment first
source ~/.venvs/pinboard-bookmarks-mcp-server/bin/activate

# Run all tests with coverage
pytest --cov=src --cov-report=term-missing

Real API testing

# Set your Pinboard token
export PINBOARD_TOKEN="username:token"

# Run debug utility to test search functionality
PINBOARD_TOKEN="username:token" python tests/debug_bookmarks.py

Mock API testing

# Run comprehensive test suite
python -m pytest tests/ -v

Development

Setup

# Clone and setup
git clone https://github.com/rossshannon/pinboard-bookmarks-mcp-server.git
cd pinboard-bookmarks-mcp-server

# Quick development setup
./scripts/dev-setup.sh

Code Quality

# Activate environment
source ~/.venvs/pinboard-bookmarks-mcp-server/bin/activate

# Linting and formatting
ruff check src/ tests/
ruff format src/ tests/

# Type checking
mypy src/

# Run tests
pytest -v

# Build package
./scripts/build.sh

Architecture

  • FastMCP 2.0: MCP scaffolding with Tool abstraction and async FastAPI server
  • pinboard.py: Pinboard API client wrapper with error handling
  • Pydantic: Data validation and serialization with JSON Schema
  • ThreadPoolExecutor: Bridges async MCP with sync pinboard.py library
  • LRU Cache: In-memory caching with intelligent invalidation

Key Files

  • src/pinboard_mcp_server/main.py - MCP server entry point and tool implementations
  • src/pinboard_mcp_server/client.py - Pinboard API client with caching
  • src/pinboard_mcp_server/models.py - Pydantic data models
  • tests/ - Comprehensive test suite
  • tests/debug_bookmarks.py - Debug utility for testing search functionality
  • docs/TEST_HARNESS.md - Documentation for test harnesses

Performance

  • P50 response time: <250ms (cached responses)
  • P95 response time: <600ms (cold cache)
  • Rate limiting: 3-second intervals between API calls
  • Cache hit ratio: >90% for typical usage patterns

Security

  • API tokens are never logged or exposed in error messages
  • Read-only access to Pinboard data
  • Input validation on all tool parameters
  • Secure environment variable handling

Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes with tests
  4. Ensure all tests pass and code is formatted
  5. Submit a pull request

License

MIT License - see LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pinboard_mcp_server-1.0.0.tar.gz (18.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pinboard_mcp_server-1.0.0-py3-none-any.whl (11.8 kB view details)

Uploaded Python 3

File details

Details for the file pinboard_mcp_server-1.0.0.tar.gz.

File metadata

  • Download URL: pinboard_mcp_server-1.0.0.tar.gz
  • Upload date:
  • Size: 18.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for pinboard_mcp_server-1.0.0.tar.gz
Algorithm Hash digest
SHA256 6e93d000ed177073d30f79774d17a6159a593f549027f87507c773508e1ecc24
MD5 d89442e9cbec8f1b1615b76c4c3110ee
BLAKE2b-256 a5c2c76777250f38a1f7e4372e9337ab5e7da1fb7f8150d30c59a9c0043159a2

See more details on using hashes here.

File details

Details for the file pinboard_mcp_server-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pinboard_mcp_server-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ab9987d5f718d132a84fe3dae02a4ed62e59fcf491a3219246e1c4dedf067cc5
MD5 0b11c9e848ee03cee83ae3d3268ba55d
BLAKE2b-256 5f0135abc2347691422e47bbe2da0893cb0296e48721310c09b5f6674ba7ca63

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page