Skip to content
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

Deno rewrite #2

Merged
merged 19 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from 16 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
25 changes: 25 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: check

on:
push:
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
44 changes: 0 additions & 44 deletions .github/workflows/main.yml

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ node_modules/
.env*
build/
.DS_Store

16 changes: 1 addition & 15 deletions .vscode/settings.json
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
}
21 changes: 21 additions & 0 deletions LICENSE
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.
112 changes: 76 additions & 36 deletions README.md
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.
30 changes: 0 additions & 30 deletions biome.json

This file was deleted.

Binary file removed bun.lockb
Binary file not shown.
27 changes: 27 additions & 0 deletions deno.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"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"
},
"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"
}
}
Loading
Loading