Skip to content

Deployment: Dockerfile and Smithery config #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged
npm run build
27 changes: 27 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Generated by https://smithery.ai. See: https://smithery.ai/docs/config#dockerfile
FROM node:lts-alpine

# Create app directory
WORKDIR /app

# Copy package.json and package-lock.json
COPY package*.json ./

# Install dependencies, ignoring any prepare scripts
RUN npm install --ignore-scripts

# Copy the rest of the application code
COPY . .

# Build the application
RUN npm run build

ENV LEETCODE_SITE=global \
LEETCODE_SESSION=

# Expose any port if needed (MCP uses stdio, so not required for now)

# Set the default command
CMD node build/index.js \
--site ${LEETCODE_SITE:-global} \
--session ${LEETCODE_SESSION}
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
[![NPM Version](https://img.shields.io/npm/v/@jinzcdev/leetcode-mcp-server.svg)](https://www.npmjs.com/package/@jinzcdev/leetcode-mcp-server)
[![GitHub License](https://img.shields.io/github/license/jinzcdev/leetcode-mcp-server.svg)](https://img.shields.io/github/license/jinzcdev/leetcode-mcp-server.svg)
[![Stars](https://img.shields.io/github/stars/jinzcdev/leetcode-mcp-server)](https://github.com/jinzcdev/leetcode-mcp-server)
[![smithery badge](https://smithery.ai/badge/@jinzcdev/leetcode-mcp-server)](https://smithery.ai/server/@jinzcdev/leetcode-mcp-server)

The LeetCode MCP Server is a [Model Context Protocol (MCP)](https://modelcontextprotocol.io/introduction) server that provides seamless integration with LeetCode APIs, enabling advanced automation and intelligent interaction with LeetCode's programming problems, contests, solutions, and user data.

Expand All @@ -21,6 +22,16 @@ The LeetCode MCP Server is a [Model Context Protocol (MCP)](https://modelcontext

## Installation

### Installing via Smithery

To install leetcode-mcp-server for Claude Desktop automatically via [Smithery](https://smithery.ai/server/@jinzcdev/leetcode-mcp-server):

```bash
npx -y @smithery/cli install @jinzcdev/leetcode-mcp-server --client claude
```

### Manual Installation

```bash
# Install from npm
npm install @jinzcdev/leetcode-mcp-server -g
Expand Down
31 changes: 31 additions & 0 deletions smithery.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Smithery configuration file: https://smithery.ai/docs/config#smitheryyaml

startCommand:
type: stdio
configSchema:
# JSON Schema defining the configuration options for the MCP.
type: object
properties:
site:
type: string
default: global
description: "LeetCode site to target: 'global' for leetcode.com, or 'cn' for leetcode.cn"
session:
type: string
description: Optional session cookie to authenticate with LeetCode API
commandFunction:
# A JS function that produces the CLI command based on the given config to start the MCP on stdio.
|-
(config) => {
const args = ['build/index.js', '--site', config.site];
if (config.session && config.session.trim() !== '') {
args.push('--session', config.session);
}
return {
command: 'node',
args
};
}
exampleConfig:
site: global
session: leetcode_session_cookie_value