Osdu Mcp — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited Osdu Mcp (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
A Python implementation that provides two ways to interact with OSDU® (Open Subsurface Data Universe) platform APIs:
Both interfaces provide the same comprehensive tools for search, storage, schema management, and dataset operations on OSDU® data.
OSDU® and the OSDU logo are registered trademarks of The Open Group.
git clone <repository-url>
cd osdu-mcppip install -e .cp .env.example .env
# Edit .env with your OSDU configurationIf you are looking for a ready to use OSDU instance, simply subscribe to Express for EDI in AWS Marketplace.
Set the following environment variables in your .env file:
OSDU_BASE_URL: Base URL of your OSDU® platform instanceOSDU_DATA_PARTITION_ID: Data partition identifierOSDU_AUTHORIZATION: JWT authorization token (with "Bearer " prefix)#### Prerequisites
Before starting the server, ensure:
.env file with OSDU® credentialspip install -e .#### Starting the Server
The OSDU MCP server communicates via stdin/stdout using the JSON-RPC 2.0 protocol. Choose one of these methods to start:
Method 1: Command Line Entry Point (Recommended)
# From project root directory
osdu-mcpMethod 2: Python Module Execution
# From project root directory
python -m osdu_mcp.serverMethod 3: Direct Script Execution
# From project root directory
python osdu_mcp/server.pyMethod 4: With Virtual Environment
# Activate virtual environment first
source venv/bin/activate # On Windows: venv\Scripts\activate
# Then use any of the above methods
osdu-mcp
# OR
python -m osdu_mcp.server#### Server Behavior
When started, the MCP server:
.env file or environment variablesExpected startup behavior:
list_tools and call_tool requests#### Stopping the Server
Interactive Mode:
# Press Ctrl+C to stop the server
^CBackground Process:
# If running in background, find and kill the process
ps aux | grep osdu-mcp
kill <process_id>
# Or use pkill
pkill -f "osdu-mcp"
pkill -f "osdu_mcp.server"Docker/Container Environment:
# Send SIGTERM signal
docker stop <container_name>
# Or force stop
docker kill <container_name>#### Service Management
Running as a Service (Linux/macOS)
Create a systemd service file at /etc/systemd/system/osdu-mcp.service:
[Unit]
Description=OSDU MCP Server
After=network.target
[Service]
Type=simple
User=your-user
WorkingDirectory=/path/to/osdu-mcp
Environment=PATH=/path/to/osdu-mcp/venv/bin
ExecStart=/path/to/osdu-mcp/venv/bin/osdu-mcp
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.targetManage the service:
# Start service
sudo systemctl start osdu-mcp
# Stop service
sudo systemctl stop osdu-mcp
# Enable auto-start on boot
sudo systemctl enable osdu-mcp
# Check status
sudo systemctl status osdu-mcp
# View logs
journalctl -u osdu-mcp -fProcess Monitoring
# Check if server is running
ps aux | grep osdu-mcp
# Monitor server resources
top -p $(pgrep -f osdu-mcp)
# View server logs (if logging to file)
tail -f /path/to/logfile.logThis server integrates with MCP-compatible clients through stdio communication:
#### Claude Desktop Integration
Add to your Claude Desktop configuration (claude_desktop_config.json):
{
"mcpServers": {
"osdu-mcp": {
"command": "osdu-mcp",
"args": [],
"env": {
"OSDU_BASE_URL": "https://your-osdu-instance.com",
"OSDU_DATA_PARTITION_ID": "your-partition-id",
"OSDU_AUTHORIZATION": "Bearer your-jwt-token"
}
}
}
}or directly map to the code
{
"mcpServers": {
"osdu-mcp": {
"command": "/path/tp/osdu-mcp/venv/bin/python",
"args": ["-m", "osdu_mcp.server"],
"env": {
"OSDU_BASE_URL": "https://your-osdu-instance.com",
"OSDU_DATA_PARTITION_ID": "your-partition-id",
"OSDU_AUTHORIZATION": "Bearer your-jwt-token"
}
}
}
}#### Custom MCP Client Integration
The server follows the standard MCP protocol:
import subprocess
import json
# Start the MCP server
process = subprocess.Popen(
['osdu-mcp'],
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
text=True
)
# Send MCP requests
request = {
"jsonrpc": "2.0",
"id": 1,
"method": "tools/list"
}
process.stdin.write(json.dumps(request) + '\n')
process.stdin.flush()
# Read response
response = process.stdout.readline()
tools = json.loads(response)#### Available Clients
#### Connection Testing
# Test basic connectivity
echo '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' | osdu-mcpFor detailed MCP protocol documentation, visit: https://modelcontextprotocol.io
The HTTP REST API provides the same OSDU® tools through standard REST endpoints with automatic OpenAPI documentation.
Method 1: Command Line Entry Point (Recommended)
# Start HTTP server on default port 8000
osdu-httpMethod 2: Python Module Execution
# Start with custom configuration
python -m osdu_mcp.http_serverMethod 3: Using uvicorn directly
# Start with custom host/port
uvicorn osdu_mcp.http_server:create_app --host 0.0.0.0 --port 8080Method 4: With Docker
# Build and run with Docker
docker build -t osdu-api .
docker run -p 8000:8000 --env-file .env osdu-api
# Or use docker-compose
docker-compose up osdu-apiAdd these optional environment variables to your .env file:
# HTTP Server Configuration
HTTP_HOST=0.0.0.0 # Server host (default: 0.0.0.0)
HTTP_PORT=8000 # Server port (default: 8000)
HTTP_RELOAD=false # Auto-reload for development (default: false)The HTTP API provides the following endpoints:
#### Core Endpoints
GET / - API information and available endpointsGET /health - Health check and configuration statusGET /tools - List all available OSDU® tools with schemasPOST /tools/call - Execute any tool by nameGET /docs - Interactive OpenAPI documentation (Swagger UI)GET /redoc - Alternative API documentation (ReDoc)#### Tool-Specific Endpoints
POST /tools/search/{tool_name} - Execute search toolsPOST /tools/storage/{tool_name} - Execute storage toolsPOST /tools/schema/{tool_name} - Execute schema toolsPOST /tools/dataset/{tool_name} - Execute dataset tools#### List Available Tools
curl http://localhost:8000/tools#### Execute a Search Query
curl -X POST http://localhost:8000/tools/search/query \
-H "Content-Type: application/json" \
-d '{
"query": "*",
"limit": 10,
"kind": "*:*:*:*"
}'#### Create Storage Records
curl -X POST http://localhost:8000/tools/storage/create_or_update_records \
-H "Content-Type: application/json" \
-d '{
"records": [
{
"id": "partition:well:example-001",
"kind": "partition:wks:master-data--Well:1.0.0",
"data": {"wellName": "Example Well"}
}
]
}'#### Generic Tool Execution
curl -X POST http://localhost:8000/tools/call \
-H "Content-Type: application/json" \
-d '{
"name": "osdu_dataset_get_registry",
"arguments": {"dataset_id": "partition:dataset:example"}
}'Once the server is running, visit:
All endpoints return JSON responses in this format:
{
"success": true,
"result": {
// Tool-specific response data
}
}Error responses:
{
"success": false,
"error": "Error message description"
}#### Docker Deployment
# Production docker-compose
docker-compose -f docker-compose.prod.yml up -d#### Reverse Proxy (nginx)
server {
listen 80;
server_name your-domain.com;
location / {
proxy_pass http://localhost:8000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}#### Environment-Specific Configuration
# Development
HTTP_RELOAD=true LOG_LEVEL=DEBUG osdu-http
# Production
HTTP_HOST=0.0.0.0 HTTP_PORT=8000 osdu-http#### Search Tools
osdu_search_query: Query the OSDU index with full text search, range queries, geospatial search, sorting, and aggregation supportosdu_search_query_with_cursor: Query with cursor support for efficiently retrieving large result setsKind Parameter Format: The kind parameter uses OSDU string patterns:
"*:*:*:*" - Search all record types"osdu:wks:well:*" - Search all well records"osdu:wks:well:1.0.0" - Search specific well version"partition:wks:master-data--Well:1.0.0" - Search specific partition and version#### Storage Tools
osdu_storage_create_or_update_records: Create or update records (main injection mechanism)osdu_storage_get_record: Get latest record version with optional field filteringosdu_storage_get_specific_record_version: Get specific version of a recordosdu_storage_get_record_versions: Get all version numbers for a recordosdu_storage_fetch_records: Fetch multiple records with field filteringosdu_storage_fetch_records_batch: Fetch records with normalization supportosdu_storage_query_all_records: Get all record IDs from a kind with cursor paginationosdu_storage_delete_record: Logically delete a record (can be reverted)osdu_storage_bulk_delete_records: Soft delete multiple recordsosdu_storage_purge_record: Permanently delete record and all versionsosdu_storage_purge_record_versions: Permanently delete specific versionsosdu_storage_patch_records: Update records using patch operationsosdu_storage_copy_record_references: Copy record references between namespaces#### Schema Tools
osdu_schema_get_schema: Get schema definition by system-defined IDosdu_schema_search_schemas: Search schemas with comprehensive filtering optionsosdu_schema_create_schema: Create new schema in repository (PUBLISHED status)osdu_schema_upsert_development_schema: Create/update schema in DEVELOPMENT statusosdu_schema_upsert_system_schema: Create/update system schema (service principal required)#### Dataset Tools
osdu_dataset_register: Create or update dataset registriesosdu_dataset_get_registry: Get dataset registry by IDosdu_dataset_get_registries: Get multiple dataset registriesosdu_dataset_storage_instructions: Generate storage instructions (signed URLs)osdu_dataset_retrieval_instructions_single: Generate retrieval instructions for single datasetosdu_dataset_retrieval_instructions_multiple: Generate retrieval instructions for multiple datasetsosdu_dataset_soft_delete: Soft delete a dataset registryosdu_dataset_undelete: Un-delete a soft deleted datasetosdu_dataset_revoke_url: Revoke previously generated URLsThe MCP server follows a modular architecture:
server.py: Main MCP server implementation with JSON-RPC 2.0client.py: HTTP client for OSDU API interactionsconfig.py: Configuration management with validationexceptions.py: Custom exception classestools/: Individual tool implementations for each OSDU serviceopen_api/: OSDU-provided OpenAPI specifications used to generate toolsAll tools are generated based on official OSDU OpenAPI specifications located in the open_api/ folder:
Each tool implementation strictly follows the parameters, request/response formats, and endpoints defined in these official OSDU specifications, ensuring full API compliance and compatibility.
python3 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activatepip install -e .pip install pytest pytest-asyncioThe project includes comprehensive unit and integration tests for all four OSDU® services (Search, Dataset, Schema, and Storage).
#### Run All Tests
python -m pytest tests/ -v#### Run Specific Test Suites by Service
# Search tool tests
python -m pytest tests/test_search_tool.py tests/test_search_tool_integration.py -v
# Dataset tool tests
python -m pytest tests/test_dataset_tool.py tests/test_dataset_tool_integration.py -v
# Schema tool tests
python -m pytest tests/test_schema_tool.py tests/test_schema_tool_integration.py -v
# Storage tool tests
python -m pytest tests/test_storage_tool.py tests/test_storage_tool_integration.py -v#### Run Individual Test Files
# Unit tests
python -m pytest tests/test_search_tool.py -v # Search unit tests (15 tests)
python -m pytest tests/test_dataset_tool.py -v # Dataset unit tests (21 tests)
python -m pytest tests/test_schema_tool.py -v # Schema unit tests (19 tests)
python -m pytest tests/test_storage_tool.py -v # Storage unit tests (25 tests)
# Integration tests
python -m pytest tests/test_search_tool_integration.py -v # Search integration (8 tests)
python -m pytest tests/test_dataset_tool_integration.py -v # Dataset integration (9 tests)
python -m pytest tests/test_schema_tool_integration.py -v # Schema integration (9 tests)
python -m pytest tests/test_storage_tool_integration.py -v # Storage integration (11 tests)#### Test Structure
Search Tool Tests (23 tests):
test_search_tool.py): 15 tests covering tool schemas, parameter validation, error handling, and response formattingtest_search_tool_integration.py): 8 tests with realistic OSDU® scenarios including geospatial searches, pagination, and complex queriesDataset Tool Tests (30 tests):
test_dataset_tool.py): 21 tests covering all 9 dataset tools, schema validation, parameter constraints, and error scenariostest_dataset_tool_integration.py): 9 tests with complete workflows including dataset lifecycle, bulk operations, and large file handlingSchema Tool Tests (28 tests):
test_schema_tool.py): 19 tests covering all 5 schema tools, pattern validation, status/scope enums, parameter mapping, and governance workflowstest_schema_tool_integration.py): 9 tests with schema development lifecycle, system schema management, version filtering, and complex schema scenariosStorage Tool Tests (36 tests):
test_storage_tool.py): 25 tests covering all 13 storage tools, record CRUD operations, versioning, patch operations, and bulk operationstest_storage_tool_integration.py): 11 tests with complete record lifecycle, bulk workflows, versioning, JSON Patch operations, and namespace copying#### Expected Test Results
======================= 117 passed, 2 warnings in 0.65s ========================Complete Test Coverage:
All tests should pass. The warnings about Pydantic validators are non-critical deprecation notices.
#### Code Formatting
black osdu_mcp/
ruff osdu_mcp/#### Type Checking (if mypy is installed)
mypy osdu_mcp/When adding new tools or modifying existing ones, follow the established testing patterns:
#### Creating Unit Tests
# Follow the naming convention: test_<service_name>_tool.py
tests/test_search_tool.py # Search tool unit tests (15 tests)
tests/test_dataset_tool.py # Dataset tool unit tests (21 tests)
tests/test_schema_tool.py # Schema tool unit tests (19 tests)
tests/test_storage_tool.py # Storage tool unit tests (25 tests)#### Creating Integration Tests
# Follow the naming convention: test_<service_name>_tool_integration.py
tests/test_search_tool_integration.py # Search integration tests (8 tests)
tests/test_dataset_tool_integration.py # Dataset integration tests (9 tests)
tests/test_schema_tool_integration.py # Schema integration tests (9 tests)
tests/test_storage_tool_integration.py # Storage integration tests (11 tests)#### Test Coverage Guidelines
AsyncMock for HTTP client operations, realistic response dataThe project includes official OSDU OpenAPI specifications in the open_api/ directory:
open_api/
├── dataset.swagger.yaml # Dataset Service API
├── schema_openapi.yaml # Schema Service API v1
├── search_openapi.yaml # Search API v2
└── storage_openapi.yaml # Storage API v2These specifications are the authoritative source for:
When extending or modifying tools, always refer to these specifications to ensure compliance.
#### Import Errors If you encounter import errors, ensure the package is installed in development mode:
pip install -e .#### Test Failures If tests fail due to missing dependencies:
pip install pytest pytest-asyncioTo run specific failing tests for debugging:
# Run individual service tests
python -m pytest tests/test_search_tool.py -v --tb=long # Search service
python -m pytest tests/test_dataset_tool.py -v --tb=long # Dataset service
python -m pytest tests/test_schema_tool.py -v --tb=long # Schema service
python -m pytest tests/test_storage_tool.py -v --tb=long # Storage service
# Run integration tests only
python -m pytest tests/*_integration.py -v --tb=long
# Run with more verbose output for all tests
python -m pytest tests/ -v -s --tb=long#### Authentication Issues
OSDU_AUTHORIZATION header includes "Bearer " prefix#### Network Connectivity
OSDU_BASE_URL is accessible from your environment#### Configuration Issues
.env file syntax and formattingOSDU_DATA_PARTITION_ID matches your OSDU instanceIf you encounter issues:
This project is licensed under the Apache License 2.0. See the LICENSE file for details.
~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.