DEPLOYMENT.md•4.56 kB
# Deployment Guide for MCP Energy Server
This guide will help you deploy the MCP Energy server to GitHub and make it available for others to use.
## Prerequisites
- Git installed on your machine
- GitHub account
- Python 3.10 or higher
## Step 1: Create a GitHub Repository
1. Go to [GitHub](https://github.com) and sign in
2. Click the "+" icon in the top right and select "New repository"
3. Name your repository: `mcp-energy`
4. Choose "Public" (or "Private" if you prefer)
5. **Do NOT** initialize with README, .gitignore, or license (we already have these)
6. Click "Create repository"
## Step 2: Initialize Local Git Repository
Open your terminal in the `mcp-energy` directory and run:
```bash
cd /path/to/mcp-energy
git init
git add .
git commit -m "Initial commit: MCP Energy Server"
```
## Step 3: Link to GitHub Repository
Replace `YOUR_USERNAME` with your actual GitHub username:
```bash
git remote add origin https://github.com/YOUR_USERNAME/mcp-energy.git
git branch -M main
git push -u origin main
```
## Step 4: Verify Deployment
1. Go to your GitHub repository: `https://github.com/YOUR_USERNAME/mcp-energy`
2. Verify all files are present
3. Check that the README.md displays correctly
## Step 5: Update README with Your Information
Edit the README.md file to update:
- Replace `YOUR_USERNAME` in the installation instructions
- Add your email in the pyproject.toml file
- Update any other personalized information
Then commit and push:
```bash
git add README.md pyproject.toml
git commit -m "Update personal information"
git push
```
## Installation for Users
Once deployed, users can install your MCP server using:
```bash
# Clone from GitHub
git clone https://github.com/YOUR_USERNAME/mcp-energy.git
cd mcp-energy
# Install dependencies
pip install -e .
```
## Using the MCP Server
### With Claude Desktop
Users need to add this configuration to their Claude Desktop config file:
**MacOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
**Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
```json
{
"mcpServers": {
"energy": {
"command": "python",
"args": ["-m", "server"],
"cwd": "/full/path/to/mcp-energy"
}
}
}
```
### Standalone Usage
```bash
python server.py
```
## Publishing to PyPI (Optional)
If you want to publish your package to PyPI for easier installation:
### 1. Create PyPI Account
- Go to [PyPI](https://pypi.org) and create an account
- Go to [TestPyPI](https://test.pypi.org) for testing
### 2. Build the Package
```bash
pip install build twine
python -m build
```
### 3. Upload to TestPyPI (Test First)
```bash
twine upload --repository testpypi dist/*
```
### 4. Upload to PyPI (Production)
```bash
twine upload dist/*
```
Then users can install with:
```bash
pip install mcp-energy
```
## Continuous Integration
The repository includes GitHub Actions for:
- Running tests on multiple Python versions
- Code linting and formatting checks
- Building the package
These run automatically on push and pull requests.
## Updating the Server
When you make changes:
```bash
git add .
git commit -m "Description of your changes"
git push
```
## Versioning
To release a new version:
1. Update version in `pyproject.toml` and `__init__.py`
2. Commit the changes
3. Create a git tag:
```bash
git tag -a v0.2.0 -m "Version 0.2.0"
git push origin v0.2.0
```
## Security Considerations
⚠️ **Important**: The API key is currently hardcoded in `server.py`. For production use, you should:
1. Move the API key to an environment variable
2. Update `server.py`:
```python
EIA_API_KEY = os.getenv("EIA_API_KEY", "your_default_key")
```
3. Add `.env` to `.gitignore`
4. Document this in README.md
## Troubleshooting
### Permission Denied on Push
```bash
# Use SSH instead of HTTPS
git remote set-url origin git@github.com:YOUR_USERNAME/mcp-energy.git
```
### Module Not Found Errors
```bash
# Reinstall in development mode
pip install -e .
```
### MCP Server Not Connecting
- Check that all dependencies are installed
- Verify the path in claude_desktop_config.json is correct
- Check server.py runs without errors: `python server.py`
## Support
For issues:
- Create an issue on GitHub
- Check the MCP documentation: https://modelcontextprotocol.io
- Check the EIA API docs: https://www.eia.gov/opendata/
## Next Steps
Consider adding:
- More comprehensive tests
- Example notebooks
- Additional data endpoints
- Caching for frequently accessed data
- Rate limiting handling
- Better error messages