Skip to content

Tanmay0215/mymcp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Simple MCP Server

A simple Model Context Protocol (MCP) server built with FastMCP.

What is MCP?

The Model Context Protocol (MCP) is a standardized way to connect LLMs to external data sources and tools. Think of it as an API specifically designed for LLM interactions.

Features

This server provides essential MCP tools that extend LLM capabilities with real-world actions:

πŸ”§ Basic Utilities

  • get_current_time() - Get current timestamp
  • greet(name, enthusiastic) - Generate greeting messages

πŸ“ File Operations

  • read_file(path) - Read file contents
  • write_file(path, content) - Write content to file
  • list_directory(path) - List directory contents
  • file_exists(path) - Check if file/directory exists
  • get_file_size(path) - Get file size in bytes

πŸ“– Documentation & Knowledge

  • search_docs(query, directory) - Search documentation files for query
  • summarize_file(path) - Summarize a documentation file
  • generate_readme(directory) - Generate README template

πŸ’» Code Analysis & Integration

  • update_documentation(directory, doc_file) - Update existing docs with current codebase info
  • generate_api_collection(directory, format) - Generate Postman or Swagger/OpenAPI collection
  • generate_integration_doc(directory, output_file) - Generate integration documentation for frontend-backend integration
  • analyze_api_endpoints(directory) - Analyze and list all API endpoints in codebase
  • extract_data_models(directory) - Extract data models and schemas
  • generate_api_client_stub(directory, language) - Generate API client stub (TypeScript/Python/JavaScript)

βœ… Validation

  • validate_email_format(email) - Validate email format

πŸ’» System Information

  • get_system_info() - Get OS, CPU, memory info
  • get_disk_usage(path) - Get disk usage statistics
  • get_cpu_percent() - Get current CPU usage
  • get_memory_info() - Get detailed memory info

🌐 Web Utilities

  • fetch_url(url) - Fetch content from URL
  • check_url_status(url) - Check if URL is accessible
  • extract_domain(url) - Extract domain from URL

πŸ“§ Email (Gmail SMTP)

  • send_email(to, subject, body, html) - Send email via Gmail
  • send_email_with_attachment(to, subject, body, file_path) - Send email with attachment
  • parse_email_address(email_string) - Parse email name and address

πŸ“š Resources

Data sources that LLMs can read:

  • info://server - Server information and capabilities
  • config://settings - Configuration settings
  • data://user/{user_id} - User data (dynamic template)

πŸ’¬ Prompts

Reusable templates for LLM interactions:

  • summarize_text(text) - Generate summarization prompts
  • code_review(code, language) - Generate code review prompts

Note

This server focuses on tools that provide real capabilities LLMs cannot do themselves:

  • File system access
  • Documentation search and indexing
  • System information
  • Network requests
  • Email sending

Redundant tools (string manipulation, JSON parsing, base64 encoding) have been removed since LLMs can handle these natively.

Tip

See tools.json for a complete catalog of all tools with detailed parameter descriptions.

Requirements

  • Python 3.10 or higher (FastMCP requires Python 3.10+)

You can check your Python version with:

python3 --version

Installation

  1. Install dependencies:
pip install -r requirements.txt

Or using uv (recommended):

uv pip install -r requirements.txt

Email Setup (Optional)

To enable email functionality via Gmail SMTP:

  1. Copy the environment template:

    cp .env.example .env
  2. Generate a Gmail App Password:

  3. Configure your .env file:

    GMAIL_USER=your-email@gmail.com
    GMAIL_APP_PASSWORD=your-16-char-app-password
    SMTP_SERVER=smtp.gmail.com
    SMTP_PORT=587
  4. See detailed instructions: EMAIL_SETUP.md

Important

The .env file is gitignored and will never be committed. Keep your credentials secure!

Running the Server

Run the server using the entry point:

# Option 1: Direct Python execution
./venv/bin/python run_server.py

# Option 2: Make it executable and run directly
chmod +x run_server.py
./run_server.py

Important

