Development · MODEL CONTEXT PROTOCOL
stevearagonsite PythonServerMcp
A template repository for MCP
连接能力
stevearagonsite PythonServerMcp 为 AI Agent 提供什么
- Real-time cryptocurrency price retrieval
- Environment-based configuration (development, production, staging, local)
- CoinMarketCap API integration
- Docker container deployment
- Python 3.12+
- uv (package and virtual environment manager)
- Docker (optional, for container execution)
- Create a `.env` file in the project root with the following variables:
- 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
- Define the function in the `src/__init__.py` file
- Register the tool in the `main()` function
- Document the tool with docstrings
安全
MCP 收录不等于安全审核
MCP 服务器可能获得模型上下文、凭据、本地文件或调用外部系统的权限。连接 Agent 前,请检查代码、环境变量、网络行为、软件包来源与维护状态。
README
仓库文档
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 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",
}
}
}
}
- Real-time cryptocurrency price retrieval
- Environment-based configuration (development, production, staging, local)
- CoinMarketCap API integration
- Docker container deployment
- Python 3.12+
- uv (package and virtual environment manager)
- Docker (optional, for container execution)
# Clone the repository
git clone <repository-url>
cd PythonServerMcpuv venv
source .venv/bin/activateuv sync
- Create a
.envfile in the project root with the following variables:
ENVIRONMENT=DEV # Options: LOCAL, DEV, STAGING, PROD
COINMARKETCAP_API_KEY=your_api_key_here
- 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
python main.pyThis will start the MCP server that will listen for requests through standard input/output (stdio).
# Build the image
docker build -t test-mcp -f Dockerfile --platform linux/amd64 .
# Run the container
docker run -it test-mcp.
├── 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
To add a new tool to the MCP server, follow these steps:
- Define the function in the
src/__init__.pyfile - Register the tool in the
main()function - 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社区
收藏、评分与讨论
正在载入社区数据…