Skip to content

Commit 365e26c

Browse files
authored
Merge pull request #7 from pamelafox/devex
Improvements to dev experience
2 parents 5024095 + 19091f4 commit 365e26c

File tree

8 files changed

+24
-646
lines changed

8 files changed

+24
-646
lines changed

.devcontainer/devcontainer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@
2727
"github.copilot-chat"
2828
],
2929
"settings": {
30-
"python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python"
30+
"python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python",
31+
"chat.mcp.autostart": "never"
3132
}
3233
}
3334
},

.vscode/launch.json

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,6 @@
11
{
22
"version": "0.2.0",
33
"configurations": [
4-
{
5-
"name": "Launch MCP HTTP Server (Debug)",
6-
"type": "debugpy",
7-
"request": "launch",
8-
"program": "${workspaceFolder}/basic_mcp_http.py",
9-
"console": "integratedTerminal",
10-
"cwd": "${workspaceFolder}",
11-
"env": {
12-
"PYTHONUNBUFFERED": "1"
13-
}
14-
},
15-
{
16-
"name": "Launch MCP stdio Server (Debug)",
17-
"type": "debugpy",
18-
"request": "launch",
19-
"program": "${workspaceFolder}/basic_mcp_stdio.py",
20-
"console": "integratedTerminal",
21-
"cwd": "${workspaceFolder}",
22-
"env": {
23-
"PYTHONUNBUFFERED": "1"
24-
}
25-
},
264
{
275
"name": "Attach to MCP Server (stdio)",
286
"type": "debugpy",
@@ -37,21 +15,6 @@
3715
"remoteRoot": "${workspaceFolder}"
3816
}
3917
]
40-
},
41-
{
42-
"name": "Attach to MCP Server (HTTP)",
43-
"type": "debugpy",
44-
"request": "attach",
45-
"connect": {
46-
"host": "localhost",
47-
"port": 5679
48-
},
49-
"pathMappings": [
50-
{
51-
"localRoot": "${workspaceFolder}",
52-
"remoteRoot": "${workspaceFolder}"
53-
}
54-
]
5518
}
5619
]
5720
}

.vscode/mcp.json

Lines changed: 5 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -7,34 +7,13 @@
77
"args": [
88
"run",
99
"basic_mcp_stdio.py"
10-
],
11-
"env": {
12-
"PYTHONUNBUFFERED": "1"
13-
}
14-
},
15-
"expenses-mcp-debug": {
16-
"type": "stdio",
17-
"command": "uv",
18-
"cwd": "${workspaceFolder}",
19-
"args": [
20-
"run",
21-
"--",
22-
"python",
23-
"-m",
24-
"debugpy",
25-
"--listen",
26-
"0.0.0.0:5678",
27-
"basic_mcp_stdio.py"
28-
],
29-
"env": {
30-
"PYTHONUNBUFFERED": "1"
31-
}
10+
]
3211
},
3312
"expenses-mcp-http": {
3413
"type": "http",
3514
"url": "http://localhost:8000/mcp"
3615
},
37-
"expenses-mcp-http-debug": {
16+
"expenses-mcp-debug": {
3817
"type": "stdio",
3918
"command": "uv",
4019
"cwd": "${workspaceFolder}",
@@ -45,13 +24,9 @@
4524
"-m",
4625
"debugpy",
4726
"--listen",
48-
"0.0.0.0:5679",
49-
"--wait-for-client",
50-
"basic_mcp_http.py"
51-
],
52-
"env": {
53-
"PYTHONUNBUFFERED": "1"
54-
}
27+
"0.0.0.0:5678",
28+
"basic_mcp_stdio.py"
29+
]
5530
}
5631
},
5732
"inputs": []

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"chat.mcp.autostart": "never"
3+
}

langchainv1_mcp_github.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from langchain.agents import create_agent
1515
from langchain_core.messages import HumanMessage
1616
from langchain_mcp_adapters.client import MultiServerMCPClient
17-
from langchain_openai import AzureChatOpenAI, ChatOpenAI
17+
from langchain_openai import ChatOpenAI
1818
from pydantic import SecretStr
1919

2020
load_dotenv(override=True)
@@ -26,11 +26,10 @@
2626
azure.identity.DefaultAzureCredential(),
2727
"https://cognitiveservices.azure.com/.default",
2828
)
29-
model = AzureChatOpenAI(
30-
azure_endpoint=os.environ["AZURE_OPENAI_ENDPOINT"],
31-
azure_deployment=os.environ["AZURE_OPENAI_CHAT_DEPLOYMENT"],
32-
api_version=os.environ["AZURE_OPENAI_VERSION"],
33-
azure_ad_token_provider=token_provider,
29+
model = ChatOpenAI(
30+
model=os.environ.get("AZURE_OPENAI_CHAT_DEPLOYMENT"),
31+
base_url=os.environ["AZURE_OPENAI_ENDPOINT"] + "/openai/v1/",
32+
api_key=token_provider,
3433
)
3534
elif API_HOST == "github":
3635
model = ChatOpenAI(

langchainv1_mcp_http.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from langchain.agents import create_agent
99
from langchain_core.messages import HumanMessage, SystemMessage
1010
from langchain_mcp_adapters.client import MultiServerMCPClient
11-
from langchain_openai import AzureChatOpenAI, ChatOpenAI
11+
from langchain_openai import ChatOpenAI
1212
from pydantic import SecretStr
1313
from rich.logging import RichHandler
1414

@@ -36,11 +36,10 @@
3636
azure.identity.DefaultAzureCredential(),
3737
AZURE_COGNITIVE_SERVICES_SCOPE
3838
)
39-
base_model = AzureChatOpenAI(
40-
azure_endpoint=os.environ.get("AZURE_OPENAI_ENDPOINT"),
41-
azure_deployment=os.environ.get("AZURE_OPENAI_CHAT_DEPLOYMENT"),
42-
api_version=os.environ.get("AZURE_OPENAI_VERSION"),
43-
azure_ad_token_provider=token_provider,
39+
base_model = ChatOpenAI(
40+
model=os.environ.get("AZURE_OPENAI_CHAT_DEPLOYMENT"),
41+
base_url=os.environ["AZURE_OPENAI_ENDPOINT"] + "/openai/v1/",
42+
api_key=token_provider,
4443
)
4544
elif API_HOST == "github":
4645
base_model = ChatOpenAI(

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
[project]
22
name = "python-mcp-demos"
33
version = "0.1.0"
4-
description = "Add your description here"
4+
description = "Demonstration of Python FastMCP servers"
55
readme = "README.md"
6-
requires-python = ">=3.13"
6+
requires-python = "==3.13.*"
77
dependencies = [
88
"fastmcp>=2.12.5",
99
"debugpy>=1.8.0",

0 commit comments

Comments
 (0)