Skip to content

Add VNet enterprise tests for Foundry IQ KB MCP server#545

Closed
farzad528 wants to merge 1164 commits intomicrosoft-foundry:mainfrom
farzad528:vnet-foundry-iq-kb-mcp-testing
Closed

Add VNet enterprise tests for Foundry IQ KB MCP server#545
farzad528 wants to merge 1164 commits intomicrosoft-foundry:mainfrom
farzad528:vnet-foundry-iq-kb-mcp-testing

Conversation

@farzad528
Copy link
Copy Markdown

Summary

Adds test scripts and infrastructure for validating the Foundry IQ Knowledge Base MCP server with Azure AI Foundry Agent Service V2 in a VNet/private endpoint scenario (template 19).

This mirrors the testing approach from #450 but specifically targets the Foundry IQ KB MCP server and Azure AI Search Knowledge Base API (\2025-11-01-preview).

New Files

File Purpose
\ oundry-iq-kb-mcp/Dockerfile\ Node 22 multi-stage container image for the MCP server
\ ests/create_sample_kb.py\ Seeds AI Search with 12 sample KB documents (SharePoint, index, web)
\ ests/test_kb_api_connectivity.py\ 5 direct REST tests against AI Search KB API
\ ests/test_foundry_iq_kb_mcp.py\ 4 Agent V2 integration tests via MCP tool
\ ests/TESTING-GUIDE-KB-MCP.md\ Full testing guide with VNet setup and troubleshooting

Architecture

\
Test Client → Agent Service → Data Proxy → (networkInjection) → VNet
├── Foundry IQ KB MCP Server (Container App)
└── Azure AI Search (Private Endpoint)
\\

Key finding: The MCP server must be containerized inside the VNet when AI Search has public access disabled, because the MCP server makes direct HTTP \ etch()\ calls to the AI Search KB API endpoint. A hosted MCP server (e.g., on Vercel) cannot reach private endpoints.

Test Coverage

  • MCP Connectivity: Direct HTTP session flow (initialize → tools/list → tools/call for \knowledge_base_retrieve)
  • KB Retrieve via Agent V2: Create agent with MCPTool → query KB → validate results
  • SharePoint Headers: Verify \x-ms-sharepoint-*\ header passthrough
  • Multi-Source Retrieval: Results from SharePoint, search index, and web sources
  • KB API Direct Tests: Endpoint reachability, index query, semantic search

Related

sdgilley and others added 30 commits May 19, 2025 13:20
Update to me (for now), team not available here yet.
…r/fix-role-assignment

Fixed Workspace GUID and References
…-1rp

Adapting Semantic Kernel agents to use Foundry project endpoint
Tweaked readme and comments in config files
…ve-update

update voice live agent sample for FDP projects
…amples

Update C# samples to use latest SDK
ericsuh and others added 28 commits January 23, 2026 16:07
* [Hosted Agents] fix the dependency version

* misc: bump version
* Automatic fixes

