eooo-io/mcp-in-docker
3.1
If you are the rightful owner of mcp-in-docker and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
The Model Context Protocol (MCP) server facilitates communication between large language models (LLMs) and tools using a standardized protocol, offering both REST API and WebSocket interfaces.
Model Context Protocol Server
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
- Clone the repository:
git clone <repository-url>
cd eooo-mcp-docker
- Create necessary directories:
mkdir -p tools context data
- 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
- Build and start the container:
docker-compose up --build
- To run in detached mode:
docker-compose up -d
API Endpoints
REST API
GET /api/tools
: List all available toolsPOST /api/execute
: Execute a specific toolGET /api/context/:id
: Retrieve context by ID
WebSocket API
Connect to ws://localhost:3000
and send/receive JSON messages:
Messages
- Execute Tool:
{
"type": "EXECUTE_TOOL",
"payload": {
"tool": "tool_name.py",
"params": {
"param1": "value1"
}
}
}
- Get Context:
{
"type": "GET_CONTEXT",
"payload": "context_id"
}
Tool Integration
- Place your Python tools in the
tools
directory - Tools should accept JSON parameters and return JSON output
- 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
- Context files are stored in the
context
directory as JSON files - Each context file should have a unique ID
- 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
- Tool execution is isolated within the container
- Input validation is performed on all API endpoints
- Context access can be restricted based on implementation needs
License
[Your License Here]