nayan-mcp-wrapper 0.1.0
Akto MCP wrapper for threat detection and discovery
Requires Python: >=3.6

# Akto Gateway

A simple MCP (Model Context Protocol) Gateway for logging and monitoring with PII (Personally Identifiable Information) detection capabilities.

## Overview

Akto Gateway provides a lightweight, Python-based gateway that can intercept, log, and monitor MCP communications while detecting sensitive information in the data stream.

## Features

- **MCP Protocol Support**: Handles Model Context Protocol communications
- **PII Detection**: Automatically detects and flags personally identifiable information
- **Comprehensive Logging**: Detailed logging of messages, sessions, errors, and blocked content
- **Session Management**: Tracks and manages MCP sessions
- **Transport Layer**: Supports multiple transport mechanisms

## Project Structure

```
akto-gateway/
├── akto_gateway/          # Main package source code
│   ├── __init__.py        # Package initialization
│   ├── __main__.py        # CLI entry point
│   ├── constants.py       # Configuration constants
│   ├── logger.py          # Logging functionality
│   ├── pii_detector.py    # PII detection logic
│   ├── session.py         # Session management
│   └── transport.py       # Transport layer implementation
├── logs/                  # Application logs (not tracked in git)
├── pyproject.toml         # Project configuration
└── README.md              # This file
```

## Installation

### Prerequisites

- Python 3.8 or higher
- pip or uv package manager

### Setup

1. Clone the repository:
   ```bash
   git clone <repository-url>
   cd akto-gateway
   ```

2. Install the package in development mode:
   ```bash
   pip install -e .
   ```

   Or using uv:
   ```bash
   uv sync
   ```

## Usage

### Command Line

Run the gateway directly:

```bash
python -m akto_gateway
```

Or using the installed script:

```bash
akto-gateway
```

### Programmatic Usage

```python
from akto_gateway import AktoGateway

# Initialize and run the gateway
gateway = AktoGateway()
gateway.start()
```

## Configuration

The gateway can be configured through environment variables or configuration files. See `constants.py` for available options.

## Development

### Setting up development environment

1. Install development dependencies:
   ```bash
   pip install -e ".[dev]"
   ```

2. Run tests:
   ```bash
   pytest
   ```

### Code Style

This project follows PEP 8 style guidelines. Use a code formatter like `black` or `autopep8` to maintain consistency.

## Logging

The gateway generates several types of logs in the `logs/` directory:

- `mcp_messages.log`: All MCP messages processed
- `mcp_info.log`: General information and debug logs
- `mcp_sessions.log`: Session creation and management
- `mcp_blocked.log`: Blocked or flagged content
- `mcp_errors.log`: Error logs

**Note**: Log files are not tracked in git and are automatically generated during runtime.

## Contributing

1. Fork the repository
2. Create a feature branch
3. Make your changes
4. Add tests if applicable
5. Submit a pull request

## License

[Add your license information here]

## Support

For questions or issues, please [create an issue](link-to-issues) or contact the development team.