1. Learning objective
Configure an MCP server
Use the Claude Agent SDK’s supported in-process MCP server, limit a tool surface, and separate MCP tool discovery from runtime authorization.
- Guide 2 concepts
- Claude Agent SDK credential and model access
2. Technical context
Understand MCP authorization
MCP makes tools discoverable, but discovery is not authority. A client must explicitly decide which server and tools to trust, while the tool host remains responsible for execution.
3. Run without AIGP
Run MCP
Run the existing claude-agent-tool-intg lab. It creates an in-process MCP server containing only lookup_policy and disables Agent SDK built-in tools.
cd labs/agent-frameworks/anthropic/claude-agent-tool-intg
python3 -m venv .venv && source .venv/bin/activate
python -m pip install -r requirements.txt
export ANTHROPIC_API_KEY=...
export CLAUDE_MODEL=...
python app.pyConfigure MCP server
The existing lab creates one in-process MCP server, disables built-in tools, and approves only the application-owned policy tool.
policy_server = create_sdk_mcp_server(
name="policy",
version="1.0.0",
tools=[lookup_policy],
)
ClaudeAgentOptions(
tools=[],
allowed_tools=[POLICY_TOOL_NAME],
mcp_servers={"policy": policy_server},
strict_mcp_config=True,
)4. Configure AIGP
Configure AIGP tracking
Enable the existing optional runtime-evidence adapter. It observes the model and application tool lifecycle through public SDK hooks. It does not record MCP discovery requests, tool arguments, or tool results.
Authenticate local AIGP requests
Obtain a short-lived token
If your local OSS stack uses Keycloak, the organization and project headers are scope selectors, not authentication. Generate a token from the generated local OAuth client and pass it only through AI_GOVERNANCE_ACCESS_TOKEN for this terminal session.
# Run from the OSS repository after its local Keycloak stack is ready.
cd /path/to/ai-governance-oss
./servers.sh up
# This ignored file contains the local walkthrough client credentials.
# It does not contain an access token.
set -a
source .env.oauth.generated
set +a
# Mint one short-lived token in memory for this terminal only.
export AI_GOVERNANCE_ACCESS_TOKEN="$(
uv run python -c 'from ai_governance.oauth import access_token_from_environment; print(access_token_from_environment())'
)"
# Return to the Claude lab. Its .env supplies Claude and AIGP scope settings.
cd /path/to/labs/agent-frameworks/anthropic/claude-agent-tool-intg
set -a
source .env
set +a
python app.py
# Remove the in-memory token when the session is over.
unset AI_GOVERNANCE_ACCESS_TOKENNever commit, print, paste into a screenshot, or add the token to .env. For development-mode and production workload identities, see Developer Authentication.
5. Inspect execution evidence
Inspect MCP evidence
Inspect the Agent Executions timeline for the one TOOL_CALL. The evidence establishes that the instrumented application reported a tool result; it is not an authorization grant for arbitrary MCP tools.
Verified execution d716945e-f271-490d-bfae-97e6582bd10d. Studio records the reported tool-call lifecycle; the MCP configuration is shown above from the lab source.
6. Test failure handling
Test missing policies
Request a missing policy. The local MCP tool returns an application result. An unavailable AIGP evidence endpoint remains fail-open here because this guide has no protected mutation.
7. Technical boundaries
Understand MCP boundaries
- The Agent SDK and application configure trusted MCP servers and allowed tools.
- The MCP server owns its tool implementation and authentication boundary.
- AIGP has no implicit MCP execution or discovery authority.
8. Next step
Track agent executions
This is a documented integration boundary, not an implicit AIGP feature. Continue only with the capabilities explicitly marked ready in the learning path.
Back to developer guides