Skip to main content
Glama
Nishant-IIT

small-mcp

by Nishant-IIT
README.md
# small-mcp

A minimal [FastMCP](https://gofastmcp.com) server in Python that demonstrates all four MCP primitives: **tools**, **resources**, **resource templates**, and **prompts** — including how to use the **context** object for logging and progress reporting.

## Requirements

- [uv](https://docs.astral.sh/uv/) (package manager)
- Python 3.14+

## Setup

```bash
uv sync
```

## Run

```bash
uv run python main.py
```

The server starts in stdio mode, ready to be connected to any MCP client.

## Primitives

### Tools

Functions the LLM can call to perform actions.

| Tool | Description |
|---|---|
| `add(a, b)` | Add two numbers |
| `word_count(text)` | Count words, characters, and lines |
| `current_time(timezone)` | Return the current UTC time |
| `log_message(message)` | Log a message via MCP context (demonstrates progress + logging) |

### Resources

Static data the LLM can read.

| URI | Description |
|---|---|
| `resource://server/info` | Basic info about this server |
| `resource://snippets/hello-world` | A Python Hello World snippet |

### Resource Templates

Dynamic resources resolved from a URI pattern.

| Template | Description |
|---|---|
| `resource://snippets/{language}/hello` | Hello World snippet for `python`, `javascript`, `go`, or `rust` |

### Prompts

Reusable prompt templates the LLM can request by name.

| Prompt | Args | Description |
|---|---|---|
| `summarize` | `text`, `style` | Ask for a summary in a given style |
| `code_review` | `code`, `language` | Request a code review |
| `explain_concept` | `concept`, `audience` | Explain a concept to a target audience |

### Context

The `log_message` tool shows how to inject `ctx: Context` into a tool to:
- Send log messages back to the client via `ctx.info()`
- Report progress via `ctx.report_progress(progress, total)`

## Inspect with MCP Inspector

```bash
uv run fastmcp dev inspector main.py
```

Then open the URL printed in the terminal to browse and call tools, read resources, and render prompts interactively.

## Connect to Claude Desktop

Add this to your `claude_desktop_config.json`:

```json
{
  "mcpServers": {
    "small-mcp": {
      "command": "uv",
      "args": ["run", "--directory", "/Users/nishantbhagat/Study/Projects/small mcp", "python", "main.py"]
    }
  }
}
```

## Project Structure

```
small mcp/
├── main.py          # MCP server (all primitives in one file)
├── pyproject.toml   # uv project config
└── uv.lock
```

TDQS

A4.2/5.0

Scored across 6 tools

Disambiguation5/5

Each tool has a clear, distinct role: search vs call, list vs read, list vs get. There is no overlap in purpose.

Naming Consistency5/5

All tool names follow a consistent verb_noun pattern (search_tools, call_tool, list_resources, read_resource, list_prompts, get_prompt).

Tool Count5/5

With 6 tools covering three resource types (tools, resources, prompts), the count is well-scoped and appropriate for a small MCP utility server.

Completeness3/5

The server covers tools, resources, and prompts, but misses a list_tools tool, which is a notable gap since search_tools cannot enumerate all tools. This could cause agent failures when trying to discover the full tool surface.

Maintenance

ActivityInactive
ResponsivenessNo issues