Skip to content

Conversation

TomeHirata
Copy link
Collaborator

@TomeHirata TomeHirata commented Oct 6, 2025

MCP has more and more popularity, so we should document how to use MCP with DSPy in the main section in addition to the existing tutorial.

@TomeHirata TomeHirata requested a review from Copilot October 6, 2025 02:53
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds documentation for using the Model Context Protocol (MCP) with DSPy, expanding the programming section to include comprehensive MCP integration guidance. The documentation explains how to use MCP tools with DSPy agents and provides practical examples for different connection types.

Key changes:

  • Added MCP documentation page to the programming section
  • Provided installation instructions and usage examples for both stdio and HTTP MCP servers
  • Included examples for creating MCP servers and converting tools to DSPy format

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
docs/mkdocs.yml Added MCP page to navigation under programming section
docs/docs/learn/programming/mcp.md New comprehensive documentation covering MCP installation, usage patterns, server creation, and tool conversion

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@TomeHirata
Copy link
Collaborator Author

The test failure is not related to this PR

- **Share tools across stacks** - Use the same tools across different frameworks
- **Simplify integration** - Convert MCP tools to DSPy tools with one line

As long as you have an `mcp.ClientSession`, you can use MCP tools with DSPy's `ReAct` module or any other tool-based workflow.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think users will be confused about "As long as you have an mcp.ClientSession", because it's not a well-known thing for many people.

We should maybe add a short paragraph to explain how DSPy manages the connections to the MCP server - we utilize the native MCP session for all connection types, and don't provide extra features for connection handling

Copy link
Collaborator

@chenmoneygithub chenmoneygithub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@TomeHirata TomeHirata merged commit 8794f65 into stanfordnlp:main Oct 11, 2025
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants