stevearagonsite PythonServerMcp

stevearagonsite PythonServerMcp avatar

by stevearagonsite

A template repository for MCP

What is stevearagonsite PythonServerMcp

MseeP.ai Security Assessment Badge

Python Server MCP - Cryptocurrency Price Service

This project implements an MCP (Model Context Protocol) server that provides cryptocurrency price information. The server is built using Python and the MCP framework to create an API that can be consumed by different clients.

Docker

Docker build: docker build -t mcp/python-server-mcp -f Dockerfile .

Add the following to your mcp.json file:

{
  "mcpServers": {
    "python-server-mcp": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-p",
        "8000:8000",
        "-e",
        "ENVIRONMENT",
        "-e",
        "COINMARKETCAP_API_KEY",
        "mcp/python-server-mcp"
      ],
      "env": {
        "ENVIRONMENT": "PRODUCTION",
        "COINMARKETCAP_API_KEY": "your-api-key",
      }
    }
  }
}

Features

  • Real-time cryptocurrency price retrieval
  • Environment-based configuration (development, production, staging, local)
  • CoinMarketCap API integration
  • Docker container deployment

Requirements

  • Python 3.12+
  • uv (package and virtual environment manager)
  • Docker (optional, for container execution)

Installation

Using uv (recommended)

# Clone the repository
git clone <repository-url>
cd PythonServerMcp

Create and activate virtual environment with uv

uv venv
source .venv/bin/activate

Install dependencies

uv sync

Configuration

  1. Create a .env file in the project root with the following variables:
ENVIRONMENT=DEV  # Options: LOCAL, DEV, STAGING, PROD
COINMARKETCAP_API_KEY=your_api_key_here
  1. You can also create specific environment files for each environment:
    • .dev.env - For development environment
    • .staging.env - For staging environment
    • .prod.env - For production environment

Usage

Local Execution

python main.py

This will start the MCP server that will listen for requests through standard input/output (stdio).

Using Docker

# Build the image
docker build -t test-mcp -f Dockerfile --platform linux/amd64 .

# Run the container
docker run -it test-mcp

Project Structure

.
โ”œโ”€โ”€ main.py
โ””โ”€โ”€ src
    โ”œโ”€โ”€ __init__.py
    โ”œโ”€โ”€ core
    โ”‚   โ”œโ”€โ”€ common
    โ”‚   โ”‚   โ”œโ”€โ”€ crypto_schema.py
    โ”‚   โ”‚   โ””โ”€โ”€ schema.py
    โ”‚   โ”œโ”€โ”€ config.py
    โ”‚   โ”œโ”€โ”€ settings
    โ”‚   โ”‚   โ”œโ”€โ”€ __init__.py
    โ”‚   โ”‚   โ”œโ”€โ”€ base.py
    โ”‚   โ”‚   โ”œโ”€โ”€ development.py
    โ”‚   โ”‚   โ”œโ”€โ”€ environment.py
    โ”‚   โ”‚   โ”œโ”€โ”€ local.py
    โ”‚   โ”‚   โ”œโ”€โ”€ production.py
    โ”‚   โ”‚   โ””โ”€โ”€ staging.py
    โ”‚   โ””โ”€โ”€ utils
    โ”‚       โ”œโ”€โ”€ datetime.py
    โ”‚       โ”œโ”€โ”€ extended_enum.py
    โ”‚       โ”œโ”€โ”€ filename_generator.py
    โ”‚       โ”œโ”€โ”€ passwords.py
    โ”‚       โ”œโ”€โ”€ query_utils.py
    โ”‚       โ””โ”€โ”€ redis.py
    โ”œโ”€โ”€ mcp_server.py
    โ”œโ”€โ”€ resources
    โ”‚   โ”œโ”€โ”€ __init__.py
    โ”‚   โ””โ”€โ”€ coinmarketcap_resource.py
    โ”œโ”€โ”€ server.py
    โ”œโ”€โ”€ services
    โ”‚   โ”œโ”€โ”€ __init__.py
    โ”‚   โ””โ”€โ”€ coinmarketcap_service.py
    โ””โ”€โ”€ tools
        โ”œโ”€โ”€ __init__.py
        โ””โ”€โ”€ prices.py

Development

Adding New Tools to the MCP Server

