Files
claude-code-action/src/mcp/install-mcp-server.ts
Lina Tawfik b02a95b3f3 Remove token-related logging for security
- Remove token type detection logging
- Remove token age/creation time logging
- Keep only non-sensitive debugging info (repo, branch, request IDs)

While the token value was never logged, it's better to err on the side
of caution and not log any token-related information.
2025-05-23 16:20:31 -07:00

50 lines
1.2 KiB
TypeScript

import * as core from "@actions/core";
export async function prepareMcpConfig(
githubToken: string,
owner: string,
repo: string,
branch: string,
): Promise<string> {
try {
const mcpConfig = {
mcpServers: {
github: {
command: "docker",
args: [
"run",
"-i",
"--rm",
"-e",
"GITHUB_PERSONAL_ACCESS_TOKEN",
"ghcr.io/anthropics/github-mcp-server:sha-7382253",
],
env: {
GITHUB_PERSONAL_ACCESS_TOKEN: githubToken,
},
},
github_file_ops: {
command: "bun",
args: [
"run",
`${process.env.GITHUB_ACTION_PATH}/src/mcp/github-file-ops-server.ts`,
],
env: {
GITHUB_TOKEN: githubToken,
REPO_OWNER: owner,
REPO_NAME: repo,
BRANCH_NAME: branch,
REPO_DIR: process.env.GITHUB_WORKSPACE || process.cwd(),
GITHUB_API_URL: process.env.GITHUB_API_URL || "https://api.github.com",
},
},
},
};
return JSON.stringify(mcpConfig, null, 2);
} catch (error) {
core.setFailed(`Install MCP server failed with error: ${error}`);
process.exit(1);
}
}