@ilhank/hello-server 0.0.0-stage → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/guide.txt +23 -0
- package/langchain_test.py +33 -0
- package/lec_image/create_agent.png +0 -0
- package/lec_image/mcp_server.svg +1 -0
- package/mcp_error.log +0 -0
- package/mcp_server.ipynb +556 -0
- package/package.json +18 -4
- package/server.js +34 -0
- package/README.md +0 -3
package/guide.txt
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# TypeScript
|
|
2
|
+
package.json 파일
|
|
3
|
+
"type": "module",
|
|
4
|
+
로 수정
|
|
5
|
+
|
|
6
|
+
npm init -y
|
|
7
|
+
npm install @modelcontextprotocol/sdk
|
|
8
|
+
|
|
9
|
+
# 실행
|
|
10
|
+
npx ts-node server.ts
|
|
11
|
+
|
|
12
|
+
## .js파일 생성
|
|
13
|
+
npx tsc --init
|
|
14
|
+
npx tsc server.ts
|
|
15
|
+
|
|
16
|
+
{
|
|
17
|
+
"mcpServers": {
|
|
18
|
+
"my-first-mcp": {
|
|
19
|
+
"command": "npx",
|
|
20
|
+
"args": ["tsx", "D:\\mcp_server_test\\server.ts"]
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import asyncio
|
|
2
|
+
from langchain.agents import create_agent
|
|
3
|
+
from langchain_openai import ChatOpenAI
|
|
4
|
+
from langchain_mcp_adapters.client import MultiServerMCPClient
|
|
5
|
+
|
|
6
|
+
# 1. MCP 서버 연결
|
|
7
|
+
client = MultiServerMCPClient({
|
|
8
|
+
"my-first-mcp": {
|
|
9
|
+
"command": "node",
|
|
10
|
+
"args": [r"D:\busan\mcp\mcp_server_test\server.js"],
|
|
11
|
+
"transport": "stdio"
|
|
12
|
+
}
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
# 2. MCP Tool 가져오기
|
|
16
|
+
tools = asyncio.run(client.get_tools())
|
|
17
|
+
|
|
18
|
+
print("Tool 목록:", [t.name for t in tools])
|
|
19
|
+
|
|
20
|
+
# 3. Agent 생성
|
|
21
|
+
agent = create_agent(
|
|
22
|
+
model=ChatOpenAI(model="gpt-4o-mini"),
|
|
23
|
+
tools=tools
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
# 4. Agent 실행
|
|
27
|
+
result = asyncio.run(agent.ainvoke({
|
|
28
|
+
"messages": [
|
|
29
|
+
{"role": "user", "content": "홍길동에게 인사해줘"}
|
|
30
|
+
]
|
|
31
|
+
}))
|
|
32
|
+
|
|
33
|
+
print(result["messages"][-1].content)
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg font-family="-apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif" font-weight="430" data-d-component="svg" fill="currentColor" style="color:rgb(255, 255, 255)" viewBox="0 0 340 218" width="100%" xmlns="http://www.w3.org/2000/svg"><rect x="65" y="5" width="210" height="43" rx="8" fill="#64748b" fill-opacity=".12" stroke="#64748b"/><text x="170" y="22" font-size="12" text-anchor="middle" font-weight="bold" fill="currentColor">MCP Host / Client</text><text x="170" y="37" font-size="10" text-anchor="middle" fill="currentColor">ChatGPT · Claude · Inspector</text><path d="M160 51 V96 M155 89 L160 96 L165 89 M180 96 V51 M175 58 L180 51 L185 58" stroke="#64748b" stroke-width="1.5" fill="none"/><text x="149" y="72" text-anchor="end" font-size="10" fill="currentColor">stdin (요청)</text><text x="191" y="72" font-size="10" fill="currentColor">stdout (응답)</text><rect x="35" y="100" width="270" height="112" rx="9" fill="#3b82f6" fill-opacity=".07" stroke="#3b82f6"/><text x="170" y="120" font-size="13" font-weight="bold" text-anchor="middle" fill="currentColor">MCP Server (server.js)</text><text x="170" y="137" font-size="10" text-anchor="middle" fill="currentColor">StdioServerTransport</text><path d="M170 143 V151 H105 V159 M170 151 H235 V159" stroke="#64748b" fill="none"/><rect x="48" y="159" width="114" height="40" rx="5" fill="#16a34a" fill-opacity=".12" stroke="#16a34a"/><rect x="178" y="159" width="114" height="40" rx="5" fill="#16a34a" fill-opacity=".12" stroke="#16a34a"/><text x="105" y="176" text-anchor="middle" font-size="11" font-weight="bold" fill="currentColor">say_hello</text><text x="105" y="190" text-anchor="middle" font-size="10" fill="currentColor">인사말 반환</text><text x="235" y="176" text-anchor="middle" font-size="11" font-weight="bold" fill="currentColor">add_numbers</text><text x="235" y="190" text-anchor="middle" font-size="10" fill="currentColor">두 숫자 덧셈</text></svg>
|
package/mcp_error.log
ADDED
|
File without changes
|
package/mcp_server.ipynb
ADDED
|
@@ -0,0 +1,556 @@
|
|
|
1
|
+
{
|
|
2
|
+
"cells": [
|
|
3
|
+
{
|
|
4
|
+
"cell_type": "markdown",
|
|
5
|
+
"id": "97d55fe6",
|
|
6
|
+
"metadata": {},
|
|
7
|
+
"source": [
|
|
8
|
+
"```text\n",
|
|
9
|
+
"# TypeScript\n",
|
|
10
|
+
"package.json 파일\n",
|
|
11
|
+
"\"type\": \"module\",\n",
|
|
12
|
+
"로 수정\n",
|
|
13
|
+
"\n",
|
|
14
|
+
"npm init -y\n",
|
|
15
|
+
"npm install @modelcontextprotocol/sdk\n",
|
|
16
|
+
"\n",
|
|
17
|
+
"# 실행\n",
|
|
18
|
+
"npx ts-node server.ts\n",
|
|
19
|
+
"\n",
|
|
20
|
+
"## .js파일 생성\n",
|
|
21
|
+
"npx tsc --init\n",
|
|
22
|
+
"npx tsc server.ts\n",
|
|
23
|
+
"\n",
|
|
24
|
+
"{\n",
|
|
25
|
+
" \"mcpServers\": {\n",
|
|
26
|
+
" \"my-first-mcp\": {\n",
|
|
27
|
+
" \"command\": \"npx\",\n",
|
|
28
|
+
" \"args\": [\"tsx\", \"D:\\\\mcp_server_test\\\\server.ts\"]\n",
|
|
29
|
+
" }\n",
|
|
30
|
+
" }\n",
|
|
31
|
+
"}\n"
|
|
32
|
+
]
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"cell_type": "markdown",
|
|
36
|
+
"id": "67c98638",
|
|
37
|
+
"metadata": {},
|
|
38
|
+
"source": [
|
|
39
|
+
"- inspector 를 이용하여 툴 테스트 하기\n",
|
|
40
|
+
"\n",
|
|
41
|
+
"npx -y @modelcontextprotocol/inspector@latest node server.js"
|
|
42
|
+
]
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"cell_type": "markdown",
|
|
46
|
+
"id": "9cda5e95",
|
|
47
|
+
"metadata": {},
|
|
48
|
+
"source": [
|
|
49
|
+
"<img src='lec_image/mcp_server.svg'>"
|
|
50
|
+
]
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"cell_type": "markdown",
|
|
54
|
+
"id": "a8d7f5a3",
|
|
55
|
+
"metadata": {},
|
|
56
|
+
"source": [
|
|
57
|
+
"```yaml\n",
|
|
58
|
+
"[mcp_servers.my-first-mcp]\n",
|
|
59
|
+
"enabled = true\n",
|
|
60
|
+
"command = \"node\"\n",
|
|
61
|
+
"args = [\"D:/busan/랭체인_latest/랭그래프/mcp/mcp_server_test/server.js\"]"
|
|
62
|
+
]
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"cell_type": "markdown",
|
|
66
|
+
"id": "26cfcde8",
|
|
67
|
+
"metadata": {},
|
|
68
|
+
"source": [
|
|
69
|
+
"my-first-mcp 서버에서 사용 가능한 Tool 목록을 보여줘."
|
|
70
|
+
]
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"cell_type": "markdown",
|
|
74
|
+
"id": "17ce4616",
|
|
75
|
+
"metadata": {},
|
|
76
|
+
"source": [
|
|
77
|
+
"my-first-mcp의 say_hello 도구를 사용해서 홍길동에게 인사해 줘."
|
|
78
|
+
]
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"cell_type": "markdown",
|
|
82
|
+
"id": "972c87c4",
|
|
83
|
+
"metadata": {},
|
|
84
|
+
"source": [
|
|
85
|
+
"my-first-mcp의 add_numbers 도구를 직접 호출해서 100과 200을 더해 줘."
|
|
86
|
+
]
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"cell_type": "code",
|
|
90
|
+
"execution_count": 3,
|
|
91
|
+
"id": "9b7753b3",
|
|
92
|
+
"metadata": {},
|
|
93
|
+
"outputs": [
|
|
94
|
+
{
|
|
95
|
+
"name": "stdout",
|
|
96
|
+
"output_type": "stream",
|
|
97
|
+
"text": [
|
|
98
|
+
"Requirement already satisfied: langchain in c:\\Python312\\Lib\\site-packages (1.5.2)\n",
|
|
99
|
+
"Requirement already satisfied: langchain-openai in c:\\Python312\\Lib\\site-packages (1.7.4)\n",
|
|
100
|
+
"Collecting langchain-openai\n",
|
|
101
|
+
" Downloading langchain_openai-1.8.5-py3-none-any.whl.metadata (3.5 kB)\n",
|
|
102
|
+
"Collecting langchain-mcp-adapters\n",
|
|
103
|
+
" Downloading langchain_mcp_adapters-0.3.2-py3-none-any.whl.metadata (11 kB)\n",
|
|
104
|
+
"Requirement already satisfied: langchain-core<2.0.0,>=1.8.0 in c:\\Python312\\Lib\\site-packages (from langchain) (1.8.0)\n",
|
|
105
|
+
"Requirement already satisfied: langgraph<1.3.0,>=1.2.12 in c:\\Python312\\Lib\\site-packages (from langchain) (1.2.18)\n",
|
|
106
|
+
"Requirement already satisfied: pydantic>=2.7.4 in c:\\Python312\\Lib\\site-packages (from langchain) (2.14.3)\n",
|
|
107
|
+
"Requirement already satisfied: certifi>=2026.10.19 in c:\\Python312\\Lib\\site-packages (from langchain-core<2.0.0,>=1.8.0->langchain) (2026.10.23)\n",
|
|
108
|
+
"Requirement already satisfied: httpx>=0.23.0 in c:\\Python312\\Lib\\site-packages (from langchain-core<2.0.0,>=1.8.0->langchain) (0.28.1)\n",
|
|
109
|
+
"Requirement already satisfied: jsonpatch>=1.33.0 in c:\\Python312\\Lib\\site-packages (from langchain-core<2.0.0,>=1.8.0->langchain) (1.38)\n",
|
|
110
|
+
"Requirement already satisfied: langchain-protocol>=0.0.20 in c:\\Python312\\Lib\\site-packages (from langchain-core<2.0.0,>=1.8.0->langchain) (0.0.20)\n",
|
|
111
|
+
"Requirement already satisfied: langsmith<1.0.0,>=0.14.9 in c:\\Python312\\Lib\\site-packages (from langchain-core<2.0.0,>=1.8.0->langchain) (0.14.14)\n",
|
|
112
|
+
"Requirement already satisfied: packaging>=23.2.0 in c:\\Python312\\Lib\\site-packages (from langchain-core<2.0.0,>=1.8.0->langchain) (26.3)\n",
|
|
113
|
+
"Requirement already satisfied: pyyaml>=5.3.0 in c:\\Python312\\Lib\\site-packages (from langchain-core<2.0.0,>=1.8.0->langchain) (6.0.3)\n",
|
|
114
|
+
"Requirement already satisfied: tenacity!=8.4.0,>=8.1.0 in c:\\Python312\\Lib\\site-packages (from langchain-core<2.0.0,>=1.8.0->langchain) (9.1.4)\n",
|
|
115
|
+
"Requirement already satisfied: typing-extensions>=4.7.0 in c:\\Python312\\Lib\\site-packages (from langchain-core<2.0.0,>=1.8.0->langchain) (4.16.0)\n",
|
|
116
|
+
"Requirement already satisfied: uuid-utils>=0.12.0 in c:\\Python312\\Lib\\site-packages (from langchain-core<2.0.0,>=1.8.0->langchain) (0.19.0)\n",
|
|
117
|
+
"Requirement already satisfied: langgraph-checkpoint<5.0.0,>=4.3.0 in c:\\Python312\\Lib\\site-packages (from langgraph<1.3.0,>=1.2.12->langchain) (4.3.1)\n",
|
|
118
|
+
"Requirement already satisfied: langgraph-prebuilt<1.2.0,>=1.1.0 in c:\\Python312\\Lib\\site-packages (from langgraph<1.3.0,>=1.2.12->langchain) (1.1.1)\n",
|
|
119
|
+
"Requirement already satisfied: langgraph-sdk<0.5.0,>=0.4.6 in c:\\Python312\\Lib\\site-packages (from langgraph<1.3.0,>=1.2.12->langchain) (0.4.10)\n",
|
|
120
|
+
"Requirement already satisfied: xxhash>=3.5.0 in c:\\Python312\\Lib\\site-packages (from langgraph<1.3.0,>=1.2.12->langchain) (4.0.2)\n",
|
|
121
|
+
"Requirement already satisfied: ormsgpack>=1.12.0 in c:\\Python312\\Lib\\site-packages (from langgraph-checkpoint<5.0.0,>=4.3.0->langgraph<1.3.0,>=1.2.12->langchain) (1.13.0)\n",
|
|
122
|
+
"Requirement already satisfied: orjson>=3.11.5 in c:\\Python312\\Lib\\site-packages (from langgraph-sdk<0.5.0,>=0.4.6->langgraph<1.3.0,>=1.2.12->langchain) (3.13.0)\n",
|
|
123
|
+
"Requirement already satisfied: websockets>=14 in c:\\Python312\\Lib\\site-packages (from langgraph-sdk<0.5.0,>=0.4.6->langgraph<1.3.0,>=1.2.12->langchain) (17.3)\n",
|
|
124
|
+
"Requirement already satisfied: anyio<5,>=3.5.0 in c:\\Python312\\Lib\\site-packages (from langsmith<1.0.0,>=0.14.9->langchain-core<2.0.0,>=1.8.0->langchain) (4.15.1)\n",
|
|
125
|
+
"Requirement already satisfied: distro<2,>=1.7.0 in c:\\Python312\\Lib\\site-packages (from langsmith<1.0.0,>=0.14.9->langchain-core<2.0.0,>=1.8.0->langchain) (1.9.0)\n",
|
|
126
|
+
"Requirement already satisfied: httpx2<3,>=2 in c:\\Python312\\Lib\\site-packages (from langsmith<1.0.0,>=0.14.9->langchain-core<2.0.0,>=1.8.0->langchain) (2.16.0)\n",
|
|
127
|
+
"Requirement already satisfied: requests-toolbelt>=1.0.0 in c:\\Python312\\Lib\\site-packages (from langsmith<1.0.0,>=0.14.9->langchain-core<2.0.0,>=1.8.0->langchain) (1.0.0)\n",
|
|
128
|
+
"Requirement already satisfied: requests>=2.0.0 in c:\\Python312\\Lib\\site-packages (from langsmith<1.0.0,>=0.14.9->langchain-core<2.0.0,>=1.8.0->langchain) (2.34.2)\n",
|
|
129
|
+
"Requirement already satisfied: sniffio in c:\\Python312\\Lib\\site-packages (from langsmith<1.0.0,>=0.14.9->langchain-core<2.0.0,>=1.8.0->langchain) (1.3.1)\n",
|
|
130
|
+
"Requirement already satisfied: zstandard>=0.23.0 in c:\\Python312\\Lib\\site-packages (from langsmith<1.0.0,>=0.14.9->langchain-core<2.0.0,>=1.8.0->langchain) (0.25.0)\n",
|
|
131
|
+
"Requirement already satisfied: idna>=2.8 in c:\\Python312\\Lib\\site-packages (from anyio<5,>=3.5.0->langsmith<1.0.0,>=0.14.9->langchain-core<2.0.0,>=1.8.0->langchain) (3.20)\n",
|
|
132
|
+
"Requirement already satisfied: httpcore2==2.16.0 in c:\\Python312\\Lib\\site-packages (from httpx2<3,>=2->langsmith<1.0.0,>=0.14.9->langchain-core<2.0.0,>=1.8.0->langchain) (2.16.0)\n",
|
|
133
|
+
"Requirement already satisfied: truststore>=0.10 in c:\\Python312\\Lib\\site-packages (from httpx2<3,>=2->langsmith<1.0.0,>=0.14.9->langchain-core<2.0.0,>=1.8.0->langchain) (0.10.5)\n",
|
|
134
|
+
"Requirement already satisfied: h11>=0.16 in c:\\Python312\\Lib\\site-packages (from httpcore2==2.16.0->httpx2<3,>=2->langsmith<1.0.0,>=0.14.9->langchain-core<2.0.0,>=1.8.0->langchain) (0.16.0)\n",
|
|
135
|
+
"Requirement already satisfied: annotated-types>=0.6.0 in c:\\Python312\\Lib\\site-packages (from pydantic>=2.7.4->langchain) (0.8.0)\n",
|
|
136
|
+
"Requirement already satisfied: pydantic-core==2.50.4 in c:\\Python312\\Lib\\site-packages (from pydantic>=2.7.4->langchain) (2.50.4)\n",
|
|
137
|
+
"Requirement already satisfied: typing-inspection>=0.4.4 in c:\\Python312\\Lib\\site-packages (from pydantic>=2.7.4->langchain) (0.4.4)\n",
|
|
138
|
+
"Collecting langchain-core<2.0.0,>=1.8.0 (from langchain)\n",
|
|
139
|
+
" Downloading langchain_core-1.8.5-py3-none-any.whl.metadata (4.7 kB)\n",
|
|
140
|
+
"Requirement already satisfied: openai>=2.45.0 in c:\\Python312\\Lib\\site-packages (from langchain-openai) (3.41.0)\n",
|
|
141
|
+
"Requirement already satisfied: tiktoken>=0.7.0 in c:\\Python312\\Lib\\site-packages (from langchain-openai) (0.14.0)\n",
|
|
142
|
+
"Collecting langchain-protocol>=0.0.15 (from langgraph-sdk<0.5.0,>=0.4.6->langgraph<1.3.0,>=1.2.12->langchain)\n",
|
|
143
|
+
" Downloading langchain_protocol-0.0.22-py3-none-any.whl.metadata (2.4 kB)\n",
|
|
144
|
+
"Collecting mcp<2.0.0,>=1.24.0 (from langchain-mcp-adapters)\n",
|
|
145
|
+
" Downloading mcp-1.30.0-py3-none-any.whl.metadata (9.3 kB)\n",
|
|
146
|
+
"Requirement already satisfied: httpx-sse>=0.4 in c:\\Python312\\Lib\\site-packages (from mcp<2.0.0,>=1.24.0->langchain-mcp-adapters) (0.4.3)\n",
|
|
147
|
+
"Requirement already satisfied: jsonschema>=4.20.0 in c:\\Python312\\Lib\\site-packages (from mcp<2.0.0,>=1.24.0->langchain-mcp-adapters) (4.26.0)\n",
|
|
148
|
+
"Requirement already satisfied: pydantic-settings>=2.5.2 in c:\\Python312\\Lib\\site-packages (from mcp<2.0.0,>=1.24.0->langchain-mcp-adapters) (2.16.2)\n",
|
|
149
|
+
"Collecting pyjwt>=2.10.1 (from pyjwt[crypto]>=2.10.1->mcp<2.0.0,>=1.24.0->langchain-mcp-adapters)\n",
|
|
150
|
+
" Downloading pyjwt-2.15.1-py3-none-any.whl.metadata (3.5 kB)\n",
|
|
151
|
+
"Requirement already satisfied: python-multipart>=0.0.9 in c:\\Python312\\Lib\\site-packages (from mcp<2.0.0,>=1.24.0->langchain-mcp-adapters) (0.0.32)\n",
|
|
152
|
+
"Collecting pywin32>=310 (from mcp<2.0.0,>=1.24.0->langchain-mcp-adapters)\n",
|
|
153
|
+
" Downloading pywin32-312-cp312-cp312-win_amd64.whl.metadata (11 kB)\n",
|
|
154
|
+
"Collecting sse-starlette>=1.6.1 (from mcp<2.0.0,>=1.24.0->langchain-mcp-adapters)\n",
|
|
155
|
+
" Downloading sse_starlette-3.7.1-py3-none-any.whl.metadata (15 kB)\n",
|
|
156
|
+
"Requirement already satisfied: starlette>=0.27 in c:\\Python312\\Lib\\site-packages (from mcp<2.0.0,>=1.24.0->langchain-mcp-adapters) (1.10.0)\n",
|
|
157
|
+
"Requirement already satisfied: uvicorn>=0.31.1 in c:\\Python312\\Lib\\site-packages (from mcp<2.0.0,>=1.24.0->langchain-mcp-adapters) (0.54.0)\n",
|
|
158
|
+
"Requirement already satisfied: httpcore==1.* in c:\\Python312\\Lib\\site-packages (from httpx>=0.23.0->langchain-core<2.0.0,>=1.8.0->langchain) (1.0.9)\n",
|
|
159
|
+
"Requirement already satisfied: jsonpointer>=3.2 in c:\\Python312\\Lib\\site-packages (from jsonpatch>=1.33.0->langchain-core<2.0.0,>=1.8.0->langchain) (3.6)\n",
|
|
160
|
+
"Requirement already satisfied: attrs>=22.2.0 in c:\\Python312\\Lib\\site-packages (from jsonschema>=4.20.0->mcp<2.0.0,>=1.24.0->langchain-mcp-adapters) (26.1.0)\n",
|
|
161
|
+
"Requirement already satisfied: jsonschema-specifications>=2023.03.6 in c:\\Python312\\Lib\\site-packages (from jsonschema>=4.20.0->mcp<2.0.0,>=1.24.0->langchain-mcp-adapters) (2025.9.1)\n",
|
|
162
|
+
"Requirement already satisfied: referencing>=0.28.4 in c:\\Python312\\Lib\\site-packages (from jsonschema>=4.20.0->mcp<2.0.0,>=1.24.0->langchain-mcp-adapters) (0.37.0)\n",
|
|
163
|
+
"Requirement already satisfied: rpds-py>=0.25.0 in c:\\Python312\\Lib\\site-packages (from jsonschema>=4.20.0->mcp<2.0.0,>=1.24.0->langchain-mcp-adapters) (2026.9.1)\n",
|
|
164
|
+
"Requirement already satisfied: jiter<1,>=0.16.0 in c:\\Python312\\Lib\\site-packages (from openai>=2.45.0->langchain-openai) (0.18.0)\n",
|
|
165
|
+
"Requirement already satisfied: python-dotenv>=1.2.2 in c:\\Python312\\Lib\\site-packages (from pydantic-settings>=2.5.2->mcp<2.0.0,>=1.24.0->langchain-mcp-adapters) (1.2.4)\n",
|
|
166
|
+
"Collecting cryptography>=3.4.0 (from pyjwt[crypto]>=2.10.1->mcp<2.0.0,>=1.24.0->langchain-mcp-adapters)\n",
|
|
167
|
+
" Downloading cryptography-50.0.2-cp311-abi3-win_amd64.whl.metadata (4.4 kB)\n",
|
|
168
|
+
"Requirement already satisfied: cffi>=2.0.0 in c:\\Python312\\Lib\\site-packages (from cryptography>=3.4.0->pyjwt[crypto]>=2.10.1->mcp<2.0.0,>=1.24.0->langchain-mcp-adapters) (2.1.1)\n",
|
|
169
|
+
"Requirement already satisfied: pycparser in c:\\Python312\\Lib\\site-packages (from cffi>=2.0.0->cryptography>=3.4.0->pyjwt[crypto]>=2.10.1->mcp<2.0.0,>=1.24.0->langchain-mcp-adapters) (3.12)\n",
|
|
170
|
+
"Requirement already satisfied: charset_normalizer<4,>=2 in c:\\Python312\\Lib\\site-packages (from requests>=2.0.0->langsmith<1.0.0,>=0.14.9->langchain-core<2.0.0,>=1.8.0->langchain) (3.5.2)\n",
|
|
171
|
+
"Requirement already satisfied: urllib3<3,>=1.26 in c:\\Python312\\Lib\\site-packages (from requests>=2.0.0->langsmith<1.0.0,>=0.14.9->langchain-core<2.0.0,>=1.8.0->langchain) (2.8.0)\n",
|
|
172
|
+
"Requirement already satisfied: regex in c:\\Python312\\Lib\\site-packages (from tiktoken>=0.7.0->langchain-openai) (2026.9.29)\n",
|
|
173
|
+
"Requirement already satisfied: click>=7.0 in c:\\Python312\\Lib\\site-packages (from uvicorn>=0.31.1->mcp<2.0.0,>=1.24.0->langchain-mcp-adapters) (8.5.0)\n",
|
|
174
|
+
"Downloading langchain_openai-1.8.5-py3-none-any.whl (158 kB)\n",
|
|
175
|
+
"Downloading langchain_core-1.8.5-py3-none-any.whl (591 kB)\n",
|
|
176
|
+
" ---------------------------------------- 0.0/591.4 kB ? eta -:--:--\n",
|
|
177
|
+
" ---------------------------------------- 591.4/591.4 kB 21.9 MB/s 0:00:00\n",
|
|
178
|
+
"Downloading langchain_mcp_adapters-0.3.2-py3-none-any.whl (28 kB)\n",
|
|
179
|
+
"Downloading mcp-1.30.0-py3-none-any.whl (234 kB)\n",
|
|
180
|
+
"Downloading langchain_protocol-0.0.22-py3-none-any.whl (7.6 kB)\n",
|
|
181
|
+
"Downloading pyjwt-2.15.1-py3-none-any.whl (33 kB)\n",
|
|
182
|
+
"Downloading cryptography-50.0.2-cp311-abi3-win_amd64.whl (3.8 MB)\n",
|
|
183
|
+
" ---------------------------------------- 0.0/3.8 MB ? eta -:--:--\n",
|
|
184
|
+
" ---------------------------------------- 3.8/3.8 MB 32.4 MB/s 0:00:00\n",
|
|
185
|
+
"Downloading pywin32-312-cp312-cp312-win_amd64.whl (6.9 MB)\n",
|
|
186
|
+
" ---------------------------------------- 0.0/6.9 MB ? eta -:--:--\n",
|
|
187
|
+
" ---------------------------------------- 6.9/6.9 MB 53.2 MB/s 0:00:00\n",
|
|
188
|
+
"Downloading sse_starlette-3.7.1-py3-none-any.whl (18 kB)\n",
|
|
189
|
+
"Installing collected packages: pywin32, pyjwt, langchain-protocol, cryptography, sse-starlette, mcp, langchain-core, langchain-openai, langchain-mcp-adapters\n",
|
|
190
|
+
"\n",
|
|
191
|
+
" ---------------------------------------- 0/9 [pywin32]\n",
|
|
192
|
+
" ---------------------------------------- 0/9 [pywin32]\n",
|
|
193
|
+
" ---------------------------------------- 0/9 [pywin32]\n",
|
|
194
|
+
" ---------------------------------------- 0/9 [pywin32]\n",
|
|
195
|
+
" ---------------------------------------- 0/9 [pywin32]\n",
|
|
196
|
+
" ---------------------------------------- 0/9 [pywin32]\n",
|
|
197
|
+
" ---------------------------------------- 0/9 [pywin32]\n",
|
|
198
|
+
" ---------------------------------------- 0/9 [pywin32]\n",
|
|
199
|
+
" ---------------------------------------- 0/9 [pywin32]\n",
|
|
200
|
+
" ---------------------------------------- 0/9 [pywin32]\n",
|
|
201
|
+
" ---------------------------------------- 0/9 [pywin32]\n",
|
|
202
|
+
" ---------------------------------------- 0/9 [pywin32]\n",
|
|
203
|
+
" ---------------------------------------- 0/9 [pywin32]\n",
|
|
204
|
+
" ---------------------------------------- 0/9 [pywin32]\n",
|
|
205
|
+
" ---------------------------------------- 0/9 [pywin32]\n",
|
|
206
|
+
" ---------------------------------------- 0/9 [pywin32]\n",
|
|
207
|
+
" ---------------------------------------- 0/9 [pywin32]\n",
|
|
208
|
+
" ---------------------------------------- 0/9 [pywin32]\n",
|
|
209
|
+
" ---------------------------------------- 0/9 [pywin32]\n",
|
|
210
|
+
" ---------------------------------------- 0/9 [pywin32]\n",
|
|
211
|
+
" ---------------------------------------- 0/9 [pywin32]\n",
|
|
212
|
+
" ---------------------------------------- 0/9 [pywin32]\n",
|
|
213
|
+
" ---------------------------------------- 0/9 [pywin32]\n",
|
|
214
|
+
" ---------------------------------------- 0/9 [pywin32]\n",
|
|
215
|
+
" ---------------------------------------- 0/9 [pywin32]\n",
|
|
216
|
+
" ---------------------------------------- 0/9 [pywin32]\n",
|
|
217
|
+
" ---------------------------------------- 0/9 [pywin32]\n",
|
|
218
|
+
" ---------------------------------------- 0/9 [pywin32]\n",
|
|
219
|
+
" ---------------------------------------- 0/9 [pywin32]\n",
|
|
220
|
+
" ---------------------------------------- 0/9 [pywin32]\n",
|
|
221
|
+
" ---------------------------------------- 0/9 [pywin32]\n",
|
|
222
|
+
" ---------------------------------------- 0/9 [pywin32]\n",
|
|
223
|
+
" ---- ----------------------------------- 1/9 [pyjwt]\n",
|
|
224
|
+
" Attempting uninstall: langchain-protocol\n",
|
|
225
|
+
" ---- ----------------------------------- 1/9 [pyjwt]\n",
|
|
226
|
+
" Found existing installation: langchain-protocol 0.0.20\n",
|
|
227
|
+
" ---- ----------------------------------- 1/9 [pyjwt]\n",
|
|
228
|
+
" Uninstalling langchain-protocol-0.0.20:\n",
|
|
229
|
+
" ---- ----------------------------------- 1/9 [pyjwt]\n",
|
|
230
|
+
" Successfully uninstalled langchain-protocol-0.0.20\n",
|
|
231
|
+
" ---- ----------------------------------- 1/9 [pyjwt]\n",
|
|
232
|
+
" ------------- -------------------------- 3/9 [cryptography]\n",
|
|
233
|
+
" ------------- -------------------------- 3/9 [cryptography]\n",
|
|
234
|
+
" ------------- -------------------------- 3/9 [cryptography]\n",
|
|
235
|
+
" ------------- -------------------------- 3/9 [cryptography]\n",
|
|
236
|
+
" ------------- -------------------------- 3/9 [cryptography]\n",
|
|
237
|
+
" ------------- -------------------------- 3/9 [cryptography]\n",
|
|
238
|
+
" ---------------------- ----------------- 5/9 [mcp]\n",
|
|
239
|
+
" ---------------------- ----------------- 5/9 [mcp]\n",
|
|
240
|
+
" ---------------------- ----------------- 5/9 [mcp]\n",
|
|
241
|
+
" ---------------------- ----------------- 5/9 [mcp]\n",
|
|
242
|
+
" ---------------------- ----------------- 5/9 [mcp]\n",
|
|
243
|
+
" ---------------------- ----------------- 5/9 [mcp]\n",
|
|
244
|
+
" ---------------------- ----------------- 5/9 [mcp]\n",
|
|
245
|
+
" ---------------------- ----------------- 5/9 [mcp]\n",
|
|
246
|
+
" Attempting uninstall: langchain-core\n",
|
|
247
|
+
" ---------------------- ----------------- 5/9 [mcp]\n",
|
|
248
|
+
" Found existing installation: langchain-core 1.8.0\n",
|
|
249
|
+
" ---------------------- ----------------- 5/9 [mcp]\n",
|
|
250
|
+
" -------------------------- ------------- 6/9 [langchain-core]\n",
|
|
251
|
+
" Uninstalling langchain-core-1.8.0:\n",
|
|
252
|
+
" -------------------------- ------------- 6/9 [langchain-core]\n",
|
|
253
|
+
" Successfully uninstalled langchain-core-1.8.0\n",
|
|
254
|
+
" -------------------------- ------------- 6/9 [langchain-core]\n",
|
|
255
|
+
" -------------------------- ------------- 6/9 [langchain-core]\n",
|
|
256
|
+
" -------------------------- ------------- 6/9 [langchain-core]\n",
|
|
257
|
+
" -------------------------- ------------- 6/9 [langchain-core]\n",
|
|
258
|
+
" -------------------------- ------------- 6/9 [langchain-core]\n",
|
|
259
|
+
" -------------------------- ------------- 6/9 [langchain-core]\n",
|
|
260
|
+
" -------------------------- ------------- 6/9 [langchain-core]\n",
|
|
261
|
+
" -------------------------- ------------- 6/9 [langchain-core]\n",
|
|
262
|
+
" -------------------------- ------------- 6/9 [langchain-core]\n",
|
|
263
|
+
" -------------------------- ------------- 6/9 [langchain-core]\n",
|
|
264
|
+
" -------------------------- ------------- 6/9 [langchain-core]\n",
|
|
265
|
+
" -------------------------- ------------- 6/9 [langchain-core]\n",
|
|
266
|
+
" -------------------------- ------------- 6/9 [langchain-core]\n",
|
|
267
|
+
" -------------------------- ------------- 6/9 [langchain-core]\n",
|
|
268
|
+
" -------------------------- ------------- 6/9 [langchain-core]\n",
|
|
269
|
+
" -------------------------- ------------- 6/9 [langchain-core]\n",
|
|
270
|
+
" Attempting uninstall: langchain-openai\n",
|
|
271
|
+
" -------------------------- ------------- 6/9 [langchain-core]\n",
|
|
272
|
+
" Found existing installation: langchain-openai 1.7.4\n",
|
|
273
|
+
" -------------------------- ------------- 6/9 [langchain-core]\n",
|
|
274
|
+
" ------------------------------- -------- 7/9 [langchain-openai]\n",
|
|
275
|
+
" Uninstalling langchain-openai-1.7.4:\n",
|
|
276
|
+
" ------------------------------- -------- 7/9 [langchain-openai]\n",
|
|
277
|
+
" Successfully uninstalled langchain-openai-1.7.4\n",
|
|
278
|
+
" ------------------------------- -------- 7/9 [langchain-openai]\n",
|
|
279
|
+
" ------------------------------- -------- 7/9 [langchain-openai]\n",
|
|
280
|
+
" ------------------------------- -------- 7/9 [langchain-openai]\n",
|
|
281
|
+
" ----------------------------------- ---- 8/9 [langchain-mcp-adapters]\n",
|
|
282
|
+
" ---------------------------------------- 9/9 [langchain-mcp-adapters]\n",
|
|
283
|
+
"\n",
|
|
284
|
+
"Successfully installed cryptography-50.0.2 langchain-core-1.8.5 langchain-mcp-adapters-0.3.2 langchain-openai-1.8.5 langchain-protocol-0.0.22 mcp-1.30.0 pyjwt-2.15.1 pywin32-312 sse-starlette-3.7.1\n",
|
|
285
|
+
"Note: you may need to restart the kernel to use updated packages.\n"
|
|
286
|
+
]
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
"name": "stderr",
|
|
290
|
+
"output_type": "stream",
|
|
291
|
+
"text": [
|
|
292
|
+
"WARNING: Ignoring incompletely removed distribution ~andas-3.1.0.dist-info (c:\\Python312\\Lib\\site-packages); '~'-prefixed leftover directories are the result of a previous incomplete installation, and can be deleted\n",
|
|
293
|
+
"WARNING: Ignoring incompletely removed distribution ~lotly-6.9.0.dist-info (c:\\Python312\\Lib\\site-packages); '~'-prefixed leftover directories are the result of a previous incomplete installation, and can be deleted\n",
|
|
294
|
+
"WARNING: Ignoring incompletely removed distribution ~andas-3.1.0.dist-info (c:\\Python312\\Lib\\site-packages); '~'-prefixed leftover directories are the result of a previous incomplete installation, and can be deleted\n",
|
|
295
|
+
"WARNING: Ignoring incompletely removed distribution ~lotly-6.9.0.dist-info (c:\\Python312\\Lib\\site-packages); '~'-prefixed leftover directories are the result of a previous incomplete installation, and can be deleted\n",
|
|
296
|
+
"WARNING: Ignoring incompletely removed distribution ~andas-3.1.0.dist-info (c:\\Python312\\Lib\\site-packages); '~'-prefixed leftover directories are the result of a previous incomplete installation, and can be deleted\n",
|
|
297
|
+
"WARNING: Ignoring incompletely removed distribution ~lotly-6.9.0.dist-info (c:\\Python312\\Lib\\site-packages); '~'-prefixed leftover directories are the result of a previous incomplete installation, and can be deleted\n"
|
|
298
|
+
]
|
|
299
|
+
}
|
|
300
|
+
],
|
|
301
|
+
"source": [
|
|
302
|
+
"%pip install -U langchain langchain-openai langchain-mcp-adapters"
|
|
303
|
+
]
|
|
304
|
+
},
|
|
305
|
+
{
|
|
306
|
+
"cell_type": "code",
|
|
307
|
+
"execution_count": 5,
|
|
308
|
+
"id": "f8360d00",
|
|
309
|
+
"metadata": {},
|
|
310
|
+
"outputs": [
|
|
311
|
+
{
|
|
312
|
+
"name": "stdout",
|
|
313
|
+
"output_type": "stream",
|
|
314
|
+
"text": [
|
|
315
|
+
"Requirement already satisfied: langchain in c:\\Python312\\Lib\\site-packages (1.5.2)\n",
|
|
316
|
+
"Requirement already satisfied: langchain-core in c:\\Python312\\Lib\\site-packages (1.8.5)\n",
|
|
317
|
+
"Requirement already satisfied: langchain-openai in c:\\Python312\\Lib\\site-packages (1.8.5)\n",
|
|
318
|
+
"Requirement already satisfied: langchain-mcp-adapters in c:\\Python312\\Lib\\site-packages (0.3.2)\n",
|
|
319
|
+
"Requirement already satisfied: langgraph in c:\\Python312\\Lib\\site-packages (1.2.18)\n",
|
|
320
|
+
"Collecting langgraph\n",
|
|
321
|
+
" Downloading langgraph-1.2.24-py3-none-any.whl.metadata (4.9 kB)\n",
|
|
322
|
+
"Requirement already satisfied: pydantic>=2.7.4 in c:\\Python312\\Lib\\site-packages (from langchain) (2.14.3)\n",
|
|
323
|
+
"Requirement already satisfied: certifi>=2026.10.19 in c:\\Python312\\Lib\\site-packages (from langchain-core) (2026.10.23)\n",
|
|
324
|
+
"Requirement already satisfied: httpx>=0.23.0 in c:\\Python312\\Lib\\site-packages (from langchain-core) (0.28.1)\n",
|
|
325
|
+
"Requirement already satisfied: jsonpatch>=1.33.0 in c:\\Python312\\Lib\\site-packages (from langchain-core) (1.38)\n",
|
|
326
|
+
"Requirement already satisfied: langchain-protocol>=0.0.22 in c:\\Python312\\Lib\\site-packages (from langchain-core) (0.0.22)\n",
|
|
327
|
+
"Requirement already satisfied: langsmith<1.0.0,>=0.14.9 in c:\\Python312\\Lib\\site-packages (from langchain-core) (0.14.14)\n",
|
|
328
|
+
"Requirement already satisfied: packaging>=23.2.0 in c:\\Python312\\Lib\\site-packages (from langchain-core) (26.3)\n",
|
|
329
|
+
"Requirement already satisfied: pyyaml>=5.3.0 in c:\\Python312\\Lib\\site-packages (from langchain-core) (6.0.3)\n",
|
|
330
|
+
"Requirement already satisfied: tenacity!=8.4.0,>=8.1.0 in c:\\Python312\\Lib\\site-packages (from langchain-core) (9.1.4)\n",
|
|
331
|
+
"Requirement already satisfied: typing-extensions>=4.7.0 in c:\\Python312\\Lib\\site-packages (from langchain-core) (4.16.0)\n",
|
|
332
|
+
"Requirement already satisfied: uuid-utils>=0.12.0 in c:\\Python312\\Lib\\site-packages (from langchain-core) (0.19.0)\n",
|
|
333
|
+
"Requirement already satisfied: langgraph-checkpoint<5.0.0,>=4.3.0 in c:\\Python312\\Lib\\site-packages (from langgraph) (4.3.1)\n",
|
|
334
|
+
"Collecting langgraph-prebuilt<1.2.0,>=1.1.3 (from langgraph)\n",
|
|
335
|
+
" Downloading langgraph_prebuilt-1.1.3-py3-none-any.whl.metadata (6.9 kB)\n",
|
|
336
|
+
"Requirement already satisfied: langgraph-sdk<0.5.0,>=0.4.6 in c:\\Python312\\Lib\\site-packages (from langgraph) (0.4.10)\n",
|
|
337
|
+
"Requirement already satisfied: xxhash>=3.5.0 in c:\\Python312\\Lib\\site-packages (from langgraph) (4.0.2)\n",
|
|
338
|
+
"Requirement already satisfied: ormsgpack>=1.12.0 in c:\\Python312\\Lib\\site-packages (from langgraph-checkpoint<5.0.0,>=4.3.0->langgraph) (1.13.0)\n",
|
|
339
|
+
"Requirement already satisfied: orjson>=3.11.5 in c:\\Python312\\Lib\\site-packages (from langgraph-sdk<0.5.0,>=0.4.6->langgraph) (3.13.0)\n",
|
|
340
|
+
"Requirement already satisfied: websockets>=14 in c:\\Python312\\Lib\\site-packages (from langgraph-sdk<0.5.0,>=0.4.6->langgraph) (17.3)\n",
|
|
341
|
+
"Requirement already satisfied: anyio<5,>=3.5.0 in c:\\Python312\\Lib\\site-packages (from langsmith<1.0.0,>=0.14.9->langchain-core) (4.15.1)\n",
|
|
342
|
+
"Requirement already satisfied: distro<2,>=1.7.0 in c:\\Python312\\Lib\\site-packages (from langsmith<1.0.0,>=0.14.9->langchain-core) (1.9.0)\n",
|
|
343
|
+
"Requirement already satisfied: httpx2<3,>=2 in c:\\Python312\\Lib\\site-packages (from langsmith<1.0.0,>=0.14.9->langchain-core) (2.16.0)\n",
|
|
344
|
+
"Requirement already satisfied: requests-toolbelt>=1.0.0 in c:\\Python312\\Lib\\site-packages (from langsmith<1.0.0,>=0.14.9->langchain-core) (1.0.0)\n",
|
|
345
|
+
"Requirement already satisfied: requests>=2.0.0 in c:\\Python312\\Lib\\site-packages (from langsmith<1.0.0,>=0.14.9->langchain-core) (2.34.2)\n",
|
|
346
|
+
"Requirement already satisfied: sniffio in c:\\Python312\\Lib\\site-packages (from langsmith<1.0.0,>=0.14.9->langchain-core) (1.3.1)\n",
|
|
347
|
+
"Requirement already satisfied: zstandard>=0.23.0 in c:\\Python312\\Lib\\site-packages (from langsmith<1.0.0,>=0.14.9->langchain-core) (0.25.0)\n",
|
|
348
|
+
"Requirement already satisfied: idna>=2.8 in c:\\Python312\\Lib\\site-packages (from anyio<5,>=3.5.0->langsmith<1.0.0,>=0.14.9->langchain-core) (3.20)\n",
|
|
349
|
+
"Requirement already satisfied: httpcore2==2.16.0 in c:\\Python312\\Lib\\site-packages (from httpx2<3,>=2->langsmith<1.0.0,>=0.14.9->langchain-core) (2.16.0)\n",
|
|
350
|
+
"Requirement already satisfied: truststore>=0.10 in c:\\Python312\\Lib\\site-packages (from httpx2<3,>=2->langsmith<1.0.0,>=0.14.9->langchain-core) (0.10.5)\n",
|
|
351
|
+
"Requirement already satisfied: h11>=0.16 in c:\\Python312\\Lib\\site-packages (from httpcore2==2.16.0->httpx2<3,>=2->langsmith<1.0.0,>=0.14.9->langchain-core) (0.16.0)\n",
|
|
352
|
+
"Requirement already satisfied: annotated-types>=0.6.0 in c:\\Python312\\Lib\\site-packages (from pydantic>=2.7.4->langchain) (0.8.0)\n",
|
|
353
|
+
"Requirement already satisfied: pydantic-core==2.50.4 in c:\\Python312\\Lib\\site-packages (from pydantic>=2.7.4->langchain) (2.50.4)\n",
|
|
354
|
+
"Requirement already satisfied: typing-inspection>=0.4.4 in c:\\Python312\\Lib\\site-packages (from pydantic>=2.7.4->langchain) (0.4.4)\n",
|
|
355
|
+
"Requirement already satisfied: openai>=2.45.0 in c:\\Python312\\Lib\\site-packages (from langchain-openai) (3.41.0)\n",
|
|
356
|
+
"Requirement already satisfied: tiktoken>=0.7.0 in c:\\Python312\\Lib\\site-packages (from langchain-openai) (0.14.0)\n",
|
|
357
|
+
"Requirement already satisfied: mcp<2.0.0,>=1.24.0 in c:\\Python312\\Lib\\site-packages (from langchain-mcp-adapters) (1.30.0)\n",
|
|
358
|
+
"Requirement already satisfied: httpx-sse>=0.4 in c:\\Python312\\Lib\\site-packages (from mcp<2.0.0,>=1.24.0->langchain-mcp-adapters) (0.4.3)\n",
|
|
359
|
+
"Requirement already satisfied: jsonschema>=4.20.0 in c:\\Python312\\Lib\\site-packages (from mcp<2.0.0,>=1.24.0->langchain-mcp-adapters) (4.26.0)\n",
|
|
360
|
+
"Requirement already satisfied: pydantic-settings>=2.5.2 in c:\\Python312\\Lib\\site-packages (from mcp<2.0.0,>=1.24.0->langchain-mcp-adapters) (2.16.2)\n",
|
|
361
|
+
"Requirement already satisfied: pyjwt>=2.10.1 in c:\\Python312\\Lib\\site-packages (from pyjwt[crypto]>=2.10.1->mcp<2.0.0,>=1.24.0->langchain-mcp-adapters) (2.15.1)\n",
|
|
362
|
+
"Requirement already satisfied: python-multipart>=0.0.9 in c:\\Python312\\Lib\\site-packages (from mcp<2.0.0,>=1.24.0->langchain-mcp-adapters) (0.0.32)\n",
|
|
363
|
+
"Requirement already satisfied: pywin32>=310 in c:\\Python312\\Lib\\site-packages (from mcp<2.0.0,>=1.24.0->langchain-mcp-adapters) (312)\n",
|
|
364
|
+
"Requirement already satisfied: sse-starlette>=1.6.1 in c:\\Python312\\Lib\\site-packages (from mcp<2.0.0,>=1.24.0->langchain-mcp-adapters) (3.7.1)\n",
|
|
365
|
+
"Requirement already satisfied: starlette>=0.27 in c:\\Python312\\Lib\\site-packages (from mcp<2.0.0,>=1.24.0->langchain-mcp-adapters) (1.10.0)\n",
|
|
366
|
+
"Requirement already satisfied: uvicorn>=0.31.1 in c:\\Python312\\Lib\\site-packages (from mcp<2.0.0,>=1.24.0->langchain-mcp-adapters) (0.54.0)\n",
|
|
367
|
+
"Requirement already satisfied: httpcore==1.* in c:\\Python312\\Lib\\site-packages (from httpx>=0.23.0->langchain-core) (1.0.9)\n",
|
|
368
|
+
"Requirement already satisfied: jsonpointer>=3.2 in c:\\Python312\\Lib\\site-packages (from jsonpatch>=1.33.0->langchain-core) (3.6)\n",
|
|
369
|
+
"Requirement already satisfied: attrs>=22.2.0 in c:\\Python312\\Lib\\site-packages (from jsonschema>=4.20.0->mcp<2.0.0,>=1.24.0->langchain-mcp-adapters) (26.1.0)\n",
|
|
370
|
+
"Requirement already satisfied: jsonschema-specifications>=2023.03.6 in c:\\Python312\\Lib\\site-packages (from jsonschema>=4.20.0->mcp<2.0.0,>=1.24.0->langchain-mcp-adapters) (2025.9.1)\n",
|
|
371
|
+
"Requirement already satisfied: referencing>=0.28.4 in c:\\Python312\\Lib\\site-packages (from jsonschema>=4.20.0->mcp<2.0.0,>=1.24.0->langchain-mcp-adapters) (0.37.0)\n",
|
|
372
|
+
"Requirement already satisfied: rpds-py>=0.25.0 in c:\\Python312\\Lib\\site-packages (from jsonschema>=4.20.0->mcp<2.0.0,>=1.24.0->langchain-mcp-adapters) (2026.9.1)\n",
|
|
373
|
+
"Requirement already satisfied: jiter<1,>=0.16.0 in c:\\Python312\\Lib\\site-packages (from openai>=2.45.0->langchain-openai) (0.18.0)\n",
|
|
374
|
+
"Requirement already satisfied: python-dotenv>=1.2.2 in c:\\Python312\\Lib\\site-packages (from pydantic-settings>=2.5.2->mcp<2.0.0,>=1.24.0->langchain-mcp-adapters) (1.2.4)\n",
|
|
375
|
+
"Requirement already satisfied: cryptography>=3.4.0 in c:\\Python312\\Lib\\site-packages (from pyjwt[crypto]>=2.10.1->mcp<2.0.0,>=1.24.0->langchain-mcp-adapters) (50.0.2)\n",
|
|
376
|
+
"Requirement already satisfied: cffi>=2.0.0 in c:\\Python312\\Lib\\site-packages (from cryptography>=3.4.0->pyjwt[crypto]>=2.10.1->mcp<2.0.0,>=1.24.0->langchain-mcp-adapters) (2.1.1)\n",
|
|
377
|
+
"Requirement already satisfied: pycparser in c:\\Python312\\Lib\\site-packages (from cffi>=2.0.0->cryptography>=3.4.0->pyjwt[crypto]>=2.10.1->mcp<2.0.0,>=1.24.0->langchain-mcp-adapters) (3.12)\n",
|
|
378
|
+
"Requirement already satisfied: charset_normalizer<4,>=2 in c:\\Python312\\Lib\\site-packages (from requests>=2.0.0->langsmith<1.0.0,>=0.14.9->langchain-core) (3.5.2)\n",
|
|
379
|
+
"Requirement already satisfied: urllib3<3,>=1.26 in c:\\Python312\\Lib\\site-packages (from requests>=2.0.0->langsmith<1.0.0,>=0.14.9->langchain-core) (2.8.0)\n",
|
|
380
|
+
"Requirement already satisfied: regex in c:\\Python312\\Lib\\site-packages (from tiktoken>=0.7.0->langchain-openai) (2026.9.29)\n",
|
|
381
|
+
"Requirement already satisfied: click>=7.0 in c:\\Python312\\Lib\\site-packages (from uvicorn>=0.31.1->mcp<2.0.0,>=1.24.0->langchain-mcp-adapters) (8.5.0)\n",
|
|
382
|
+
"Downloading langgraph-1.2.24-py3-none-any.whl (264 kB)\n",
|
|
383
|
+
"Downloading langgraph_prebuilt-1.1.3-py3-none-any.whl (42 kB)\n",
|
|
384
|
+
"Installing collected packages: langgraph-prebuilt, langgraph\n",
|
|
385
|
+
"\n",
|
|
386
|
+
" Attempting uninstall: langgraph-prebuilt\n",
|
|
387
|
+
"\n",
|
|
388
|
+
" Found existing installation: langgraph-prebuilt 1.1.1\n",
|
|
389
|
+
"\n",
|
|
390
|
+
" Uninstalling langgraph-prebuilt-1.1.1:\n",
|
|
391
|
+
"\n",
|
|
392
|
+
" Successfully uninstalled langgraph-prebuilt-1.1.1\n",
|
|
393
|
+
"\n",
|
|
394
|
+
" Attempting uninstall: langgraph\n",
|
|
395
|
+
"\n",
|
|
396
|
+
" Found existing installation: langgraph 1.2.18\n",
|
|
397
|
+
"\n",
|
|
398
|
+
" Uninstalling langgraph-1.2.18:\n",
|
|
399
|
+
"\n",
|
|
400
|
+
" -------------------- ------------------- 1/2 [langgraph]\n",
|
|
401
|
+
" Successfully uninstalled langgraph-1.2.18\n",
|
|
402
|
+
" -------------------- ------------------- 1/2 [langgraph]\n",
|
|
403
|
+
" -------------------- ------------------- 1/2 [langgraph]\n",
|
|
404
|
+
" -------------------- ------------------- 1/2 [langgraph]\n",
|
|
405
|
+
" -------------------- ------------------- 1/2 [langgraph]\n",
|
|
406
|
+
" -------------------- ------------------- 1/2 [langgraph]\n",
|
|
407
|
+
" -------------------- ------------------- 1/2 [langgraph]\n",
|
|
408
|
+
" -------------------- ------------------- 1/2 [langgraph]\n",
|
|
409
|
+
" ---------------------------------------- 2/2 [langgraph]\n",
|
|
410
|
+
"\n",
|
|
411
|
+
"Successfully installed langgraph-1.2.24 langgraph-prebuilt-1.1.3\n",
|
|
412
|
+
"Note: you may need to restart the kernel to use updated packages.\n"
|
|
413
|
+
]
|
|
414
|
+
},
|
|
415
|
+
{
|
|
416
|
+
"name": "stderr",
|
|
417
|
+
"output_type": "stream",
|
|
418
|
+
"text": [
|
|
419
|
+
"WARNING: Ignoring incompletely removed distribution ~andas-3.1.0.dist-info (c:\\Python312\\Lib\\site-packages); '~'-prefixed leftover directories are the result of a previous incomplete installation, and can be deleted\n",
|
|
420
|
+
"WARNING: Ignoring incompletely removed distribution ~lotly-6.9.0.dist-info (c:\\Python312\\Lib\\site-packages); '~'-prefixed leftover directories are the result of a previous incomplete installation, and can be deleted\n",
|
|
421
|
+
"WARNING: Ignoring incompletely removed distribution ~andas-3.1.0.dist-info (c:\\Python312\\Lib\\site-packages); '~'-prefixed leftover directories are the result of a previous incomplete installation, and can be deleted\n",
|
|
422
|
+
"WARNING: Ignoring incompletely removed distribution ~lotly-6.9.0.dist-info (c:\\Python312\\Lib\\site-packages); '~'-prefixed leftover directories are the result of a previous incomplete installation, and can be deleted\n",
|
|
423
|
+
"WARNING: Ignoring incompletely removed distribution ~andas-3.1.0.dist-info (c:\\Python312\\Lib\\site-packages); '~'-prefixed leftover directories are the result of a previous incomplete installation, and can be deleted\n",
|
|
424
|
+
"WARNING: Ignoring incompletely removed distribution ~lotly-6.9.0.dist-info (c:\\Python312\\Lib\\site-packages); '~'-prefixed leftover directories are the result of a previous incomplete installation, and can be deleted\n"
|
|
425
|
+
]
|
|
426
|
+
}
|
|
427
|
+
],
|
|
428
|
+
"source": [
|
|
429
|
+
"%pip install -U langchain langchain-core langchain-openai langchain-mcp-adapters langgraph"
|
|
430
|
+
]
|
|
431
|
+
},
|
|
432
|
+
{
|
|
433
|
+
"cell_type": "markdown",
|
|
434
|
+
"id": "3bcb4a85",
|
|
435
|
+
"metadata": {},
|
|
436
|
+
"source": [
|
|
437
|
+
"### py 파일로실행\n",
|
|
438
|
+
"\n",
|
|
439
|
+
"<img src='lec_image/create_agent.png' width='600' height='400'>"
|
|
440
|
+
]
|
|
441
|
+
},
|
|
442
|
+
{
|
|
443
|
+
"cell_type": "code",
|
|
444
|
+
"execution_count": null,
|
|
445
|
+
"id": "08759944",
|
|
446
|
+
"metadata": {},
|
|
447
|
+
"outputs": [],
|
|
448
|
+
"source": [
|
|
449
|
+
"import asyncio\n",
|
|
450
|
+
"from langchain.agents import create_agent\n",
|
|
451
|
+
"from langchain_openai import ChatOpenAI\n",
|
|
452
|
+
"from langchain_mcp_adapters.client import MultiServerMCPClient\n",
|
|
453
|
+
"\n",
|
|
454
|
+
"async def main():\n",
|
|
455
|
+
"\n",
|
|
456
|
+
" # 1. Node.js MCP 서버 연결\n",
|
|
457
|
+
" client = MultiServerMCPClient({\n",
|
|
458
|
+
" \"my-first-mcp\": {\n",
|
|
459
|
+
" \"command\": \"node\",\n",
|
|
460
|
+
" \"args\": [\n",
|
|
461
|
+
" r\"D:\\busan\\mcp\\mcp_server_test\\server.js\"\n",
|
|
462
|
+
" ],\n",
|
|
463
|
+
" \"transport\": \"stdio\"\n",
|
|
464
|
+
" }\n",
|
|
465
|
+
" })\n",
|
|
466
|
+
"\n",
|
|
467
|
+
" # 2. MCP Tool 가져오기\n",
|
|
468
|
+
" tools = await client.get_tools()\n",
|
|
469
|
+
"\n",
|
|
470
|
+
" print(\"Tool 목록:\", [tool.name for tool in tools])\n",
|
|
471
|
+
"\n",
|
|
472
|
+
" # 3. Agent 생성\n",
|
|
473
|
+
" agent = create_agent(\n",
|
|
474
|
+
" model=ChatOpenAI(model=\"gpt-4o-mini\"),\n",
|
|
475
|
+
" tools=tools\n",
|
|
476
|
+
" )\n",
|
|
477
|
+
"\n",
|
|
478
|
+
" # 4. Agent 실행\n",
|
|
479
|
+
" result = await agent.ainvoke({\n",
|
|
480
|
+
" \"messages\": [\n",
|
|
481
|
+
" {\"role\": \"user\", \"content\": \"say_hello 도구로 홍길동에게 인사해줘\"}\n",
|
|
482
|
+
" ]\n",
|
|
483
|
+
" })\n",
|
|
484
|
+
"\n",
|
|
485
|
+
" print(result[\"messages\"][-1].content)\n",
|
|
486
|
+
"\n",
|
|
487
|
+
"\n",
|
|
488
|
+
"if __name__ == \"__main__\":\n",
|
|
489
|
+
" asyncio.run(main())"
|
|
490
|
+
]
|
|
491
|
+
},
|
|
492
|
+
{
|
|
493
|
+
"cell_type": "code",
|
|
494
|
+
"execution_count": null,
|
|
495
|
+
"id": "f01f90fe",
|
|
496
|
+
"metadata": {},
|
|
497
|
+
"outputs": [],
|
|
498
|
+
"source": [
|
|
499
|
+
"import asyncio\n",
|
|
500
|
+
"from langchain.agents import create_agent\n",
|
|
501
|
+
"from langchain_openai import ChatOpenAI\n",
|
|
502
|
+
"from langchain_mcp_adapters.client import MultiServerMCPClient\n",
|
|
503
|
+
"\n",
|
|
504
|
+
"# 1. MCP 서버 연결\n",
|
|
505
|
+
"client = MultiServerMCPClient({\n",
|
|
506
|
+
" \"my-first-mcp\": {\n",
|
|
507
|
+
" \"command\": \"node\",\n",
|
|
508
|
+
" \"args\": [r\"D:\\busan\\mcp\\mcp_server_test\\server.js\"],\n",
|
|
509
|
+
" \"transport\": \"stdio\"\n",
|
|
510
|
+
" }\n",
|
|
511
|
+
"})\n",
|
|
512
|
+
"\n",
|
|
513
|
+
"# 2. MCP Tool 가져오기:asyncio.run()은 비동기 작업이 완료될 때까지 기다린 후 결과를 반환\n",
|
|
514
|
+
"tools = asyncio.run(client.get_tools())\n",
|
|
515
|
+
"\n",
|
|
516
|
+
"print(\"Tool 목록:\", [t.name for t in tools])\n",
|
|
517
|
+
"\n",
|
|
518
|
+
"# 3. Agent 생성\n",
|
|
519
|
+
"agent = create_agent(\n",
|
|
520
|
+
" model=ChatOpenAI(model=\"gpt-4o-mini\"),\n",
|
|
521
|
+
" tools=tools\n",
|
|
522
|
+
")\n",
|
|
523
|
+
"\n",
|
|
524
|
+
"# 4. Agent 실행\n",
|
|
525
|
+
"result = asyncio.run(agent.ainvoke({\n",
|
|
526
|
+
" \"messages\": [\n",
|
|
527
|
+
" {\"role\": \"user\", \"content\": \"홍길동에게 인사해줘\"}\n",
|
|
528
|
+
" ]\n",
|
|
529
|
+
"}))\n",
|
|
530
|
+
"\n",
|
|
531
|
+
"print(result[\"messages\"][-1].content)"
|
|
532
|
+
]
|
|
533
|
+
}
|
|
534
|
+
],
|
|
535
|
+
"metadata": {
|
|
536
|
+
"kernelspec": {
|
|
537
|
+
"display_name": "Python 3",
|
|
538
|
+
"language": "python",
|
|
539
|
+
"name": "python3"
|
|
540
|
+
},
|
|
541
|
+
"language_info": {
|
|
542
|
+
"codemirror_mode": {
|
|
543
|
+
"name": "ipython",
|
|
544
|
+
"version": 3
|
|
545
|
+
},
|
|
546
|
+
"file_extension": ".py",
|
|
547
|
+
"mimetype": "text/x-python",
|
|
548
|
+
"name": "python",
|
|
549
|
+
"nbconvert_exporter": "python",
|
|
550
|
+
"pygments_lexer": "ipython3",
|
|
551
|
+
"version": "3.12.9"
|
|
552
|
+
}
|
|
553
|
+
},
|
|
554
|
+
"nbformat": 4,
|
|
555
|
+
"nbformat_minor": 5
|
|
556
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ilhank/hello-server",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "server.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"hello-server": "server.js"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
11
|
+
"start": "node server.js"
|
|
12
|
+
},
|
|
13
|
+
"keywords": [],
|
|
14
|
+
"author": "",
|
|
15
|
+
"license": "ISC",
|
|
16
|
+
"description": "",
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"@modelcontextprotocol/sdk": "^1.32.2"
|
|
19
|
+
}
|
|
20
|
+
}
|
package/server.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
|
|
5
|
+
const server = new McpServer({
|
|
6
|
+
name: "my-first-mcp",
|
|
7
|
+
version: "1.0.0",
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
server.registerTool("say_hello", {
|
|
11
|
+
title: "인사 툴", // ← 새로 추가된 필드
|
|
12
|
+
description: "이름을 받아 인사말을 반환합니다",
|
|
13
|
+
inputSchema: {
|
|
14
|
+
name: z.string().describe("인사할 이름"),
|
|
15
|
+
},
|
|
16
|
+
}, async ({ name }) => ({
|
|
17
|
+
content: [{ type: "text", text: `안녕하세요, ${name}님!` }],
|
|
18
|
+
}));
|
|
19
|
+
|
|
20
|
+
server.registerTool("add_numbers", {
|
|
21
|
+
title: "덧셈 툴",
|
|
22
|
+
description: "두 숫자를 더합니다",
|
|
23
|
+
inputSchema: {
|
|
24
|
+
a: z.number(),
|
|
25
|
+
b: z.number(),
|
|
26
|
+
},
|
|
27
|
+
}, async ({ a, b }) => ({
|
|
28
|
+
content: [{ type: "text", text: `${a} + ${b} = ${a + b}` }],
|
|
29
|
+
}));
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
const transport = new StdioServerTransport();
|
|
33
|
+
await server.connect(transport);
|
|
34
|
+
//표준입출력(stdio)을 통해 MCP Client의 요청을 기다리고 있음.....
|
package/README.md
DELETED