Password Generator MCP Server

Password Generator MCP Server

Enables generating secure passwords, exposing password policies, and providing reusable prompt templates for secure password creation through MCP primitives.

Category
Visit Server

README

Password Generator MCP Server

A simple Model Context Protocol (MCP) server built using the Python MCP SDK to demonstrate the three core MCP Primitives:

  • šŸ› ļø Tools – Generate a secure password.
  • šŸ“„ Resources – Expose a password policy.
  • šŸ’” Prompts – Provide a reusable prompt template for generating secure passwords.

This project accompanies my Medium article on MCP Inspector and MCP Primitives, providing a hands-on example to help you understand how these concepts work together.


Project Structure

MCP-INSPECTOR/
│
ā”œā”€ā”€ prompts/
│   ā”œā”€ā”€ __init__.py
│   └── password_prompt.py
│
ā”œā”€ā”€ resources/
│   ā”œā”€ā”€ __init__.py
│   └── password_resource.py
│
ā”œā”€ā”€ tools/
│   ā”œā”€ā”€ __init__.py
│   └── password_tool.py
│
ā”œā”€ā”€ .gitignore
ā”œā”€ā”€ .python-version
ā”œā”€ā”€ app.py
ā”œā”€ā”€ pyproject.toml
ā”œā”€ā”€ README.md
ā”œā”€ā”€ server.py
└── uv.lock

Project Overview

  • app.py – Creates the FastMCP server instance.
  • server.py – Entry point that registers all MCP primitives and starts the server.
  • tools/password_tool.py – Implements the Password Generator Tool.
  • resources/password_resource.py – Exposes the Password Policy Resource.
  • prompts/password_prompt.py – Defines the reusable Prompt template.
  • pyproject.toml – Project configuration and project dependencies.
  • uv.lock – Lock file generated by UV.
  • README.md – Project documentation.

Clone the Repository

Clone the repository to your local machine.

git clone <YOUR_GITHUB_REPOSITORY_LINK>

Navigate to the project directory.

cd MCP-INSPECTOR

Synchronize and install all project dependencies.

uv sync

Activate the virtual environment.

Windows

.venv\Scripts\activate

Running the MCP Server with MCP Inspector

Start the MCP server using:

mcp dev server.py

This command starts the MCP server and automatically launches MCP Inspector in your browser.

Using MCP Inspector you can:

  • View all registered MCP primitives.
  • Execute Tools.
  • Read Resources.
  • Test Prompt templates.
  • Validate your MCP server before integrating it with an MCP client.

Screenshot: MCP Inspector Home Page


Testing the Tool

Open the Tools section inside MCP Inspector.

Select generate_password and provide the required inputs such as:

  • Password Length
  • Include Special Characters

Execute the Tool to generate a secure password.

Screenshot: Password Generator Tool

Screenshot: Generated Password Output


Testing the Resource

Open the Resources section.

Select the password://policy resource.

The server returns the password policy and security recommendations exposed by the MCP server.

Screenshot: Password Policy Resource


Testing the Prompt

Navigate to the Prompts section.

Select create_secure_password_prompt.

Provide an account type such as:

  • Banking
  • Email
  • Social Media

The Prompt generates a reusable instruction template for creating a secure password.

Screenshot: Prompt Execution


Installing the MCP Server in Claude Desktop

Open a new terminal and run:

mcp install server.py

Once the installation is complete, restart Claude Desktop if it is already running.

Claude Desktop will automatically discover the MCP server and its registered primitives.

You can now interact with the server using natural language.

For example:

Generate a strong password for my email.

or

Show me the password policy.

alt text Claude Desktop Detecting the MCP Server

alt text Claude Desktop Invoking the Password Generator Tool


Creating an MCP Project from Scratch

If you'd like to build your own MCP server from scratch, follow these steps.

1. Initialize a UV Project

uv init

2. Create a Virtual Environment

uv venv

3. Activate the Virtual Environment

Windows

.venv\Scripts\activate

4. Install the MCP SDK

uv add "mcp[cli]"

5. Start MCP Inspector

mcp dev server.py

6. Install the MCP Server in Claude Desktop

Open a new terminal and run:

mcp install server.py

MCP Primitives Included

šŸ› ļø Tool

generate_password()

Generates a secure password with configurable length and optional special characters.


šŸ“„ Resource

password://policy

Returns the password generation policy and recommended password security practices.


šŸ’” Prompt

create_secure_password_prompt()

Creates a reusable prompt template for generating a secure password for a specified account type.


Medium Article

If you're new to MCP and would like a detailed explanation of MCP Inspector and MCP Primitives, check out my accompanying Medium article.

Medium: https://medium.com/@n.raki2331/understanding-mcp-inspector-and-the-three-core-mcp-primitives-tools-resources-prompts-e6069f1ca75d?sharedUserId=n.raki2331


Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured
Password Generator MCP Server