aixtools 0.1.0__py3-none-any.whl → 0.1.2__py3-none-any.whl
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.
Potentially problematic release.
This version of aixtools might be problematic. Click here for more details.
- aixtools/.chainlit/config.toml +113 -0
- aixtools/.chainlit/translations/bn.json +214 -0
- aixtools/.chainlit/translations/en-US.json +214 -0
- aixtools/.chainlit/translations/gu.json +214 -0
- aixtools/.chainlit/translations/he-IL.json +214 -0
- aixtools/.chainlit/translations/hi.json +214 -0
- aixtools/.chainlit/translations/ja.json +214 -0
- aixtools/.chainlit/translations/kn.json +214 -0
- aixtools/.chainlit/translations/ml.json +214 -0
- aixtools/.chainlit/translations/mr.json +214 -0
- aixtools/.chainlit/translations/nl.json +214 -0
- aixtools/.chainlit/translations/ta.json +214 -0
- aixtools/.chainlit/translations/te.json +214 -0
- aixtools/.chainlit/translations/zh-CN.json +214 -0
- aixtools/__init__.py +7 -1
- aixtools/_version.py +34 -0
- aixtools/agents/agent_batch.py +2 -5
- aixtools/chainlit.md +14 -0
- aixtools/mcp/faulty_mcp.py +30 -30
- aixtools/model_patch/model_patch.py +3 -5
- {aixtools-0.1.0.dist-info → aixtools-0.1.2.dist-info}/METADATA +1 -1
- {aixtools-0.1.0.dist-info → aixtools-0.1.2.dist-info}/RECORD +36 -9
- aixtools-0.1.2.dist-info/top_level.txt +4 -0
- docker/mcp-base/Dockerfile +36 -0
- notebooks/example_faulty_mcp_server.ipynb +74 -0
- notebooks/example_mcp_server_stdio.ipynb +76 -0
- notebooks/example_raw_mcp_client.ipynb +84 -0
- notebooks/example_tool_doctor.ipynb +65 -0
- scripts/config.sh +28 -0
- scripts/lint.sh +32 -0
- scripts/log_view.sh +18 -0
- scripts/run_example_mcp_server.sh +14 -0
- scripts/run_faulty_mcp_server.sh +13 -0
- scripts/run_server.sh +29 -0
- aixtools-0.1.0.dist-info/top_level.txt +0 -1
- {aixtools-0.1.0.dist-info → aixtools-0.1.2.dist-info}/WHEEL +0 -0
- {aixtools-0.1.0.dist-info → aixtools-0.1.2.dist-info}/entry_points.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from typing import Any
|
|
2
2
|
|
|
3
|
-
from pydantic import BaseModel
|
|
3
|
+
from pydantic import BaseModel, ConfigDict
|
|
4
4
|
|
|
5
5
|
from aixtools.logging.logging_config import get_logger
|
|
6
6
|
|
|
@@ -19,8 +19,7 @@ class ModelRawRequestResult(BaseModel):
|
|
|
19
19
|
request_id: str # Unique request ID
|
|
20
20
|
result: Any # Method's result
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
arbitrary_types_allowed = True
|
|
22
|
+
model_config = ConfigDict(arbitrary_types_allowed=True)
|
|
24
23
|
|
|
25
24
|
|
|
26
25
|
class ModelRawRequestYieldItem(BaseModel):
|
|
@@ -29,8 +28,7 @@ class ModelRawRequestYieldItem(BaseModel):
|
|
|
29
28
|
item_num: int # Item number in the stream
|
|
30
29
|
item: Any # Yielded item
|
|
31
30
|
|
|
32
|
-
|
|
33
|
-
arbitrary_types_allowed = True
|
|
31
|
+
model_config = ConfigDict(arbitrary_types_allowed=True)
|
|
34
32
|
|
|
35
33
|
|
|
36
34
|
def get_request_fn(model):
|
|
@@ -1,12 +1,28 @@
|
|
|
1
|
-
aixtools/__init__.py,sha256=
|
|
1
|
+
aixtools/__init__.py,sha256=9NGHm7LjsQmsvjTZvw6QFJexSvAU4bCoN_KBk9SCa00,260
|
|
2
|
+
aixtools/_version.py,sha256=Ok5oAXdWgR9aghaFXTafTeDW6sYO3uVe6d2Nket57R4,704
|
|
2
3
|
aixtools/app.py,sha256=JzQ0nrv_bjDQokllIlGHOV0HEb-V8N6k_nGQH-TEsVU,5227
|
|
4
|
+
aixtools/chainlit.md,sha256=yC37Ly57vjKyiIvK4oUvf4DYxZCwH7iocTlx7bLeGLU,761
|
|
3
5
|
aixtools/context.py,sha256=XuvSGjG8f-QHBJlI_yCPdjYo4rm_WrswmUE8GjLoRqI,491
|
|
6
|
+
aixtools/.chainlit/config.toml,sha256=jxpzXQ9l2IRqBKTFLdvpDG4DunUcOko6kIEb3dQw4HU,3788
|
|
7
|
+
aixtools/.chainlit/translations/bn.json,sha256=eB36bL3SggncVGejh29UDnGYFd_MMDtQGBiMxQ9w1fM,16432
|
|
8
|
+
aixtools/.chainlit/translations/en-US.json,sha256=V5pTnHxsR0dkzhUwlkxqKe0qvR-T39N9tJN0c1CLsAw,7118
|
|
9
|
+
aixtools/.chainlit/translations/gu.json,sha256=0ivycR8SD6tivkcNCRcy2DEdmbnHtunt1aw_CfZxo6s,14685
|
|
10
|
+
aixtools/.chainlit/translations/he-IL.json,sha256=OS_Be7da9SITuym8ajM6yLmVQ3j3bd1cU79pkYynJbs,12431
|
|
11
|
+
aixtools/.chainlit/translations/hi.json,sha256=pClbRMdjMZf9s0KhEsaCT_B115uiP9cD3mxkkz5m1LE,15533
|
|
12
|
+
aixtools/.chainlit/translations/ja.json,sha256=WfCE9ZRXmv2KbmaLMLDQvZQNzU-Bbj-7Qo7277welW8,10845
|
|
13
|
+
aixtools/.chainlit/translations/kn.json,sha256=3Uih38QQhGx3smr8CT_-4DjUejDLBjBQsG5CFm5UzAs,17195
|
|
14
|
+
aixtools/.chainlit/translations/ml.json,sha256=cOOgV6azmVVnaqIsc_poYUS8IChRjIygxha89C8H8_c,17838
|
|
15
|
+
aixtools/.chainlit/translations/mr.json,sha256=W6ju8BdBQwZujLy4FF80Ly6gONDPOWmrenBkvHErcb0,14884
|
|
16
|
+
aixtools/.chainlit/translations/nl.json,sha256=R3e-WxkQXAiuQgnnXjFWhwzpn1EA9xJ8g9W75yyy5nM,7437
|
|
17
|
+
aixtools/.chainlit/translations/ta.json,sha256=pxa2uLEEDjiGiT6MFcCJ_kNh5KoFViHFptcJjc79Llc,17224
|
|
18
|
+
aixtools/.chainlit/translations/te.json,sha256=0qGj-ODEHVOcxfVVX5IszS1QBCKSXuU1okANP_EbvBQ,16885
|
|
19
|
+
aixtools/.chainlit/translations/zh-CN.json,sha256=EWxhT2_6CW9z0F6SI2llr3RsaL2omH1QZWHVG2n5POA,8664
|
|
4
20
|
aixtools/a2a/__init__.py,sha256=UGeU-1JoE-QmgT3A_9r4Gzw7WQU2cZr4JxNGqm5ZZrg,191
|
|
5
21
|
aixtools/a2a/app.py,sha256=VQAKJHYJJr5-qJRLXvRgc2pZtH_SPXvB293nJaEDXTw,5071
|
|
6
22
|
aixtools/a2a/utils.py,sha256=EHr3IyyBJn23ni-JcfAf6i3VpQmPs0g1TSnAZazvY_8,4039
|
|
7
23
|
aixtools/agents/__init__.py,sha256=MAW196S2_G7uGqv-VNjvlOETRfuV44WlU1leO7SiR0A,282
|
|
8
24
|
aixtools/agents/agent.py,sha256=E1zu70t53RqIbcLI_R09wUtsiYZR1bTnElCQ5PrsrKw,6127
|
|
9
|
-
aixtools/agents/agent_batch.py,sha256=
|
|
25
|
+
aixtools/agents/agent_batch.py,sha256=0Zu9yNCRPAQZPjXQ-dIUAmP1uGTVbxVt7xvnMpoJMjU,2251
|
|
10
26
|
aixtools/db/__init__.py,sha256=b8vRhme3egV-aUZbAntnOaDkSXB8UT0Xy5oqQhU_z0Q,399
|
|
11
27
|
aixtools/db/database.py,sha256=caWe95GlxZYlxn2ubDmR-_cQUW0ulkpR3BHunKIaOsw,3369
|
|
12
28
|
aixtools/db/vector_db.py,sha256=be4JGyXj3o8VEfy9L6SO1aAoDET_zazMJkYfjlYHTYQ,4133
|
|
@@ -30,8 +46,8 @@ aixtools/mcp/__init__.py,sha256=tLo2KZ1Ojo-rgEEJBGtZfUw-iOoopWoHDnYQTq3IzfE,163
|
|
|
30
46
|
aixtools/mcp/example_client.py,sha256=QCFGP3NCNJMOKWjUOnFwjnbJhUSb879IA1ZYmwjRnmc,889
|
|
31
47
|
aixtools/mcp/example_server.py,sha256=1SWCyrLWsAnOa81HC4QbPJo_lBVu0b3SZBWI-qDh1vQ,458
|
|
32
48
|
aixtools/mcp/fast_mcp_log.py,sha256=XYOS406dVjn5YTHyGRsRvVNQ0SKlRObfrKj6EeLFjHg,1057
|
|
33
|
-
aixtools/mcp/faulty_mcp.py,sha256=
|
|
34
|
-
aixtools/model_patch/model_patch.py,sha256=
|
|
49
|
+
aixtools/mcp/faulty_mcp.py,sha256=_qqiZs6SYa_baqLzBwV9ImqSjiW54bn2mbQqpy6Gb_w,12969
|
|
50
|
+
aixtools/model_patch/model_patch.py,sha256=JT-oHubIn2LeoSwWbzEQ5vLH7crJmFUecHyQfaAFHa0,1813
|
|
35
51
|
aixtools/server/__init__.py,sha256=rwPx020YpOzCnrxA80Lc4yLLcIp-Mpe9hNqVO9wDPv0,448
|
|
36
52
|
aixtools/server/app_mounter.py,sha256=0tJ0tC140ezAjnYdlhpLJQjY-TO8NVw7D8LseYCCVY8,3336
|
|
37
53
|
aixtools/server/path.py,sha256=SaIJxvmhJy3kzx5zJ6d4cKP6kKu2wFFciQkOLGTA4gg,3056
|
|
@@ -51,8 +67,19 @@ aixtools/utils/persisted_dict.py,sha256=0jQzV7oF-A6Or-HjcU6V7aMXWQL67SOKpULgmtFw
|
|
|
51
67
|
aixtools/utils/utils.py,sha256=4AkAPPnymYt4faThWz0QYSrAeQVys-l-YO8Kw302CcA,4703
|
|
52
68
|
aixtools/utils/chainlit/cl_agent_show.py,sha256=vaRuowp4BRvhxEr5hw0zHEJ7iaSF_5bo_9BH7pGPPpw,4398
|
|
53
69
|
aixtools/utils/chainlit/cl_utils.py,sha256=fxaxdkcZg6uHdM8uztxdPowg3a2f7VR7B26VPY4t-3c,5738
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
70
|
+
docker/mcp-base/Dockerfile,sha256=sSpbt0sasSBHHeGwPIpJpiEQMU5HGeXzerK8biVSt7Q,1547
|
|
71
|
+
notebooks/example_faulty_mcp_server.ipynb,sha256=b2Cy3GXfj-gOBZ7SoUzj25F1rxp5u-32EWPHWQ-sxn8,1729
|
|
72
|
+
notebooks/example_mcp_server_stdio.ipynb,sha256=ya4dRKNFU2vQxob-uIhKHGAzINXGQ6MehgKVmSCpHLk,1634
|
|
73
|
+
notebooks/example_raw_mcp_client.ipynb,sha256=uchaG-LuuwEpE2oIkmhZ2s1EDb19AgT1fUv2Jxtjgu8,1795
|
|
74
|
+
notebooks/example_tool_doctor.ipynb,sha256=bWTlPNI1ZQStwMfr-KSkTGYckJuJmRG_e112Gr4KZ0I,1339
|
|
75
|
+
scripts/config.sh,sha256=xnA_S4p2w8fuIEPB4MiTWZdyIlCh5m4XuHY_fhE68kg,820
|
|
76
|
+
scripts/lint.sh,sha256=YmPcjfFVe2s-xSaddgSxOsSm9dmHnsmbiLZnuaPgXmY,744
|
|
77
|
+
scripts/log_view.sh,sha256=bp8oXFRRbbHpyvHAN85wfDHTVK7vMJOYsBx_-bgECQc,511
|
|
78
|
+
scripts/run_example_mcp_server.sh,sha256=f7m7h7O_wo6-nAsYlOXVWIASCOh3Qbuu0XWizlxMhl8,355
|
|
79
|
+
scripts/run_faulty_mcp_server.sh,sha256=u_-8NbPDnJQt6IinNSjh8tc2ed-_MjGyipJXrUXaGR8,291
|
|
80
|
+
scripts/run_server.sh,sha256=5iiB9bB5M2MuOgxVQqu7Oa_tBVtJpt0uB4z9uLu2J50,720
|
|
81
|
+
aixtools-0.1.2.dist-info/METADATA,sha256=3bcgV9cnwdS8dqv1K78MVnwYmXEuV5dY0QDS5pSLzaM,10109
|
|
82
|
+
aixtools-0.1.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
83
|
+
aixtools-0.1.2.dist-info/entry_points.txt,sha256=dHoutULEZx7xXSqJrZdViSVjfInJibfLibi2nRXL3SE,56
|
|
84
|
+
aixtools-0.1.2.dist-info/top_level.txt,sha256=IPyw70hj9gVDyugaIr3LRlanLYXzostW4azlTgdlALo,34
|
|
85
|
+
aixtools-0.1.2.dist-info/RECORD,,
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
FROM ubuntu:24.04
|
|
2
|
+
|
|
3
|
+
RUN apt-get -y update && \
|
|
4
|
+
apt-get -y install git curl sudo ca-certificates
|
|
5
|
+
|
|
6
|
+
# Build argument for custom certificate file (optional)
|
|
7
|
+
ARG CUSTOM_CERT_FILE
|
|
8
|
+
# Copy custom certificate if specified
|
|
9
|
+
RUN if [ -n "$CUSTOM_CERT_FILE" ] && [ -f "$CUSTOM_CERT_FILE" ]; then \
|
|
10
|
+
cp "$CUSTOM_CERT_FILE" /usr/local/share/ca-certificates/ && \
|
|
11
|
+
update-ca-certificates && \
|
|
12
|
+
export SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt && \
|
|
13
|
+
export CURL_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt; \
|
|
14
|
+
fi
|
|
15
|
+
|
|
16
|
+
# Install `uv` Python package manager
|
|
17
|
+
RUN bash -o pipefail -c "curl -LsSf https://astral.sh/uv/install.sh | env UV_INSTALL_DIR=/usr/local/bin sh"
|
|
18
|
+
|
|
19
|
+
# Add a user matching the sandbox user so that the files and folders created by the MCP server
|
|
20
|
+
# are writable by the user in the sandbox containers (UID=1000 must match!)
|
|
21
|
+
ENV USER=mcp_user
|
|
22
|
+
RUN useradd -m -s /bin/bash -u 1000 ${USER} && \
|
|
23
|
+
echo "${USER} ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/${USER} && chmod 0440 /etc/sudoers.d/${USER}
|
|
24
|
+
USER ${USER}
|
|
25
|
+
|
|
26
|
+
# Build argument: GITHUB_PAT (optional)
|
|
27
|
+
# If provided, this GitHub Personal Access Token will be used to authenticate git
|
|
28
|
+
# operations against github.com during the build. This is useful for accessing private repositories such as `aixtools`.
|
|
29
|
+
# If not set, git will use unauthenticated access (public repositories only).
|
|
30
|
+
ARG GITHUB_PAT
|
|
31
|
+
RUN if [ -n "$GITHUB_PAT" ]; then \
|
|
32
|
+
git config --global url."https://x-access-token:${GITHUB_PAT}@github.com/".insteadOf "https://github.com/"; \
|
|
33
|
+
fi
|
|
34
|
+
|
|
35
|
+
WORKDIR /app
|
|
36
|
+
RUN mkdir data
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
{
|
|
2
|
+
"cells": [
|
|
3
|
+
{
|
|
4
|
+
"cell_type": "markdown",
|
|
5
|
+
"id": "57d36f62",
|
|
6
|
+
"metadata": {},
|
|
7
|
+
"source": [
|
|
8
|
+
"# Example \"Faulty MCP Server\"\n",
|
|
9
|
+
"\n",
|
|
10
|
+
"Run the server using the script:\n",
|
|
11
|
+
"\n",
|
|
12
|
+
"```bash\n",
|
|
13
|
+
"./scripts/run_faulty_mcp_server.sh\n",
|
|
14
|
+
"``` "
|
|
15
|
+
]
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"cell_type": "code",
|
|
19
|
+
"execution_count": null,
|
|
20
|
+
"id": "ebf6d915",
|
|
21
|
+
"metadata": {},
|
|
22
|
+
"outputs": [],
|
|
23
|
+
"source": [
|
|
24
|
+
"from aixtools.agents.agent import get_agent, run_agent\n",
|
|
25
|
+
"from pydantic_ai.mcp import MCPServerStreamableHTTP"
|
|
26
|
+
]
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"cell_type": "code",
|
|
30
|
+
"execution_count": null,
|
|
31
|
+
"id": "97d1e607",
|
|
32
|
+
"metadata": {},
|
|
33
|
+
"outputs": [],
|
|
34
|
+
"source": [
|
|
35
|
+
"server = MCPServerStreamableHTTP(\"http://localhost:9999/mcp/\")\n",
|
|
36
|
+
"agent = get_agent(mcp_servers=[server])"
|
|
37
|
+
]
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"cell_type": "code",
|
|
41
|
+
"execution_count": null,
|
|
42
|
+
"id": "fc560d25",
|
|
43
|
+
"metadata": {},
|
|
44
|
+
"outputs": [],
|
|
45
|
+
"source": [
|
|
46
|
+
"async with agent:\n",
|
|
47
|
+
" # ret = await run_agent(agent, \"What is the add of 40123456789 and 2123456789?\", verbose=True, debug=True)\n",
|
|
48
|
+
" # ret = await run_agent(agent, \"Invoke the always_error tool\", verbose=True, debug=True)\n",
|
|
49
|
+
" ret = await run_agent(agent, \"Invoke the throw_404_exception tool\", verbose=True, debug=True)"
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
],
|
|
53
|
+
"metadata": {
|
|
54
|
+
"kernelspec": {
|
|
55
|
+
"display_name": ".venv",
|
|
56
|
+
"language": "python",
|
|
57
|
+
"name": "python3"
|
|
58
|
+
},
|
|
59
|
+
"language_info": {
|
|
60
|
+
"codemirror_mode": {
|
|
61
|
+
"name": "ipython",
|
|
62
|
+
"version": 3
|
|
63
|
+
},
|
|
64
|
+
"file_extension": ".py",
|
|
65
|
+
"mimetype": "text/x-python",
|
|
66
|
+
"name": "python",
|
|
67
|
+
"nbconvert_exporter": "python",
|
|
68
|
+
"pygments_lexer": "ipython3",
|
|
69
|
+
"version": "3.12.2"
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
"nbformat": 4,
|
|
73
|
+
"nbformat_minor": 5
|
|
74
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
{
|
|
2
|
+
"cells": [
|
|
3
|
+
{
|
|
4
|
+
"cell_type": "markdown",
|
|
5
|
+
"id": "57d36f62",
|
|
6
|
+
"metadata": {},
|
|
7
|
+
"source": [
|
|
8
|
+
"# Example MCP Server STDIO"
|
|
9
|
+
]
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"cell_type": "code",
|
|
13
|
+
"execution_count": null,
|
|
14
|
+
"id": "ebf6d915",
|
|
15
|
+
"metadata": {},
|
|
16
|
+
"outputs": [],
|
|
17
|
+
"source": [
|
|
18
|
+
"from aixtools.agents.agent import get_agent, run_agent\n",
|
|
19
|
+
"from aixtools.utils.config import PROJECT_DIR\n",
|
|
20
|
+
"from pydantic_ai.mcp import MCPServerStdio"
|
|
21
|
+
]
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"cell_type": "code",
|
|
25
|
+
"execution_count": null,
|
|
26
|
+
"id": "97d1e607",
|
|
27
|
+
"metadata": {},
|
|
28
|
+
"outputs": [],
|
|
29
|
+
"source": [
|
|
30
|
+
"mcp_path = PROJECT_DIR /'aixtools' / 'mcp' / 'example_server.py'\n",
|
|
31
|
+
"server = MCPServerStdio(command='fastmcp', args=['run', str(mcp_path)])\n",
|
|
32
|
+
"agent = get_agent(mcp_servers=[server])"
|
|
33
|
+
]
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"cell_type": "code",
|
|
37
|
+
"execution_count": null,
|
|
38
|
+
"id": "fc560d25",
|
|
39
|
+
"metadata": {},
|
|
40
|
+
"outputs": [],
|
|
41
|
+
"source": [
|
|
42
|
+
"async with agent:\n",
|
|
43
|
+
" ret = await run_agent(agent, \"What is the add of 40123456789 and 2123456789?\", verbose=True, debug=True)"
|
|
44
|
+
]
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"cell_type": "code",
|
|
48
|
+
"execution_count": null,
|
|
49
|
+
"id": "cad32e85",
|
|
50
|
+
"metadata": {},
|
|
51
|
+
"outputs": [],
|
|
52
|
+
"source": []
|
|
53
|
+
}
|
|
54
|
+
],
|
|
55
|
+
"metadata": {
|
|
56
|
+
"kernelspec": {
|
|
57
|
+
"display_name": ".venv",
|
|
58
|
+
"language": "python",
|
|
59
|
+
"name": "python3"
|
|
60
|
+
},
|
|
61
|
+
"language_info": {
|
|
62
|
+
"codemirror_mode": {
|
|
63
|
+
"name": "ipython",
|
|
64
|
+
"version": 3
|
|
65
|
+
},
|
|
66
|
+
"file_extension": ".py",
|
|
67
|
+
"mimetype": "text/x-python",
|
|
68
|
+
"name": "python",
|
|
69
|
+
"nbconvert_exporter": "python",
|
|
70
|
+
"pygments_lexer": "ipython3",
|
|
71
|
+
"version": "3.12.2"
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
"nbformat": 4,
|
|
75
|
+
"nbformat_minor": 5
|
|
76
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
{
|
|
2
|
+
"cells": [
|
|
3
|
+
{
|
|
4
|
+
"cell_type": "markdown",
|
|
5
|
+
"id": "57d36f62",
|
|
6
|
+
"metadata": {},
|
|
7
|
+
"source": [
|
|
8
|
+
"# Example \"Raw MCP Client\"\n",
|
|
9
|
+
"\n",
|
|
10
|
+
"Run the server using the script:\n",
|
|
11
|
+
"\n",
|
|
12
|
+
"```bash\n",
|
|
13
|
+
"./scripts/run_faulty_mcp_server.sh\n",
|
|
14
|
+
"``` "
|
|
15
|
+
]
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"cell_type": "code",
|
|
19
|
+
"execution_count": null,
|
|
20
|
+
"id": "cad32e85",
|
|
21
|
+
"metadata": {},
|
|
22
|
+
"outputs": [],
|
|
23
|
+
"source": [
|
|
24
|
+
"from fastmcp import Client\n",
|
|
25
|
+
"import rich\n",
|
|
26
|
+
"\n",
|
|
27
|
+
"client = Client(\"http://localhost:9999/mcp/\")"
|
|
28
|
+
]
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"cell_type": "code",
|
|
32
|
+
"execution_count": null,
|
|
33
|
+
"id": "e372fc6a",
|
|
34
|
+
"metadata": {},
|
|
35
|
+
"outputs": [],
|
|
36
|
+
"source": [
|
|
37
|
+
"async with client:\n",
|
|
38
|
+
" # Basic server interaction\n",
|
|
39
|
+
" await client.ping()\n",
|
|
40
|
+
" \n",
|
|
41
|
+
" # # List available operations\n",
|
|
42
|
+
" # tools = await client.list_tools()\n",
|
|
43
|
+
" # rich.print(tools)\n",
|
|
44
|
+
" # \n",
|
|
45
|
+
" # # Execute 'add' tool\n",
|
|
46
|
+
" # result = await client.call_tool(\"add\", {\"a\": 7, \"b\": 3})\n",
|
|
47
|
+
" # rich.print(result)\n",
|
|
48
|
+
"\n",
|
|
49
|
+
" # Execute 'add' tool\n",
|
|
50
|
+
" result = await client.call_tool(\"throw_404_exception\", {})\n",
|
|
51
|
+
" rich.print(result)\n"
|
|
52
|
+
]
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"cell_type": "code",
|
|
56
|
+
"execution_count": null,
|
|
57
|
+
"id": "a8a743e2",
|
|
58
|
+
"metadata": {},
|
|
59
|
+
"outputs": [],
|
|
60
|
+
"source": []
|
|
61
|
+
}
|
|
62
|
+
],
|
|
63
|
+
"metadata": {
|
|
64
|
+
"kernelspec": {
|
|
65
|
+
"display_name": ".venv",
|
|
66
|
+
"language": "python",
|
|
67
|
+
"name": "python3"
|
|
68
|
+
},
|
|
69
|
+
"language_info": {
|
|
70
|
+
"codemirror_mode": {
|
|
71
|
+
"name": "ipython",
|
|
72
|
+
"version": 3
|
|
73
|
+
},
|
|
74
|
+
"file_extension": ".py",
|
|
75
|
+
"mimetype": "text/x-python",
|
|
76
|
+
"name": "python",
|
|
77
|
+
"nbconvert_exporter": "python",
|
|
78
|
+
"pygments_lexer": "ipython3",
|
|
79
|
+
"version": "3.12.2"
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
"nbformat": 4,
|
|
83
|
+
"nbformat_minor": 5
|
|
84
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
{
|
|
2
|
+
"cells": [
|
|
3
|
+
{
|
|
4
|
+
"cell_type": "markdown",
|
|
5
|
+
"id": "dab47237",
|
|
6
|
+
"metadata": {},
|
|
7
|
+
"source": [
|
|
8
|
+
"# Tool doctor example"
|
|
9
|
+
]
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"cell_type": "code",
|
|
13
|
+
"execution_count": null,
|
|
14
|
+
"id": "9735e38c",
|
|
15
|
+
"metadata": {},
|
|
16
|
+
"outputs": [],
|
|
17
|
+
"source": [
|
|
18
|
+
"# Example 1: A reasonably well-defined tool\n",
|
|
19
|
+
"from aixtools.tools.doctor import tool_doctor\n",
|
|
20
|
+
"\n",
|
|
21
|
+
"\n",
|
|
22
|
+
"def add(a: int, b: int) -> int:\n",
|
|
23
|
+
" \"\"\" Add two numbers \"\"\"\n",
|
|
24
|
+
" return a + b\n",
|
|
25
|
+
"\n",
|
|
26
|
+
"# Example 2: A poorly defined tool\n",
|
|
27
|
+
"def z(a: int, b: int) -> int:\n",
|
|
28
|
+
" \"\"\" performs some arithmentic with two parameters \"\"\"\n",
|
|
29
|
+
" return a + b\n"
|
|
30
|
+
]
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"cell_type": "code",
|
|
34
|
+
"execution_count": null,
|
|
35
|
+
"id": "e50d48d6",
|
|
36
|
+
"metadata": {},
|
|
37
|
+
"outputs": [],
|
|
38
|
+
"source": [
|
|
39
|
+
"# Call tool doctor\n",
|
|
40
|
+
"ret = await tool_doctor([add, z])"
|
|
41
|
+
]
|
|
42
|
+
}
|
|
43
|
+
],
|
|
44
|
+
"metadata": {
|
|
45
|
+
"kernelspec": {
|
|
46
|
+
"display_name": ".venv",
|
|
47
|
+
"language": "python",
|
|
48
|
+
"name": "python3"
|
|
49
|
+
},
|
|
50
|
+
"language_info": {
|
|
51
|
+
"codemirror_mode": {
|
|
52
|
+
"name": "ipython",
|
|
53
|
+
"version": 3
|
|
54
|
+
},
|
|
55
|
+
"file_extension": ".py",
|
|
56
|
+
"mimetype": "text/x-python",
|
|
57
|
+
"name": "python",
|
|
58
|
+
"nbconvert_exporter": "python",
|
|
59
|
+
"pygments_lexer": "ipython3",
|
|
60
|
+
"version": "3.12.2"
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
"nbformat": 4,
|
|
64
|
+
"nbformat_minor": 5
|
|
65
|
+
}
|
scripts/config.sh
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#-----------------------------------------------------------------------------
|
|
2
|
+
#
|
|
3
|
+
# This template script sets up the environment for the project by defining the
|
|
4
|
+
# project directory and activating the virtual environment.
|
|
5
|
+
#
|
|
6
|
+
#-----------------------------------------------------------------------------
|
|
7
|
+
|
|
8
|
+
export SCRIPTS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
9
|
+
|
|
10
|
+
# Project directory
|
|
11
|
+
export PROJECT_DIR="$( cd $SCRIPTS_DIR/.. && pwd -P )"
|
|
12
|
+
export PROJECT_NAME="$(basename $PROJECT_DIR)"
|
|
13
|
+
|
|
14
|
+
# Data directories
|
|
15
|
+
export DATA_DIR="$PROJECT_DIR/data"
|
|
16
|
+
export LOGS_DIR="$PROJECT_DIR/logs"
|
|
17
|
+
export PG_DATA_DIR="$DATA_DIR/data/db/postgres"
|
|
18
|
+
|
|
19
|
+
# Server configuration
|
|
20
|
+
export PORT=8081
|
|
21
|
+
|
|
22
|
+
# Activate virtual environment
|
|
23
|
+
if [ "${OS-}" == "Windows_NT" ]; then
|
|
24
|
+
source .venv/Scripts/activate
|
|
25
|
+
else
|
|
26
|
+
source .venv/bin/activate
|
|
27
|
+
fi
|
|
28
|
+
|
scripts/lint.sh
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
#!/bin/bash -eu
|
|
2
|
+
set -o pipefail
|
|
3
|
+
|
|
4
|
+
#-----------------------------------------------------------------------------
|
|
5
|
+
#
|
|
6
|
+
# Template script for running the linter
|
|
7
|
+
#
|
|
8
|
+
#-----------------------------------------------------------------------------
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
# Get script directory
|
|
12
|
+
SCRIPTS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
13
|
+
source "$SCRIPTS_DIR/config.sh"
|
|
14
|
+
|
|
15
|
+
# Check if the fix parameter is provided
|
|
16
|
+
FIX_MODE=false
|
|
17
|
+
if [[ $# -gt 0 && "$1" == "--fix" ]]; then
|
|
18
|
+
FIX_MODE=true
|
|
19
|
+
fi
|
|
20
|
+
|
|
21
|
+
# Run linter
|
|
22
|
+
if [ "$FIX_MODE" = true ]; then
|
|
23
|
+
echo "Running linters in fix mode..."
|
|
24
|
+
ruff format .
|
|
25
|
+
ruff check --fix .
|
|
26
|
+
else
|
|
27
|
+
echo "Running linters in check mode..."
|
|
28
|
+
ruff format --check .
|
|
29
|
+
ruff check .
|
|
30
|
+
fi
|
|
31
|
+
echo "Running pylint..."
|
|
32
|
+
pylint aixtools/
|
scripts/log_view.sh
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#!/bin/bash -eu
|
|
2
|
+
set -o pipefail
|
|
3
|
+
|
|
4
|
+
#-----------------------------------------------------------------------------
|
|
5
|
+
#
|
|
6
|
+
# Template script for running the Chainlit server
|
|
7
|
+
#
|
|
8
|
+
#-----------------------------------------------------------------------------
|
|
9
|
+
|
|
10
|
+
# Get script directory
|
|
11
|
+
SCRIPTS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
12
|
+
source "$SCRIPTS_DIR/config.sh"
|
|
13
|
+
|
|
14
|
+
# Activate virtual environment (with special handling for Windows)
|
|
15
|
+
cd "$PROJECT_DIR"
|
|
16
|
+
|
|
17
|
+
# Run the server
|
|
18
|
+
streamlit run aixtools/log_view/app.py $*
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/bin/bash -eu
|
|
2
|
+
set -o pipefail
|
|
3
|
+
|
|
4
|
+
# Get script directory
|
|
5
|
+
SCRIPTS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
6
|
+
source "$SCRIPTS_DIR/config.sh"
|
|
7
|
+
|
|
8
|
+
# Activate virtual environment (with special handling for Windows)
|
|
9
|
+
cd "$PROJECT_DIR"
|
|
10
|
+
|
|
11
|
+
# Run the example MCP server
|
|
12
|
+
fastmcp run \
|
|
13
|
+
--transport http \
|
|
14
|
+
"$PROJECT_DIR/aixtools/mcp/example_server.py"
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#!/bin/bash -eu
|
|
2
|
+
set -o pipefail
|
|
3
|
+
|
|
4
|
+
# Get script directory
|
|
5
|
+
SCRIPTS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
6
|
+
source "$SCRIPTS_DIR/config.sh"
|
|
7
|
+
|
|
8
|
+
cd "$PROJECT_DIR"
|
|
9
|
+
|
|
10
|
+
while true; do
|
|
11
|
+
uv run aixtools/mcp/faulty_mcp.py "$@" || true
|
|
12
|
+
echo "MCP server terminated. Restarting..."
|
|
13
|
+
done
|
scripts/run_server.sh
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#!/bin/bash -eu
|
|
2
|
+
set -o pipefail
|
|
3
|
+
|
|
4
|
+
#-----------------------------------------------------------------------------
|
|
5
|
+
#
|
|
6
|
+
# Template script for running the Chainlit server
|
|
7
|
+
#
|
|
8
|
+
#-----------------------------------------------------------------------------
|
|
9
|
+
|
|
10
|
+
# Get script directory
|
|
11
|
+
SCRIPTS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
12
|
+
source "$SCRIPTS_DIR/config.sh"
|
|
13
|
+
|
|
14
|
+
# Activate virtual environment (with special handling for Windows)
|
|
15
|
+
cd "$PROJECT_DIR"
|
|
16
|
+
|
|
17
|
+
# Run linter before starting the server
|
|
18
|
+
"$SCRIPTS_DIR/lint.sh"
|
|
19
|
+
|
|
20
|
+
# Go into the sub-dir (most projects don't need this)
|
|
21
|
+
cd "$PROJECT_NAME"
|
|
22
|
+
|
|
23
|
+
# Run the server
|
|
24
|
+
chainlit run \
|
|
25
|
+
--host 0.0.0.0 \
|
|
26
|
+
--port $PORT \
|
|
27
|
+
--root-path /$PROJECT_NAME \
|
|
28
|
+
--watch \
|
|
29
|
+
app.py
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
aixtools
|
|
File without changes
|
|
File without changes
|