A Model Context Protocol (MCP) server that provides comprehensive access to the UCSC Genome Browser API. This server enables LLM applications to query genomic data, sequences, tracks, and metadata from the UCSC Genome Browser. This MCP server exposes 12 tools that cover all major UCSC Genome Browser API endpoints: - findgenome - Search for genomes using keywords, accession IDs, or organism names -
Add this skill
npx mdskills install hlydecker/ucsc-genome-mcpComprehensive genomics API wrapper with 12 well-documented tools for querying UCSC Genome Browser data
1# UCSC Genome Browser MCP Server23A Model Context Protocol (MCP) server that provides comprehensive access to the UCSC Genome Browser API. This server enables LLM applications to query genomic data, sequences, tracks, and metadata from the UCSC Genome Browser.45## Features67This MCP server exposes 12 tools that cover all major UCSC Genome Browser API endpoints:89### Listing & Discovery Tools10- **find_genome** - Search for genomes using keywords, accession IDs, or organism names11- **list_public_hubs** - List all available public track hubs12- **list_ucsc_genomes** - List all UCSC database genomes13- **list_genark_genomes** - List GenArk assembly hub genomes14- **list_hub_genomes** - List genomes from a specific hub15- **list_files** - List downloadable files for a genome16- **list_tracks** - List data tracks in a genome or hub17- **list_chromosomes** - List chromosomes in a genome or track18- **list_schema** - Get schema/field definitions for a track1920### Data Retrieval Tools21- **get_sequence** - Retrieve DNA sequences from genomes22- **get_track_data** - Get track data (genes, variants, annotations, etc.)23- **search_genome** - Search within a genome assembly2425## Installation2627### Prerequisites28- Python 3.10 or higher29- pip3031### Install from source3233```bash34# Clone or download the repository35cd ucsc-genome-mcp-server3637# Install in development mode38pip install -e .39```4041### Required Dependencies42- `mcp>=0.9.0` - Model Context Protocol SDK43- `httpx>=0.27.0` - HTTP client for API requests4445## Usage4647### Running the Server4849The server communicates over stdio, following the MCP protocol:5051```bash52python ucsc_genome_mcp_server.py53```5455### Configuration with Claude Desktop5657Add this to your Claude Desktop configuration file:5859**MacOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`60**Windows**: `%APPDATA%/Claude/claude_desktop_config.json`6162```json63{64 "mcpServers": {65 "ucsc-genome-browser": {66 "command": "/Users/You/.local/bin/uv",67 "args": [68 "--directory",69 "/Users/Path/To/Repository/ucsc-genome-mcp",70 "run",71 "ucsc-genome-mcp.py"72 ],73 "env": {},74 "metadata": {75 "description": "UCSC Genome Browser API",76 "version": "1.0.0"77 }78 }79}80```8182## Tool Examples8384### 1. Find Genomes8586Search for dog genomes:87```json88{89 "query": "dog"90}91```9293Search with advanced operators:94```json95{96 "query": "+white +rhino* -southern",97 "browser": "mustExist"98}99```100101### 2. List Available Tracks102103List all tracks for human genome (hg38):104```json105{106 "genome": "hg38"107}108```109110List tracks without container information:111```json112{113 "genome": "hg38",114 "track_leaves_only": true115}116```117118### 3. Get DNA Sequence119120Get entire mitochondrial chromosome:121```json122{123 "genome": "hg38",124 "chrom": "chrM"125}126```127128Get specific region:129```json130{131 "genome": "hg38",132 "chrom": "chrM",133 "start": 4321,134 "end": 5678135}136```137138Get reverse complement:139```json140{141 "genome": "hg38",142 "chrom": "chrM",143 "start": 4321,144 "end": 5678,145 "reverse_complement": true146}147```148149### 4. Get Track Data150151Get gene annotations for a region:152```json153{154 "genome": "hg38",155 "track": "knownGene",156 "chrom": "chr1",157 "start": 47000,158 "end": 48000159}160```161162Get track data from an assembly hub:163```json164{165 "hub_url": "http://hgdownload.gi.ucsc.edu/hubs/mouseStrains/hub.txt",166 "genome": "CAST_EiJ",167 "track": "assembly",168 "chrom": "chr1"169}170```171172### 5. Search Within a Genome173174Search for BRCA1 in human genome:175```json176{177 "search": "brca1",178 "genome": "hg38"179}180```181182Search only in help documentation:183```json184{185 "search": "bigBed",186 "genome": "hg38",187 "categories": "helpDocs"188}189```190191## API Details192193### Base URL194All requests go to: `https://api.genome.ucsc.edu`195196### Rate Limits197- Recommended: Maximum 1 request per second198- The API has a botDelay system to prevent overload199- Excessive queries may result in restricted access200201### Coordinate Systems202- **Start coordinates**: 0-based (first base is 0)203- **End coordinates**: 1-based (exclusive)204- Example: `start=0, end=10` retrieves the first 10 bases205206### Supported Track Types207The `get_track_data` tool supports these track types:208- bed, bigBed, bigWig209- genePred, bigGenePred210- bigChain, bigPsl, bigMaf211- narrowPeak, bigNarrowPeak212- wiggle/wig, barChart/bigBarChart213- interact/bigInteract214- And many more...215216## Advanced Features217218### Working with Large Datasets219220For tracks with over 1 million items, use pagination:2212221. Query by chromosome:223```json224{225 "genome": "hg19",226 "track": "knownGene",227 "chrom": "chr1"228}229```2302312. Use start/end coordinates for smaller regions:232```json233{234 "genome": "hg19",235 "track": "knownGene",236 "chrom": "chr1",237 "start": 1000000,238 "end": 2000000239}240```241242### Working with Track Hubs243244Track hubs allow accessing external genomic data:245246```json247{248 "hub_url": "http://hgdownload.gi.ucsc.edu/hubs/mouseStrains/hub.txt",249 "genome": "CAST_EiJ",250 "track": "ensGene",251 "chrom": "chr1"252}253```254255## Error Handling256257The server handles various error conditions:258- HTTP errors (404, 500, etc.)259- Invalid parameters260- Non-existent genomes/tracks/chromosomes261- Request timeouts (30 second default)262263Errors are returned as text responses with descriptive messages.264265## Use Cases266267This MCP server enables LLM applications to:2682691. **Genomic Research**: Query gene locations, sequences, and annotations2702. **Variant Analysis**: Retrieve SNP and variant data2713. **Comparative Genomics**: Access data from multiple species2724. **Sequence Analysis**: Get DNA/RNA sequences for analysis2735. **Data Discovery**: Find available datasets and assemblies2746. **Educational**: Learn about genomics through interactive queries275276## API Documentation277278For complete API documentation, visit:279https://genome.ucsc.edu/goldenpath/help/api.html280281## License282283This project interfaces with the UCSC Genome Browser, which has its own terms of use:284https://genome.ucsc.edu/conditions.html285286## Support287288For issues with the UCSC Genome Browser API, contact UCSC.289For issues with this MCP server, please file an issue in the repository.290291## Development292293### Project Structure294```295.296├── ucsc_genome_mcp_server.py # Main server implementation297├── pyproject.toml # Project metadata and dependencies298└── README.md # This file299```300301### Adding New Tools302303To add new endpoints:3043051. Add the tool definition in `list_tools()`3062. Add the handler in `call_tool()`3073. Update this README with examples308309### Testing310311Test individual endpoints manually:312```bash313# Using curl314curl -L 'https://api.genome.ucsc.edu/list/ucscGenomes'315316# Using wget317wget -O- 'https://api.genome.ucsc.edu/getData/sequence?genome=hg38;chrom=chrM;start=4321;end=5678'318```319320## Changelog321322### Version 0.1.0323- Initial release324- Support for all major UCSC Genome Browser API endpoints325- 12 tools covering listing, discovery, and data retrieval326- Full documentation and examples327
Full transparency — inspect the skill content before installing.