pyramid-mcp


Namepyramid-mcp JSON
Version 0.0.5 PyPI version JSON
download
home_pageNone
SummaryModel Context Protocol (MCP) integration for Pyramid web framework
upload_time2025-07-11 13:56:33
maintainerNone
docs_urlNone
authorpyramid-mcp contributors
requires_python<4.0,>=3.10
licenseMIT
keywords pyramid mcp model-context-protocol web framework ai llm
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Pyramid MCP

[![PyPI version](https://badge.fury.io/py/pyramid-mcp.svg)](https://badge.fury.io/py/pyramid-mcp)
[![Python 3.9+](https://img.shields.io/badge/python-3.9+-blue.svg)](https://www.python.org/downloads/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Tests](https://github.com/your-org/pyramid-mcp/workflows/tests/badge.svg)](https://github.com/your-org/pyramid-mcp/actions)
[![Coverage](https://codecov.io/gh/your-org/pyramid-mcp/branch/main/graph/badge.svg)](https://codecov.io/gh/your-org/pyramid-mcp)

Pyramid MCP is a library that exposes Pyramid web application endpoints as Model Context Protocol (MCP) tools. It's inspired by fastapi_mcp but designed specifically for the Pyramid web framework.

## Features

- ๐Ÿ”Œ **Pyramid Plugin**: Easy integration with `config.include('pyramid_mcp')`
- ๐Ÿ› ๏ธ **Tool Registration**: Simple `@tool` decorator for registering MCP tools
- โš™๏ธ **Settings-based Configuration**: Configure via Pyramid settings
- ๐Ÿ” **Route Discovery**: Automatic discovery of Pyramid routes (planned)
- ๐Ÿ“ก **Multiple Protocols**: Support for HTTP and SSE (Server-Sent Events)
- ๐Ÿงช **Well Tested**: Comprehensive test suite with pytest
- ๐Ÿ“š **Type Hints**: Full type annotations for better IDE support
- ๐Ÿš€ **Easy to Use**: Minimal setup required

## Installation

### From PyPI (Recommended)

```bash
pip install pyramid-mcp
```

### From Source

```bash
git clone https://github.com/your-org/pyramid-mcp
cd pyramid-mcp
pip install -e .
```

### Requirements

- Python 3.9+
- Pyramid 2.0+
- Marshmallow 3.22+ (for schema validation)

## Quick Start

### Basic Usage

```python
from pyramid.config import Configurator
from pyramid.view import view_config
from pyramid_mcp import tool

# Include pyramid_mcp in your Pyramid application
def create_app():
    config = Configurator(settings={
        'mcp.server_name': 'my-api',
        'mcp.mount_path': '/mcp'
    })
    
    # Include the pyramid_mcp plugin
    config.include('pyramid_mcp')
    
    # Add your regular Pyramid routes
    config.add_route('home', '/')
    config.scan()
    
    return config.make_wsgi_app()

# Register MCP tools using the decorator
@tool(name="calculate", description="Perform basic math operations")
def calculate(operation: str, a: float, b: float) -> float:
    """Perform basic math operations."""
    if operation == "add":
        return a + b
    elif operation == "subtract":
        return a - b
    elif operation == "multiply":
        return a * b
    elif operation == "divide":
        if b == 0:
            raise ValueError("Cannot divide by zero")
        return a / b
    else:
        raise ValueError(f"Unknown operation: {operation}")

@view_config(route_name='home', renderer='json')
def home_view(request):
    return {"message": "Hello World", "mcp_available": True}
```

### Run Your Application

```python
if __name__ == '__main__':
    from wsgiref.simple_server import make_server
    
    app = create_app()
    server = make_server('0.0.0.0', 8080, app)
    print("Server started at http://localhost:8080")
    print("MCP endpoint available at http://localhost:8080/mcp")
    server.serve_forever()
```

### Test Your MCP Integration

```bash
# Initialize MCP connection
curl -X POST http://localhost:8080/mcp \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc": "2.0", "method": "initialize", "id": 1}'

# List available tools
curl -X POST http://localhost:8080/mcp \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc": "2.0", "method": "tools/list", "id": 2}'

# Call the calculate tool
curl -X POST http://localhost:8080/mcp \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0", 
    "method": "tools/call", 
    "id": 3,
    "params": {
      "name": "calculate",
      "arguments": {"operation": "add", "a": 5, "b": 3}
    }
  }'
```

### Configuration

Configure pyramid_mcp using Pyramid settings:

```python
settings = {
    # MCP Server Configuration
    'mcp.server_name': 'my-api',           # Server name
    'mcp.server_version': '1.0.0',        # Server version
    'mcp.mount_path': '/mcp',              # Mount path for MCP endpoints
    
    # Protocol Configuration  
    'mcp.enable_sse': 'true',              # Enable Server-Sent Events
    'mcp.enable_http': 'true',             # Enable HTTP protocol
    
    # Route Discovery (planned)
    'mcp.include_patterns': 'api/*, users/*',  # Routes to include
    'mcp.exclude_patterns': 'internal/*',      # Routes to exclude
}

config = Configurator(settings=settings)
config.include('pyramid_mcp')
```

### Accessing MCP in Views

```python
@view_config(route_name='mcp_info', renderer='json')
def mcp_info_view(request):
    # Access MCP instance through request
    mcp = request.mcp
    
    # Get available tools
    tools = list(mcp.protocol_handler.tools.keys())
    
    return {
        'server_name': mcp.config.server_name,
        'available_tools': tools,
        'mount_path': mcp.config.mount_path
    }
```

## API Reference

### Plugin Integration

```python
# Basic inclusion
config.include('pyramid_mcp')

# Access MCP instance
mcp = config.get_mcp()           # From configurator
mcp = request.mcp                # From request (in views)
```

### Tool Registration

```python
from pyramid_mcp import tool

@tool(name="my_tool", description="Tool description")
def my_tool(param1: str, param2: int) -> str:
    """Tool implementation."""
    return f"Result: {param1} * {param2}"

# With schema validation (optional)
from marshmallow import Schema, fields

class MyToolSchema(Schema):
    param1 = fields.Str(required=True)
    param2 = fields.Int(required=True)

@tool(name="validated_tool", schema=MyToolSchema)
def validated_tool(param1: str, param2: int) -> str:
    return f"Validated: {param1} + {param2}"
```

### Manual Usage (Advanced)

```python
from pyramid_mcp import PyramidMCP, MCPConfiguration

# Manual configuration
config = Configurator()
mcp_config = MCPConfiguration(
    server_name="my-server",
    mount_path="/mcp"
)

pyramid_mcp = PyramidMCP(config, config=mcp_config)

# Register tools manually
@pyramid_mcp.tool("manual_tool")
def manual_tool(x: int) -> int:
    return x * 2

# Mount manually (with auto_commit=False for more control)
pyramid_mcp.mount(auto_commit=False)
config.commit()
```

## MCP Protocol

Once configured, your Pyramid application will expose MCP endpoints:

- **HTTP**: `POST /mcp` (or your configured mount path)
- **SSE**: `GET /mcp/sse` (if enabled)

### Example MCP Requests

```bash
# Initialize MCP connection
curl -X POST http://localhost:8080/mcp \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc": "2.0", "method": "initialize", "id": 1}'

# List available tools
curl -X POST http://localhost:8080/mcp \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc": "2.0", "method": "tools/list", "id": 2}'

# Call a tool
curl -X POST http://localhost:8080/mcp \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0", 
    "method": "tools/call", 
    "id": 3,
    "params": {
      "name": "calculate",
      "arguments": {"operation": "add", "a": 5, "b": 3}
    }
  }'
```

## Troubleshooting

### Common Issues

#### "Module not found" error
```bash
ModuleNotFoundError: No module named 'pyramid_mcp'
```
**Solution**: Make sure pyramid-mcp is installed in your active Python environment:
```bash
pip list | grep pyramid-mcp
pip install pyramid-mcp
```

#### MCP endpoints not accessible
**Problem**: Getting 404 when accessing `/mcp` endpoint.

**Solutions**:
1. Ensure you've included the plugin: `config.include('pyramid_mcp')`
2. Check your mount path setting: `'mcp.mount_path': '/mcp'`
3. Verify the configurator is properly committed if using manual setup

#### Tools not showing up in `/tools/list`
**Problem**: Registered tools don't appear in MCP tools list.

**Solutions**:
1. Ensure tools are registered before mounting: `pyramid_mcp.mount()`
2. Check that `config.scan()` is called to discover `@tool` decorators
3. Verify the tool registration syntax

#### Type validation errors
**Problem**: Getting validation errors when calling tools.

**Solutions**:
1. Check parameter types match the function signature
2. Use Marshmallow schemas for complex validation
3. Review the MCP request format

### Debug Mode

Enable debug logging to troubleshoot issues:

```python
import logging
logging.basicConfig(level=logging.DEBUG)

# In your Pyramid settings
settings = {
    'mcp.server_name': 'my-api',
    'mcp.mount_path': '/mcp',
    # Add debug settings if needed
}
```

### Getting Help

- ๐Ÿ“– [Documentation](https://your-org.github.io/pyramid-mcp)
- ๐Ÿ› [Report Issues](https://github.com/your-org/pyramid-mcp/issues)
- ๐Ÿ’ฌ [Discussions](https://github.com/your-org/pyramid-mcp/discussions)
- ๐Ÿ“ง [Contact the maintainers](https://github.com/your-org/pyramid-mcp/discussions)

## Examples

### Complete Examples

See the `examples/` directory for complete example applications:

- **[Basic Integration](examples/pyramid_app_example.py)**: Complete Pyramid application with MCP integration
- **Advanced Usage**: Multiple tools, schema validation, and SSE support

### Tool Examples

```python
# Simple tool
@tool(name="greet", description="Greet a user")
def greet(name: str) -> str:
    return f"Hello, {name}!"

# Tool with schema validation
from marshmallow import Schema, fields

class UserSchema(Schema):
    name = fields.Str(required=True, validate=lambda x: len(x) > 0)
    age = fields.Int(required=True, validate=lambda x: x > 0)

@tool(name="create_user", description="Create a new user", schema=UserSchema)
def create_user(name: str, age: int) -> dict:
    return {"id": 123, "name": name, "age": age, "created": True}

# Async tool (if using async views)
@tool(name="async_tool", description="Async operation")
async def async_tool(data: str) -> str:
    # Simulate async work
    await asyncio.sleep(0.1)
    return f"Processed: {data}"
```

## Configuration

### All Configuration Options

```python
settings = {
    # MCP Server Configuration
    'mcp.server_name': 'my-api',           # Server name (default: 'pyramid-mcp-server')
    'mcp.server_version': '1.0.0',        # Server version (default: '1.0.0')
    'mcp.mount_path': '/mcp',              # Mount path for MCP endpoints (default: '/mcp')
    
    # Protocol Configuration  
    'mcp.enable_sse': 'true',              # Enable Server-Sent Events (default: True)
    'mcp.enable_http': 'true',             # Enable HTTP protocol (default: True)
    
    # Route Discovery (planned feature)
    'mcp.include_patterns': 'api/*, users/*',  # Routes to include as tools
    'mcp.exclude_patterns': 'internal/*',      # Routes to exclude from tools
    
    # Advanced Options
    'mcp.auto_commit': 'true',             # Auto-commit configuration (default: True)
    'mcp.strict_mode': 'false',            # Strict mode for validation (default: False)
}
```

## Development

### Setup Development Environment

```bash
# Clone the repository
git clone https://github.com/your-org/pyramid-mcp
cd pyramid-mcp

# Install with development dependencies
make install

# Or manually with poetry
poetry install
poetry shell
```

### Running Tests

```bash
# Run all tests
make test

# Run with coverage
make test-coverage

# Run specific test types
make test-unit         # Unit tests only
make test-integration  # Integration tests only

# Run tests with pytest directly
poetry run pytest -v
poetry run pytest --cov=pyramid_mcp --cov-report=html
```

### Code Quality

```bash
# Run all quality checks
make check

# Individual commands
make format    # Format code with black
make lint      # Lint with ruff
make type      # Type check with mypy
```

### Making Changes

1. Create a new branch: `git checkout -b feature/your-feature`
2. Make your changes
3. Add tests for new functionality
4. Run the test suite: `make test`
5. Check code quality: `make check`
6. Commit your changes: `git commit -m "Add your feature"`
7. Push and create a pull request

## Contributing

We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.

### Ways to Contribute

- ๐Ÿ› **Report bugs** by creating issues
- ๐Ÿ’ก **Suggest features** through discussions
- ๐Ÿ“– **Improve documentation** 
- ๐Ÿงช **Write tests** to improve coverage
- ๐Ÿ”ง **Fix bugs** and implement features
- ๐Ÿ“ **Write examples** and tutorials

## Changelog

See [CHANGELOG.md](CHANGELOG.md) for version history and changes.

## License

MIT License - see [LICENSE](LICENSE) file for details.

## Related Projects

- ๐Ÿ”— [Model Context Protocol (MCP)](https://github.com/modelcontextprotocol/python-sdk) - The official MCP Python SDK
- ๐Ÿš€ [FastAPI MCP](https://github.com/your-org/fastapi-mcp) - Similar integration for FastAPI
- ๐Ÿ—๏ธ [Pyramid](https://trypyramid.com/) - The Pyramid web framework

## Acknowledgments

- Thanks to the [Pyramid](https://trypyramid.com/) team for the excellent web framework
- Inspired by [FastAPI MCP](https://github.com/your-org/fastapi-mcp)
- Built with the [Model Context Protocol](https://github.com/modelcontextprotocol/python-sdk)

---

**โญ If you find this project useful, please consider giving it a star on GitHub! โญ**

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "pyramid-mcp",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.10",
    "maintainer_email": null,
    "keywords": "pyramid, mcp, model-context-protocol, web, framework, ai, llm",
    "author": "pyramid-mcp contributors",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/18/5b/d3c73367f2d9fc922ace87034a13d23fbfab0f1095b65916d434e796cd8e/pyramid_mcp-0.0.5.tar.gz",
    "platform": null,
    "description": "# Pyramid MCP\n\n[![PyPI version](https://badge.fury.io/py/pyramid-mcp.svg)](https://badge.fury.io/py/pyramid-mcp)\n[![Python 3.9+](https://img.shields.io/badge/python-3.9+-blue.svg)](https://www.python.org/downloads/)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Tests](https://github.com/your-org/pyramid-mcp/workflows/tests/badge.svg)](https://github.com/your-org/pyramid-mcp/actions)\n[![Coverage](https://codecov.io/gh/your-org/pyramid-mcp/branch/main/graph/badge.svg)](https://codecov.io/gh/your-org/pyramid-mcp)\n\nPyramid MCP is a library that exposes Pyramid web application endpoints as Model Context Protocol (MCP) tools. It's inspired by fastapi_mcp but designed specifically for the Pyramid web framework.\n\n## Features\n\n- \ud83d\udd0c **Pyramid Plugin**: Easy integration with `config.include('pyramid_mcp')`\n- \ud83d\udee0\ufe0f **Tool Registration**: Simple `@tool` decorator for registering MCP tools\n- \u2699\ufe0f **Settings-based Configuration**: Configure via Pyramid settings\n- \ud83d\udd0d **Route Discovery**: Automatic discovery of Pyramid routes (planned)\n- \ud83d\udce1 **Multiple Protocols**: Support for HTTP and SSE (Server-Sent Events)\n- \ud83e\uddea **Well Tested**: Comprehensive test suite with pytest\n- \ud83d\udcda **Type Hints**: Full type annotations for better IDE support\n- \ud83d\ude80 **Easy to Use**: Minimal setup required\n\n## Installation\n\n### From PyPI (Recommended)\n\n```bash\npip install pyramid-mcp\n```\n\n### From Source\n\n```bash\ngit clone https://github.com/your-org/pyramid-mcp\ncd pyramid-mcp\npip install -e .\n```\n\n### Requirements\n\n- Python 3.9+\n- Pyramid 2.0+\n- Marshmallow 3.22+ (for schema validation)\n\n## Quick Start\n\n### Basic Usage\n\n```python\nfrom pyramid.config import Configurator\nfrom pyramid.view import view_config\nfrom pyramid_mcp import tool\n\n# Include pyramid_mcp in your Pyramid application\ndef create_app():\n    config = Configurator(settings={\n        'mcp.server_name': 'my-api',\n        'mcp.mount_path': '/mcp'\n    })\n    \n    # Include the pyramid_mcp plugin\n    config.include('pyramid_mcp')\n    \n    # Add your regular Pyramid routes\n    config.add_route('home', '/')\n    config.scan()\n    \n    return config.make_wsgi_app()\n\n# Register MCP tools using the decorator\n@tool(name=\"calculate\", description=\"Perform basic math operations\")\ndef calculate(operation: str, a: float, b: float) -> float:\n    \"\"\"Perform basic math operations.\"\"\"\n    if operation == \"add\":\n        return a + b\n    elif operation == \"subtract\":\n        return a - b\n    elif operation == \"multiply\":\n        return a * b\n    elif operation == \"divide\":\n        if b == 0:\n            raise ValueError(\"Cannot divide by zero\")\n        return a / b\n    else:\n        raise ValueError(f\"Unknown operation: {operation}\")\n\n@view_config(route_name='home', renderer='json')\ndef home_view(request):\n    return {\"message\": \"Hello World\", \"mcp_available\": True}\n```\n\n### Run Your Application\n\n```python\nif __name__ == '__main__':\n    from wsgiref.simple_server import make_server\n    \n    app = create_app()\n    server = make_server('0.0.0.0', 8080, app)\n    print(\"Server started at http://localhost:8080\")\n    print(\"MCP endpoint available at http://localhost:8080/mcp\")\n    server.serve_forever()\n```\n\n### Test Your MCP Integration\n\n```bash\n# Initialize MCP connection\ncurl -X POST http://localhost:8080/mcp \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"jsonrpc\": \"2.0\", \"method\": \"initialize\", \"id\": 1}'\n\n# List available tools\ncurl -X POST http://localhost:8080/mcp \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"jsonrpc\": \"2.0\", \"method\": \"tools/list\", \"id\": 2}'\n\n# Call the calculate tool\ncurl -X POST http://localhost:8080/mcp \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"jsonrpc\": \"2.0\", \n    \"method\": \"tools/call\", \n    \"id\": 3,\n    \"params\": {\n      \"name\": \"calculate\",\n      \"arguments\": {\"operation\": \"add\", \"a\": 5, \"b\": 3}\n    }\n  }'\n```\n\n### Configuration\n\nConfigure pyramid_mcp using Pyramid settings:\n\n```python\nsettings = {\n    # MCP Server Configuration\n    'mcp.server_name': 'my-api',           # Server name\n    'mcp.server_version': '1.0.0',        # Server version\n    'mcp.mount_path': '/mcp',              # Mount path for MCP endpoints\n    \n    # Protocol Configuration  \n    'mcp.enable_sse': 'true',              # Enable Server-Sent Events\n    'mcp.enable_http': 'true',             # Enable HTTP protocol\n    \n    # Route Discovery (planned)\n    'mcp.include_patterns': 'api/*, users/*',  # Routes to include\n    'mcp.exclude_patterns': 'internal/*',      # Routes to exclude\n}\n\nconfig = Configurator(settings=settings)\nconfig.include('pyramid_mcp')\n```\n\n### Accessing MCP in Views\n\n```python\n@view_config(route_name='mcp_info', renderer='json')\ndef mcp_info_view(request):\n    # Access MCP instance through request\n    mcp = request.mcp\n    \n    # Get available tools\n    tools = list(mcp.protocol_handler.tools.keys())\n    \n    return {\n        'server_name': mcp.config.server_name,\n        'available_tools': tools,\n        'mount_path': mcp.config.mount_path\n    }\n```\n\n## API Reference\n\n### Plugin Integration\n\n```python\n# Basic inclusion\nconfig.include('pyramid_mcp')\n\n# Access MCP instance\nmcp = config.get_mcp()           # From configurator\nmcp = request.mcp                # From request (in views)\n```\n\n### Tool Registration\n\n```python\nfrom pyramid_mcp import tool\n\n@tool(name=\"my_tool\", description=\"Tool description\")\ndef my_tool(param1: str, param2: int) -> str:\n    \"\"\"Tool implementation.\"\"\"\n    return f\"Result: {param1} * {param2}\"\n\n# With schema validation (optional)\nfrom marshmallow import Schema, fields\n\nclass MyToolSchema(Schema):\n    param1 = fields.Str(required=True)\n    param2 = fields.Int(required=True)\n\n@tool(name=\"validated_tool\", schema=MyToolSchema)\ndef validated_tool(param1: str, param2: int) -> str:\n    return f\"Validated: {param1} + {param2}\"\n```\n\n### Manual Usage (Advanced)\n\n```python\nfrom pyramid_mcp import PyramidMCP, MCPConfiguration\n\n# Manual configuration\nconfig = Configurator()\nmcp_config = MCPConfiguration(\n    server_name=\"my-server\",\n    mount_path=\"/mcp\"\n)\n\npyramid_mcp = PyramidMCP(config, config=mcp_config)\n\n# Register tools manually\n@pyramid_mcp.tool(\"manual_tool\")\ndef manual_tool(x: int) -> int:\n    return x * 2\n\n# Mount manually (with auto_commit=False for more control)\npyramid_mcp.mount(auto_commit=False)\nconfig.commit()\n```\n\n## MCP Protocol\n\nOnce configured, your Pyramid application will expose MCP endpoints:\n\n- **HTTP**: `POST /mcp` (or your configured mount path)\n- **SSE**: `GET /mcp/sse` (if enabled)\n\n### Example MCP Requests\n\n```bash\n# Initialize MCP connection\ncurl -X POST http://localhost:8080/mcp \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"jsonrpc\": \"2.0\", \"method\": \"initialize\", \"id\": 1}'\n\n# List available tools\ncurl -X POST http://localhost:8080/mcp \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"jsonrpc\": \"2.0\", \"method\": \"tools/list\", \"id\": 2}'\n\n# Call a tool\ncurl -X POST http://localhost:8080/mcp \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"jsonrpc\": \"2.0\", \n    \"method\": \"tools/call\", \n    \"id\": 3,\n    \"params\": {\n      \"name\": \"calculate\",\n      \"arguments\": {\"operation\": \"add\", \"a\": 5, \"b\": 3}\n    }\n  }'\n```\n\n## Troubleshooting\n\n### Common Issues\n\n#### \"Module not found\" error\n```bash\nModuleNotFoundError: No module named 'pyramid_mcp'\n```\n**Solution**: Make sure pyramid-mcp is installed in your active Python environment:\n```bash\npip list | grep pyramid-mcp\npip install pyramid-mcp\n```\n\n#### MCP endpoints not accessible\n**Problem**: Getting 404 when accessing `/mcp` endpoint.\n\n**Solutions**:\n1. Ensure you've included the plugin: `config.include('pyramid_mcp')`\n2. Check your mount path setting: `'mcp.mount_path': '/mcp'`\n3. Verify the configurator is properly committed if using manual setup\n\n#### Tools not showing up in `/tools/list`\n**Problem**: Registered tools don't appear in MCP tools list.\n\n**Solutions**:\n1. Ensure tools are registered before mounting: `pyramid_mcp.mount()`\n2. Check that `config.scan()` is called to discover `@tool` decorators\n3. Verify the tool registration syntax\n\n#### Type validation errors\n**Problem**: Getting validation errors when calling tools.\n\n**Solutions**:\n1. Check parameter types match the function signature\n2. Use Marshmallow schemas for complex validation\n3. Review the MCP request format\n\n### Debug Mode\n\nEnable debug logging to troubleshoot issues:\n\n```python\nimport logging\nlogging.basicConfig(level=logging.DEBUG)\n\n# In your Pyramid settings\nsettings = {\n    'mcp.server_name': 'my-api',\n    'mcp.mount_path': '/mcp',\n    # Add debug settings if needed\n}\n```\n\n### Getting Help\n\n- \ud83d\udcd6 [Documentation](https://your-org.github.io/pyramid-mcp)\n- \ud83d\udc1b [Report Issues](https://github.com/your-org/pyramid-mcp/issues)\n- \ud83d\udcac [Discussions](https://github.com/your-org/pyramid-mcp/discussions)\n- \ud83d\udce7 [Contact the maintainers](https://github.com/your-org/pyramid-mcp/discussions)\n\n## Examples\n\n### Complete Examples\n\nSee the `examples/` directory for complete example applications:\n\n- **[Basic Integration](examples/pyramid_app_example.py)**: Complete Pyramid application with MCP integration\n- **Advanced Usage**: Multiple tools, schema validation, and SSE support\n\n### Tool Examples\n\n```python\n# Simple tool\n@tool(name=\"greet\", description=\"Greet a user\")\ndef greet(name: str) -> str:\n    return f\"Hello, {name}!\"\n\n# Tool with schema validation\nfrom marshmallow import Schema, fields\n\nclass UserSchema(Schema):\n    name = fields.Str(required=True, validate=lambda x: len(x) > 0)\n    age = fields.Int(required=True, validate=lambda x: x > 0)\n\n@tool(name=\"create_user\", description=\"Create a new user\", schema=UserSchema)\ndef create_user(name: str, age: int) -> dict:\n    return {\"id\": 123, \"name\": name, \"age\": age, \"created\": True}\n\n# Async tool (if using async views)\n@tool(name=\"async_tool\", description=\"Async operation\")\nasync def async_tool(data: str) -> str:\n    # Simulate async work\n    await asyncio.sleep(0.1)\n    return f\"Processed: {data}\"\n```\n\n## Configuration\n\n### All Configuration Options\n\n```python\nsettings = {\n    # MCP Server Configuration\n    'mcp.server_name': 'my-api',           # Server name (default: 'pyramid-mcp-server')\n    'mcp.server_version': '1.0.0',        # Server version (default: '1.0.0')\n    'mcp.mount_path': '/mcp',              # Mount path for MCP endpoints (default: '/mcp')\n    \n    # Protocol Configuration  \n    'mcp.enable_sse': 'true',              # Enable Server-Sent Events (default: True)\n    'mcp.enable_http': 'true',             # Enable HTTP protocol (default: True)\n    \n    # Route Discovery (planned feature)\n    'mcp.include_patterns': 'api/*, users/*',  # Routes to include as tools\n    'mcp.exclude_patterns': 'internal/*',      # Routes to exclude from tools\n    \n    # Advanced Options\n    'mcp.auto_commit': 'true',             # Auto-commit configuration (default: True)\n    'mcp.strict_mode': 'false',            # Strict mode for validation (default: False)\n}\n```\n\n## Development\n\n### Setup Development Environment\n\n```bash\n# Clone the repository\ngit clone https://github.com/your-org/pyramid-mcp\ncd pyramid-mcp\n\n# Install with development dependencies\nmake install\n\n# Or manually with poetry\npoetry install\npoetry shell\n```\n\n### Running Tests\n\n```bash\n# Run all tests\nmake test\n\n# Run with coverage\nmake test-coverage\n\n# Run specific test types\nmake test-unit         # Unit tests only\nmake test-integration  # Integration tests only\n\n# Run tests with pytest directly\npoetry run pytest -v\npoetry run pytest --cov=pyramid_mcp --cov-report=html\n```\n\n### Code Quality\n\n```bash\n# Run all quality checks\nmake check\n\n# Individual commands\nmake format    # Format code with black\nmake lint      # Lint with ruff\nmake type      # Type check with mypy\n```\n\n### Making Changes\n\n1. Create a new branch: `git checkout -b feature/your-feature`\n2. Make your changes\n3. Add tests for new functionality\n4. Run the test suite: `make test`\n5. Check code quality: `make check`\n6. Commit your changes: `git commit -m \"Add your feature\"`\n7. Push and create a pull request\n\n## Contributing\n\nWe welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.\n\n### Ways to Contribute\n\n- \ud83d\udc1b **Report bugs** by creating issues\n- \ud83d\udca1 **Suggest features** through discussions\n- \ud83d\udcd6 **Improve documentation** \n- \ud83e\uddea **Write tests** to improve coverage\n- \ud83d\udd27 **Fix bugs** and implement features\n- \ud83d\udcdd **Write examples** and tutorials\n\n## Changelog\n\nSee [CHANGELOG.md](CHANGELOG.md) for version history and changes.\n\n## License\n\nMIT License - see [LICENSE](LICENSE) file for details.\n\n## Related Projects\n\n- \ud83d\udd17 [Model Context Protocol (MCP)](https://github.com/modelcontextprotocol/python-sdk) - The official MCP Python SDK\n- \ud83d\ude80 [FastAPI MCP](https://github.com/your-org/fastapi-mcp) - Similar integration for FastAPI\n- \ud83c\udfd7\ufe0f [Pyramid](https://trypyramid.com/) - The Pyramid web framework\n\n## Acknowledgments\n\n- Thanks to the [Pyramid](https://trypyramid.com/) team for the excellent web framework\n- Inspired by [FastAPI MCP](https://github.com/your-org/fastapi-mcp)\n- Built with the [Model Context Protocol](https://github.com/modelcontextprotocol/python-sdk)\n\n---\n\n**\u2b50 If you find this project useful, please consider giving it a star on GitHub! \u2b50**\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Model Context Protocol (MCP) integration for Pyramid web framework",
    "version": "0.0.5",
    "project_urls": {
        "Documentation": "https://github.com/cartaorobbin/pyramid-mcp",
        "Homepage": "https://github.com/cartaorobbin/pyramid-mcp",
        "Repository": "https://github.com/cartaorobbin/pyramid-mcp"
    },
    "split_keywords": [
        "pyramid",
        " mcp",
        " model-context-protocol",
        " web",
        " framework",
        " ai",
        " llm"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "5c4969df045d70a2c5bd3b7029ce54280edbead1ef5b8143fb388b34baef9130",
                "md5": "83d31397d554da730b9e918f73c305a9",
                "sha256": "9d09c5db901910cab0e648648d592b858b52e69c13faf75b68f704c72b732bea"
            },
            "downloads": -1,
            "filename": "pyramid_mcp-0.0.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "83d31397d554da730b9e918f73c305a9",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.10",
            "size": 33847,
            "upload_time": "2025-07-11T13:56:32",
            "upload_time_iso_8601": "2025-07-11T13:56:32.538097Z",
            "url": "https://files.pythonhosted.org/packages/5c/49/69df045d70a2c5bd3b7029ce54280edbead1ef5b8143fb388b34baef9130/pyramid_mcp-0.0.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "185bd3c73367f2d9fc922ace87034a13d23fbfab0f1095b65916d434e796cd8e",
                "md5": "00e948f2144277b86ad10103015fb315",
                "sha256": "b65d76599cb1c8c993140ff3b937e1c91f5340f2bc98574e6b6a896af6c2a424"
            },
            "downloads": -1,
            "filename": "pyramid_mcp-0.0.5.tar.gz",
            "has_sig": false,
            "md5_digest": "00e948f2144277b86ad10103015fb315",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.10",
            "size": 34105,
            "upload_time": "2025-07-11T13:56:33",
            "upload_time_iso_8601": "2025-07-11T13:56:33.715865Z",
            "url": "https://files.pythonhosted.org/packages/18/5b/d3c73367f2d9fc922ace87034a13d23fbfab0f1095b65916d434e796cd8e/pyramid_mcp-0.0.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-11 13:56:33",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "cartaorobbin",
    "github_project": "pyramid-mcp",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "pyramid-mcp"
}
        
Elapsed time: 0.66740s