Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,9 @@ public Agent365Agent(Kernel kernel, IServiceProvider service, IMcpToolRegistrati
if (MyAgent.TermsAndConditionsAccepted)
{
// Provide the tool service with necessary parameters to connect to A365
// The environmentId will be extracted programmatically
string environmentId = Environment.GetEnvironmentVariable("ENVIRONMENT_ID") ?? string.Empty;
this._kernel.ImportPluginFromType<TermsAndConditionsAcceptedPlugin>();

toolService.AddToolServersToAgent(kernel, environmentId, userAuthorization, turnContext);
toolService.AddToolServersToAgent(kernel, userAuthorization, turnContext);
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development",
"USE_AGENTIC_AUTH": "false",
"ENVIRONMENT_ID": "", // This is the Environment id, only needed when using MCPPlatform mode
},
"applicationUrl": "https://localhost:64896;http://localhost:64897"
}
Expand Down
1 change: 0 additions & 1 deletion nodejs/claude/sample-agent/.env.template
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ ANTHROPIC_API_KEY=
# MCP Tooling Configuration
TOOLS_MODE=MCPPlatform # Options: MockMCPServer | MCPPlatform
BEARER_TOKEN=
USE_ENVIRONMENT_ID=false

# Environment Settings
NODE_ENV=development # Retrieve mcp servers from ToolingManifest
Expand Down
1 change: 0 additions & 1 deletion nodejs/claude/sample-agent/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ export async function getClient(authorization: Authorization, turnContext: TurnC
await toolService.addToolServersToAgent(
agentConfig,
process.env.AGENTIC_USER_ID || '',
process.env.MCP_ENVIRONMENT_ID || "",
authorization,
turnContext,
process.env.MCP_AUTH_TOKEN || "",
Expand Down
1 change: 0 additions & 1 deletion nodejs/langchain/sample-agent/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ OPENAI_API_KEY=
# MCP Tooling Configuration
TOOLS_MODE=MCPPlatform # Options: MockMCPServer | MCPPlatform
BEARER_TOKEN=
USE_ENVIRONMENT_ID=false

# MCPPlatform Configuration. Default to production values.
MCP_PLATFORM_ENDPOINT=
Expand Down
11 changes: 3 additions & 8 deletions nodejs/langchain/sample-agent/Agent-Code-Walkthrough.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ export async function getClient(authorization: any, turnContext: TurnContext): P
tools = await toolService.addMcpToolServers(
mcpClientConfig,
'',
process.env.ENVIRONMENT_ID || "",
authorization,
turnContext,
process.env.BEARER_TOKEN || "",
Expand Down Expand Up @@ -179,22 +178,18 @@ export async function getClient(authorization: any, turnContext: TurnContext): P

**LangChain Integration**:
- **MCP Tools**: Loads tools from MCP tool servers dynamically
- **Environment-Based**: Uses `ENVIRONMENT_ID` and `BEARER_TOKEN` for authentication
- **Auth**: Uses `BEARER_TOKEN` for authentication
- **OpenAI Model**: Configured for GPT-4o-mini
- **Error Handling**: Gracefully handles tool loading failures

**Authentication Options**:
1. **The environment for which your servers are provisioned**:
```
ENVIRONMENT_ID=
```

2. **OBO (On-Behalf-Of) Authentication**:
1. **OBO (On-Behalf-Of) Authentication**:
```
BEARER_TOKEN=<your-mcp-bearer-token>
```

3. **Agentic Authentication**:
2. **Agentic Authentication**:
```
USE_AGENTIC_AUTH=true

Expand Down
1 change: 0 additions & 1 deletion nodejs/langchain/sample-agent/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ export async function getClient(authorization: Authorization, turnContext: TurnC
agentWithMcpTools = await toolService.addToolServersToAgent(
agent,
'',
process.env.ENVIRONMENT_ID || "",
authorization,
turnContext,
process.env.BEARER_TOKEN || "",
Expand Down
1 change: 0 additions & 1 deletion nodejs/n8n/sample-agent/.env.template
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ PORT=3978

# MCP Tool Server Configuration (optional)
# Set these if you want to provide Microsoft 365 tools to your n8n workflow
MCP_ENVIRONMENT_ID=
MCP_AUTH_TOKEN=
TOOLS_MODE=MCPPlatform

Expand Down
1 change: 0 additions & 1 deletion nodejs/n8n/sample-agent/Agent-Code-Walkthrough.MD
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,6 @@ agentic_altBlueprintConnectionName=service_connection
agentic_scopes=ea9ffc3e-8a23-4a7d-836d-234d7c7565c1/.default

# MCP Tools (Optional)
MCP_ENVIRONMENT_ID=your-environment-id
MCP_AUTH_TOKEN=optional-bearer-token
TOOLS_MODE=MCPPlatform
```
Expand Down
7 changes: 1 addition & 6 deletions nodejs/n8n/sample-agent/src/mcpToolRegistrationService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ export class McpToolRegistrationService {

async getMcpServers(
agentUserId: string,
environmentId: string,
authorization: Authorization,
turnContext: TurnContext,
authToken: string
Expand All @@ -31,7 +30,7 @@ export class McpToolRegistrationService {
}

const mcpServers: McpServer[] = [];
const servers = await this.configService.listToolServers(agentUserId, environmentId, authToken);
const servers = await this.configService.listToolServers(agentUserId, authToken);

for (const server of servers) {
// Compose headers if values are available
Expand All @@ -40,10 +39,6 @@ export class McpToolRegistrationService {
headers['Authorization'] = `Bearer ${authToken}`;
}

if (environmentId) {
headers['x-ms-environment-id'] = environmentId;
}

// Add each server to the config object
const mcpServer = {
mcpServerName: server.mcpServerName,
Expand Down
1 change: 0 additions & 1 deletion nodejs/n8n/sample-agent/src/n8nAgent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,6 @@ export class N8nAgent {
try {
mcpServers.push(...await this.toolService.getMcpServers(
process.env.AGENTIC_USER_ID || '',
process.env.MCP_ENVIRONMENT_ID || "",
this.authorization,
turnContext,
process.env.MCP_AUTH_TOKEN || ""
Expand Down
1 change: 0 additions & 1 deletion nodejs/openai/sample-agent/.env.template
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ OPENAI_API_KEY=
# MCP Tooling Configuration
TOOLS_MODE=MCPPlatform # Options: MockMCPServer | MCPPlatform
BEARER_TOKEN=
USE_ENVIRONMENT_ID=false

# Environment Settings
NODE_ENV=development # Retrieve mcp servers from ToolingManifest
Expand Down
4 changes: 0 additions & 4 deletions nodejs/openai/sample-agent/AGENT-CODE-WALKTHROUGH.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ export async function getClient(authorization: any, turnContext: TurnContext): P
await toolService.addToolServersToAgent(
agent,
process.env.AGENTIC_USER_ID || '',
process.env.MCP_ENVIRONMENT_ID || "",
authorization,
turnContext,
process.env.MCP_AUTH_TOKEN || "",
Expand All @@ -149,7 +148,6 @@ export async function getClient(authorization: any, turnContext: TurnContext): P

**Environment Variables**:
- `AGENTIC_USER_ID`: User identifier for the agent
- `MCP_ENVIRONMENT_ID`: Environment where MCP servers are provisioned
- `MCP_AUTH_TOKEN`: Bearer token for MCP server authentication

---
Expand Down Expand Up @@ -223,7 +221,6 @@ MCP servers are registered in the `getClient` function:
await toolService.addToolServersToAgent(
agent,
process.env.AGENTIC_USER_ID || '',
process.env.MCP_ENVIRONMENT_ID || "",
authorization,
turnContext,
process.env.MCP_AUTH_TOKEN || "",
Expand All @@ -234,7 +231,6 @@ await toolService.addToolServersToAgent(

**Environment Variables**:
- `AGENTIC_USER_ID`: Identifier for the agent instance
- `MCP_ENVIRONMENT_ID`: Environment ID for MCP server provisioning
- `MCP_AUTH_TOKEN`: Bearer token for MCP authentication

**Authentication Modes**:
Expand Down
1 change: 0 additions & 1 deletion nodejs/openai/sample-agent/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ export async function getClient(authorization: any, turnContext: TurnContext): P
await toolService.addToolServersToAgent(
agent,
process.env.AGENTIC_USER_ID || '',
process.env.MCP_ENVIRONMENT_ID || "",
authorization,
turnContext,
process.env.MCP_AUTH_TOKEN || "",
Expand Down
1 change: 0 additions & 1 deletion nodejs/perplexity/sample-agent/.env.template
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ CLIENT_SECRET=
TENANT_ID=

# MCP Tools Configuration (optional - for M365 integration)
MCP_ENVIRONMENT_ID=
AGENTIC_USER_ID=
MCP_AUTH_TOKEN=

Expand Down
18 changes: 8 additions & 10 deletions python/agent-framework/sample-agent/.env.template
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,21 @@ OPENAI_API_KEY=
MCP_SERVER_HOST=
MCP_PLATFORM_ENDPOINT=
# Logging

LOG_LEVEL=INFO

# Observability Configuration
OBSERVABILITY_SERVICE_NAME=agent-framework-sample
OBSERVABILITY_SERVICE_NAMESPACE=agent-framework.samples

ENV_ID=

BEARER_TOKEN=
OPENAI_MODEL=

#USE_ENVIRONMENT_ID=false
USE_AGENTIC_AUTH=true

# Agentic Authentication Scope
AGENTIC_AUTH_SCOPE=

AGENT_ID=

# Agent365 Agentic Authentication Configuration
Expand All @@ -32,13 +30,13 @@ CONNECTIONS__SERVICE_CONNECTION__SETTINGS__SCOPES=
AGENTAPPLICATION__USERAUTHORIZATION__HANDLERS__AGENTIC__SETTINGS__TYPE=AgenticUserAuthorization
AGENTAPPLICATION__USERAUTHORIZATION__HANDLERS__AGENTIC__SETTINGS__SCOPES=https://graph.microsoft.com/.default
AGENTAPPLICATION__USERAUTHORIZATION__HANDLERS__AGENTIC__SETTINGS__ALTERNATEBLUEPRINTCONNECTIONNAME=https://graph.microsoft.com/.default

CONNECTIONSMAP_0_SERVICEURL=*
CONNECTIONSMAP_0_CONNECTION=SERVICE_CONNECTION

# Optional: Server Configuration
PORT=3978

# Azure OpenAI Configuration
AZURE_OPENAI_API_KEY=
AZURE_OPENAI_ENDPOINT=
Expand All @@ -51,5 +49,5 @@ ENABLE_A365_OBSERVABILITY_EXPORTER=false
PYTHON_ENVIRONMENT=development

# Enable otel logs on AgentFramework SDK. Required for auto instrumentation
ENABLE_OTEL=true
ENABLE_OTEL=true
ENABLE_SENSITIVE_DATA=true
Loading