loading…
Search for a command to run...
loading…
Provides a secure workspace for AI-driven file management and Python script execution designed to run on Vercel. It enables tools for full file operations and c
Provides a secure workspace for AI-driven file management and Python script execution designed to run on Vercel. It enables tools for full file operations and code execution within a sandboxed environment.
A Model Context Protocol (MCP) server that provides AI with a secure workspace for file management and Python script execution. Designed to run on Vercel as a serverless function.
npm install -g vercel
Your project should look like this:
ai-workspace-mcp/
├── api/
│ └── mcp.py # Serverless function
├── vercel.json # Vercel configuration
├── requirements.txt # Python dependencies
└── README.md # This file
# Login to Vercel
vercel login
# Deploy
vercel
# Deploy to production
vercel --prod
After deployment, Vercel will give you a URL like:
https://your-project-name.vercel.app
Once deployed, your server will have these endpoints:
Returns server information and status
curl https://your-project.vercel.app/
Health check endpoint
curl https://your-project.vercel.app/health
List all available tools
curl https://your-project.vercel.app/tools
Execute a tool
curl -X POST https://your-project.vercel.app/execute \
-H "Content-Type: application/json" \
-d '{
"tool": "create_file",
"arguments": {
"filepath": "hello.py",
"content": "print(\"Hello World!\")"
}
}'
Add this to your Claude Desktop config:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%/Claude/claude_desktop_config.json
{
"mcpServers": {
"ai-workspace": {
"command": "curl",
"args": [
"-X", "POST",
"https://your-project.vercel.app/execute",
"-H", "Content-Type: application/json",
"-d", "@-"
]
}
}
}
You can integrate this with any AI that supports HTTP tool calling:
import requests
# Create a file
response = requests.post(
"https://your-project.vercel.app/execute",
json={
"tool": "create_file",
"arguments": {
"filepath": "script.py",
"content": "print('Hello from AI!')"
}
}
)
print(response.json())
# Execute the file
response = requests.post(
"https://your-project.vercel.app/execute",
json={
"tool": "execute_python",
"arguments": {
"filepath": "script.py"
}
}
)
print(response.json())
/tmp/workspace# Create a file
curl -X POST https://your-project.vercel.app/execute \
-H "Content-Type: application/json" \
-d '{
"tool": "create_file",
"arguments": {
"filepath": "hello.py",
"content": "print(\"Hello from Vercel!\")"
}
}'
# Execute it
curl -X POST https://your-project.vercel.app/execute \
-H "Content-Type: application/json" \
-d '{
"tool": "execute_python",
"arguments": {
"filepath": "hello.py"
}
}'
curl -X POST https://your-project.vercel.app/execute \
-H "Content-Type: application/json" \
-d '{
"tool": "list_files",
"arguments": {}
}'
curl -X POST https://your-project.vercel.app/execute \
-H "Content-Type: application/json" \
-d '{
"tool": "create_directory",
"arguments": {
"dirpath": "scripts"
}
}'
All tool executions return JSON:
Success Response:
{
"success": true,
"message": "Successfully created file: hello.py\nSize: 26 bytes"
}
Error Response:
{
"success": false,
"error": "File not found: nonexistent.py"
}
Execute Python Response:
{
"success": true,
"exit_code": 0,
"stdout": "Hello from Vercel!\n",
"stderr": ""
}
/tmp are ephemeral and cleared between invocationsIf you need persistent file storage, consider:
You can set environment variables in Vercel Dashboard:
WORKSPACE_PATH - Custom workspace path (default: /tmp/workspace)EXECUTION_TIMEOUT - Python execution timeout in seconds (default: 30)Test locally before deploying:
# Install dependencies
pip install -r requirements.txt
# Run with Python's built-in server
cd api
python -m http.server 8000
# Or use Vercel CLI
vercel dev
Then test with:
curl http://localhost:8000/health
Ensure requirements.txt is in the project root and contains all dependencies.
Remember: /tmp storage is ephemeral on Vercel. Files won't persist between invocations.
class VercelMCPClient:
def __init__(self, base_url):
self.base_url = base_url
def call_tool(self, tool_name, arguments):
response = requests.post(
f"{self.base_url}/execute",
json={"tool": tool_name, "arguments": arguments}
)
return response.json()
def list_tools(self):
response = requests.get(f"{self.base_url}/tools")
return response.json()
# Usage
client = VercelMCPClient("https://your-project.vercel.app")
result = client.call_tool("create_file", {
"filepath": "test.py",
"content": "print('test')"
})
Feel free to extend this server with additional tools:
get_tools()execute_tool()MIT License - modify and use as needed.
Добавь это в claude_desktop_config.json и перезапусти Claude Desktop.
{
"mcpServers": {
"ai-workspace-mcp-server": {
"command": "npx",
"args": []
}
}
}