PTC-MCP
PTC-MCP enables programmatic tool calling for Claude Code via MCP, allowing batch execution of multiple tool calls in a single Python script without intermediate results consuming conversation tokens.
Discover available tools: Use
list_callable_toolsto get a JSON list of all namespaced tool names from connected MCP serversInspect tool schemas: Use
inspect_toolto retrieve detailed schema information including input requirements, description, and output structureExecute complex workflows: Run Python scripts with
execute_programwhere tools are available asmcp__<server>__<tool>()async functions, enabling loops, conditional logic, data filtering, and aggregationReduce token usage: Keep intermediate tool results within the Python runtime instead of adding them to the conversation context—only
print()statements are returned as outputImprove performance: Execute 3+ tool calls in a single script to reduce latency from multiple model round-trips
Bridge multiple MCP servers: Connect to downstream servers via stdio or SSE transports
Control access and limits: Apply tool allow/block lists to control which tools are available, and configure timeout and output size limits for execution safety
Provides a Python execution environment that allows for the programmatic orchestration of multiple MCP tools within a single script, enabling batch processing and complex logic without multiple model round-trips.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@PTC-MCPBatch compare the quarterly revenue trends for AMZN, MSFT, and GOOG."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Programmatic Tool Call MCP
Programmatic Tool Calling for Claude Code via MCP.
Claude Code on subscription plans lacks the Anthropic API's programmatic tool calling (PTC) feature, where Claude can write Python scripts that call multiple tools in a single execution. Without it, every tool invocation is a full model round-trip — intermediate results enter the context window, consuming tokens and adding latency.
PTC-MCP fixes this. It's an MCP server that exposes three tools:
list_callable_tools— Returns a JSON list of all available tool names. Use this to discover what's callable before writing a script.inspect_tool— Returns the schema and description of a specific tool, including itsoutputSchemaif the upstream server defines one.execute_program— Runs a Python script with MCP tools injected as async functions. Only stdout comes back. Intermediate tool results stay in the Python runtime and never enter the conversation.
How it works
flowchart TD
A[Claude Code] -->|list_callable_tools| B[PTC-MCP Server]
A -->|inspect_tool| B
A -->|execute_program| B
B --> C[Tool Registry]
B --> D[Execution Engine]
C -->|Connects at startup,<br/>applies allow/block filters| E[Downstream MCP Servers]
D -->|Runs script with tools<br/>as async functions| C
D -->|stdout only| AAt startup, PTC-MCP connects to your configured MCP servers as a client, discovers their tools, and makes them callable as mcp__<server>__<tool>() async functions inside scripts. Claude can call list_callable_tools to discover available tools, inspect_tool to understand a tool's schema, and then execute_program to run a script using those tools. Tool calls proxy to the real MCP servers, results stay local, and only print() output goes back.
Related MCP server: code2mcp
Tools
list_callable_tools
Takes no arguments. Returns a JSON array of sorted namespaced tool names:
["mcp__financial_data__query_financials", "mcp__internal_apis__get_resource"]inspect_tool
Takes a tool_name string. Returns the tool's schema, description, and outputSchema (if available):
{
"name": "mcp__financial_data__query_financials",
"description": "Query financial statements for a given ticker.",
"inputSchema": { "type": "object", "properties": { "ticker": { "type": "string" } }, "required": ["ticker"] },
"outputSchema": null,
"note": "No output schema defined by the upstream server. Inspect the return value in your script."
}Note:
outputSchemais populated when the downstream MCP server defines one on its tools per the MCP tool output schema specification. Downstream servers that declare output schemas improve discoverability — Claude can understand return types before writing a script. Without one,inspect_toolreturnsnullforoutputSchemaand suggests inspecting return values at runtime instead.
execute_program
Takes a code string. Runs the Python script with all registered tools available as async functions. Returns stdout prefixed with a status line.
Example
Claude decides comparing three tickers benefits from batched execution:
execute_program(code="""
tickers = ["AMZN", "MSFT", "GOOG"]
for t in tickers:
data = await mcp__financial_data__query_financials(
ticker=t, statement="income", period="quarter", limit=4
)
revenues = [q["revenue"] for q in data]
trend = " → ".join(f"${r/1e9:.1f}B" for r in revenues)
print(f"{t}: {trend}")
""")Three tool calls happen inside the script. Claude sees only:
[Script executed successfully]
AMZN: $170.0B → $165.3B → $158.9B → $149.2B
MSFT: $65.6B → $62.0B → $59.1B → $56.5B
GOOG: $96.5B → $88.3B → $85.0B → $80.5BSetup
Requires Python 3.11+.
uv venv && uv pip install -e ".[dev]"Configuration
Create a config.yaml (or set PTC_MCP_CONFIG to point elsewhere):
servers:
- name: financial-data
transport: stdio
command: node
args: ["./financial-data-mcp/dist/index.js"]
- name: internal-apis
transport: sse
url: "http://localhost:8080/mcp"
tools:
block:
- "mcp__internal_apis__delete_resource"
execution:
timeout_seconds: 120
max_output_bytes: 65536servers — MCP servers to bridge. Supports
stdioandssetransports.tools.allow / tools.block — Whitelist or blacklist namespaced tool names (mutually exclusive). Omit both to allow everything.
execution — Timeout and output size limits for
execute_program.
The server starts fine with no config file or an empty servers list.
Running
# Directly
uv run python -m ptc_mcp
# Or via the installed entry point
ptc-mcpThe server communicates over stdio (JSON-RPC). Add it to your Claude Code MCP settings to use it.
Testing
uv run pytest tests/ -vTests include unit tests for config parsing, the execution engine, registry filtering/namespacing, and end-to-end integration tests that spin up a real mock MCP server.
Available Tools
1 toolexecute_programA
Execute a Python program with access to MCP tools as async functions. Tool calls within the script are dispatched to their respective MCP servers. Only stdout (from print statements) is returned — intermediate tool results do not enter the conversation context. Use this when a task involves 3+ tool calls, loops, filtering, aggregation, or conditional logic based on intermediate results. For single tool calls, call the tool directly. All tool functions require await.
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | Python code to execute. MCP tools are available as async functions using their namespaced names (e.g., mcp__financial_data__query_financials). Use `await` for all tool calls. Use `print()` to produce output. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure and does so effectively. It explains key behavioral traits: tool calls are dispatched to MCP servers, only stdout from print statements is returned (not intermediate results), and all tool functions require await. It doesn't cover potential limitations like execution timeouts or error handling, but provides substantial operational context.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is efficiently structured with zero wasted sentences. It front-loads the core purpose, then explains behavioral constraints, followed by clear usage guidelines. Every sentence adds essential information about how the tool works and when to use it.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a tool with no annotations, no output schema, and a single parameter, the description provides comprehensive context about the tool's behavior, constraints, and appropriate usage. It explains the execution model, output limitations, and programming requirements. The main gap is lack of information about return format or error conditions, but overall it's quite complete for this complexity level.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so the schema already documents the single 'code' parameter. The description adds some context about how MCP tools are accessed within the code (namespaced names) and the requirement to use print() for output, but doesn't provide significant additional parameter semantics beyond what the schema indicates.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose with specific verbs ('execute a Python program') and resources ('with access to MCP tools as async functions'). It distinguishes this tool's unique capability of running multi-step scripts with tool integration from direct tool calls, even though there are no sibling tools to differentiate from.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides explicit guidance on when to use this tool ('when a task involves 3+ tool calls, loops, filtering, aggregation, or conditional logic based on intermediate results') and when not to use it ('for single tool calls, call the tool directly'). It clearly defines the appropriate context and alternatives.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
1 tool update
v0.1.0- First observed
execute_program
TDQS
With only one tool, there is no possibility of ambiguity or overlap between tools. The tool has a clearly defined singular purpose of executing Python programs with MCP integration.
The single tool follows a clear verb_noun naming pattern (execute_program). Since there are no other tools to compare against, consistency is inherently perfect.
One tool is too few for a server's apparent purpose of program execution with MCP integration, as it lacks complementary tools for tasks like listing available programs, managing execution environments, or handling errors. This feels thin and incomplete for the domain.
The tool surface is severely incomplete for the inferred domain of program execution and MCP tool orchestration. There are obvious gaps, such as no tools for program management, debugging, or result handling, which will limit agent capabilities and cause failures in complex workflows.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
One MCP endpoint for Claude, GPT & Gemini: 100+ tools + no-code connectors + agent workers.
Multiple MCP tools, persistent graph memory, token-saving data pointers, and more.
No-data MCP handoff for local Claude Code to Codex harness moves. $49 lifetime.
The Remote MCP server acts as a standardized bridge between LLM applications (like Claude, ChatGPT, and Cursor) and external services, enabling AI agents to access external tools and resources. Its primary capability is providing a centralized search tool to discover other MCP servers and their respective tools. Unlike local implementations, it runs remotely with OAuth authentication and permission controls for security.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceUniversal MCP server for executing TypeScript and Python code with progressive disclosure, reducing token usage by 98% by enabling on-demand access to all other MCP tools through code execution rather than loading tool definitions directly.22130MIT
- FlicenseAqualityNot gradedmaintenanceEnables execution of TypeScript code to call MCP tools instead of direct tool calls, reducing token usage by up to 98% while orchestrating complex multi-tool workflows through secure sandboxed code execution.1-
- FlicenseNot gradedqualityDmaintenanceEnables AI agents to write and execute Python code in an isolated sandbox that can orchestrate multiple MCP tool calls, reducing context window bloat and improving efficiency for complex workflows.23-
- FlicenseNot gradedqualityDmaintenanceEnables dynamic loading, hot-reloading, and orchestration of MCP servers without restarting Claude Code, allowing programmatic tool calling and workflow automation across multiple servers.2-
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/gallanoe/ptc-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server