Skip to content

Add MCP base app samples for Node.js, Python, Go, and .NET - #1

Merged
Trustinbtc999-hue merged 2 commits into
mainfrom
copilot/base-app-mcp
Jul 15, 2026
Merged

Trustinbtc999-hue merged 2 commits into
mainfrom
copilot/base-app-mcp

Conversation

Copilot AI commented Jul 15, 2026 •

Copy link
Copy Markdown

Adds minimal runnable sample apps demonstrating MCP server integration across all four primary SDK languages, using @modelcontextprotocol/server-filesystem as the reference server.

New files

File Language
nodejs/samples/mcp.ts TypeScript
python/samples/mcp.py Python
go/samples/mcp/main.go Go
dotnet/samples/Mcp.cs .NET

Pattern (TypeScript example)

const session = await client.createSession({
    onPermissionRequest: approveAll,
    mcpServers: {
        filesystem: {
            type: "local",
            command: "npx",
            args: ["-y", "@modelcontextprotocol/server-filesystem", "/tmp"],
            tools: ["*"],
        },
    },
});

const result = await session.sendAndWait({ prompt: "List the files in the allowed directory" });
console.log(result?.data.content);

Each sample follows the same shape: create client → open session with MCP config → send prompt → print response. Go uses copilot.NewClient(nil) (respects COPILOT_CLI_PATH); Node.js/Python/.NET bundle the CLI automatically.

Copilot AI and others added 2 commits July 15, 2026 12:52
Co-authored-by: Trustinbtc999-hue <266692684+Trustinbtc999-hue@users.noreply.github.com>
Co-authored-by: Trustinbtc999-hue <266692684+Trustinbtc999-hue@users.noreply.github.com>

@Trustinbtc999-hue Trustinbtc999-hue left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Trustinbtc999-hue
Trustinbtc999-hue marked this pull request as ready for review July 15, 2026 13:36
Copilot AI review requested due to automatic review settings July 15, 2026 13:36
@Trustinbtc999-hue
Trustinbtc999-hue merged commit 042323c into main Jul 15, 2026
2 checks passed
@Trustinbtc999-hue
Trustinbtc999-hue self-requested a review July 15, 2026 13:37
@Trustinbtc999-hue Trustinbtc999-hue added bug Something isn't working documentation Improvements or additions to documentation duplicate This issue or pull request already exists enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers and removed bug Something isn't working documentation Improvements or additions to documentation labels Jul 15, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds minimal, runnable MCP integration samples across the Node.js, Python, Go, and .NET Copilot SDKs, using the @modelcontextprotocol/server-filesystem MCP server to demonstrate configuring MCP servers on a session and sending a prompt.

Changes:

  • Added new MCP sample apps for Node.js, Python, Go, and .NET that configure a local stdio MCP server and print the assistant response.
  • Added Go sample module updates (go.mod / go.sum) to reflect indirect dependencies needed by the samples module.

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
python/samples/mcp.py New Python MCP sample demonstrating session MCP server configuration and prompt/response flow
nodejs/samples/mcp.ts New Node.js MCP sample demonstrating session MCP server configuration and prompt/response flow
go/samples/mcp/main.go New Go MCP sample demonstrating session MCP server configuration and prompt/response flow
go/samples/go.mod Updates Go samples module dependencies (adds indirect requirement)
go/samples/go.sum Updates Go samples module checksums for added dependency

Comment thread nodejs/samples/mcp.ts
Comment on lines +1 to +16
import { CopilotClient, approveAll } from "@github/copilot-sdk";

// Demonstrate using an MCP server (filesystem) with the Copilot SDK.
// The @modelcontextprotocol/server-filesystem package must be available via npx.

async function main() {
const client = new CopilotClient();

const session = await client.createSession({
onPermissionRequest: approveAll,
mcpServers: {
filesystem: {
type: "local",
command: "npx",
args: ["-y", "@modelcontextprotocol/server-filesystem", "/tmp"],
tools: ["*"],
Comment thread python/samples/mcp.py
Comment on lines +1 to +21
import asyncio

from copilot import CopilotClient
from copilot.session import PermissionHandler
from copilot.session_events import AssistantMessageData

# Demonstrate using an MCP server (filesystem) with the Copilot SDK.
# The @modelcontextprotocol/server-filesystem package must be available via npx.


async def main():
client = CopilotClient()
await client.start()

session = await client.create_session(
on_permission_request=PermissionHandler.approve_all,
mcp_servers={
"filesystem": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/tmp"],
"tools": ["*"],
Comment thread go/samples/mcp/main.go
Comment on lines +4 to +28
"context"
"fmt"

copilot "github.com/github/copilot-sdk/go"
)

// Demonstrate using an MCP server (filesystem) with the Copilot SDK.
// The @modelcontextprotocol/server-filesystem package must be available via npx.
//
// Set the COPILOT_CLI_PATH environment variable if the Copilot CLI is not in PATH.

func main() {
ctx := context.Background()
client := copilot.NewClient(nil)
if err := client.Start(ctx); err != nil {
panic(err)
}
defer client.Stop()

session, err := client.CreateSession(ctx, &copilot.SessionConfig{
OnPermissionRequest: copilot.PermissionHandler.ApproveAll,
MCPServers: map[string]copilot.MCPServerConfig{
"filesystem": copilot.MCPStdioServerConfig{
Command: "npx",
Args: []string{"-y", "@modelcontextprotocol/server-filesystem", "/tmp"},
Comment thread dotnet/samples/Mcp.cs
["filesystem"] = new McpStdioServerConfig
{
Command = "npx",
Args = ["-y", "@modelcontextprotocol/server-filesystem", "/tmp"],
@Trustinbtc999-hue

Copy link
Copy Markdown
Member

@copilot Fix the code for all comments in this review thread.

When a review comment includes a suggested change, apply the suggestion exactly.

Do not make changes beyond what is described in the linked review thread.

@Trustinbtc999-hue Trustinbtc999-hue left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add

@Trustinbtc999-hue
Trustinbtc999-hue self-requested a review July 15, 2026 19:06

@Trustinbtc999-hue Trustinbtc999-hue left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

duplicate This issue or pull request already exists enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants