# Pier Cloud MCP Server

A scalable Model Context Protocol server with clean architecture.

## Quick Start

```bash
# Setup
poetry install

# Local mode (stdio)
poetry run piercloud-mcp

# Production mode (HTTP/SSE)
poetry run piercloud-mcp --sse --port 8000
```

## Production Deployment

Deploy as HTTP server at `https://mcp.piercloud.io`:

```bash
# Run server
poetry run piercloud-mcp --sse --port 8000
```

### MCP Protocol (Claude, Cline, etc)
```json
{
  "mcpServers": {
    "pier": {
      "url": "https://mcp.piercloud.io/mcp/sse"
    }
  }
}
```

### REST API (ChatGPT, Gemini, any LLM)
```bash
# List tools
curl https://mcp.piercloud.io/api/tools

# Execute tool
curl -X POST https://mcp.piercloud.io/api/tools/echo \
  -H "Content-Type: application/json" \
  -d '{"message": "hello", "uppercase": true}'

# OpenAPI spec
curl https://mcp.piercloud.io/openapi.json
```

## Adding Tools

Create a new file in `src/pier_mcp/tools/` and register:

```python
from pydantic import BaseModel, Field

class MyToolInput(BaseModel):
    param: str = Field(description="Parameter description")

def register_my_tools(mcp):
    @mcp.tool("my_tool", "Tool description", MyToolInput)
    async def my_tool(args: MyToolInput) -> str:
        return f"Result: {args.param}"
```

Then import in `main.py`:

```python
from pier_mcp.tools.my_tools import register_my_tools
register_my_tools(mcp)
```

## Architecture

- `server.py` - Core MCP server with tool registry
- `tools/` - Tool implementations (one file per domain)
- `main.py` - Entry point and tool registration

Clean, minimal, scalable.
