File size: 3,679 Bytes
565a26a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
# πŸš€ A1D MCP Server - Deployment Guide

## πŸ“‹ Quick Deployment to Hugging Face Space

### Method 1: Using the Push Script (Recommended)

1. **Run the push script:**
   ```bash
   ./push_to_space.sh
   ```

2. **When prompted for credentials:**
   - **Username:** `aigchacker` (your Hugging Face username)
   - **Password:** Your Hugging Face token (not your account password)

3. **Get your Hugging Face token:**
   - Go to: https://huggingface.co/settings/tokens
   - Click "New token"
   - Name: `a1d-mcp-server`
   - Type: `Write`
   - Click "Generate a token"
   - Copy the token

### Method 2: Manual Git Push

```bash
# Ensure you're in the project directory
cd /path/to/a1d-mcp-server-hf

# Check git status
git status

# Push to Space
git push -u origin main
```

## πŸ”§ Post-Deployment Configuration

### 1. Set Environment Variables in Space

1. **Go to your Space:** https://huggingface.co/spaces/aigchacker/a1d-mcp-server
2. **Click "Settings" tab**
3. **Scroll to "Variables and secrets"**
4. **Add environment variable:**
   - **Name:** `A1D_API_KEY`
   - **Value:** Your A1D API key (get from https://a1d.ai/home/api)
   - **Type:** Secret (recommended)
5. **Click "Add variable"**
6. **Space will automatically restart**

### 2. Verify Deployment

1. **Check Space status:** Should show "Running" 
2. **Test web interface:** Click "App" tab to test tools
3. **Test MCP endpoint:** `https://aigchacker-a1d-mcp-server.hf.space/gradio_api/mcp/sse`

## πŸ”— MCP Client Configuration

### For Claude Desktop (Header-based API Key)

Add to your Claude Desktop config:

```json
{
  "mcpServers": {
    "a1d-hosted": {
      "command": "npx",
      "args": [
        "mcp-remote@latest",
        "https://aigchacker-a1d-mcp-server.hf.space/gradio_api/mcp/sse",
        "--header",
        "API_KEY:${MCP_API_KEY}"
      ],
      "env": {
        "MCP_API_KEY": "your_a1d_api_key_here"
      }
    }
  }
}
```

### For Claude Desktop (Environment Variable)

```json
{
  "mcpServers": {
    "a1d-hosted": {
      "command": "npx",
      "args": [
        "mcp-remote",
        "https://aigchacker-a1d-mcp-server.hf.space/gradio_api/mcp/sse"
      ]
    }
  }
}
```

## πŸ” Troubleshooting

### Push Issues

**Problem:** `fatal: unable to access 'https://huggingface.co/spaces/...'`
**Solution:** 
- Check your Hugging Face token
- Ensure you have write permissions to the Space
- Try clearing git credentials: `git config --global --unset credential.helper`

**Problem:** `Authentication failed`
**Solution:**
- Use your Hugging Face username and token (not password)
- Generate a new token with write permissions

### Space Issues

**Problem:** Space shows "Build Error"
**Solution:**
- Check the logs in the Space
- Ensure all files are properly committed
- Verify requirements.txt is correct

**Problem:** "API key not found" error
**Solution:**
- Set A1D_API_KEY environment variable in Space settings
- Restart the Space after adding the variable

### MCP Client Issues

**Problem:** MCP client can't connect
**Solution:**
- Verify the Space is running
- Check the MCP endpoint URL
- Ensure mcp-remote is installed: `npm install -g mcp-remote`

## πŸ“± Space URLs

- **Space Home:** https://huggingface.co/spaces/aigchacker/a1d-mcp-server
- **Web Interface:** https://aigchacker-a1d-mcp-server.hf.space
- **MCP Endpoint:** https://aigchacker-a1d-mcp-server.hf.space/gradio_api/mcp/sse

## 🎯 Next Steps

1. βœ… Deploy to Space
2. βœ… Set environment variables
3. βœ… Test web interface
4. βœ… Configure MCP client
5. βœ… Test with Claude Desktop
6. πŸŽ‰ Start using AI tools!

---

**Need help?** Check the main README.md or create an issue in the repository.