mcp-lab
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
mcp-lab
Companion repo for the "MCP" post (#14) on
karthiksolution.wordpress.com,
in the AI/agents series. Builds on the tracer/drift-monitor infra
established across earlier posts, most directly
structured-outputs-lab.
What's in here
A real MCP (Model Context Protocol) server, mcp_server/server.py,
exposing all 3 of the protocol's primitives around a small ops-
knowledge domain:
Tools:
search_incidents(query),get_runbook(service)Resource:
incident://{incident_id}, a full incident record addressed by URIPrompt:
postmortem_summary(incident_id), a reusable, pre-filled prompt template
Two ways to connect a Gemini-based client to it:
mcp_client_native:google-genai's own experimental built-in MCP bridge, pass a live MCP session directly into generation config and automatic function calling drives it. Tools only, async client only, and (see Pitfalls) requires passingconfigas a plain dict, not atypes.GenerateContentConfigobject, or it crashes.mcp_client_manual: a hand-written bridge covering all 3 primitives, converting MCP tool schemas to Gemini function declarations, running the tool-call loop by hand, and manually fetching the resource and prompt the native bridge can't touch.
common/evaluator.py's ToolCallEvaluator checks structural
correctness against real MCP call history (response.automatic_function_calling_history
for the native bridge, the manual loop's own return value for the
other), not an LLM judge, this post is about protocol plumbing, not
prompt content quality.
Related MCP server: OpsLens AI MCP Server
4 real bugs found while building this, all in Pitfalls
A subprocess launched with the bare string
"python"instead ofsys.executableused the system Python, not the venv, and couldn't findmcpat all.GenerateContentConfig(tools=[session])crashes withTypeError: cannot pickle '_asyncio.Task' object,generate_contentunconditionally deep-copies its config before reaching any MCP-specific handling. Passingconfigas a plain dict avoids it entirely.Schema.from_json_schema()expects aJSONSchemaobject, not the plain dictTool.input_schemaactually is,JSONSchema.model_validate(...)first is required.Replaying a
function_callpart back into conversation history for a hand-written multi-turn loop needs the original part'sthought_signaturepreserved, reconstructing a newPartfrom just the extracted call drops it and the API rejects the next turn.
Setup (Windows / PowerShell)
python -m venv venv
.\venv\Scripts\Activate.ps1
pip install -r requirements.txt
copy .env.example .envEdit .env and set GEMINI_API_KEY to your real key.
Running the demo
python run_demo.pyRunning the offline validation (no API key required beyond a placeholder)
python -m tests_offline.test_data_mock
python -m tests_offline.test_bridge_conversion_mock
python -m tests_offline.test_evaluator_mock
python -m tests_offline.test_llm_utils_config_mockRunning the evaluator
python run_eval.py --save-baseline
python run_eval.pyLicense
MIT, see LICENSE.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Your org's AI agents, tasks, runs, search, and brain files as MCP tools and resources.
Enrich, search, assess, and manage threat intelligence through 80+ typed MCP tools.
Search and manage your team's knowledge from MCP clients.
Governed data discovery, exact queries, decisions, simulations, and runtime utilities over MCP.
Related MCP Servers
AlicenseNot gradedqualityDmaintenanceEnables managing incident response workflows including incidents, on-call, postmortems, and more through the Runframe platform using MCP tools.76 npm4MIT- FlicenseNot gradedqualityDmaintenanceProvides MCP tools to search engineering runbooks and historical incidents using semantic retrieval, supporting evidence-grounded incident investigation.-
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to investigate production incidents by exposing service health, logs, and deployment data through MCP tools.9 npmISC
- FlicenseNot gradedqualityCmaintenanceEnables SafeOps operators to monitor worker health, inspect job queues, investigate incidents, search runbooks, and approve or reject targeted failed-job retries through MCP tools, resources, and a prompt.-