From 04209ec24813c063775bb4e0e9e51bc265d3bf1c Mon Sep 17 00:00:00 2001 From: s2005 Date: Sat, 21 Dec 2024 18:38:12 +0100 Subject: [PATCH 01/10] feat(memory): add MEMORY_FILE_PATH environment variable support - Add environment variable MEMORY_FILE_PATH to configure custom storage location - Support both absolute and relative paths - Update documentation with configuration examples - Bump version to 0.6.3 --- src/memory/README.md | 23 +++++++++++++++++++++++ src/memory/index.ts | 14 +++++++++----- src/memory/package.json | 2 +- 3 files changed, 33 insertions(+), 6 deletions(-) diff --git a/src/memory/README.md b/src/memory/README.md index e405a0d4..eead5faf 100644 --- a/src/memory/README.md +++ b/src/memory/README.md @@ -158,6 +158,29 @@ Add this to your claude_desktop_config.json: } ``` +#### NPX with custom setting + +The server can be configured using the following environment variables: + +```json +{ + "mcpServers": { + "memory": { + "command": "npx", + "args": [ + "-y", + "@modelcontextprotocol/server-memory" + ], + "env": { + "MEMORY_FILE_PATH": "/path/to/custom/memory.json" + } + } + } +} +``` + +- `MEMORY_FILE_PATH`: Path to the memory storage JSON file (default: `memory.json` in the server directory) + ### System Prompt The prompt for utilizing memory depends on the use case. Changing the prompt will help the model determine the frequency and types of memories created. diff --git a/src/memory/index.ts b/src/memory/index.ts index 0117c920..14ef92ad 100644 --- a/src/memory/index.ts +++ b/src/memory/index.ts @@ -10,10 +10,15 @@ import { promises as fs } from 'fs'; import path from 'path'; import { fileURLToPath } from 'url'; +// Define memory file path using environment variable with fallback +const defaultMemoryPath = path.join(path.dirname(fileURLToPath(import.meta.url)), 'memory.json'); -// Define the path to the JSONL file, you can change this to your desired local path -const __dirname = path.dirname(fileURLToPath(import.meta.url)); -const MEMORY_FILE_PATH = path.join(__dirname, 'memory.json'); +// If MEMORY_FILE_PATH is just a filename, put it in the same directory as the script +const MEMORY_FILE_PATH = process.env.MEMORY_FILE_PATH + ? path.isAbsolute(process.env.MEMORY_FILE_PATH) + ? process.env.MEMORY_FILE_PATH + : path.join(path.dirname(fileURLToPath(import.meta.url)), process.env.MEMORY_FILE_PATH) + : defaultMemoryPath; // We are storing our memory using entities, relations, and observations in a graph structure interface Entity { @@ -178,8 +183,7 @@ class KnowledgeGraphManager { } } -const knowledgeGraphManager = new KnowledgeGraphManager(); - +const knowledgeGraphManager = new KnowledgeGraphManager; // The server instance and tools exposed to Claude const server = new Server({ diff --git a/src/memory/package.json b/src/memory/package.json index 741244b1..b64cf3b6 100644 --- a/src/memory/package.json +++ b/src/memory/package.json @@ -1,6 +1,6 @@ { "name": "@modelcontextprotocol/server-memory", - "version": "0.6.2", + "version": "0.6.3", "description": "MCP server for enabling memory for Claude through a knowledge graph", "license": "MIT", "author": "Anthropic, PBC (https://anthropic.com)", From 5d0bee029505c66fd94cb78df5e814f7107b4cce Mon Sep 17 00:00:00 2001 From: s2005 Date: Sat, 21 Dec 2024 18:54:35 +0100 Subject: [PATCH 02/10] fix(memory): revert back instantiation of KnowledgeGraphManager --- src/memory/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/memory/index.ts b/src/memory/index.ts index 14ef92ad..75b30aae 100644 --- a/src/memory/index.ts +++ b/src/memory/index.ts @@ -183,7 +183,7 @@ class KnowledgeGraphManager { } } -const knowledgeGraphManager = new KnowledgeGraphManager; +const knowledgeGraphManager = new KnowledgeGraphManager(); // The server instance and tools exposed to Claude const server = new Server({ From 05fb0eab366ef3b9c0fd0e4d8273c2fb800d7d17 Mon Sep 17 00:00:00 2001 From: s2005 <17839543+s2005@users.noreply.github.com> Date: Sat, 21 Dec 2024 18:59:17 +0100 Subject: [PATCH 03/10] Add newline before server instance initialization As it was before --- src/memory/index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/memory/index.ts b/src/memory/index.ts index 75b30aae..62f7aeb6 100644 --- a/src/memory/index.ts +++ b/src/memory/index.ts @@ -185,6 +185,7 @@ class KnowledgeGraphManager { const knowledgeGraphManager = new KnowledgeGraphManager(); + // The server instance and tools exposed to Claude const server = new Server({ name: "memory-server", From f2a802822b8a72e6a5b3bc9e6847a86b91918749 Mon Sep 17 00:00:00 2001 From: Alexandros Pappas Date: Sun, 22 Dec 2024 15:55:07 +0100 Subject: [PATCH 04/10] feat: Add start and start:sse scripts to package.json on everything server --- src/everything/package.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/everything/package.json b/src/everything/package.json index 0344f2f1..680dbb88 100644 --- a/src/everything/package.json +++ b/src/everything/package.json @@ -16,7 +16,9 @@ "scripts": { "build": "tsc && shx chmod +x dist/*.js", "prepare": "npm run build", - "watch": "tsc --watch" + "watch": "tsc --watch", + "start": "node dist/index.js", + "start:sse": "node dist/sse.js" }, "dependencies": { "@modelcontextprotocol/sdk": "1.0.1", From 69bba96dab6fa105b5f83ffc997579ecd4e1c8b3 Mon Sep 17 00:00:00 2001 From: Cass Petrus Date: Sun, 22 Dec 2024 12:04:12 -0800 Subject: [PATCH 05/10] fix: update filesystem readme The README for the filesystem MCP setup had a trailing comma (invalid JSON syntax). This addresses that. Along the way, as I was testing out Claude's use of the filesystem, I asked it to check for other inconsistencies. Here are a few others. --- src/filesystem/README.md | 2 +- src/git/README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/filesystem/README.md b/src/filesystem/README.md index 05c915ad..c52f1a40 100644 --- a/src/filesystem/README.md +++ b/src/filesystem/README.md @@ -124,7 +124,7 @@ Note: all directories must be mounted to `/projects` by default. "--mount", "type=bind,src=/path/to/other/allowed/dir,dst=/projects/other/allowed/dir,ro", "--mount", "type=bind,src=/path/to/file.txt,dst=/projects/path/to/file.txt", "mcp/filesystem", - "/projects", + "/projects" ] } } diff --git a/src/git/README.md b/src/git/README.md index cb22629e..f0855695 100644 --- a/src/git/README.md +++ b/src/git/README.md @@ -213,7 +213,7 @@ If you are doing local development, there are two ways to test your changes: ```json { "mcpServers": { - "brave-search": { + "git": { "command": "docker", "args": [ "run", From 7ecbfdfd84a168d76a08dd404e000fbabccba721 Mon Sep 17 00:00:00 2001 From: Cass Petrus Date: Wed, 25 Dec 2024 15:04:28 -0800 Subject: [PATCH 06/10] fix: also change tag name --- src/google-maps/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/google-maps/README.md b/src/google-maps/README.md index c0fd576e..b91a0657 100644 --- a/src/google-maps/README.md +++ b/src/google-maps/README.md @@ -106,7 +106,7 @@ Add the following to your `claude_desktop_config.json`: Docker build: ```bash -docker build -t vonwig/google-maps:mcp -f src/google-maps/Dockerfile . +docker build -t mcp/google-maps -f src/google-maps/Dockerfile . ``` ## License From ded263ff4174a8cbce33d252d3e2d3700c4f6a72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Charri=C3=A8re?= Date: Tue, 31 Dec 2024 13:40:34 +0100 Subject: [PATCH 07/10] Add arguments to the docker command to avoid the server exit --- src/gitlab/README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gitlab/README.md b/src/gitlab/README.md index e2b16fe1..4b3d6dc3 100644 --- a/src/gitlab/README.md +++ b/src/gitlab/README.md @@ -117,6 +117,8 @@ Add the following to your `claude_desktop_config.json`: "command": "docker", "args": [ "run", + "--rm", + "-i", "-e", "GITLAB_PERSONAL_ACCESS_TOKEN", "-e", @@ -167,4 +169,4 @@ docker build -t vonwig/gitlab:mcp -f src/gitlab/Dockerfile . ## License -This MCP server is licensed under the MIT License. This means you are free to use, modify, and distribute the software, subject to the terms and conditions of the MIT License. For more details, please see the LICENSE file in the project repository. \ No newline at end of file +This MCP server is licensed under the MIT License. This means you are free to use, modify, and distribute the software, subject to the terms and conditions of the MIT License. For more details, please see the LICENSE file in the project repository. From 726f50a4d577e50935681fd8843060da26861785 Mon Sep 17 00:00:00 2001 From: freiit Date: Fri, 17 Jan 2025 11:02:20 +0100 Subject: [PATCH 08/10] add a volume to docker, otherwise memory gets lost --- src/memory/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/memory/README.md b/src/memory/README.md index e405a0d4..d6d4c6f0 100644 --- a/src/memory/README.md +++ b/src/memory/README.md @@ -137,7 +137,7 @@ Add this to your claude_desktop_config.json: "mcpServers": { "memory": { "command": "docker", - "args": ["run", "-i", "--rm", "mcp/memory"] + "args": ["run", "-i", "-v", "claude-memory:/app/dist", "--rm", "mcp/memory"] } } } @@ -200,4 +200,4 @@ docker build -t mcp/memory -f src/memory/Dockerfile . ## License -This MCP server is licensed under the MIT License. This means you are free to use, modify, and distribute the software, subject to the terms and conditions of the MIT License. For more details, please see the LICENSE file in the project repository. \ No newline at end of file +This MCP server is licensed under the MIT License. This means you are free to use, modify, and distribute the software, subject to the terms and conditions of the MIT License. For more details, please see the LICENSE file in the project repository. From fc32e8712985b596c5e657fa85f2c63c5b3a422a Mon Sep 17 00:00:00 2001 From: Shashwat Date: Tue, 21 Jan 2025 17:44:18 +0530 Subject: [PATCH 09/10] Add git init command support to mcp-git-server and update README --- src/git/README.md | 9 +++++++-- src/git/src/mcp_server_git/server.py | 26 ++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/src/git/README.md b/src/git/README.md index f0855695..827d58fa 100644 --- a/src/git/README.md +++ b/src/git/README.md @@ -67,18 +67,23 @@ Please note that mcp-server-git is currently in early development. The functiona - `branch_name` (string): Name of the new branch - `start_point` (string, optional): Starting point for the new branch - Returns: Confirmation of branch creation -8. `git_checkout` +10. `git_checkout` - Switches branches - Inputs: - `repo_path` (string): Path to Git repository - `branch_name` (string): Name of branch to checkout - Returns: Confirmation of branch switch -9. `git_show` +11. `git_show` - Shows the contents of a commit - Inputs: - `repo_path` (string): Path to Git repository - `revision` (string): The revision (commit hash, branch name, tag) to show - Returns: Contents of the specified commit +12. `git_init` + - Initializes a Git repository + - Inputs: + - `repo_path` (string): Path to directory to initialize git repo + - Returns: Confirmation of repository initialization ## Installation diff --git a/src/git/src/mcp_server_git/server.py b/src/git/src/mcp_server_git/server.py index 9b204c6e..c6a346cf 100644 --- a/src/git/src/mcp_server_git/server.py +++ b/src/git/src/mcp_server_git/server.py @@ -56,6 +56,9 @@ class GitShow(BaseModel): repo_path: str revision: str +class GitInit(BaseModel): + repo_path: str + class GitTools(str, Enum): STATUS = "git_status" DIFF_UNSTAGED = "git_diff_unstaged" @@ -68,6 +71,7 @@ class GitTools(str, Enum): CREATE_BRANCH = "git_create_branch" CHECKOUT = "git_checkout" SHOW = "git_show" + INIT = "git_init" def git_status(repo: git.Repo) -> str: return repo.git.status() @@ -118,6 +122,13 @@ def git_checkout(repo: git.Repo, branch_name: str) -> str: repo.git.checkout(branch_name) return f"Switched to branch '{branch_name}'" +def git_init(repo_path: str) -> str: + try: + repo = git.Repo.init(path=repo_path, mkdir=True) + return f"Initialized empty Git repository in {repo.git_dir}" + except Exception as e: + return f"Error initializing repository: {str(e)}" + def git_show(repo: git.Repo, revision: str) -> str: commit = repo.commit(revision) output = [ @@ -206,6 +217,11 @@ async def serve(repository: Path | None) -> None: name=GitTools.SHOW, description="Shows the contents of a commit", inputSchema=GitShow.schema(), + ), + Tool( + name=GitTools.INIT, + description="Initialize a new Git repository", + inputSchema=GitInit.schema(), ) ] @@ -241,6 +257,16 @@ async def serve(repository: Path | None) -> None: @server.call_tool() async def call_tool(name: str, arguments: dict) -> list[TextContent]: repo_path = Path(arguments["repo_path"]) + + # Handle git init separately since it doesn't require an existing repo + if name == GitTools.INIT: + result = git_init(str(repo_path)) + return [TextContent( + type="text", + text=result + )] + + # For all other commands, we need an existing repo repo = git.Repo(repo_path) match name: From c701fe7dea7dab842fba2764ff81979ba02fe682 Mon Sep 17 00:00:00 2001 From: Anish Pednekar Date: Wed, 22 Jan 2025 15:54:49 +0530 Subject: [PATCH 10/10] windows credential file path resolution fix --- src/gdrive/index.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/gdrive/index.ts b/src/gdrive/index.ts index 575c350c..1fa4dc89 100644 --- a/src/gdrive/index.ts +++ b/src/gdrive/index.ts @@ -12,6 +12,7 @@ import { import fs from "fs"; import { google } from "googleapis"; import path from "path"; +import { fileURLToPath } from 'url'; const drive = google.drive("v3"); @@ -176,7 +177,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => { }); const credentialsPath = process.env.GDRIVE_CREDENTIALS_PATH || path.join( - path.dirname(new URL(import.meta.url).pathname), + path.dirname(fileURLToPath(import.meta.url)), "../../../.gdrive-server-credentials.json", ); @@ -184,7 +185,7 @@ async function authenticateAndSaveCredentials() { console.log("Launching auth flow…"); const auth = await authenticate({ keyfilePath: process.env.GDRIVE_OAUTH_PATH || path.join( - path.dirname(new URL(import.meta.url).pathname), + path.dirname(fileURLToPath(import.meta.url)), "../../../gcp-oauth.keys.json", ), scopes: ["https://www.googleapis.com/auth/drive.readonly"],