Metadata-Version: 2.4
Name: mcp-wxo
Version: 0.1.0
Summary: MCP Server with factorial calculation tools
Author-email: Your Name <your.email@example.com>
License: MIT
Project-URL: Homepage, https://github.com/yourusername/mcp-wxo
Project-URL: Repository, https://github.com/yourusername/mcp-wxo
Keywords: mcp,factorial,calculator,watsonx,orchestrate
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: fastmcp>=0.1.0
Requires-Dist: mcp>=1.0.0
Provides-Extra: dev
Requires-Dist: pytest>=7.0.0; extra == "dev"
Dynamic: license-file

# MCP-WXO Project

## Project Setup

This project uses:
- **Project Directory**: `~/bob/mcp-wxo` (`/Users/amandawinkles/bob/mcp-wxo`)
- **Python Virtual Environment**: `~/wxo-adk/wxO-adk` (`/Users/amandawinkles/wxo-adk/wxO-adk`)
- **Python Version**: 3.13.12

## Activating the Virtual Environment

To activate the virtual environment, run:

```bash
source ~/wxo-adk/wxO-adk/bin/activate
```

Or from the project directory:

```bash
source /Users/amandawinkles/wxo-adk/wxO-adk/bin/activate
```

## Deactivating the Virtual Environment

To deactivate the virtual environment:

```bash
deactivate
```

## Project Structure

This is the root directory for the MCP-WXO project. All project files should be placed here.

## Factorial MCP Server

This project includes an MCP (Model Context Protocol) server with two mathematical tools for factorial calculations:

### Tools

1. **factorial_value**: Calculates and returns the exact value of n! (factorial of n)
   - Input: A non-negative integer `n`
   - Output: The exact factorial value
   - Example: `factorial_value(5)` returns `120`

2. **factorial_digits**: Returns the number of decimal digits in n!
   - Input: A non-negative integer `n`
   - Output: The number of digits in n!
   - Example: `factorial_digits(100)` returns `158`
   - Useful for very large factorials that are too big to display

### Installation

1. Activate the virtual environment:
   ```bash
   source ~/wxo-adk/wxO-adk/bin/activate
   ```

2. Install dependencies:
   ```bash
   pip install -e .
   ```

### Running the Server

To start the MCP server:

```bash
python server.py
```

The server will start and listen for MCP tool requests.

### Testing

Run the test suite to verify the implementation:

```bash
pytest test_server.py -v
```

### Usage Examples

#### Using factorial_value

```python
# Calculate 5!
factorial_value(5)  # Returns: 120

# Calculate 10!
factorial_value(10)  # Returns: 3628800

# Calculate 20!
factorial_value(20)  # Returns: 2432902008176640000
```

#### Using factorial_digits

```python
# Get digit count for 5!
factorial_digits(5)  # Returns: 3 (because 5! = 120 has 3 digits)

# Get digit count for 100!
factorial_digits(100)  # Returns: 158

# Get digit count for 1000!
factorial_digits(1000)  # Returns: 2568
```

### Implementation Details

- Both tools share a common helper function `calculate_factorial()` to avoid code duplication
- `factorial_value` uses Python's built-in `math.factorial()` for exact computation
- `factorial_digits` uses logarithms for efficient calculation without computing the full factorial
- Comprehensive error handling for negative numbers and invalid input types
- Full test coverage with pytest

### Error Handling

Both tools validate input and raise appropriate errors:

- `TypeError`: If the input is not an integer
- `ValueError`: If the input is a negative number (factorial is undefined for negative numbers)
