UniProtDataAccessor_MCP
A dedicated Model Context Protocol service engineered to retrieve comprehensive macromolecular data directly from the UniProt knowledgebase. It facilitates single or concurrent lookups for essential protein attributes, such as functional annotations, primary structure sequences, and taxonomic lineage.
Author

TakumiY235
Quick Info
Actions
Tags
UniProt Data Accessor (MCP Service)
This implementation of the Model Context Protocol (MCP) serves as an interface layer for querying the vast UniProt repository. It enables intelligent agents to systematically extract detailed characteristics pertaining to specific protein entities, including functional summaries and the complete amino acid sequence.
Core Capabilities
- Access protein specifics using its canonical UniProt accession identifier.
- Support for bulk retrieval operations targeting numerous proteins simultaneously.
- Integrated data persistence layer with a 24-hour Time-To-Live (TTL) for latency reduction.
- Robust error management and comprehensive operational logging.
- Data retrieval encompasses:
- Official nomenclature
- Detailed functional descriptions
- The entire constituent sequence
- Sequence dimensionality (length)
- Species origin
Initial Setup Procedure
- Confirm that a compatible version of Python (3.10 or newer) is established on your system.
-
Obtain the source code repository: bash git clone https://github.com/TakumiY235/uniprot-mcp-server.git cd uniprot-mcp-server
-
Establish necessary external libraries: bash # Recommended approach using uv uv pip install -r requirements.txt
# Alternative using pip pip install -r requirements.txt
Integration Configuration
Incorporate the following configuration stanza into your Claude Desktop preference file:
- Windows Environments:
%APPDATA%\Claude\claude_desktop_config.json - macOS Environments:
~/Library/Application Support/Claude/claude_desktop_config.json - Linux Environments:
~/.config/Claude/claude_desktop_config.json
{ "mcpServers": { "uniprot": { "command": "uv", "args": ["--directory", "path/to/uniprot-mcp-server", "run", "uniprot-mcp-server"] } } }
Operational Examples
Once the service endpoint is registered within Claude Desktop, query initiation can proceed as follows:
Requesting a single entity's data:
Kindly retrieve the comprehensive attributes associated with UniProt accession P98160.
For comparative or multi-entity queries:
Execute a parallel fetch for protein data corresponding to both P04637 and P02747.
Interface Specification
Available Methods
get_protein_info- Purpose: Retrieves characteristics for an isolated protein entity.
- Mandatory Argument:
accession(The specific UniProt identifier string) -
Illustrative Return Structure:
{ "accession": "P12345", "protein_name": "Example protein", "function": ["Description of protein function"], "sequence": "MLTVX...", "length": 123, "organism": "Homo sapiens" }
-
get_batch_protein_info - Purpose: Fetches data for a collection of proteins concurrently.
- Mandatory Argument:
accessions(A list/array containing multiple UniProt accession identifiers) - Output: Yields an array structure where each element corresponds to a retrieved protein record.
Development Environment Setup
Establishing the Build Environment
- Replicate the source repository.
-
Instantiate an isolated execution environment: bash python -m venv .venv source .venv/bin/activate # For Windows users: .venv\Scripts\activate
-
Install necessary development dependencies: bash pip install -e ".[dev]"
Validation Execution
Execute the automated test suite:
bash pytest
Code Style Adherence
This codebase mandates strict adherence to the following formatting and quality standards: - Code Formatting: Black - Import Ordering: isort - Static Analysis: flake8 - Type Validation: mypy - Security Scanning: bandit - Dependency Auditing: safety
To run the complete quality assurance sequence: bash black . isort . flake8 . mypy . bandit -r src/ safety check
Architectural Insights
- Constructed leveraging the core MCP Python Software Development Kit.
- Utilizes the
httpxlibrary for non-blocking, asynchronous network communications. - Implements an
OrderedDict-based caching mechanism featuring a 24-hour expiration policy. - Incorporates logic for managing API rate limitations and implementing request retries.
- Ensures the provision of descriptive diagnostic messages upon failure.
Failure Management
The service is engineered to gracefully manage several classes of operational issues: - Invalid Identifier Input (Returns HTTP 404 equivalents) - Network Interruption during API communication - Exceeding Server Query Limits (HTTP 429 responses) - Data Integrity Issues (e.g., parsing failures in received payloads) - Internal Cache Saturation or TTL violations
Contribution Guidelines
We actively encourage community involvement! Contributions via Pull Requests are highly valued. To participate effectively:
- Create a personal fork of the repository.
- Establish a dedicated feature branch (e.g.,
git checkout -b feature/enhanced-search). - Commit your modifications with descriptive messages (
git commit -m 'Introduce feature XYZ'). - Push the new branch upstream (
git push origin feature/enhanced-search). - Submit an official Pull Request for review.
Please ensure that all new or modified functionality is covered by corresponding tests and that existing coding standards are maintained.
Software Licensing
This project is distributed under the terms specified in the MIT License; refer to the dedicated [LICENSE] file for specifics.
Credits Acknowledged
- UniProt Consortium for maintaining the foundational protein data access service.
- Anthropic for defining the Model Context Protocol standard.
- All developers and reviewers contributing to the project's evolution.
WIKIPEDIA: XMLHttpRequest (XHR) is an Application Programming Interface presented as a JavaScript object. Its primary functions involve dispatching HTTP requests from a web client (browser) to a designated web server. This capability allows client-side applications to initiate server interactions post-page load and subsequently receive relayed data. XHR is a foundational element of the Ajax programming paradigm. Before Ajax, server communication predominantly relied on traditional hyperlink navigation and form submissions, actions which typically resulted in a full-page refresh.
== Chronology ==
The conceptual framework underpinning XMLHttpRequest originated around the year 2000 through the efforts of Microsoft Outlook developers. This concept was subsequently materialized within the Internet Explorer 5 browser release (1999). However, the initial invocation syntax did not utilize the standard XMLHttpRequest identifier. Instead, early implementations relied on COM object instantiations such as ActiveXObject("Msxml2.XMLHTTP") or ActiveXObject("Microsoft.XMLHTTP"). By the time Internet Explorer 7 was released (2006), universal browser adoption of the XMLHttpRequest identifier was achieved.
Today, XMLHttpRequest is recognized as the established convention across all leading browser engines, including Mozilla’s Gecko (2002), Safari 1.2 (2004), and Opera 8.0 (2005).
=== Standardization Efforts === The World Wide Web Consortium (W3C) formally published a preliminary specification (Working Draft) for the XMLHttpRequest object on April 5, 2006. A subsequent Level 2 specification was released by the W3C on February 25, 2008. Level 2 introduced enhancements for progress monitoring, support for cross-origin data transfers, and improved handling of binary data streams. By the close of 2011, the Level 2 features were integrated back into the primary specification document. Development responsibilities were transferred to the WHATWG at the end of 2012, where it is now maintained as a dynamic document defined using Web IDL.
== Practical Implementation == Sending a request utilizing XMLHttpRequest generally involves a prescribed sequence of programming operations.
- Instantiate the XHR object by invoking its constructor:
- Utilize the "open" method to define the request method (e.g., GET/POST), specify the target Uniform Resource Identifier (URI), and declare the operation mode as synchronous or asynchronous:
- If an asynchronous execution path is selected, an event handler must be configured to react to subsequent state transitions:
- Trigger the network transmission via the "send" method:
- Monitor the state changes within the registered listener. Upon successful server data reception, the payload typically resides in the "responseText" property. When processing concludes, the object transitions to state 4, indicating completion ("done"): Beyond these fundamental steps, XMLHttpRequest provides extensive configurability for request transmission and response handling. Custom headers can be appended to influence server processing; data payloads can be transmitted to the server within the "send" call. Responses are capable of being parsed directly from JSON format into native JavaScript objects, or processed incrementally as they arrive, avoiding wait times for the complete transmission. Furthermore, requests can be terminated prematurely or equipped with a timeout threshold.
== Inter-Domain Communication ==
During the nascent stages of the World Wide Web, a security constraint emerged regarding the feasibility of execut
