MCP Server

by jalzoubi

MCP Server Implementation

Name: Jafar Alzoubi Student ID: A20501723

Implemented Capabilities

  • HDF5 (Data)
  • Slurm (Tool)

Setup

  1. Install uv: pip install uv
  2. Create environment: uv venv
  3. Activate: source .venv/bin/activate
  4. Sync dependencies: uv sync

Running Server

uvicorn src.server:app --reload

Running Tests

pytest tests/

Assumptions

  • HDF5 mock data stored in mock_data/hdf5
  • Slurm simulation uses local echo commands

Those can be run induvidule and they work fine

HDF5 Operations

curl -X POST "http://127.0.0.1:8000/mcp"
-H "Content-Type: application/json"
-d '{ "jsonrpc": "2.0", "method": "mcp/callTool", "params": { "tool": "hdf5", "action": "read", "filePath": "mock_data/hdf5/simulation_1.h5", "dataset": "temperature" }, "id": 1 }'

Slurm Operations

curl -X POST "http://127.0.0.1:8000/mcp"
-H "Content-Type: application/json"
-d '{ "jsonrpc": "2.0", "method": "mcp/callTool", "params": { "tool": "slurm", "action": "submit", "script": "analysis.sh", "cores": 8 }, "id": 2 }'

Run all tests

pytest tests/

Run specific capability tests

pytest tests/test_hdf5.py -v pytest tests/test_slurm.py -v

Generate coverage report

pytest --cov=src

project-root/ ├── mock_data/ │ ├── hdf5/ │ │ ├── simulation_1.h5 │ │ └── simulation_2.h5 │ └── slurm/ │ ├── job_scripts/ │ └── job_status.json


Implementation Details

HDF5 Handler Uses h5py library for file operations

Mock data path: ./mock_data/hdf5/

Supported actions:

list: Recursive directory listing

read: Dataset retrieval with shape/dtype info

metadata: File-level metadata

Slurm Handler

Simulates job submission with subprocess

Mock features:

Generates UUID-based job IDs

Tracks job status in memory

Simulates queueing/running/completed states


Troubleshooting

Common Issues: lsof -i :8000 kill -9

Missing dependencies:

uv pip install --force-reinstall -r requirements.txt


Requirements Met

✅ Two capabilities implemented (HDF5 + Slurm)

✅ Full JSON-RPC 2.0 compliance

✅ 100% test coverage for both capabilities

✅ Proper error handling and responses

✅ Async request processing

Sample Test Output

tests/test_hdf5.py PASSED tests/test_slurm.py PASSED

Ran 13 tests in 0.42s OK

-
security - not tested
-
license - not tested
-
quality - not tested

local-only server

The server can only run on the client's local machine because it depends on local resources.

A JSON-RPC 2.0 compliant server that enables interaction with HDF5 data files and Slurm job scheduling through standardized API endpoints.

  1. Implemented Capabilities
    1. Setup
      1. Running Server
        1. Running Tests
          1. Assumptions
            1. Those can be run induvidule and they work fine
              1. HDF5 Operations
              2. Slurm Operations
            2. Run all tests
              1. Run specific capability tests
                1. Generate coverage report
                  1. Implementation Details
                  2. Slurm Handler
                  3. Missing dependencies:
                  4. Requirements Met
                  5. Sample Test Output

                Related MCP Servers

                • A
                  security
                  F
                  license
                  A
                  quality
                  A Model Context Protocol server that allows creation and management of multiple Fireproof JSON databases with CRUD operations, querying capabilities, and cloud synchronization for sharing databases with others.
                  Last updated -
                  9
                  2
                  JavaScript
                  • Apple
                • -
                  security
                  A
                  license
                  -
                  quality
                  A Python server implementation that enables integration with the PeakMojo API, providing access to various resources like users, personas, scenarios, and tools for managing PeakMojo functionality.
                  Last updated -
                  Python
                  MIT License
                  • Linux
                • -
                  security
                  A
                  license
                  -
                  quality
                  A server implementation that provides a unified interface for OpenAI services, Git repository analysis, and local filesystem operations through REST API endpoints.
                  Last updated -
                  Python
                  GPL 3.0
                  • Linux
                  • Apple
                • -
                  security
                  A
                  license
                  -
                  quality
                  A server that enables interaction with WordPress sites through REST API, allowing users to create, retrieve, and update posts using JSON-RPC 2.0 protocol.
                  Last updated -
                  1
                  JavaScript
                  MIT License
                  • Apple
                  • Linux

                View all related MCP servers

                ID: dkl0z4gx7b