Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
"github.copilot-chat"
],
"settings": {
"python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python"
"python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python",
"chat.mcp.autostart": "never"
}
}
},
Expand Down
37 changes: 0 additions & 37 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,6 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch MCP HTTP Server (Debug)",
"type": "debugpy",
"request": "launch",
"program": "${workspaceFolder}/basic_mcp_http.py",
"console": "integratedTerminal",
"cwd": "${workspaceFolder}",
"env": {
"PYTHONUNBUFFERED": "1"
}
},
{
"name": "Launch MCP stdio Server (Debug)",
"type": "debugpy",
"request": "launch",
"program": "${workspaceFolder}/basic_mcp_stdio.py",
"console": "integratedTerminal",
"cwd": "${workspaceFolder}",
"env": {
"PYTHONUNBUFFERED": "1"
}
},
{
"name": "Attach to MCP Server (stdio)",
"type": "debugpy",
Expand All @@ -37,21 +15,6 @@
"remoteRoot": "${workspaceFolder}"
}
]
},
{
"name": "Attach to MCP Server (HTTP)",
"type": "debugpy",
"request": "attach",
"connect": {
"host": "localhost",
"port": 5679
},
"pathMappings": [
{
"localRoot": "${workspaceFolder}",
"remoteRoot": "${workspaceFolder}"
}
]
}
]
}
35 changes: 5 additions & 30 deletions .vscode/mcp.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,34 +7,13 @@
"args": [
"run",
"basic_mcp_stdio.py"
],
"env": {
"PYTHONUNBUFFERED": "1"
}
},
"expenses-mcp-debug": {
"type": "stdio",
"command": "uv",
"cwd": "${workspaceFolder}",
"args": [
"run",
"--",
"python",
"-m",
"debugpy",
"--listen",
"0.0.0.0:5678",
"basic_mcp_stdio.py"
],
"env": {
"PYTHONUNBUFFERED": "1"
}
]
},
"expenses-mcp-http": {
"type": "http",
"url": "http://localhost:8000/mcp"
},
"expenses-mcp-http-debug": {
"expenses-mcp-debug": {
"type": "stdio",
"command": "uv",
"cwd": "${workspaceFolder}",
Expand All @@ -45,13 +24,9 @@
"-m",
"debugpy",
"--listen",
"0.0.0.0:5679",
"--wait-for-client",
"basic_mcp_http.py"
],
"env": {
"PYTHONUNBUFFERED": "1"
}
"0.0.0.0:5678",
"basic_mcp_stdio.py"
]
}
},
"inputs": []
Expand Down
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"chat.mcp.autostart": "never"
}
11 changes: 5 additions & 6 deletions langchainv1_mcp_github.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from langchain.agents import create_agent
from langchain_core.messages import HumanMessage
from langchain_mcp_adapters.client import MultiServerMCPClient
from langchain_openai import AzureChatOpenAI, ChatOpenAI
from langchain_openai import ChatOpenAI
from pydantic import SecretStr

load_dotenv(override=True)
Expand All @@ -26,11 +26,10 @@
azure.identity.DefaultAzureCredential(),
"https://cognitiveservices.azure.com/.default",
)
model = AzureChatOpenAI(
azure_endpoint=os.environ["AZURE_OPENAI_ENDPOINT"],
azure_deployment=os.environ["AZURE_OPENAI_CHAT_DEPLOYMENT"],
api_version=os.environ["AZURE_OPENAI_VERSION"],
azure_ad_token_provider=token_provider,
model = ChatOpenAI(
model=os.environ.get("AZURE_OPENAI_CHAT_DEPLOYMENT"),
base_url=os.environ["AZURE_OPENAI_ENDPOINT"] + "/openai/v1/",
api_key=token_provider,
)
elif API_HOST == "github":
model = ChatOpenAI(
Expand Down
11 changes: 5 additions & 6 deletions langchainv1_mcp_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from langchain.agents import create_agent
from langchain_core.messages import HumanMessage, SystemMessage
from langchain_mcp_adapters.client import MultiServerMCPClient
from langchain_openai import AzureChatOpenAI, ChatOpenAI
from langchain_openai import ChatOpenAI
from pydantic import SecretStr
from rich.logging import RichHandler

Expand Down Expand Up @@ -36,11 +36,10 @@
azure.identity.DefaultAzureCredential(),
AZURE_COGNITIVE_SERVICES_SCOPE
)
base_model = AzureChatOpenAI(
azure_endpoint=os.environ.get("AZURE_OPENAI_ENDPOINT"),
azure_deployment=os.environ.get("AZURE_OPENAI_CHAT_DEPLOYMENT"),
api_version=os.environ.get("AZURE_OPENAI_VERSION"),
azure_ad_token_provider=token_provider,
base_model = ChatOpenAI(
model=os.environ.get("AZURE_OPENAI_CHAT_DEPLOYMENT"),
base_url=os.environ["AZURE_OPENAI_ENDPOINT"] + "/openai/v1/",
api_key=token_provider,
)
elif API_HOST == "github":
base_model = ChatOpenAI(
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[project]
name = "python-mcp-demos"
version = "0.1.0"
description = "Add your description here"
description = "Demonstration of Python FastMCP servers"
readme = "README.md"
requires-python = ">=3.13"
requires-python = "==3.13.*"
dependencies = [
"fastmcp>=2.12.5",
"debugpy>=1.8.0",
Expand Down
Loading