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
2 changes: 1 addition & 1 deletion deploy/docker/.env
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ CHATBOT_SERVER_PORT=5002
ENABLE_SHELL_INJECTION=false
ENABLE_LOG4J=false
LISTEN_IP="127.0.0.1"
TLS_ENABLED=true
TLS_ENABLED=false
VERSION=latest
LOG_LEVEL=INFO
6 changes: 4 additions & 2 deletions deploy/docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ services:
crapi-identity:
container_name: crapi-identity
image: crapi/crapi-identity:${VERSION:-latest}
#ports:
# - "${LISTEN_IP:-127.0.0.1}:8080:8080"
ports:
- "${LISTEN_IP:-127.0.0.1}:8080:8080"
volumes:
- ./keys:/app/keys
environment:
Expand Down Expand Up @@ -170,6 +170,8 @@ services:
depends_on:
mongodb:
condition: service_healthy
crapi-identity:
condition: service_healthy
# ports:
# - "${LISTEN_IP:-127.0.0.1}:5002:5002"

Expand Down
2 changes: 2 additions & 0 deletions services/chatbot/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ RUN pip install --no-cache-dir -r requirements.txt
COPY src /app
COPY certs /app/certs
COPY retrieval /app/retrieval
RUN mkdir -p /app/resources
COPY src/resources/crapi-openapi-spec.json /app/resources/crapi-openapi-spec.json
ENV PYTHONPATH="/app"
COPY entrypoint.sh /app/entrypoint.sh
CMD /app/entrypoint.sh
Expand Down
6 changes: 3 additions & 3 deletions services/chatbot/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ langchain-openai==0.3.16
langchain-text-splitters==0.3.8
markdown==3.8
pymongo==4.12.1
python-dotenv==1.0.1
python-dotenv==1.1.0
unstructured==0.17.2
numpy==1.26.4
langchain-mcp-adapters==0.1.8
Expand All @@ -15,7 +15,7 @@ quart-cors==0.8.0
motor==3.7.1
openai==1.77.0
langgraph==0.5.1
python-dotenv==1.0.1
faiss-cpu==1.11.0
psycopg2-binary
uvicorn==0.35.0
uvicorn==0.35.0
fastmcp==2.10.2
6 changes: 3 additions & 3 deletions services/chatbot/src/chatbot/langgraph_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ async def get_retriever_tool(api_key):
return retriever_tool


async def build_langgraph_agent(api_key, session_id):
async def build_langgraph_agent(api_key):
system_prompt = textwrap.dedent(
"""
You are crAPI Assistant — an expert agent that helps users explore and test the Completely Ridiculous API (crAPI), a vulnerable-by-design application for learning and evaluating modern API security issues.
Expand Down Expand Up @@ -93,12 +93,12 @@ async def build_langgraph_agent(api_key, session_id):
tools = mcp_tools + db_tools
# retriever_tool = await get_retriever_tool(api_key)
# tools.append(retriever_tool)
agent_node = create_react_agent(llm, tools=tools, prompt=system_prompt)
agent_node = create_react_agent(model=llm, tools=tools, prompt=system_prompt)
return agent_node


async def execute_langgraph_agent(api_key, messages, session_id=None):
agent = await build_langgraph_agent(api_key, session_id)
agent = await build_langgraph_agent(api_key)
print("messages", messages)
print("Session ID", session_id)
response = await agent.ainvoke({"messages": messages})
Expand Down
12 changes: 3 additions & 9 deletions services/chatbot/src/mcpserver/__main__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import logging
import os

from .mcp_server import app
from .server import mcp as app

# Configure logging
logging.basicConfig(
Expand All @@ -11,11 +11,5 @@

if __name__ == "__main__":
logger.info("Starting MCP server...")
app.settings.host = "0.0.0.0"
app.settings.port = 5002
app.settings.debug = os.getenv("DEBUG", "False").lower() in (
"true",
"1",
"yes",
)
app.run(transport="streamable-http")
mcp_server_port = int(os.environ.get("MCP_SERVER_PORT", 5500))
app.run(transport="streamable-http", host="0.0.0.0", port=mcp_server_port)
Loading
Loading