A demonstration project showcasing Model Context Protocol (MCP) implementations using FastMCP, with examples of stdio, HTTP transports, and integration with LangChain and Agent Framework.
- Python 3.13 or higher
- uv
- API access to one of the following:
- GitHub Models (GitHub token)
- Azure OpenAI (Azure credentials)
- Ollama (local installation)
- OpenAI API (API key)
- Install dependencies using
uv:
uv sync- Copy
.env-sampleto.envand configure your environment variables:
cp .env-sample .env- Edit
.envwith your API credentials. Choose one of the following providers by settingAPI_HOST:github- GitHub Models (requiresGITHUB_TOKEN)azure- Azure OpenAI (requires Azure credentials)ollama- Local Ollama instanceopenai- OpenAI API (requiresOPENAI_API_KEY)
Run any script with: uv run <script_name>
- basic_mcp_http.py - MCP server with HTTP transport on port 8000
- basic_mcp_stdio.py - MCP server with stdio transport for VS Code integration
- langchainv1_mcp_http.py - LangChain agent with MCP integration
- langchainv1_mcp_github.py - LangChain tool filtering demo with GitHub MCP (requires
GITHUB_TOKEN) - openai_agents_tool_filtering.py - OpenAI Agents SDK tool filtering demo with Microsoft Learn MCP
- agentframework_mcp_learn.py - Microsoft Agent Framework integration with MCP
The MCP Inspector is a developer tool for testing and debugging MCP servers.
Note: While HTTP servers can technically work with port forwarding in Codespaces/Dev Containers, the setup for MCP Inspector and debugger attachment is not straightforward. For the best development experience with full debugging capabilities, we recommend running this project locally.
For stdio servers:
npx @modelcontextprotocol/inspector uv run basic_mcp_stdio.pyFor HTTP servers:
- Start the HTTP server:
uv run basic_mcp_http.py- In another terminal, run the inspector:
npx @modelcontextprotocol/inspector http://localhost:8000/mcpThe inspector provides a web interface to:
- View available tools, resources, and prompts
- Test tool invocations with custom parameters
- Inspect server responses and errors
- Debug server communication
The .vscode/mcp.json file configures MCP servers for GitHub Copilot integration:
Available Servers:
- expenses-mcp: stdio transport server for production use
- expenses-mcp-debug: stdio server with debugpy on port 5678
- expenses-mcp-http: HTTP transport server at
http://localhost:8000/mcp - expenses-mcp-http-debug: stdio server with debugpy on port 5679
Switching Servers:
Configure which server GitHub Copilot uses by selecting it in the Chat panel selecting the tools icon.
The .vscode/launch.json provides four debug configurations:
-
Launch MCP HTTP Server (Debug)
- Directly starts
basic_mcp_http.pywith debugger attached - Best for: Standalone testing and LangChain script debugging
- Directly starts
-
Launch MCP stdio Server (Debug)
- Directly starts
basic_mcp_stdio.pywith debugger attached - Best for: Testing stdio communication
- Directly starts
-
Attach to MCP Server (stdio) - Port 5678
- Attaches to server started via
expenses-mcp-debuginmcp.json - Best for: Debugging during GitHub Copilot Chat usage
- Attaches to server started via
-
Attach to MCP Server (HTTP) - Port 5679
- Attaches to server started via
expenses-mcp-http-debuginmcp.json - Best for: Debugging HTTP server during Copilot usage
- Attaches to server started via
Use this approach for debugging with MCP Inspector or LangChain scripts:
- Set breakpoints in
basic_mcp_http.pyorbasic_mcp_stdio.py - Press
Cmd+Shift+Dto open Run and Debug - Select "Launch MCP HTTP Server (Debug)" or "Launch MCP stdio Server (Debug)"
- Press
F5or click the green play button - Connect MCP Inspector or run your LangChain script to trigger breakpoints
- For HTTP:
npx @modelcontextprotocol/inspector http://localhost:8000/mcp - For stdio:
npx @modelcontextprotocol/inspector uv run basic_mcp_stdio.py(start without debugger first)
- For HTTP:
- Set breakpoints in your MCP server file
- Start the debug server via
mcp.jsonconfiguration:- Select
expenses-mcp-debugorexpenses-mcp-http-debug
- Select
- Press
Cmd+Shift+Dto open Run and Debug - Select appropriate "Attach to MCP Server" configuration
- Press
F5to attach - Select correct expense mcp server in GitHub Copilot Chat tools
- Use GitHub Copilot Chat to trigger the MCP tools
- Debugger pauses at breakpoints
MIT