Skip to main content
Glama
README.md
# MCP Tool Server

Reference implementation of a Model Context Protocol (MCP) server for integrating external APIs as agent tools.

Built from MCP patterns used in production agentic platforms integrating weather, database, and enterprise system tools.

## Features

- **MCP-compliant server** with tool registration, discovery, and execution
- **Built-in tools**: weather lookup, database query, web search, calculator
- **Tool schema validation** with Pydantic models
- **Authentication**: API key and OAuth2 support
- **Rate limiting** per tool and per client
- **Execution logging** for observability

## Quick start

```bash
pip install -r requirements.txt
python src/server.py  # Starts MCP server on port 8000
```

## Adding custom tools

```python
from src.server import MCPServer, Tool

@Tool(name="lookup_inventory", description="Check inventory levels")
def lookup_inventory(product_id: str) -> dict:
    return {"product_id": product_id, "quantity": 142, "warehouse": "Seattle-WH1"}

server = MCPServer()
server.register(lookup_inventory)
server.run()
```

## Tech stack

Python, FastAPI, Pydantic, httpx