Python Server MCP
Python Server MCP – Kryptowährungspreisdienst
Dieses Projekt implementiert einen MCP-Server (Model Context Protocol), der Preisinformationen zu Kryptowährungen bereitstellt. Der Server basiert auf Python und dem MCP-Framework, um eine API zu erstellen, die von verschiedenen Clients genutzt werden kann.
Docker
Docker-Build: docker build -t mcp/python-server-mcp -f Dockerfile .
Fügen Sie Ihrer mcp.json Datei Folgendes hinzu:
{
"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",
}
}
}
}Related MCP server: Coin MCP Server
Merkmale
Echtzeit-Abruf von Kryptowährungspreisen
Umgebungsbasierte Konfiguration (Entwicklung, Produktion, Staging, lokal)
CoinMarketCap API-Integration
Bereitstellung von Docker-Containern
Anforderungen
Python 3.12+
uv (Paket- und virtueller Umgebungsmanager)
Docker (optional, zur Containerausführung)
Installation
Verwendung von UV (empfohlen)
# Clone the repository
git clone <repository-url>
cd PythonServerMcpErstellen und aktivieren Sie virtuelle Umgebungen mit UV
uv venv
source .venv/bin/activateInstallieren von Abhängigkeiten
uv sync
Konfiguration
Erstellen Sie im Projektstammverzeichnis eine
.envDatei mit den folgenden Variablen:
ENVIRONMENT=DEV # Options: LOCAL, DEV, STAGING, PROD
COINMARKETCAP_API_KEY=your_api_key_hereSie können auch spezifische Umgebungsdateien für jede Umgebung erstellen:
.dev.env– Für die Entwicklungsumgebung.staging.env– Für die Staging-Umgebung.prod.env– Für die Produktionsumgebung
Verwendung
Lokale Ausführung
python main.pyDadurch wird der MCP-Server gestartet, der über die Standardeingabe/-ausgabe (stdio) auf Anforderungen wartet.
Verwenden von Docker
# Build the image
docker build -t test-mcp -f Dockerfile --platform linux/amd64 .
# Run the container
docker run -it test-mcpProjektstruktur
.
├── 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.pyEntwicklung
Hinzufügen neuer Tools zum MCP-Server
Um dem MCP-Server ein neues Tool hinzuzufügen, gehen Sie folgendermaßen vor:
Definieren Sie die Funktion in der Datei
src/__init__.pyRegistrieren Sie das Tool in der Funktion
main()Dokumentieren Sie das Tool mit Docstrings
Beispiel:
@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 resultThis server cannot be deployed
Maintenance
Related MCP Connectors
MCP server with quote and live cryptocurrency price tools, local and cloud-deployed transports.
Crypto MCP — cryptocurrency prices and currency conversion.
Unlock the power of real-time cryptocurrency data with our Crypto Price Insights MCP server.
Official CoinMarketCap MCP server: real-time crypto prices, market cap, rankings and exchange data.
Related MCP Servers
- AlicenseBqualityBmaintenanceA Model Context Protocol (MCP) server that provides comprehensive cryptocurrency analysis using the CoinCap API. This server offers real-time price data, market analysis, and historical trends through an easy-to-use interface.3349 npm39MIT
- FlicenseNot gradedqualityFmaintenanceA Model Context Protocol server that provides access to CoinMarketCap's cryptocurrency data, enabling AI applications to retrieve cryptocurrency listings, quotes, and detailed information.36-
- FlicenseNot gradedqualityDmaintenanceA cryptocurrency price query service based on Model Context Protocol that provides tools for retrieving virtual currency prices, market trends, detailed information, and K-line data.3-
- AlicenseNot gradedqualityDmaintenanceA server that provides real-time cryptocurrency data through the Model Context Protocol, allowing access to detailed exchange information and current cryptocurrency rates from the CoinCap API.9 npm1MIT