Back to catalog / MCP testing
Test MCP server discovery and tool calls locally
Connect an SDK test client to a local server and verify protocol discovery, input validation, and tool results.
Goal
Verify the MCP interface in isolation without depending on production services or accounts.
Steps
- Create a local test-server configuration that uses no real account or production data. [mcp-test] [mcp-tools]
- Create an in-memory session with
async with Client(mcp, raise_exceptions=True) as client:; no subprocess or port is needed. [mcp-test] [mcp-tools] - Inspect
input_schemafromclient.list_tools(), then invoke a read-only test tool withawait client.call_tool(name, args). [mcp-test] [mcp-tools] - Submit missing-field, wrong-type, and unknown-tool requests and verify controlled protocol errors. [mcp-test] [mcp-tools]
- Close the session and confirm child processes and temporary resources are released. [mcp-test] [mcp-tools]
How to verify
Local tests cover initialization, capability discovery, valid and invalid calls, and shutdown without contacting production.
Troubleshooting
If initialization fails, compare client/server protocol versions and inspect the controlled error without enabling production access.
Permissions
Prerequisites
- Python 3.10+ and the MCP Python SDK compatible with the pinned revision
Permissions
- Use a local or isolated test environment; use least privilege and approval for external data or side effects
Limitations
SDK behavior varies by version. Check the pinned revision against your agent or client, then review data retention, authorization, and side effects before production use.
Pinned upstream source
- Repository
- modelcontextprotocol/python-sdk
- File path
- docs/get-started/testing.md
- Pinned commit
754254c08fe1c3eda18b69da3d336106fe8d72d6- Source checked
- 2026-10-14 · Reviewed against the pinned upstream source
Repository metrics
These values describe the upstream repository, not popularity or likes for an individual skill or playbook.
- Stars
- Not collected
- Forks
- Not collected
- Observed at
- Not collected
No metrics snapshot is available yet.
License: MIT