To add a new tool to the MCP server, follow these steps:

  1. Define the function in the src/__init__.py file
  2. Register the tool in the main() function
  3. Document the tool with docstrings

Example:

@server.add_tool
def my_new_tool(parameter1: str, parameter2: int) -> str:
    """
    Description of what the tool does.
    
    Args:
        parameter1: Description of parameter 1
        parameter2: Description of parameter 2
        
    Returns:
        Description of what is returned
    """
    # Tool implementation
    return result

Leave a Comment

Frequently Asked Questions

What is MCP?

MCP (Model Context Protocol) is an open protocol that standardizes how applications provide context to LLMs. Think of MCP like a USB-C port for AI applications, providing a standardized way to connect AI models to different data sources and tools.

What are MCP Servers?

MCP Servers are lightweight programs that expose specific capabilities through the standardized Model Context Protocol. They act as bridges between LLMs like Claude and various data sources or services, allowing secure access to files, databases, APIs, and other resources.

How do MCP Servers work?

MCP Servers follow a client-server architecture where a host application (like Claude Desktop) connects to multiple servers. Each server provides specific functionality through standardized endpoints and protocols, enabling Claude to access data and perform actions through the standardized protocol.

Are MCP Servers secure?

Yes, MCP Servers are designed with security in mind. They run locally with explicit configuration and permissions, require user approval for actions, and include built-in security features to prevent unauthorized access and ensure data privacy.

Related MCP Servers

chrisdoc hevy mcp avatar

chrisdoc hevy mcp

mcp
sylphlab pdf reader mcp avatar

sylphlab pdf reader mcp

An MCP server built with Node.js/TypeScript that allows AI agents to securely read PDF files (local or URL) and extract text, metadata, or page counts. Uses pdf-parse.

pdf-parsetypescriptnodejs
aashari mcp server atlassian bitbucket avatar

aashari mcp server atlassian bitbucket

Node.js/TypeScript MCP server for Atlassian Bitbucket. Enables AI systems (LLMs) to interact with workspaces, repositories, and pull requests via tools (list, get, comment, search). Connects AI directly to version control workflows through the standard MCP interface.

atlassianrepositorymcp
aashari mcp server atlassian confluence avatar

aashari mcp server atlassian confluence

Node.js/TypeScript MCP server for Atlassian Confluence. Provides tools enabling AI systems (LLMs) to list/get spaces & pages (content formatted as Markdown) and search via CQL. Connects AI seamlessly to Confluence knowledge bases using the standard MCP interface.

atlassianmcpconfluence
prisma prisma avatar

prisma prisma

Next-generation ORM for Node.js & TypeScript | PostgreSQL, MySQL, MariaDB, SQL Server, SQLite, MongoDB and CockroachDB

cockroachdbgomcp
Zzzccs123 mcp sentry avatar

Zzzccs123 mcp sentry

mcp sentry for typescript sdk

mcptypescript
zhuzhoulin dify mcp server avatar

zhuzhoulin dify mcp server

mcp
zhongmingyuan mcp my mac avatar

zhongmingyuan mcp my mac

mcp
zhixiaoqiang desktop image manager mcp avatar

zhixiaoqiang desktop image manager mcp

MCP ๆœๅŠกๅ™จ๏ผŒ็”จไบŽ็ฎก็†ๆกŒ้ขๅ›พ็‰‡ใ€ๆŸฅ็œ‹่ฏฆๆƒ…ใ€ๅŽ‹็ผฉใ€็งปๅŠจ็ญ‰๏ผˆๅฎŒๅ…จ่ฎฉTraeๅฎž็Žฐ๏ผ‰

mcp
zhixiaoqiang antd components mcp avatar

zhixiaoqiang antd components mcp

An MCP service for Ant Design components query | ไธ€ไธชๅ‡ๅฐ‘ Ant Design ็ป„ไปถไปฃ็ ็”Ÿๆˆๅนป่ง‰็š„ MCP ๆœๅŠก๏ผŒๅŒ…ๅซ็ณป็ปŸๆ็คบ่ฏใ€็ป„ไปถๆ–‡ๆกฃใ€API ๆ–‡ๆกฃใ€ไปฃ็ ็คบไพ‹ๅ’Œๆ›ดๆ–ฐๆ—ฅๅฟ—ๆŸฅ่ฏข

designantdapi

Submit Your MCP Server

Share your MCP server with the community

Submit Now