Skip to main content
Glama
TonyC793

SAMS Catalog MCP Server

by TonyC793
README.md
# SAMS Catalog MCP Server

MCP server for catalog management service for the SAMS platform with ADK integration support.

## Quick Start

### Standalone Operation

1. **Install Dependencies**
   ```bash
   pip install uv
   uv sync
   ```

3. **Configure the Server**
   Create or modify `config/config.json` with your API configurations:
   ```json
   {
     "api_connections": {
       "iqs": {
          "base_url"
         "timeout": 30,
         "max_retries": 3,
         "ssl_verify": false
       }
     },
     "server": {
       "host": "0.0.0.0",
       "port": 8080,
       "debug": true
     }
   }
   ```

4. **Run the Server**
   ```bash
   # Simple command using uv
   uv run python main.py
   
   # Or using the script entry point (if defined in pyproject.toml)
   uv run mcp-server
   ```

### Configuration via JSON

The server reads its configuration from a `config.json` file. The config file can be located in:

1. Path specified by `CONFIG_JSON_PATH` environment variable
2. `/etc/secrets/config.json` (for Docker/Kubernetes deployments)
3. `config/config.json` (relative to the project root)
4. `config.json` (current working directory)

**Configuration Structure:**

```json
{
  "api_connections": {
    "iqs": {
      "base_url"
      "timeout": 30,
      "max_retries": 3,
      "ssl_verify": false
    },
    "iro": { ... },
    "elixir_v1": { ... },
    "elixir_v2": { ... },
    "score_v1": { ... },
    "mapper": { ... }
  },
  "server": {
    "host": "0.0.0.0",
    "port": 8080,
    "debug": true
  },
  "analysis": {
    "false_positive_threshold": 0.95,
    "merge_confidence_threshold": 0.8
  },
  "log_level": "INFO"
}
```

**Environment Variables (Optional):**

```bash
# Configuration Override
CONFIG_JSON_PATH=/path/to/your/config.json  # Override config file location

# Server Override (will override JSON values if set)
SERVER_PORT=8080          # Server port
DEBUG=true               # Debug mode
LOG_LEVEL=INFO          # Logging level
```

### Development

```bash
# Run in development mode
DEBUG=true LOG_LEVEL=DEBUG uv run python main.py

# Run on different port
SERVER_PORT=9000 uv run python main.py

# Use custom config file
CONFIG_JSON_PATH=/path/to/custom/config.json uv run python main.py
```

### Docker

```bash
### Docker

```bash
# Build and run with docker-compose (uses config/config.json)
docker-compose up --build

# Or direct docker run with custom config
docker run -v /path/to/your/config.json:/etc/secrets/config.json:ro -p 8080:8080 sams-catalog-mcp
```
docker build -t sams-catalog-mcp .
docker run -p 8080:8080 --env-file .env sams-catalog-mcp
```

### Testing

```bash
# Test server health
curl http://localhost:8080/health

# Test MCP protocol
curl -X POST http://localhost:8080/mcp \
  -H "Content-Type: application/json" \
  -d '{"method": "tools/list"}'

# List available tools
curl http://localhost:8080/tools
```

## ADK Integration

The server now works seamlessly with ADK without command-line arguments:

```json
{
  "mcpServers": {
    "sams-catalog-mcp": {
      "command": "uv",
      "args": ["run", "python", "main.py"],
      "transport": "streamable-http",
      "endpoint": "http://localhost:8080/mcp",
      "env": {
        "PYTHONPATH": "/path/to/sams-catalog-mcp",
        "PYTHONUNBUFFERED": "1",
        "SERVER_PORT": "8080"
      }
    }
  }
}
```