Skip to content

Commit

Permalink
udpated mcp and docs
Browse files Browse the repository at this point in the history
  • Loading branch information
vinayak-sachdeva committed Jan 20, 2025
1 parent 582be2c commit 6a2681d
Show file tree
Hide file tree
Showing 6 changed files with 589 additions and 155 deletions.
27 changes: 27 additions & 0 deletions mcp/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Use UV's Python image as builder
FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim AS builder

WORKDIR /app

# Enable bytecode compilation and copy mode
ENV UV_COMPILE_BYTECODE=1
ENV UV_LINK_MODE=copy

# Install dependencies
COPY pyproject.toml ./
RUN --mount=type=cache,target=/root/.cache/uv \
uv pip install --system -r pyproject.toml

# Copy and install source code
COPY . /app/

# Final stage
FROM python:3.12-slim-bookworm

WORKDIR /app

# Copy installed packages and source code
COPY --from=builder /usr/local/lib/python3.12/site-packages/ /usr/local/lib/python3.12/site-packages/
COPY --from=builder /app/server.py /app/server.py

CMD ["python", "server.py"]
52 changes: 45 additions & 7 deletions mcp/README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,53 @@
# Setup MCP
`./setup.sh`
# MCP Server

# MCP
## MCP Server
MCP Server is created on top of all the APIs from the Social Toolkit. All APIs are exposed as tools in the MCP protocol and available for any AI application to integrate with.

**Note:** Currently MCP only supports local connections, so it doesn't support remote use of these tools.

# Try it!
Run the MCP to try out the Social Toolkit using natural language.
## Setup

`./run.sh`
### Docker Setup
Build the Docker image:
```bash
docker build -t social-toolkit/mcp .
```

Run the MCP server using Docker:
```bash
docker run -i --rm social-toolkit/mcp
```

### Usage with Claude Desktop

Add the following to your `claude_desktop_config.json`:

```json
{
"mcpServers": {
"social-toolkit": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"social-toolkit/mcp"
]
}
}
}
```

## MCP Client Sample
Run the MCP client locally to try out the Social Toolkit using natural language:

### Setup
```bash
./setup.sh
```

### Run
```bash
./run.sh
```

It will run both MCP server and client, connected to each other. The terminal will prompt for natural language queries from the user, which then will be translated into MCP tool calls to answer the user query.
6 changes: 6 additions & 0 deletions mcp/inspector.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
npx @modelcontextprotocol/inspector \
docker \
run \
-i \
--rm \
social-toolkit/mcp
Loading

0 comments on commit 6a2681d

Please sign in to comment.