Skip to content

Commit 4c13271

Browse files
committed
Init
0 parents  commit 4c13271

File tree

13 files changed

+1777
-0
lines changed

13 files changed

+1777
-0
lines changed

.github/workflows/ci.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v3
15+
16+
- name: Use Node.js
17+
uses: actions/setup-node@v3
18+
with:
19+
node-version: '22.x'
20+
cache: 'npm'
21+
22+
- name: Install dependencies
23+
run: npm ci
24+
25+
- name: Build
26+
run: npm run build
27+
28+
- name: Lint
29+
run: npm run lint
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Publish Docker image
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
push_to_registry:
9+
name: Push Docker image to Docker Hub
10+
runs-on: ubuntu-latest
11+
permissions:
12+
packages: write
13+
contents: read
14+
attestations: write
15+
id-token: write
16+
steps:
17+
- name: Check out the repo
18+
uses: actions/checkout@v4
19+
20+
- name: Set up Docker Buildx
21+
uses: docker/setup-buildx-action@v3
22+
23+
- name: Log in to Docker Hub
24+
uses: docker/login-action@v3
25+
with:
26+
username: ${{ secrets.DOCKER_USERNAME }}
27+
password: ${{ secrets.DOCKER_PASSWORD }}
28+
29+
- name: Extract metadata (tags, labels) for Docker
30+
id: meta
31+
uses: docker/metadata-action@v5
32+
with:
33+
images: ashdev/discourse-mcp-server
34+
35+
- name: Build and push Docker image
36+
id: push
37+
uses: docker/build-push-action@v6
38+
with:
39+
context: .
40+
platforms: linux/amd64,linux/arm64
41+
push: true
42+
tags: ${{ steps.meta.outputs.tags }}
43+
labels: ${{ steps.meta.outputs.labels }}
44+
cache-from: type=registry,ref=ashdev/discourse-mcp-server:buildcache
45+
cache-to: type=registry,ref=ashdev/discourse-mcp-server:buildcache,mode=max
46+
47+
- name: Generate artifact attestation
48+
uses: actions/attest-build-provenance@v2
49+
with:
50+
subject-name: index.docker.io/ashdev/discourse-mcp-server
51+
subject-digest: ${{ steps.push.outputs.digest }}
52+
push-to-registry: true

.github/workflows/publish-npm.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Publish Package
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
8+
jobs:
9+
publish:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v3
14+
15+
- name: Use Node.js
16+
uses: actions/setup-node@v3
17+
with:
18+
node-version: '22.x'
19+
registry-url: 'https://registry.npmjs.org'
20+
21+
- name: Install dependencies
22+
run: npm ci
23+
24+
- name: Build
25+
run: npm run build
26+
27+
- name: Publish to NPM
28+
run: npm publish --access public
29+
env:
30+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/build/
2+
/node_modules/
3+
4+
/discourse-mcp.sh
5+
/openapi.json

.tool-versions

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
nodejs 22.14.0

Dockerfile

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
FROM node:22.14-alpine AS builder
2+
3+
WORKDIR /app
4+
5+
COPY . /app
6+
7+
RUN --mount=type=cache,target=/root/.npm npm install
8+
9+
RUN --mount=type=cache,target=/root/.npm-production npm ci --ignore-scripts --omit-dev
10+
11+
RUN npm run build
12+
13+
14+
FROM node:22-alpine AS release
15+
16+
WORKDIR /app
17+
18+
COPY --from=builder /app/build /app/build
19+
COPY --from=builder /app/package.json /app/package.json
20+
COPY --from=builder /app/package-lock.json /app/package-lock.json
21+
22+
ENV NODE_ENV=production
23+
24+
RUN npm ci --ignore-scripts --omit-dev
25+
26+
ENTRYPOINT ["node", "/app/build/index.js"]

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Sylvain CAU
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# Discourse MCP Server
2+
3+
Node.js server implementing Model Context Protocol (MCP) for Discourse search operation.
4+
5+
## Features
6+
7+
- Search Posts on a Discourse forum using MCP protocol.
8+
9+
## API
10+
11+
### Tools
12+
13+
- **search_posts**
14+
- Search posts on a Discourse forum
15+
- Input: `query` (string)
16+
- Returns an array of post objects
17+
18+
## Usage with Claude Desktop
19+
Add this to your `claude_desktop_config.json`:
20+
21+
### Docker
22+
23+
```json
24+
{
25+
"mcpServers": {
26+
"discourse": {
27+
"command": "docker",
28+
"args": [
29+
"run",
30+
"-i",
31+
"--rm",
32+
"-e DISCOURSE_API_URL=https://try.discourse.org",
33+
"-e DISCOURSE_API_KEY=1234",
34+
"-e DISCOURSE_API_USERNAME=ash",
35+
"ashdev/discourse-mcp-server"
36+
]
37+
}
38+
}
39+
}
40+
```
41+
42+
### NPX
43+
44+
```json
45+
{
46+
"mcpServers": {
47+
"discourse": {
48+
"command": "npx",
49+
"args": [
50+
"-y",
51+
"@ashdev/discourse-mcp-server"
52+
],
53+
"env": {
54+
"DISCOURSE_API_URL": "https://try.discourse.org",
55+
"DISCOURSE_API_KEY": "1234",
56+
"DISCOURSE_API_USERNAME": "ash"
57+
}
58+
}
59+
}
60+
}
61+
```
62+
63+
## Build
64+
65+
Docker build:
66+
67+
```bash
68+
docker build -t ashdev/discourse-mcp-server .
69+
```

biome.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
3+
"vcs": {
4+
"enabled": false,
5+
"clientKind": "git",
6+
"useIgnoreFile": false
7+
},
8+
"files": {
9+
"ignoreUnknown": false,
10+
"ignore": []
11+
},
12+
"formatter": {
13+
"enabled": true,
14+
"indentStyle": "tab"
15+
},
16+
"organizeImports": {
17+
"enabled": true
18+
},
19+
"linter": {
20+
"enabled": true,
21+
"rules": {
22+
"recommended": true
23+
}
24+
},
25+
"javascript": {
26+
"formatter": {
27+
"quoteStyle": "double"
28+
}
29+
}
30+
}

0 commit comments

Comments
 (0)