Skip to content

Add MCP tooling to Claude Python sample agent#200

Merged
JoanBency merged 7 commits into
mainfrom
JoanBency/claudePython-toolingImplementation
Jan 30, 2026
Merged

Add MCP tooling to Claude Python sample agent#200
JoanBency merged 7 commits into
mainfrom
JoanBency/claudePython-toolingImplementation

Conversation

@JoanBency

Copy link
Copy Markdown
Contributor

Summary

This PR adds Model Context Protocol (MCP) tooling integration and complete observability instrumentation to the Claude Python sample agent, aligning it with the Agent365 SDK best practices demonstrated in the CrewAI sample.

Changes

MCP Tooling Integration

  • New file: [mcp_tool_registration_service.py] - Claude-specific MCP tool service that:
    - Uses [McpToolServerConfigurationService] for production MCP server discovery
    - Falls back to [ToolingManifest.json] for local development
    - Handles SSE (Server-Sent Events) parsing for MCP responses
    - Provides tool discovery (tools/list) and execution (tools/call) with retry logic
    - Converts MCP servers to Claude SDK's [mcp_servers] format

Observability Implementation

  • New file: [turn_context_utils.py] - Shared utilities for extracting observability details from TurnContext (matches CrewAI pattern)
  • Updated: [agent.py] - Complete observability instrumentation:
    - [ExecuteToolScope] for individual tool execution tracking

Testing

✅ Verified MCP tool discovery and connection
✅ Verified observability spans are created correctly
✅ All Python files pass syntax validation
✅ All files have Microsoft copyright headers
✅ No "Kairo" legacy references

Copilot AI review requested due to automatic review settings January 29, 2026 00:52
@JoanBency JoanBency requested a review from a team as a code owner January 29, 2026 00:52
@JoanBency JoanBency removed the request for review from Copilot January 29, 2026 00:58

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR adds MCP-based tooling and full observability instrumentation to the Claude Python sample agent, bringing it in line with the Agent365 SDK and CrewAI sample patterns.

Changes:

  • Introduces turn_context_utils.py to normalize extraction of agent, caller, tenant, and request details for observability scopes.
  • Adds mcp_tool_registration_service.py to discover MCP servers (via SDK or ToolingManifest.json fallback), list tools, and execute tools over HTTP/SSE with retry and timeout handling.
  • Updates agent.py, ToolingManifest.json, README.md, and .env.template to wire in MCP tooling, switch to BaggageBuilder + Invoke/Inference scopes, and document/configure MCP and observability options.

Reviewed changes

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

Show a summary per file
File Description
python/claude/sample-agent/turn_context_utils.py New shared helper for extracting TurnContext details and constructing observability models (AgentDetails, CallerDetails, TenantDetails, Request, InvokeAgentDetails).
python/claude/sample-agent/mcp_tool_registration_service.py New Claude-specific MCP registration service that discovers MCP servers, parses SSE responses, lists tools, and executes tools with retry/timeout logic and Claude-compatible configuration shapes.
python/claude/sample-agent/agent.py Wires in MCP discovery/execution, replaces ad-hoc observability with BaggageBuilder + InvokeAgentScope/InferenceScope, and adds ExecuteToolScope instrumentation for tool calls, but introduces signature mismatches with the existing host/interface.
python/claude/sample-agent/ToolingManifest.json Expands manifest to include additional MCP servers (Mail, M365 Copilot, Calendar) for the Claude sample.
python/claude/sample-agent/README.md Documents MCP tooling support, manifest-based configuration, and MCP-related environment variables and auth flows.
python/claude/sample-agent/.env.template Updates environment template with MCP-related settings (ENVIRONMENT, MCP platform endpoint) and observability log-level configuration.

Comment thread python/claude/sample-agent/agent.py Outdated
Comment thread python/claude/sample-agent/agent.py
Comment thread python/claude/sample-agent/README.md
Comment thread python/claude/sample-agent/.env.template Outdated
Comment thread python/claude/sample-agent/mcp_tool_registration_service.py Outdated
Comment thread python/claude/sample-agent/mcp_tool_registration_service.py Outdated
Comment thread python/claude/sample-agent/agent.py

@nikhilNava nikhilNava 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.

Please address all the changes asked by the Johan/Claud agent.

Comment thread python/claude/sample-agent/turn_context_utils.py
@JoanBency JoanBency requested a review from nikhilNava January 29, 2026 23:06
Comment thread python/claude/sample-agent/turn_context_utils.py
@nikhilNava

Copy link
Copy Markdown

Be sure to change the target branch to your other open branch.

@JoanBency JoanBency merged commit ed93b0b into main Jan 30, 2026
18 checks passed
@JoanBency JoanBency deleted the JoanBency/claudePython-toolingImplementation branch January 30, 2026 18:36
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.

5 participants