-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from Omedia/deno
chore: deno rewrite
- Loading branch information
Showing
25 changed files
with
2,165 additions
and
389 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: check | ||
|
||
on: | ||
pull_request: | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: denoland/setup-deno@v2 | ||
with: | ||
deno-version: "2.x" | ||
- run: deno task lint | ||
- run: deno fmt --check | ||
|
||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: denoland/setup-deno@v2 | ||
with: | ||
deno-version: "2.x" | ||
- run: deno task build --output=build/mcp-server-drupal |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
name: Release | ||
env: | ||
PACKAGE_NAME: "mcp-server-drupal" | ||
TARGET_LIST: "x86_64-unknown-linux-gnu,aarch64-unknown-linux-gnu,x86_64-pc-windows-msvc,x86_64-apple-darwin,aarch64-apple-darwin" | ||
on: | ||
push: | ||
tags: | ||
- "v*.*.*" | ||
permissions: | ||
contents: write | ||
id-token: write | ||
jobs: | ||
build-and-sign: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
- name: Setup Deno | ||
uses: denoland/setup-deno@v2 | ||
with: | ||
deno-version: "2.x" | ||
- name: Extract version from tag | ||
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV | ||
- name: Setup cosign | ||
uses: sigstore/[email protected] | ||
- name: Build the binaries | ||
run: | | ||
for target in $(echo $TARGET_LIST | tr "," "\n") | ||
do | ||
arch=$(echo $target | cut -d'-' -f1) | ||
os=$(echo $target | cut -d'-' -f2) | ||
case $arch in | ||
"x86_64") arch_name="x86" ;; | ||
"aarch64") arch_name="arm" ;; | ||
*) arch_name=$arch ;; | ||
esac | ||
case $os in | ||
"apple") os_name="darwin" ;; | ||
"unknown") os_name="linux" ;; | ||
"pc") os_name="windows" ;; | ||
*) os_name=$os ;; | ||
esac | ||
binary_name="${PACKAGE_NAME}_${os_name}_${arch_name}" | ||
deno task build --target=$target --output=./build/$binary_name | ||
done | ||
- name: Sign binaries | ||
run: | | ||
mkdir -p build/bundles | ||
for file in build/*; do | ||
if [[ "$file" == "build/bundles" ]]; then continue; fi | ||
base_name=$(basename "$file" .exe) | ||
cosign sign-blob --bundle "build/bundles/${base_name}.bundle" --yes "$file" | ||
done | ||
cd build/bundles | ||
tar -czf ../signatures.tar.gz * | ||
cd ../.. | ||
- name: Release | ||
uses: softprops/action-gh-release@v2 | ||
with: | ||
files: | | ||
build/* | ||
name: "MCP Server Drupal: ${{ env.VERSION }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ node_modules/ | |
.env* | ||
build/ | ||
.DS_Store | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,3 @@ | ||
{ | ||
"typescript.tsdk": "node_modules/typescript/lib", | ||
"editor.defaultFormatter": "biomejs.biome", | ||
"editor.formatOnSave": true, | ||
"editor.codeActionsOnSave": { | ||
"quickfix.biome": "explicit" | ||
}, | ||
"[typescript]": { | ||
"editor.defaultFormatter": "biomejs.biome" | ||
}, | ||
"[json]": { | ||
"editor.defaultFormatter": "biomejs.biome" | ||
}, | ||
"files.insertFinalNewline": false, | ||
"files.autoSave": "off", | ||
"cSpell.words": ["Zodios"] | ||
"deno.enable": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2025 Omedia | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,68 +1,108 @@ | ||
# MCP Server for Drupal | ||
|
||
A Model Context Protocol server | ||
![image](https://github.com/user-attachments/assets/3fc18e9b-acd6-4490-8f43-504d812354dc) | ||
|
||
This is a typescript based companion | ||
[Model Context Protocol(MCP)](https://modelcontextprotocol.io/introduction) | ||
server for the [Drupal MCP module](https://www.drupal.org/project/mcp) that | ||
works with the `STDIO` transport. In order to use `SSE` transport this server is | ||
not required. | ||
|
||
> [!IMPORTANT] | ||
> Both the Drupal module and this server are in active development. Use them at | ||
> your own risk. | ||
## Installation and Usage | ||
|
||
- Download the binary for your system from the | ||
[releases](https://github.com/Omedia/mcp-server-drupal/releases) page | ||
|
||
- To use it with [Claude Desktop](https://claude.ai/download) you need to add | ||
the server config in the `claude_desktop_config.json` file. The file is | ||
located at the following path: | ||
|
||
- On MacOS: `~/Library/Application Support/Claude/claude_desktop_config.json` | ||
- On Windows: `%APPDATA%/Claude/claude_desktop_config.json` | ||
|
||
```json | ||
{ | ||
"mcpServers": { | ||
"mcp-server-drupal": { | ||
"command": "__BINARY_PATH__", | ||
"args": ["--drupal-url", "__DRUPAL_BASE_URL__"], | ||
"env": {} | ||
} | ||
} | ||
} | ||
``` | ||
|
||
- Replace `__BINARY_PATH__` with the path to the downloaded binary | ||
- Replace `__DRUPAL_BASE_URL__` with the base URL of your Drupal site | ||
|
||
This is a TypeScript-based MCP server for Drupal. | ||
> [!IMPORTANT] | ||
> | ||
> `--drupal-url` is a required argument | ||
## Features | ||
- To check the server and sdk version run the following command: | ||
|
||
### Resources | ||
```bash | ||
mcp-server-drupal --version | ||
``` | ||
|
||
- All the resources defined by the Drupal API during the initialization phase | ||
- To check the available commands run the following command: | ||
|
||
### Tools | ||
```bash | ||
mcp-server-drupal --help | ||
``` | ||
|
||
- All the tools defined by the Drupal API during the initialization phase | ||
## MCP | ||
|
||
### Prompts | ||
- All instruments are defined by the Drupal API during the initialization phase | ||
|
||
- All the prompts defined by the Drupal API during the initialization phase | ||
> [!NOTE] | ||
> The server now exposes the following | ||
> | ||
> - Resources (templates, reads) | ||
> - Tools (calls) | ||
> | ||
> No prompts are exposed by the server for now | ||
## Development | ||
|
||
Install dependencies: | ||
This project is built with [Deno](https://deno.land/). | ||
|
||
```bash | ||
bun install | ||
``` | ||
> [!NOTE] | ||
> Use deno version `2.0.0` or above | ||
Build the server: | ||
Install dependencies: | ||
|
||
```bash | ||
bun run build | ||
deno install | ||
``` | ||
|
||
For development with auto-rebuild: | ||
|
||
```bash | ||
bun run dev | ||
bun task dev | ||
``` | ||
|
||
## Installation | ||
|
||
To use with Claude Desktop, add the server config: | ||
|
||
On MacOS: `~/Library/Application Support/Claude/claude_desktop_config.json` | ||
On Windows: `%APPDATA%/Claude/claude_desktop_config.json` | ||
Build the server: | ||
|
||
```json | ||
{ | ||
"mcpServers": { | ||
"mcp-server-drupal": { | ||
"command": "__BINARY_PATH__", | ||
"args": ["--drupalBaseUrl", "__DRUPAL_BASE_URL__"], | ||
"env": {} | ||
} | ||
} | ||
} | ||
```bash | ||
deno task build --output build/mcp-server-drupal | ||
``` | ||
|
||
> [!TIP] | ||
> To build for the specific platform use the `--target` flag and check the | ||
> [docs](https://docs.deno.com/runtime/reference/cli/compile/#supported-targets) | ||
### Debugging | ||
|
||
Since MCP servers communicate over stdio, debugging can be challenging. We recommend using the [MCP Inspector](https://github.com/modelcontextprotocol/inspector), which is available as a package script: | ||
Since MCP servers communicate over stdio, debugging can be challenging. We | ||
recommend using the | ||
[MCP Inspector](https://github.com/modelcontextprotocol/inspector), which is | ||
available as a deno task: | ||
|
||
```bash | ||
bun run inspector | ||
deno task inspector --drupal-url [DRUPAL_BASE_URL] | ||
``` | ||
|
||
The Inspector will provide a URL to access debugging tools in your browser. |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"version": "0.1.0", | ||
"tasks": { | ||
"dev": "deno run -A scripts/dev.ts", | ||
"format": "deno fmt", | ||
"lint": "deno lint", | ||
"build": "deno run --allow-read --allow-net --allow-env --allow-run scripts/build.ts", | ||
"inspector": "npx @modelcontextprotocol/inspector build/mcp-server-drupal", | ||
"release": "deno run -A npm:release-it" | ||
}, | ||
"compilerOptions": { | ||
"strict": true, | ||
"noFallthroughCasesInSwitch": true, | ||
"noUnusedLocals": true, | ||
"noUnusedParameters": true, | ||
"noPropertyAccessFromIndexSignature": true | ||
}, | ||
"imports": { | ||
"@modelcontextprotocol/sdk": "npm:@modelcontextprotocol/sdk@^1.0.4", | ||
"@std/assert": "jsr:@std/assert@1", | ||
"@std/cli": "jsr:@std/cli@^1.0.9", | ||
"@std/dotenv": "jsr:@std/dotenv@^0.225.3", | ||
"@std/fmt": "jsr:@std/fmt@^1.0.3", | ||
"@std/fs": "jsr:@std/fs@^1.0.8", | ||
"@std/path": "jsr:@std/path@^1.0.8", | ||
"zod": "npm:zod@^3.24.1" | ||
} | ||
} |
Oops, something went wrong.