Merge branch 'main' into dappier-mcp

This commit is contained in:
Amaan
2025-02-03 19:22:59 +05:30
committed by GitHub
9 changed files with 77 additions and 13 deletions

View File

@@ -16,7 +16,9 @@
"scripts": { "scripts": {
"build": "tsc && shx chmod +x dist/*.js", "build": "tsc && shx chmod +x dist/*.js",
"prepare": "npm run build", "prepare": "npm run build",
"watch": "tsc --watch" "watch": "tsc --watch",
"start": "node dist/index.js",
"start:sse": "node dist/sse.js"
}, },
"dependencies": { "dependencies": {
"@modelcontextprotocol/sdk": "1.0.1", "@modelcontextprotocol/sdk": "1.0.1",

View File

@@ -12,6 +12,7 @@ import {
import fs from "fs"; import fs from "fs";
import { google } from "googleapis"; import { google } from "googleapis";
import path from "path"; import path from "path";
import { fileURLToPath } from 'url';
const drive = google.drive("v3"); const drive = google.drive("v3");
@@ -176,7 +177,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
}); });
const credentialsPath = process.env.GDRIVE_CREDENTIALS_PATH || path.join( 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", "../../../.gdrive-server-credentials.json",
); );
@@ -184,7 +185,7 @@ async function authenticateAndSaveCredentials() {
console.log("Launching auth flow…"); console.log("Launching auth flow…");
const auth = await authenticate({ const auth = await authenticate({
keyfilePath: process.env.GDRIVE_OAUTH_PATH || path.join( 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", "../../../gcp-oauth.keys.json",
), ),
scopes: ["https://www.googleapis.com/auth/drive.readonly"], scopes: ["https://www.googleapis.com/auth/drive.readonly"],

View File

@@ -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 - `branch_name` (string): Name of the new branch
- `start_point` (string, optional): Starting point for the new branch - `start_point` (string, optional): Starting point for the new branch
- Returns: Confirmation of branch creation - Returns: Confirmation of branch creation
8. `git_checkout` 10. `git_checkout`
- Switches branches - Switches branches
- Inputs: - Inputs:
- `repo_path` (string): Path to Git repository - `repo_path` (string): Path to Git repository
- `branch_name` (string): Name of branch to checkout - `branch_name` (string): Name of branch to checkout
- Returns: Confirmation of branch switch - Returns: Confirmation of branch switch
9. `git_show` 11. `git_show`
- Shows the contents of a commit - Shows the contents of a commit
- Inputs: - Inputs:
- `repo_path` (string): Path to Git repository - `repo_path` (string): Path to Git repository
- `revision` (string): The revision (commit hash, branch name, tag) to show - `revision` (string): The revision (commit hash, branch name, tag) to show
- Returns: Contents of the specified commit - 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 ## Installation

View File

@@ -56,6 +56,9 @@ class GitShow(BaseModel):
repo_path: str repo_path: str
revision: str revision: str
class GitInit(BaseModel):
repo_path: str
class GitTools(str, Enum): class GitTools(str, Enum):
STATUS = "git_status" STATUS = "git_status"
DIFF_UNSTAGED = "git_diff_unstaged" DIFF_UNSTAGED = "git_diff_unstaged"
@@ -68,6 +71,7 @@ class GitTools(str, Enum):
CREATE_BRANCH = "git_create_branch" CREATE_BRANCH = "git_create_branch"
CHECKOUT = "git_checkout" CHECKOUT = "git_checkout"
SHOW = "git_show" SHOW = "git_show"
INIT = "git_init"
def git_status(repo: git.Repo) -> str: def git_status(repo: git.Repo) -> str:
return repo.git.status() return repo.git.status()
@@ -118,6 +122,13 @@ def git_checkout(repo: git.Repo, branch_name: str) -> str:
repo.git.checkout(branch_name) repo.git.checkout(branch_name)
return f"Switched to branch '{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: def git_show(repo: git.Repo, revision: str) -> str:
commit = repo.commit(revision) commit = repo.commit(revision)
output = [ output = [
@@ -206,6 +217,11 @@ async def serve(repository: Path | None) -> None:
name=GitTools.SHOW, name=GitTools.SHOW,
description="Shows the contents of a commit", description="Shows the contents of a commit",
inputSchema=GitShow.schema(), 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() @server.call_tool()
async def call_tool(name: str, arguments: dict) -> list[TextContent]: async def call_tool(name: str, arguments: dict) -> list[TextContent]:
repo_path = Path(arguments["repo_path"]) 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) repo = git.Repo(repo_path)
match name: match name:

View File

@@ -117,6 +117,8 @@ Add the following to your `claude_desktop_config.json`:
"command": "docker", "command": "docker",
"args": [ "args": [
"run", "run",
"--rm",
"-i",
"-e", "-e",
"GITLAB_PERSONAL_ACCESS_TOKEN", "GITLAB_PERSONAL_ACCESS_TOKEN",
"-e", "-e",

View File

@@ -106,7 +106,7 @@ Add the following to your `claude_desktop_config.json`:
Docker build: Docker build:
```bash ```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 ## License

View File

@@ -137,7 +137,7 @@ Add this to your claude_desktop_config.json:
"mcpServers": { "mcpServers": {
"memory": { "memory": {
"command": "docker", "command": "docker",
"args": ["run", "-i", "--rm", "mcp/memory"] "args": ["run", "-i", "-v", "claude-memory:/app/dist", "--rm", "mcp/memory"]
} }
} }
} }
@@ -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 ### 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. 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.

View File

@@ -10,10 +10,15 @@ import { promises as fs } from 'fs';
import path from 'path'; import path from 'path';
import { fileURLToPath } from 'url'; 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 // If MEMORY_FILE_PATH is just a filename, put it in the same directory as the script
const __dirname = path.dirname(fileURLToPath(import.meta.url)); const MEMORY_FILE_PATH = process.env.MEMORY_FILE_PATH
const MEMORY_FILE_PATH = path.join(__dirname, 'memory.json'); ? 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 // We are storing our memory using entities, relations, and observations in a graph structure
interface Entity { interface Entity {

View File

@@ -1,6 +1,6 @@
{ {
"name": "@modelcontextprotocol/server-memory", "name": "@modelcontextprotocol/server-memory",
"version": "0.6.2", "version": "0.6.3",
"description": "MCP server for enabling memory for Claude through a knowledge graph", "description": "MCP server for enabling memory for Claude through a knowledge graph",
"license": "MIT", "license": "MIT",
"author": "Anthropic, PBC (https://anthropic.com)", "author": "Anthropic, PBC (https://anthropic.com)",