Model Context Protocol Server
About
A Dockerized MCP server setup to deploy onto remote development servers
Explore
- Dual runtime environment (Node.js + Python)
- WebSocket support for real-time updates
- REST API endpoints for tool management
- Context persistence and management
- Tool execution isolation
- Easy deployment with Docker
- Support for Python-based tools
- Docker
- Docker Compose
1. Build and start the container:
docker-compose up --build
2. To run in detached mode:
docker-compose up -d
1. Place your Python tools in the tools directory
2. Tools should accept JSON parameters and return JSON output
3. Example tool structure:
```python
import sys
import json
def main(params):
A containerized Model Context Protocol (MCP) server that enables communication between LLMs and tools through a standardized protocol. The server provides both REST API and WebSocket interfaces for tool execution and context management.
Features
- Dual runtime environment (Node.js + Python)
- WebSocket support for real-time updates
- REST API endpoints for tool management
- Context persistence and management
- Tool execution isolation
- Easy deployment with Docker
- Support for Python-based tools
Prerequisites
- Docker
- Docker Compose
Setup
1. Clone the repository:
git clone <repository-url>
cd eooo-mcp-docker
2. Create necessary directories:
mkdir -p tools context data
3. Configure environment variables by creating a .env file:
NODE_ENV=production
PORT=3000
TOOLS_DIR=/app/tools
CONTEXT_DIR=/app/context
PYTHON_PATH=/usr/local/bin/python
Running the Server
1. Build and start the container:
docker-compose up --build
2. To run in detached mode:
docker-compose up -d
API Endpoints
REST API
- GET /api/tools: List all available tools
- POST /api/execute: Execute a specific tool
- GET /api/context/:id: Retrieve context by ID
WebSocket API
Connect to ws://localhost:3000 and send/receive JSON messages:
Messages
1. Execute Tool:
{
"type": "EXECUTE_TOOL",
"payload": {
"tool": "tool_name.py",
"params": {
"param1": "value1"
}
}
}
2. Get Context:
{
"type": "GET_CONTEXT",
"payload": "context_id"
}
Tool Integration
1. Place your Python tools in the tools directory
2. Tools should accept JSON parameters and return JSON output
3. Example tool structure:
import sys
import json
def main(params):
# Process params
result = {"status": "success", "data": {}}
return json.dumps(result)
if __name__ == "__main__":
params = json.loads(sys.argv[1])
print(main(params))
Context Management
1. Context files are stored in the context directory as JSON files
2. Each context file should have a unique ID
3. Context can be accessed via both REST API and WebSocket
Development
To run in development mode with hot reload:
docker-compose up --build
Stopping the Server
docker-compose down
Security Considerations
1. Tool execution is isolated within the container
2. Input validation is performed on all API endpoints
3. Context access can be restricted based on implementation needs
License
[Your License Here]
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.