* Mengla/add af foundry tools sample (microsoft-foundry#1)

* Bump hosted agents version to 1.0.0b8

* remove agent_framework dependency in requrements.txt

* add a sample for agentframework with foundry tool

* align naming convention

---------

Co-authored-by: junanchen <[email protected]>

* use latest from_agent_framework signature (microsoft-foundry#2)

* use latest from_agent_framework signature

* remove keyword

* lg tools (microsoft-foundry#3)

* add lg tools sample, bump agentserver version to 1.0.0b9

* rename FoundryToolsReactAgent

* add desc FoundryToolsReactAgent

* remove unused file

---------

Co-authored-by: foundry-samples automation <[email protected]>
Co-authored-by: junanchen <[email protected]>
Co-authored-by: Jun'an Chen <[email protected]>
…undry#491)

* Automatic fixes

* Mengla/add af foundry tools sample (microsoft-foundry#1)

* Bump hosted agents version to 1.0.0b8

* remove agent_framework dependency in requrements.txt

* add a sample for agentframework with foundry tool

* align naming convention

---------

Co-authored-by: junanchen <[email protected]>

* use latest from_agent_framework signature (microsoft-foundry#2)

* use latest from_agent_framework signature

* remove keyword

* lg tools (microsoft-foundry#3)

* add lg tools sample, bump agentserver version to 1.0.0b9

* rename FoundryToolsReactAgent

* add desc FoundryToolsReactAgent

* remove unused file

* restore the correct readme

---------

Co-authored-by: foundry-samples automation <[email protected]>
Co-authored-by: junanchen <[email protected]>
Co-authored-by: Jun'an Chen <[email protected]>
… version pinning. Change to use Acr image build, to not require local docker. (microsoft-foundry#494)
…osoft-foundry#496)

* Initial plan

* Update FoundryA365 README to clarify agent blueprint approval workflow

Co-authored-by: fosteramanda <[email protected]>

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: fosteramanda <[email protected]>
…tandard-agent-setup (microsoft-foundry#503)

- Added dnsZonesSubscriptionId parameter to allow DNS zones from different subscriptions
- Updated all DNS zone references in private-endpoint-and-dns.bicep to support cross-subscription scope
- Added comprehensive documentation in README.md about cross-subscription requirements
- Updated main.bicepparam with clear usage examples and warnings
- Maintains backward compatibility (empty parameter uses current subscription)

This enables users to reference existing private DNS zones located in a different Azure subscription than the deployment subscription, which is useful in enterprise environments with centralized DNS management.
* update agent usage detail

* add use agent in response

---------

Co-authored-by: bobogogo1990 <[email protected]>
* Automatic fixes

* Mengla/add af foundry tools sample (microsoft-foundry#1)

* Bump hosted agents version to 1.0.0b8

* remove agent_framework dependency in requrements.txt

* add a sample for agentframework with foundry tool

* align naming convention

---------

Co-authored-by: junanchen <[email protected]>

* use latest from_agent_framework signature (microsoft-foundry#2)

* use latest from_agent_framework signature

* remove keyword

* lg tools (microsoft-foundry#3)

* add lg tools sample, bump agentserver version to 1.0.0b9

* rename FoundryToolsReactAgent

* add desc FoundryToolsReactAgent

* LG HITL example

* remove unused file

* validated HITL

* af ai-function based HITL

* af workflow hitl

* workflow hitl

* restore the correct readme

* add workflow for python sample test

* modify triggering condition

* fix requirements.txt

* add missing env

* fix workflow

* fix type checking issue

* Fix workflow hitl issue

* fix requirements.txt

* fix sample

* fix sample

* chore:  Add C# hosted agent testing to CI/CD pipeline

* minor fix for samples

* Automatic fixes

* fix: SystemUtilityAgent sample

* chore: improve C# build error reporting in CI workflow

* test: ci error details

* Revert "test: ci error details"

This reverts commit e48fe24.

* misc: increate error message limit

* Reapply "test: ci error details"

This reverts commit 7c6e1ed.

* Revert "Reapply "test: ci error details""

This reverts commit d416fd5.

* bump to 1.0.0b10 (microsoft-foundry#8)

* exclude CI related changes

* sync latest manually

---------

Co-authored-by: foundry-samples automation <[email protected]>
Co-authored-by: junanchen <[email protected]>
Co-authored-by: Jun'an Chen <[email protected]>
Co-authored-by: Declan <[email protected]>
Co-authored-by: lixiaoli <[email protected]>
…oundry#500)

* Fixes requirements.txt

* Fixes evaluation implementation

* Corrected C# Evaluations implementation

* Correct lost section tags
* Add RFT sample for score_model grader, delete the old incorrect sample

* Add RFT samples for python grader

* Add RFT sample for string_check grader

* Add RFT sample for text similarity grader

* Add RFT sample for multi grader

* Update README

* Fix for reasoning model doesn't support temperature

* Remove multi-grader sample as the support is not there in CLI yet

* Refatoring, update datasets, and fix errors

* Update medmcq dataset to match the file formats - reference_answer was missing
Merging on behalf of hosted agent PM + eng reviewers
* Sample for local tool calls in agent

* Remove image since it is not relevant.
…ies when calling tools (microsoft-foundry#514)

* Sample for local tool calls in agent

* Remove image since it is not relevant.

* Updating sample to use hotels instead of date and time for local tool calls
…oyment. Include sample launch.json if using VS Code (microsoft-foundry#516)

* Sample for local tool calls in agent

* Remove image since it is not relevant.

* Updating sample to use hotels instead of date and time for local tool calls

* -Align PROJECT_ENDPOINT and MODEL_DEPLOYMENT_NAME with azd conventions for agents
and add VS Code launch.json for easier local debugging
Removed the questions.jsonl file from CODEOWNERS and updated the CLI fine-tuning ownership.
… substitution (microsoft-foundry#518)

* Sample for local tool calls in agent

* Remove image since it is not relevant.

* Updating sample to use hotels instead of date and time for local tool calls

* -Align PROJECT_ENDPOINT and MODEL_DEPLOYMENT_NAME with azd conventions for agents
and add VS Code launch.json for easier local debugging

* Updating model to use chat reference from resources
…y#519)

- Move C# samples into AgentFramework/ subfolder
- Update .gitignore

Note: python/hosted-agents/agent-framework/agent-with-local-tools/ and python/hosted-agents/code-interpreter-custom/ unchanged (foundry-samples is source of truth)
…ry#520)

* Sample for local tool calls in agent

* Remove image since it is not relevant.

* Updating sample to use hotels instead of date and time for local tool calls

* -Align PROJECT_ENDPOINT and MODEL_DEPLOYMENT_NAME with azd conventions for agents
and add VS Code launch.json for easier local debugging

* Updating model to use chat reference from resources

* Adding AgentWithLocalTools csharp sample

* Updating default model

* Moving to AgentFramework folder
…required. (microsoft-foundry#524)

* Sample for local tool calls in agent

* Remove image since it is not relevant.

* Updating sample to use hotels instead of date and time for local tool calls

* -Align PROJECT_ENDPOINT and MODEL_DEPLOYMENT_NAME with azd conventions for agents
and add VS Code launch.json for easier local debugging

* Updating model to use chat reference from resources

* Adding AgentWithLocalTools csharp sample

* Updating default model

* Moving to AgentFramework folder

* Remove credential for agent framework as it is not required.
…foundry#525)

* Update Python enterprise agent tutorial to v2 SDK

Migrate from azure-ai-agents (v1) to azure-ai-projects 2.0.0b3 (v2):

main.py:
- Replace AgentsClient with AIProjectClient + openai_client
- Replace create_agent() with agents.create_version() + PromptAgentDefinition
- Replace SharepointTool with SharepointPreviewTool + SharepointGroundingToolParameters
- Replace McpTool with MCPTool (require_approval='always')
- Replace thread/message/run pattern with Responses API
- Replace RunHandler/ToolApproval with McpApprovalResponse
- Use context manager pattern for client lifecycle

evaluate.py:
- Standardize env vars: AZURE_AI_PROJECT_ENDPOINT -> PROJECT_ENDPOINT
- Standardize env vars: AZURE_AI_MODEL_DEPLOYMENT_NAME -> MODEL_DEPLOYMENT_NAME
- Update usage comment to reference azure-ai-projects==2.0.0b3

requirements.txt:
- Remove azure-ai-agents==1.2.0b6
- Update azure-ai-projects from 1.0.0 to 2.0.0b3
- Add openai dependency

* Address review: output name/version, rename chat_with_assistant to create_agent_response

* Use context managers for credential, project client, and openai client

* chore: migrate C# ModernWorkplaceAssistant to v2 SDK (Azure.AI.Projects + Responses API)

- Replace PersistentAgentsClient with AIProjectClient + PromptAgentDefinition
- Replace threads/runs with Responses API (ProjectResponsesClient)
- Replace SharepointToolDefinition with SharepointPreviewTool + SharePointGroundingToolOptions
- Replace MCPToolDefinition with McpTool from OpenAI.Responses
- Replace SubmitToolApprovalAction with McpToolCallApprovalRequestItem pattern
- Update csproj: Azure.AI.Projects 2.0.0-beta.1 + Azure.AI.Projects.OpenAI 1.0.0-beta.5
- Remove Azure.AI.Agents.Persistent dependency
- Preserve all snippet ID tags for doc system

* fix: use correct v2 SDK type names and package versions for C# sample

- SharepointPreviewTool -> SharepointAgentTool (actual type in Azure.AI.Projects.OpenAI)
- GetProjectOpenAIClient() -> .OpenAI property accessor
- Azure.AI.Projects 2.0.0-beta.1 -> 1.2.0-beta.5 (available on azure-sdk-dev feed)
- Azure.Identity 1.13.1 -> 1.17.1 (required by Azure.AI.Projects 1.2.0-beta.5)
- Add NoWarn OPENAI001 to csproj (preview API suppression)
- GetConnectionAsync now includes required includeCredentials parameter
- Build verified: dotnet build succeeds with azure-sdk-dev feed packages

---------

Co-authored-by: Jon Burchel <[email protected]>
…t-foundry#526)

* Sample for local tool calls in agent

* Remove image since it is not relevant.

* Updating sample to use hotels instead of date and time for local tool calls

* -Align PROJECT_ENDPOINT and MODEL_DEPLOYMENT_NAME with azd conventions for agents
and add VS Code launch.json for easier local debugging

* Updating model to use chat reference from resources

* Adding AgentWithLocalTools csharp sample

* Updating default model

* Moving to AgentFramework folder

* Remove credential for agent framework as it is not required.

* Pin azure-ai-agentserver-agentframework to 1.0.0b10
Co-authored-by: foundry-samples-repo-sync[bot] <foundry-samples-repo-sync[bot]@users.noreply.github.com>
…sources)

- Reverted 15-private-network-standard-agent-setup to match upstream/main exactly
- Added 19-hybrid-private-resources-agent-setup: hybrid architecture with public
  AI Services endpoint and private backend resources (AI Search, Cosmos DB, Storage)
- Template 19 enables portal-based agent testing while keeping data resources private
- Includes TESTING-GUIDE.md, test scripts, and architecture diagrams in template 19
Updates based on actual testing:
- Fixed SDK usage: use AzureAISearchTool class, not dict format
- Added note about portal limitation with network injection
- Added correct API version (2025-05-15-preview) for REST API
- Added MCP HTTP server implementation (Streamable HTTP transport)
- Updated MCP deployment instructions with proper HTTP-based server
- Added connection name lookup command
- Fixed test script to use AzureAISearchTool class

MCP Server:
- Added mcp-http-server/server.py - Flask-based MCP server
- Added mcp-http-server/Dockerfile for containerization
- Implements JSON-RPC over HTTP as required by Azure AI Agents
Add test scripts and infrastructure for validating the Foundry IQ Knowledge
Base MCP server with Azure AI Foundry Agent Service V2 in a VNet/private
endpoint scenario (template 19).

New files:
- foundry-iq-kb-mcp/Dockerfile: Container image for the MCP server
- tests/create_sample_kb.py: Seed AI Search with sample KB data
- tests/test_kb_api_connectivity.py: Direct REST tests against AI Search KB API
- tests/test_foundry_iq_kb_mcp.py: Agent V2 integration tests via MCP tool
- tests/TESTING-GUIDE-KB-MCP.md: Full testing guide with VNet setup guidance

The MCP server must be containerized inside the VNet when AI Search has
public access disabled, as it makes direct HTTP calls to the KB API endpoint.

Co-authored-by: Copilot <[email protected]>
Covers 11 enterprise scenarios with pre-configured variables:
1. Public (basic), 2. PNA disabled, 3. VNet injection,
4. PNA+PLE+VPN, 5. CMK, 6. Custom subdomain,
7. Disable local auth, 8. RBAC only, 9. UAI,
10. BYO Storage, 11. Actionable error messaging

Use with VS Code REST Client extension.

Co-authored-by: Copilot <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.