Always use the virtual environment Python to ensure dependencies are available.

Testing the Server

You can test the server using an MCP client like Claude Desktop or by using FastMCP's built-in testing tools.

Using FastMCP Dev Mode

FastMCP provides a development mode for testing:

fastmcp dev server.py

Using with Cursor IDE

To use this MCP server with Cursor IDE:

  1. Add to Cursor Settings:
    • Open Cursor Settings (Cmd+,)
    • Search for "MCP" or go to Features β†’ Model Context Protocol
    • Click "Edit Config" and add:
{
  "mcpServers": {
    "simple-server": {
      "command": "/Users/tanmay/Developer/mymcp/venv/bin/python",
      "args": ["/Users/tanmay/Developer/mymcp/server.py"]
    }
  }
}
  1. Restart Cursor completely (Cmd+Q, then reopen)

  2. Verify - The server tools and resources will be available to Cursor's AI

Project Structure

mymcp/
β”œβ”€β”€ src/
β”‚   └── mymcp/              # Main package
β”‚       β”œβ”€β”€ __init__.py     # Package exports
β”‚       β”œβ”€β”€ server.py       # Server initialization
β”‚       β”œβ”€β”€ config.py       # Environment & settings
β”‚       β”œβ”€β”€ tools/          # Tool modules
β”‚       β”‚   β”œβ”€β”€ __init__.py
β”‚       β”‚   β”œβ”€β”€ basic.py    # Basic utilities
β”‚       β”‚   β”œβ”€β”€ files.py    # File operations
β”‚       β”‚   β”œβ”€β”€ docs.py     # Documentation tools
β”‚       β”‚   β”œβ”€β”€ code.py     # Code analysis & integration
β”‚       β”‚   β”œβ”€β”€ validation.py # Email validation
β”‚       β”‚   β”œβ”€β”€ system.py   # System info
β”‚       β”‚   β”œβ”€β”€ web.py      # Web utilities
β”‚       β”‚   └── email.py    # Email tools
β”‚       β”œβ”€β”€ resources/      # Resource modules
β”‚       β”‚   β”œβ”€β”€ __init__.py
β”‚       β”‚   └── info.py     # Server info
β”‚       └── prompts/        # Prompt modules
β”‚           β”œβ”€β”€ __init__.py
β”‚           └── templates.py
β”œβ”€β”€ run_server.py           # Entry point
β”œβ”€β”€ mcp.json                # MCP client configuration
β”œβ”€β”€ tools.json              # Tool catalog with descriptions
β”œβ”€β”€ requirements.txt        # Dependencies
β”œβ”€β”€ .env.example           # Env template
β”œβ”€β”€ .env                   # Your credentials (gitignored)
β”œβ”€β”€ EMAIL_SETUP.md         # Gmail setup guide
β”œβ”€β”€ MCP_SETUP.md           # MCP configuration guide
└── README.md              # This file

Learn More

Next Steps

To extend this server further, you can:

  1. Add more specialized tools for your use case
  2. Connect to databases or external APIs
  3. Create custom prompts for specific workflows
  4. Add authentication for other services (GitHub, Azure, etc.)
  5. Deploy to production using FastMCP Cloud
  6. Integrate with other email providers (SendGrid, Mailgun, etc.)

Tool Categories Summary

Category Tools Description
πŸ”§ Basic Utilities 2 Time and greetings
πŸ“ File Operations 5 Read, write, list files
πŸ“– Documentation 3 Search, summarize, generate docs
πŸ’» Code Analysis 6 Integration docs, API analysis, Postman/Swagger generation
βœ… Validation 1 Email format validation
πŸ’» System Info 4 CPU, memory, disk usage
🌐 Web Utilities 3 HTTP requests, URL parsing
πŸ“§ Email 3 Gmail SMTP integration
Total 27 Focused on real capabilities

Philosophy: This server provides only tools that give LLMs real-world capabilities they cannot achieve through text generation alone. Redundant tools for string manipulation, JSON parsing, and encoding have been removed.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages