NitinBot002 commited on
Commit
7e7f9f2
Β·
verified Β·
1 Parent(s): 46c51e5

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +268 -1
README.md CHANGED
@@ -4,7 +4,274 @@ emoji: 😻
4
  colorFrom: green
5
  colorTo: yellow
6
  sdk: docker
 
7
  pinned: false
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  colorFrom: green
5
  colorTo: yellow
6
  sdk: docker
7
+ app_port: 5555
8
  pinned: false
9
  ---
10
 
11
+ ```markdown
12
+ ---
13
+ title: Coral Protocol MCP Server
14
+ emoji: πŸͺΈ
15
+ colorFrom: blue
16
+ colorTo: purple
17
+ sdk: docker
18
+ app_port: 7860
19
+ pinned: false
20
+ license: apache-2.0
21
+ tags:
22
+ - mcp
23
+ - multi-agent
24
+ - coral-protocol
25
+ - ai-agents
26
+ ---
27
+
28
+ # πŸͺΈ Coral Protocol MCP Server
29
+
30
+ This Space hosts a **Coral Protocol MCP (Model Context Protocol) Server** that enables multi-agent communication and coordination.
31
+
32
+ ## πŸš€ Features
33
+
34
+ - **MCP-compliant server** with SSE (Server-Sent Events) transport
35
+ - **Multi-agent communication** through thread-based messaging
36
+ - **RESTful API** for agent management
37
+ - **Real-time event streaming** for agent interactions
38
+ - **Production-ready** nginx reverse proxy setup
39
+
40
+ ## πŸ“‘ Endpoints
41
+
42
+ ### Status Check
43
+ - **GET** `/` - Server status page
44
+ - **GET** `/health` - Health check endpoint
45
+
46
+ ### MCP SSE Endpoint
47
+ - **GET** `/devmode/exampleApplication/privkey/session1/sse` - Main SSE endpoint for MCP communication
48
+
49
+ ### API Endpoints
50
+ - **POST** `/api/agents` - Register new agent
51
+ - **GET** `/api/agents` - List all agents
52
+ - **POST** `/api/threads` - Create new thread
53
+ - **POST** `/api/messages` - Send message
54
+
55
+ ## πŸ”§ Technical Details
56
+
57
+ - **Framework**: Coral Server (Kotlin/Gradle)
58
+ - **Transport**: Server-Sent Events (SSE)
59
+ - **Proxy**: Nginx reverse proxy
60
+ - **Port**: 7860 (proxied from internal port 5555)
61
+
62
+ ## πŸ“š Documentation
63
+
64
+ For detailed documentation, visit:
65
+ - [Coral Protocol Documentation](https://docs.coralprotocol.org)
66
+ - [Quickstart Guide](https://docs.coralprotocol.org/setup/quickstart)
67
+ - [Server Applications](https://docs.coralprotocol.org/setup/coral-server-applications)
68
+
69
+ ## 🀝 Integration
70
+
71
+ ### Using with MCP Clients
72
+
73
+ ```python
74
+ import requests
75
+ import sseclient
76
+
77
+ # Connect to SSE endpoint
78
+ url = "https://[your-space-name].hf.space/devmode/exampleApplication/privkey/session1/sse"
79
+ response = requests.get(url, stream=True)
80
+ client = sseclient.SSEClient(response)
81
+
82
+ # Listen for events
83
+ for event in client.events():
84
+ print(f"Event: {event.event}")
85
+ print(f"Data: {event.data}")
86
+ ```
87
+
88
+ ### Using with Coral SDK
89
+
90
+ ```javascript
91
+ const CoralClient = require('@coral-protocol/sdk');
92
+
93
+ const client = new CoralClient({
94
+ serverUrl: 'https://[your-space-name].hf.space',
95
+ transport: 'sse'
96
+ });
97
+
98
+ await client.connect();
99
+ ```
100
+
101
+ ## 🌟 About Coral Protocol
102
+
103
+ Coral Protocol is an open and decentralized infrastructure designed to enable:
104
+ - **Communication** between AI agents
105
+ - **Coordination** of multi-agent tasks
106
+ - **Trust** mechanisms for agent interactions
107
+ - **Payments** for agent services
108
+
109
+ ## πŸ“ License
110
+
111
+ This project is licensed under the Apache License 2.0.
112
+
113
+ ## πŸ”— Links
114
+
115
+ - [GitHub Repository](https://github.com/Coral-Protocol/coral-server)
116
+ - [Coral Protocol Website](https://coralprotocol.org)
117
+ - [Discord Community](https://discord.gg/coral-protocol)
118
+
119
+ ## πŸ’‘ Status
120
+
121
+ Current Status: **🟒 Active**
122
+
123
+ Last Updated: 2024
124
+ ```
125
+
126
+ ## 3. **.gitignore** (Optional but recommended)
127
+
128
+ ```gitignore
129
+ # Gradle
130
+ .gradle/
131
+ build/
132
+ !gradle/wrapper/gradle-wrapper.jar
133
+ !**/src/main/**/build/
134
+ !**/src/test/**/build/
135
+
136
+ # IDE
137
+ .idea/
138
+ *.iml
139
+ *.ipr
140
+ *.iws
141
+ .vscode/
142
+ *.swp
143
+ *.swo
144
+
145
+ # OS
146
+ .DS_Store
147
+ Thumbs.db
148
+
149
+ # Logs
150
+ logs/
151
+ *.log
152
+
153
+ # Temporary files
154
+ tmp/
155
+ temp/
156
+ *.tmp
157
+
158
+ # Environment variables
159
+ .env
160
+ .env.local
161
+
162
+ # Node (if using any JS tools)
163
+ node_modules/
164
+ npm-debug.log*
165
+ yarn-debug.log*
166
+ yarn-error.log*
167
+
168
+ # Python (if using any Python tools)
169
+ __pycache__/
170
+ *.py[cod]
171
+ *$py.class
172
+ .Python
173
+ venv/
174
+ ENV/
175
+
176
+ # Hugging Face
177
+ .huggingface/
178
+ ```
179
+
180
+ ## 4. **docker-compose.yml** (Optional - for local testing)
181
+
182
+ ```yaml
183
+ version: '3.8'
184
+
185
+ services:
186
+ coral-server:
187
+ build: .
188
+ ports:
189
+ - "7860:7860"
190
+ environment:
191
+ - CONFIG_PATH=/app/coral-config/
192
+ - GRADLE_USER_HOME=/home/user/.gradle
193
+ volumes:
194
+ - ./coral-config:/app/coral-config
195
+ - gradle-cache:/home/user/.gradle
196
+ healthcheck:
197
+ test: ["CMD", "curl", "-f", "http://localhost:7860/health"]
198
+ interval: 30s
199
+ timeout: 10s
200
+ retries: 3
201
+ start_period: 60s
202
+
203
+ volumes:
204
+ gradle-cache:
205
+ ```
206
+
207
+ ## 5. **test.sh** (Optional - Test script)
208
+
209
+ ```bash
210
+ #!/bin/bash
211
+
212
+ # Test script for Coral Server endpoints
213
+ SERVER_URL="${1:-http://localhost:7860}"
214
+
215
+ echo "πŸͺΈ Testing Coral Server at: $SERVER_URL"
216
+ echo "================================"
217
+
218
+ # Test 1: Health check
219
+ echo -n "Testing health endpoint... "
220
+ if curl -s -f "$SERVER_URL/health" > /dev/null; then
221
+ echo "βœ… OK"
222
+ else
223
+ echo "❌ FAILED"
224
+ fi
225
+
226
+ # Test 2: Root endpoint
227
+ echo -n "Testing root endpoint... "
228
+ if curl -s "$SERVER_URL/" | grep -q "Coral Server"; then
229
+ echo "βœ… OK"
230
+ else
231
+ echo "❌ FAILED"
232
+ fi
233
+
234
+ # Test 3: SSE endpoint (just check if it connects)
235
+ echo -n "Testing SSE endpoint... "
236
+ if curl -s -N --max-time 2 "$SERVER_URL/devmode/exampleApplication/privkey/session1/sse" 2>/dev/null; then
237
+ echo "βœ… OK (Connected)"
238
+ else
239
+ echo "⚠️ Timeout (Expected for SSE)"
240
+ fi
241
+
242
+ echo "================================"
243
+ echo "Test complete!"
244
+ ```
245
+
246
+ ## Deployment Instructions:
247
+
248
+ 1. **Create a new Space on Hugging Face**:
249
+ - Go to https://huggingface.co/spaces
250
+ - Click "Create new Space"
251
+ - Choose "Docker" as the SDK
252
+ - Set visibility (public/private)
253
+
254
+ 2. **Upload the files**:
255
+ - Upload the `Dockerfile` to the root of your Space
256
+ - Upload the `README.md` to the root of your Space
257
+ - Optionally upload `.gitignore` and other files
258
+
259
+ 3. **Wait for build**:
260
+ - Hugging Face will automatically build and deploy your Space
261
+ - Check the logs for any errors
262
+ - The build process might take 5-10 minutes
263
+
264
+ 4. **Access your server**:
265
+ - Once deployed, access at: `https://[your-username]-[space-name].hf.space/`
266
+ - Test the SSE endpoint: `https://[your-username]-[space-name].hf.space/devmode/exampleApplication/privkey/session1/sse`
267
+
268
+ 5. **Monitor logs**:
269
+ - Use the "Logs" tab in your Space to monitor both build and runtime logs
270
+ - Check for any startup errors or connection issues
271
+
272
+ This complete setup should work properly on Hugging Face Spaces. The key improvements include:
273
+ - Proper supervisor configuration for managing multiple processes
274
+ - Correct nginx configuration for SSE/MCP protocol
275
+ - Better error handling and logging
276
+ - Health checks and status endpoints
277
+ - Proper permissions for non-root user execution