Agent skill

Dspy MCP Tool Integration

by OmidZamani in OmidZamani/dspy-skills

A skill your agent uses for MCP tools with DSPy, Model Context Protocol servers, dspy.Tool.frommcptool, and ReAct agents over MCP-compatible tools.

MITAuto-check passedAgent Workflows

Install Dspy MCP Tool Integration

skills CLI
$ npx skills add OmidZamani/dspy-skills --skill dspy-mcp-tool-integration -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install OmidZamani/dspy-skills dspy-mcp-tool-integration --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/OmidZamani/dspy-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/dspy-mcp-tool-integration .claude/skills/dspy-mcp-tool-integration && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
dspy-mcp-tool-integration
GitHub stars
123
Token cost
~752 tokens
SKILL.md length
133 words
Files
2
Skills in repo
17
Repo updated
First seen
Licence
MIT

At a glance

A skill your agent uses for MCP tools with DSPy, Model Context Protocol servers, dspy.Tool.frommcptool, and ReAct agents over MCP-compatible tools.

  • Works in 5 steps: Use acall() because MCP tools are… → Initialize the session before listing… → Keep tool descriptions precise at the… → …
  • MCP tools with DSPy
  • SKILL.md covers Goal, Install, Streamable HTTP Server and Local Stdio Server, plus 3 more sections
  • Runs Python scripts from its folder; calls pip

What it does

Dspy MCP Tool Integration is an agent skill from OmidZamani/dspy-skills. Use for MCP tools with DSPy, Model Context Protocol servers, dspy.Tool.frommcptool, and ReAct agents over MCP-compatible tools.

Its SKILL.md is about 750 tokens, which your agent loads only when the skill is triggered. The skill folder holds 1 other file (for example `example.py`).

It sits in Agent Workflows, covering MCP servers. It works with Model Context Protocol and React. The repository describes itself as: Collection of Claude Skills for DSPy framework - program language models, optimize prompts, and build RAG pipelines systematically. The licence is MIT.

When your agent uses it

  • MCP tools with DSPy
  • Model Context Protocol servers
  • Dspy.Tool.frommcptool
  • ReAct agents over MCP-compatible tools

Example prompts

  • “/dspy-mcp-tool-integration”

Requirements

  • Python 3
  • Pre-approved tools (allowed-tools): Read, Write, Glob, Grep

Workflow steps

5 steps, taken from the first numbered list in SKILL.md.

  1. Use acall() because MCP tools are asynchronous.
  2. Initialize the session before listing tools.
  3. Keep tool descriptions precise at the MCP server boundary.
  4. Apply authentication and authorization before exposing sensitive tools.
  5. Set a modest max_iters and trace tool use in production.

What it can do on your machine

Read from SKILL.md and the folder at commit f5db3b7. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Read
    • Write
    • Glob
    • Grep

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships script files (Python), which the agent can run.

    Shell commands in SKILL.md call:

    • pip

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • dspy.ai
    • github.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Dspy MCP Tool Integration loads about 752 tokens when it runs. Until then it costs about 39 tokens; SKILL.md has 133 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~39
When it runs · the whole SKILL.md, loaded when a task matches
~752

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from OmidZamani/dspy-skills at commit f5db3b7, republished under its MIT licence (© OmidZamani). 133 words, ~752 tokens.

