project basic

This commit is contained in:
ext-ensky-jeremy.jj.he
2025-08-28 17:32:41 +08:00
commit 9415c1578b
11 changed files with 1729 additions and 0 deletions

10
.gitignore vendored Normal file
View File

@@ -0,0 +1,10 @@
# Python-generated files
__pycache__/
*.py[oc]
build/
dist/
wheels/
*.egg-info
# Virtual environments
.venv

1
.python-version Normal file
View File

@@ -0,0 +1 @@
3.13

0
README.md Normal file
View File

15
pyproject.toml Normal file
View File

@@ -0,0 +1,15 @@
[project]
name = "login-mcp"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.13"
dependencies = [
"fastmcp>=2.11.3",
"langchain>=0.3.27",
"langchain-ollama>=0.3.7",
"langgraph>=0.6.6",
"mcpstore>=1.4.27",
"python-dotenv>=1.1.1",
"requests>=2.32.5",
]

1
src/.env Normal file
View File

@@ -0,0 +1 @@
remote_ollama_url = 'http://192.168.50.19:11434'

11
src/login_test.py Normal file
View File

@@ -0,0 +1,11 @@
import requests
payload={
'username':'user@example.com',
'password':'stringt'
}
url = 'http://localhost:8000/api/v1/login/access-token'
response = requests.post(url,data=payload)
print(response.text)

35
src/mcp_server.py Normal file
View File

@@ -0,0 +1,35 @@
from mcp.server.fastmcp import FastMCP
import requests
mcp = FastMCP(name='FastMCP',host='0.0.0.0',port=8000)
@mcp.tool()
def login_function(username:str, password:str) -> dict :
"""
功能:
使用账号密码调用登陆api进行登陆。
参数:
username:用户的账号,或者是用户名称
password:用户的密码
"""
payload={
'username':username,
'password':password
}
url = 'http://localhost:8000/api/v1/login/access-token'
response = requests.post(url,data=payload)
return response.text
@mcp.tool()
def register_function(username:str, password:str):
"""
功能:
注册用户调用注册api进行新用户注册。
参数:
username:用户的账号,或者是用户名称
password:用户的密码
"""

31
src/ollama_agent.py Normal file
View File

@@ -0,0 +1,31 @@
from langchain_ollama import ChatOllama
from langgraph.prebuilt import create_react_agent
from mcpstore import MCPStore
from dotenv import load_dotenv
import os
load_dotenv()
remote_ollama_url = os.environ.get("remote_ollama_url")
llm = ChatOllama(
model="qwen3:8b",
base_url=remote_ollama_url,
temperature=0.1,
)
store_mcp = MCPStore.setup_store()
store_mcp.for_store().add_service(
config=[
{'name':'登陆助手','url':''}
]
)
tools = store_mcp.for_store().for_langchain().list_tools()

12
src/register_test.py Normal file
View File

@@ -0,0 +1,12 @@
import requests
payload={
'email':'bbxx@qq.com',
"full_name": "string",
'password':'stringt123'
}
url = 'http://localhost:8000/api/v1/users/signup'
response = requests.post(url,json=payload)
print(response.text)

0
src/webui.py Normal file
View File

1613
uv.lock generated Normal file

File diff suppressed because it is too large Load Diff