# Practical ways to use the Claude Agent SDK
🔌 Connect Playwright, databases, GitHub, and more to your agent via MCP for unlimited capabilities.
MCP (External Tool Connections) connects external MCP servers (browsers, databases, APIs) to your agent via the Model Context Protocol.
📌 Title: Connecting External Tools with MCP
🔗 URL:
🧩 Overview
Specify external MCP servers in `mcp_servers` via stdio / HTTP / SSE transports. Control tool access with `allowedTools` and inject credentials via `env` or `headers`.
🛠 How to use it
Specify MCP servers in `mcp_servers` via stdio, HTTP, or SSE transports. For example, Playwright uses `{"command": "npx", "args": ["
@playwright/mcp
@latest"]}`, and Postgres injects credentials via `"env": {"DATABASE_URL": "..."}`. Control access with `allowed_tools=["mcp__postgres__query"]`.
🏗 Practical usage
- Connect Playwright MCP and run "Open and describe what you see" for E2E testing or web scraping agents.
- Connect a Postgres MCP server and ask "Daily signups for last week" — Claude auto-detects schema, generates SQL, and executes. Lock down with `allowedTools: ["mcp__postgres__query"]`.
- Build GitHub Issue triage and auto-response bots with the GitHub MCP server.
- Verify connection status at startup via `system/init` message's `mcp_servers[].status`.
💡 Use cases
🌐 Browser automation with Playwright
🗄 Natural language database queries
📋 Automated GitHub Issue triage
⚠️ Watch out
`permissionMode: "acceptEdits"` does NOT auto-approve MCP tools. Use `allowedTools` wildcards (`mcp__github__*`) to safely whitelist specific servers. Default connection timeout is 60 seconds.
#
ClaudeAgentSDK# #
AI#