Download SKILL.mdSave it as .claude/skills/dspy-mcp-tool-integration/SKILL.md (or your agent's skills folder). This skill also uses 1 other file; get the full folder from GitHub.
name
dspy-mcp-tool-integration
description
Use for MCP tools with DSPy, Model Context Protocol servers, dspy.Tool.from_mcp_tool, and ReAct agents over MCP-compatible tools.
allowed-tools
Read, Write, Glob, Grep
version
1.0.0
dspy-compatibility
3.2.1
tags
agent, production
requires-extras
dspy[mcp]

DSPy MCP Tool Integration

Goal

Connect an MCP server with the MCP Python client, convert its tools to dspy.Tool, and use them in an async DSPy agent.

Install

bash
pip install -U "dspy[mcp]>=3.2.1,<3.3"

DSPy converts tools but does not manage MCP connections. Keep the ClientSession alive for as long as the DSPy tools are in use.

Streamable HTTP Server

python
import asyncio
import dspy
from mcp import ClientSession
from mcp.client.streamable_http import streamablehttp_client

async def main():
    async with streamablehttp_client("http://localhost:8000/mcp") as (read, write):
        async with ClientSession(read, write) as session:
            await session.initialize()
            response = await session.list_tools()
            tools = [dspy.Tool.from_mcp_tool(session, tool) for tool in response.tools]

            agent = dspy.ReAct("task -> result", tools=tools, max_iters=5)
            output = await agent.acall(task="Check the weather in Tokyo")
            print(output.result)

asyncio.run(main())

Local Stdio Server

python
import asyncio
import dspy
from mcp import ClientSession, StdioServerParameters
from mcp.client.stdio import stdio_client

async def main():
    params = StdioServerParameters(
        command="python3",
        args=["path/to/server.py"],
        env=None,
    )

    async with stdio_client(params) as (read, write):
        async with ClientSession(read, write) as session:
            await session.initialize()
            response = await session.list_tools()
            tools = [dspy.Tool.from_mcp_tool(session, tool) for tool in response.tools]
            agent = dspy.ReAct("question -> answer", tools=tools, max_iters=5)
            print((await agent.acall(question="What is 25 + 17?")).answer)

asyncio.run(main())

Best Practices

  1. Use acall() because MCP tools are asynchronous.
  2. Initialize the session before listing tools.
  3. Keep tool descriptions precise at the MCP server boundary.
  4. Apply authentication and authorization before exposing sensitive tools.
  5. Set a modest max_iters and trace tool use in production.

Official Documentation

© OmidZamani, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 1 other file in skills/dspy-mcp-tool-integration of OmidZamani/dspy-skills.

  • SKILL.md
  • example.py

Open the folder on GitHubat commit f5db3b7

Compare with similar skills

Dspy MCP Tool Integration next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Dspy MCP Tool Integration compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Dspy MCP Tool Integration this skillOmidZamani/dspy-skills123—~752Automated safety check: PassMIT
MCP Server Builder with mcp-usemcp-use/mcp-use11k—~923Automated safety check: PassApache-2.0
Chatgpt App Builderalpic-ai/skybridge2.2k—~1kAutomated safety check: PassMIT
MCP App Builderalpic-ai/skybridge2.2k—~906Automated safety check: PassMIT
Domscribepatchorbit/domscribe194—~3.3kAutomated safety check: NotesMIT
Skybridgealpic-ai/skybridge2.2k—~923Automated safety check: PassMIT

Similar skills

  • Builds, modifies, debugs, migrates and verifies TypeScript MCP servers and MCP Apps with the mcp-use framework, treating the installed package's types as the source of truth.

    11k GitHub stars~923 tokensUpdated 2 days ago
    Agent WorkflowsAuto-check passed
  • Chatgpt App Builder

    alpic-ai/skybridge

    Guide developers through creating and updating ChatGPT plugins.

    2.2k GitHub stars~1k tokensUpdated 3 days ago
    Agent WorkflowsAuto-check passed
  • MCP App Builder

    alpic-ai/skybridge

    Guide developers through creating and updating MCP Apps. An agent skill from alpic-ai/skybridge.

    2.2k GitHub stars~906 tokensUpdated 3 days ago
    Agent WorkflowsAuto-check passed
  • Domscribe

    patchorbit/domscribe

    Work with Domscribe — the pixel-to-code bridge. An agent skill from patchorbit/domscribe.

    194 GitHub stars~3.3k tokensUpdated 2 mo ago
    Agent WorkflowsAuto-check: notes
  • Skybridge

    alpic-ai/skybridge

    Guide developers through creating and updating ChatGPT plugins and MCP Apps.

    2.2k GitHub stars~923 tokensUpdated 3 days ago
    Agent WorkflowsAuto-check passed
  • Memorywhale

    wuisabel-gif/MemWhale

    Query and write durable debugging memory recorded by MemoryWhale.

    154 GitHub stars~765 tokensUpdated 3 days ago
    Agent WorkflowsAuto-check passed

More from OmidZamani/dspy-skills

All 17 skills in this repo
  • Skill Perfection

    OmidZamani/dspy-skills

    A skill your agent uses when you need to QA audit and fix a plugin skill file.

    123 GitHub stars~1.6k tokensUpdated 3 mo ago
    Auto-check passed
  • Dspy Haystack Integration

    OmidZamani/dspy-skills

    A skill your agent uses for integrating DSPy with Haystack, optimizing Haystack prompts, improving retrieval pipelines, and extracting DSPy prompts.

    123 GitHub stars~1.4k tokensUpdated 3 mo ago
    Auto-check passed
  • Dspy Adapters Multimodal

    OmidZamani/dspy-skills

    A skill your agent uses for DSPy adapter selection, JSONAdapter, XMLAdapter, ChatAdapter, native function calling, structured outputs, and multimodal inputs like dspy.Image or dspy.Audio.

    123 GitHub stars~864 tokensUpdated 3 mo ago
    Auto-check passed
  • Dspy Advanced Module Composition

    OmidZamani/dspy-skills

    A skill your agent uses for composing DSPy modules with Ensemble, MultiChainComparison, ensemble voting, sequential pipelines, and multi-program workflows.

    123 GitHub stars~2.2k tokensUpdated 3 mo ago
    Auto-check passed
  • Dspy Better Together

    OmidZamani/dspy-skills

    A skill your agent uses for BetterTogether, prompt plus weight optimization, fine-tuning sequences, and strategy chains like p - w - p.

    123 GitHub stars~756 tokensUpdated 3 mo ago
    Auto-check passed
  • Dspy Bootstrap Fewshot

    OmidZamani/dspy-skills

    A skill your agent uses for BootstrapFewShot, bootstrapped demonstrations, teacher-model demos, and low-data DSPy prompt optimization.

    123 GitHub stars~1.3k tokensUpdated 3 mo ago
    Auto-check passed

Categories

Questions about Dspy MCP Tool Integration

What does Dspy MCP Tool Integration do?

A skill your agent uses for MCP tools with DSPy, Model Context Protocol servers, dspy.Tool.frommcptool, and ReAct agents over MCP-compatible tools. Dspy MCP Tool Integration is an agent skill from OmidZamani/dspy-skills.frommcptool, and ReAct agents over MCP-compatible tools.

When should I use Dspy MCP Tool Integration?

Dspy MCP Tool Integration fits situations like: MCP tools with DSPy; model Context Protocol servers; dspy.Tool.frommcptool; reAct agents over MCP-compatible tools.

How do I install Dspy MCP Tool Integration in Claude Code?

Run `npx skills add OmidZamani/dspy-skills --skill dspy-mcp-tool-integration -a claude-code`. Or copy the skill folder (skills/dspy-mcp-tool-integration in OmidZamani/dspy-skills) into .claude/skills/dspy-mcp-tool-integration in your project. Claude Code loads it when a task matches its description.

How do I install Dspy MCP Tool Integration in Codex?

Run `npx skills add OmidZamani/dspy-skills --skill dspy-mcp-tool-integration -a codex`. Or copy the skill folder (skills/dspy-mcp-tool-integration in OmidZamani/dspy-skills) into .agents/skills/dspy-mcp-tool-integration in your project. Codex loads it when a task matches its description.

Can I use Dspy MCP Tool Integration in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add OmidZamani/dspy-skills --skill dspy-mcp-tool-integration -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/dspy-mcp-tool-integration, .gemini/skills/dspy-mcp-tool-integration, .github/skills/dspy-mcp-tool-integration and .opencode/skills/dspy-mcp-tool-integration in your project.

What does Dspy MCP Tool Integration need to run?

Going by SKILL.md and its folder, Dspy MCP Tool Integration needs Python for the scripts in its folder and the command-line tools its instructions call (pip). Our summary lists: Python 3. Its frontmatter pre-approves these tools: Read, Write, Glob, Grep.

Does Dspy MCP Tool Integration access the network?

SKILL.md names 2 domains. As links in the text: dspy.ai and github.com. This is read from the text; nothing was executed.

Is Dspy MCP Tool Integration safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Dspy MCP Tool Integration use?

Dspy MCP Tool Integration is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Dspy MCP Tool Integration use?

About 752 tokens (SKILL.md is roughly 3k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Dspy MCP Tool Integration?

Skills that share tags, products or a category with Dspy MCP Tool Integration: MCP Server Builder with mcp-use (mcp-use/mcp-use, 11k stars), Chatgpt App Builder (alpic-ai/skybridge, 2.2k stars), MCP App Builder (alpic-ai/skybridge, 2.2k stars) and Domscribe (patchorbit/domscribe, 194 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Dspy MCP Tool Integration?

OmidZamani (a GitHub user) maintains it in OmidZamani/dspy-skills, which has 123 GitHub stars. The repository holds 17 skills in this directory. The repository was last updated on June 23, 2026.

Source: OmidZamani/dspy-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.