Add 'getting started' extensions documentation (#9536)

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
This commit is contained in:
christine betts
2025-09-25 20:01:49 -04:00
committed by GitHub
parent 463e5d5b7e
commit 7e2ffd7a80
9 changed files with 280 additions and 6 deletions

View File

@@ -1,10 +1,11 @@
{
"name": "mcp-server",
"name": "mcp-server-example",
"version": "1.0.0",
"mcpServers": {
"nodeServer": {
"command": "node",
"args": ["${extensionPath}${/}example.ts"]
"args": ["${extensionPath}${/}dist${/}example.js"],
"cwd": "${extensionPath}"
}
}
}

View File

@@ -0,0 +1,18 @@
{
"name": "mcp-server-example",
"version": "1.0.0",
"description": "Example MCP Server for Gemini CLI Extension",
"type": "module",
"main": "example.js",
"scripts": {
"build": "tsc"
},
"devDependencies": {
"typescript": "~5.4.5",
"@types/node": "^20.11.25"
},
"dependencies": {
"@modelcontextprotocol/sdk": "^1.11.0",
"zod": "^3.22.4"
}
}

View File

@@ -0,0 +1,13 @@
{
"compilerOptions": {
"target": "ES2022",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"outDir": "./dist"
},
"include": ["example.ts"]
}

View File

@@ -53,8 +53,18 @@ describe('extensions new command', () => {
recursive: true,
});
expect(mockedFs.cp).toHaveBeenCalledWith(
expect.stringContaining('context'),
'/some/path',
expect.stringContaining('context/context'),
'/some/path/context',
{ recursive: true },
);
expect(mockedFs.cp).toHaveBeenCalledWith(
expect.stringContaining('context/custom-commands'),
'/some/path/custom-commands',
{ recursive: true },
);
expect(mockedFs.cp).toHaveBeenCalledWith(
expect.stringContaining('context/mcp-server'),
'/some/path/mcp-server',
{ recursive: true },
);
});

View File

@@ -36,7 +36,12 @@ async function copyDirectory(template: string, path: string) {
const examplePath = join(EXAMPLES_PATH, template);
await mkdir(path, { recursive: true });
await cp(examplePath, path, { recursive: true });
const entries = await readdir(examplePath, { withFileTypes: true });
for (const entry of entries) {
const srcPath = join(examplePath, entry.name);
const destPath = join(path, entry.name);
await cp(srcPath, destPath, { recursive: true });
}
}
async function handleNew(args: NewArgs) {