Skip to content

Commit 67c86e7

Browse files
Merge branch 'main' into new-servers/kintone
2 parents ab5a324 + ebac6f2 commit 67c86e7

File tree

14 files changed

+481
-15
lines changed

14 files changed

+481
-15
lines changed

README.md

Lines changed: 49 additions & 6 deletions
Large diffs are not rendered by default.

src/gdrive/index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
import fs from "fs";
1313
import { google } from "googleapis";
1414
import path from "path";
15+
import { fileURLToPath } from 'url';
1516

1617
const drive = google.drive("v3");
1718

@@ -176,15 +177,15 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
176177
});
177178

178179
const credentialsPath = process.env.GDRIVE_CREDENTIALS_PATH || path.join(
179-
path.dirname(new URL(import.meta.url).pathname),
180+
path.dirname(fileURLToPath(import.meta.url)),
180181
"../../../.gdrive-server-credentials.json",
181182
);
182183

183184
async function authenticateAndSaveCredentials() {
184185
console.log("Launching auth flow…");
185186
const auth = await authenticate({
186187
keyfilePath: process.env.GDRIVE_OAUTH_PATH || path.join(
187-
path.dirname(new URL(import.meta.url).pathname),
188+
path.dirname(fileURLToPath(import.meta.url)),
188189
"../../../gcp-oauth.keys.json",
189190
),
190191
scopes: ["https://www.googleapis.com/auth/drive.readonly"],

src/git/README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,18 +67,23 @@ Please note that mcp-server-git is currently in early development. The functiona
6767
- `branch_name` (string): Name of the new branch
6868
- `start_point` (string, optional): Starting point for the new branch
6969
- Returns: Confirmation of branch creation
70-
8. `git_checkout`
70+
10. `git_checkout`
7171
- Switches branches
7272
- Inputs:
7373
- `repo_path` (string): Path to Git repository
7474
- `branch_name` (string): Name of branch to checkout
7575
- Returns: Confirmation of branch switch
76-
9. `git_show`
76+
11. `git_show`
7777
- Shows the contents of a commit
7878
- Inputs:
7979
- `repo_path` (string): Path to Git repository
8080
- `revision` (string): The revision (commit hash, branch name, tag) to show
8181
- Returns: Contents of the specified commit
82+
12. `git_init`
83+
- Initializes a Git repository
84+
- Inputs:
85+
- `repo_path` (string): Path to directory to initialize git repo
86+
- Returns: Confirmation of repository initialization
8287

8388
## Installation
8489

src/git/src/mcp_server_git/server.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ class GitShow(BaseModel):
5656
repo_path: str
5757
revision: str
5858

59+
class GitInit(BaseModel):
60+
repo_path: str
61+
5962
class GitTools(str, Enum):
6063
STATUS = "git_status"
6164
DIFF_UNSTAGED = "git_diff_unstaged"
@@ -68,6 +71,7 @@ class GitTools(str, Enum):
6871
CREATE_BRANCH = "git_create_branch"
6972
CHECKOUT = "git_checkout"
7073
SHOW = "git_show"
74+
INIT = "git_init"
7175

7276
def git_status(repo: git.Repo) -> str:
7377
return repo.git.status()
@@ -118,6 +122,13 @@ def git_checkout(repo: git.Repo, branch_name: str) -> str:
118122
repo.git.checkout(branch_name)
119123
return f"Switched to branch '{branch_name}'"
120124

125+
def git_init(repo_path: str) -> str:
126+
try:
127+
repo = git.Repo.init(path=repo_path, mkdir=True)
128+
return f"Initialized empty Git repository in {repo.git_dir}"
129+
except Exception as e:
130+
return f"Error initializing repository: {str(e)}"
131+
121132
def git_show(repo: git.Repo, revision: str) -> str:
122133
commit = repo.commit(revision)
123134
output = [
@@ -206,6 +217,11 @@ async def list_tools() -> list[Tool]:
206217
name=GitTools.SHOW,
207218
description="Shows the contents of a commit",
208219
inputSchema=GitShow.schema(),
220+
),
221+
Tool(
222+
name=GitTools.INIT,
223+
description="Initialize a new Git repository",
224+
inputSchema=GitInit.schema(),
209225
)
210226
]
211227

@@ -241,6 +257,16 @@ def by_commandline() -> Sequence[str]:
241257
@server.call_tool()
242258
async def call_tool(name: str, arguments: dict) -> list[TextContent]:
243259
repo_path = Path(arguments["repo_path"])
260+
261+
# Handle git init separately since it doesn't require an existing repo
262+
if name == GitTools.INIT:
263+
result = git_init(str(repo_path))
264+
return [TextContent(
265+
type="text",
266+
text=result
267+
)]
268+
269+
# For all other commands, we need an existing repo
244270
repo = git.Repo(repo_path)
245271

246272
match name:

src/github/common/utils.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1+
import { getUserAgent } from "universal-user-agent";
12
import { createGitHubError } from "./errors.js";
3+
import { VERSION } from "./version.js";
24

35
type RequestOptions = {
46
method?: string;
57
body?: unknown;
68
headers?: Record<string, string>;
7-
};
9+
}
810

911
async function parseResponseBody(response: Response): Promise<unknown> {
1012
const contentType = response.headers.get("content-type");
@@ -24,13 +26,16 @@ export function buildUrl(baseUrl: string, params: Record<string, string | number
2426
return url.toString();
2527
}
2628

29+
const USER_AGENT = `modelcontextprotocol/servers/github/v${VERSION} ${getUserAgent()}`;
30+
2731
export async function githubRequest(
2832
url: string,
2933
options: RequestOptions = {}
3034
): Promise<unknown> {
3135
const headers: Record<string, string> = {
3236
"Accept": "application/vnd.github.v3+json",
3337
"Content-Type": "application/json",
38+
"User-Agent": USER_AGENT,
3439
...options.headers,
3540
};
3641

src/github/common/version.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const VERSION = "0.6.2";

src/github/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,12 @@ import {
2525
GitHubConflictError,
2626
isGitHubError,
2727
} from './common/errors.js';
28+
import { VERSION } from "./common/version.js";
2829

2930
const server = new Server(
3031
{
3132
name: "github-mcp-server",
32-
version: "0.1.0",
33+
version: VERSION,
3334
},
3435
{
3536
capabilities: {

src/github/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,12 @@
2323
"@types/node": "^22",
2424
"@types/node-fetch": "^2.6.12",
2525
"node-fetch": "^3.3.2",
26+
"universal-user-agent": "^7.0.2",
2627
"zod": "^3.22.4",
2728
"zod-to-json-schema": "^3.23.5"
2829
},
2930
"devDependencies": {
3031
"shx": "^0.3.4",
3132
"typescript": "^5.6.2"
3233
}
33-
}
34+
}

src/memory/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ Add this to your claude_desktop_config.json:
137137
"mcpServers": {
138138
"memory": {
139139
"command": "docker",
140-
"args": ["run", "-i", "--rm", "mcp/memory"]
140+
"args": ["run", "-i", "-v", "claude-memory:/app/dist", "--rm", "mcp/memory"]
141141
}
142142
}
143143
}
@@ -223,4 +223,4 @@ docker build -t mcp/memory -f src/memory/Dockerfile .
223223

224224
## License
225225

226-
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.
226+
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.

src/redis/Dockerfile

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

0 commit comments

Comments
 (0)