A Model Context Protocol (MCP) server for querying vCosmos Test Logic API - UUTs and Tasks
Project description
vCosmos UUT MCP Server
A Model Context Protocol (MCP) server that provides tools to query Units Under Test (UUTs) and tasks from the vCosmos Test Logic API using the official MCP Python library.
๐ฆ Now available as a PyPI package! Install and run with: uvx vcosmos-mcp-server
๐ฏ Overview
This production-ready, packaged MCP server exposes vCosmos API functionality to MCP clients (like VS Code, Claude, etc.), allowing them to:
- Query UUTs with comprehensive filtering options (pool, site, status, product, health, etc.)
- Query vCosmos tasks with filtering and sorting capabilities
- Get data in optimized flat JSON format for LLM consumption
- Support for sorting and pagination
๐๏ธ Architecture
graph TD
A[MCP Client<br/>VS Code, Claude, etc.] -->|MCP Protocol<br/>JSON-RPC over stdio| B[vCosmos MCP Server]
subgraph B[vCosmos MCP Server]
C[MCP Tools<br/>โข query_vcosmos_uuts<br/>โข query_vcosmos_tasks]
D[VCosmosAPIClient Class<br/>built-in HTTP client]
end
B -->|HTTPS/REST| E[vCosmos Test Logic API]
style A fill:#e1f5fe
style B fill:#f3e5f5
style C fill:#fff3e0
style D fill:#fff3e0
style E fill:#e8f5e8
๐ง Available Tools
query_vcosmos_uuts
Query vCosmos test devices (UUT) with comprehensive filtering and sorting options.
Parameters:
pool(optional): Device pool IDid(optional): UUT IDsite(optional): Site nameip(optional): IP addressstatus(optional): Device statusinternal_product_name(optional): Internal product namemarketing_product_name(optional): Marketing product namephase(optional): Product phaserelease_year(optional): Release yearlimit(optional, default: 25): Return result count limit (1-5000)health_status(optional): Health status (Healthy, Unhealthy, Offline, Unregistered)sort_by(optional, default: "id"): Sort fieldsort_direction(optional, default: "asc"): Sort direction (asc, desc)
Returns:
- Flat JSON array of UUT objects with fields like: id, hostname, serial_number, site, ip_address, status, product_name, health_status, etc.
query_vcosmos_tasks
Query vCosmos tasks with filtering and sorting capabilities.
Parameters:
status(optional): Task status filter (Waiting, Pending, Running, Done, etc.)result_status(optional): Result status filter (PASS, FAIL, None, etc.)site(optional): Site name filterjob_id(optional): Job ID filterexecutor(optional): Executor filteruut_serial_number(optional): UUT serial number filterlimit(optional, default: 25): Task count limit (1-50)sort_by(optional, default: "createdAt"): Sort fieldsort_direction(optional, default: "desc"): Sort direction (asc, desc)
Returns:
- Flat JSON array of task objects with fields like: id, job_id, status, result_status, finished_at, uut_serial_number
๐ Quick Start
Prerequisites
Before using this MCP server, ensure you have the following installed:
- Python 3.8+: Download from python.org
- uv: Python package installer and resolver. Install from docs.astral.sh/uv
- Valid vCosmos authentication token: Contact your vCosmos administrator
Installation (Recommended: uvx)
The easiest way to install and run the vCosmos MCP server is using uvx:
-
Install and run with uvx (one command):
uvx vcosmos-mcp-serverThis automatically:
- Downloads and installs the package from PyPI
- Sets up an isolated environment
- Runs the MCP server
-
Set your authentication token:
# PowerShell $env:VCOSMOS_TOKEN = "your_token_here" # Linux/Mac export VCOSMOS_TOKEN="your_token_here"
Alternative Installation Methods
Method 1: Install with uv
# Install the package
uv add vcosmos-mcp-server
# Run the server
vcosmos-mcp-server
Method 2: Development Installation
For development or customization:
# Clone the repository
git clone <repository-url>
cd vcosmos-mcp-server
# Install dependencies
uv sync
# Run the server
uv run vcosmos-mcp-server
VS Code Integration
Option 1: Using uvx (Recommended)
Add this configuration to your VS Code MCP settings:
{
"mcpServers": {
"vcosmos": {
"command": "uvx",
"args": ["vcosmos-mcp-server"],
"env": {
"VCOSMOS_TOKEN": "your_token_here"
}
}
}
}
Option 2: Development/Local
For development or local installations:
{
"mcpServers": {
"vcosmos": {
"command": "python",
"args": ["project_file_path/vcosmos_mcp_server/server.py"],
"env": {
"VCOSMOS_TOKEN": "your_token_here"
}
}
}
}
๐ Current Implementation
The current implementation is a production-ready, packaged MCP server available on PyPI that includes:
- โ
PyPI Package: Published as
vcosmos-mcp-serverfor easy installation - โ
uvx Compatible: Can be run directly with
uvx vcosmos-mcp-server - โ Official MCP Library: Uses the official MCP Python library
- โ Async Implementation: Full async/await support
- โ stdio Transport: JSON-RPC over stdio communication
- โ
Two Main Tools:
query_vcosmos_uutsandquery_vcosmos_tasks - โ Comprehensive Filtering: Multiple filter options for both UUTs and tasks
- โ Flat JSON Output: Optimized for LLM consumption
- โ Error Handling: Robust error handling and validation
- โ Built-in HTTP Client: No external dependencies except MCP library
- โ
CLI Entry Point: Includes
vcosmos-mcp-servercommand
Example Usage
Query UUTs by site:
{
"tool": "query_vcosmos_uuts",
"arguments": {
"site": "hp-tnn-prd",
"limit": 10,
"health_status": "Healthy"
}
}
Query recent failed tasks:
{
"tool": "query_vcosmos_tasks",
"arguments": {
"result_status": "FAIL",
"limit": 5,
"sort_by": "createdAt",
"sort_direction": "desc"
}
}
๐ฎ Features
UUT Query Features
- Filter by pool, site, IP, status, product names, phase, release year
- Health status filtering (Healthy, Unhealthy, Offline, Unregistered)
- Sorting by various fields (id, site, ip, status, etc.)
- Pagination with configurable limits (1-5000)
- Flat JSON output with clean field names
Task Query Features
- Filter by status, result status, site, job ID, executor
- UUT serial number filtering
- Sort by creation date, status, executor, etc.
- Pagination with configurable limits (1-50)
- Extracts UUT serial numbers and result statuses
Data Format
All responses are in flat JSON format optimized for LLM processing:
UUT Response Example:
[
{
"id": "6710bdbdf3e08f001a43b627",
"hostname": "test-hostname",
"serial_number": "8CC1180BC4",
"site": "hp-tnn-prd",
"ip_address": "15.37.194.115",
"status": "Idle",
"product_name": "HP EliteDesk 800 G8",
"health_status": "Healthy",
"last_updated": "2025-08-22T13:45:54.377Z"
}
]
Task Response Example:
[
{
"id": "68a955a3a5e663f2cca2e788",
"job_id": "job123",
"status": "Running",
"result_status": "PASS",
"finished_at": "2025-08-23T10:30:00Z",
"uut_serial_number": "000277072S"
}
]
๏ฟฝ Package Information
- Package Name:
vcosmos-mcp-server - Latest Version:
0.1.5 - Python Support: 3.8+
- PyPI: https://pypi.org/project/vcosmos-mcp-server/
- Installation:
uvx vcosmos-mcp-server(recommended) - CLI Command:
vcosmos-mcp-server - Dependencies: Only requires
mcp>=1.13.1
๏ฟฝ๐ File Structure
vcosmos-mcp-server/
โโโ vcosmos_mcp_server/ # ๐ฆ Main package directory
โ โโโ __init__.py # Package initialization
โ โโโ server.py # โ
Production MCP Server (main module)
โโโ pyproject.toml # ๐ฆ Package configuration and dependencies
โโโ README.md # ๐ Main project documentation
โโโ LICENSE # ๐ MIT License
โโโ MANIFEST.in # ๐ฆ Package manifest
โโโ uv.lock # ๐ Dependency lock file
PyPI Package: Available as vcosmos-mcp-server on PyPI
CLI Command: vcosmos-mcp-server (automatically available after installation)
๐งช Testing the Server
You can test the server functionality using different methods:
Method 1: Using uvx (Recommended)
# Set your token
export VCOSMOS_TOKEN="your_token_here" # Linux/Mac
# or
$env:VCOSMOS_TOKEN = "your_token_here" # PowerShell
# Run and test the server
uvx vcosmos-mcp-server
# The server will show:
# INFO - Starting vCosmos MCP Server
# INFO - VCOSMOS_TOKEN configured
# INFO - Server ready for MCP connections
Method 2: Using installed package
# Install first
uv add vcosmos-mcp-server
# Run the server
vcosmos-mcp-server
Method 3: Development testing
# From the project directory
uv run vcosmos-mcp-server
For integration testing with MCP clients, configure the server in your MCP client and test the tools through the client interface.
๐ฏ Integration with MCP Clients
This server is ready for integration with:
- VS Code: Through MCP extensions and settings configuration
- Claude: Through MCP protocol support
- Custom Applications: Any application supporting the MCP standard
๐ Security Notes
- The server uses the
VCOSMOS_TOKENenvironment variable for authentication - Built-in HTTP client with proper timeout handling (30 seconds)
- No credentials are stored in the code
- All API communication uses HTTPS
๐ Troubleshooting
-
"VCOSMOS_TOKEN environment variable not set":
- Set the environment variable with your vCosmos API token
- Verify the token has the correct permissions
-
"Request error" or API failures:
- Check your network connection to vcosmos.hpcloud.hp.com
- Verify your token is valid and not expired
- Check if the vCosmos API endpoints are accessible
-
"Tool execution error":
- Check the server logs for detailed error messages
- Validate your tool parameters match the schema
- Ensure limit values are within the allowed ranges
-
Empty results
[]:- Check if there are UUTs/tasks matching your filter criteria
- Try broader filter parameters or remove filters to see all data
- Verify your token has access to the requested site/pool
โก Performance Notes
- UUT queries support up to 5000 results per request
- Task queries support up to 50 results per request
- Built-in request timeout of 30 seconds
- Flat JSON output optimized for LLM token efficiency
- Minimal memory footprint with direct field extraction
This production-ready MCP server provides a robust bridge between your vCosmos infrastructure and AI/automation tools! ๐
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file vcosmos_mcp_server-0.1.5.tar.gz.
File metadata
- Download URL: vcosmos_mcp_server-0.1.5.tar.gz
- Upload date:
- Size: 27.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4ceb01e9fe62fe77c80f274c3bbde8da65036093b669cee05b7bce399b9163e0
|
|
| MD5 |
5a3fe16689a7268057a65336e1c6495b
|
|
| BLAKE2b-256 |
682b009b1a77e09540a511aa2c91d84e37fa91af2820c4a1b2645b341aa08a0b
|
File details
Details for the file vcosmos_mcp_server-0.1.5-py3-none-any.whl.
File metadata
- Download URL: vcosmos_mcp_server-0.1.5-py3-none-any.whl
- Upload date:
- Size: 11.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dc0e080367750ae5f7a1d4e27186e9452e7336fe8bec1f76c760edc57787f003
|
|
| MD5 |
2f9265b7cb199f8d534a3abbf21e2ebe
|
|
| BLAKE2b-256 |
49ef94b1b9866779803786e4dc556d2a763d7d3cf81e0dd211e5b4298b4235cd
|