Skip to content
Closed
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
35 changes: 28 additions & 7 deletions codemcp/agno.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
from agno.api.playground import PlaygroundEndpointCreate, create_playground_endpoint
from agno.cli.console import console
from agno.cli.settings import agno_cli_settings
from agno.models.anthropic import Claude
from agno.models.google import Gemini
from agno.playground import Playground
from agno.tools.mcp import MCPTools
from agno.utils.log import logger
from fastapi import FastAPI
Expand Down Expand Up @@ -67,23 +65,46 @@ async def main():
async with MCPTools(f"{sys.executable} -m codemcp.hot_reload_entry") as codemcp:
# TODO: cli-ify the model
agent = Agent(
#model=Claude(id="claude-3-7-sonnet-20250219"),
# model=Claude(id="claude-3-7-sonnet-20250219"),
model=Gemini(id="gemini-2.5-pro-exp-03-25"),
tools=[codemcp],
instructions="",
markdown=True,
show_tool_calls=True,
)
#agent.print_response("What tools do you have?", stream=True, show_full_reasoning=True, stream_intermediate_steps=True)
#return
playground = Playground(agents=[agent]).get_app()
await serve_playground_app_async(playground)
# agent.print_response("What tools do you have?", stream=True, show_full_reasoning=True, stream_intermediate_steps=True)
# return

# Comment out the playground code
# playground = Playground(agents=[agent]).get_app()
# await serve_playground_app_async(playground)

# Replace with a simple async loop for stdin input
print("Enter your query (Ctrl+C to exit):")
while True:
try:
# Use asyncio to read from stdin in an async-friendly way
loop = asyncio.get_event_loop()
user_input = await loop.run_in_executor(None, lambda: input("> "))

# Properly await the async print_response method
await agent.print_response(
user_input,
stream=True,
show_full_reasoning=True,
stream_intermediate_steps=True,
)
except KeyboardInterrupt:
print("\nExiting...")
break


if __name__ == "__main__":
from agno.debug import enable_debug_mode

enable_debug_mode()
import logging

logging.basicConfig(level=logging.DEBUG)
logging.getLogger("httpx").setLevel(logging.DEBUG) # For HTTP logging
logging.getLogger("anthropic").setLevel(logging.DEBUG)
Expand Down
4 changes: 3 additions & 1 deletion codemcp/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ async def codemcp(
subtool: str,
*,
path: str | None = None,
content: str | dict | None = None, # Allow any type, will be serialized to string if needed
content: str
| dict
| None = None, # Allow any type, will be serialized to string if needed
old_string: str | None = None,
new_string: str | None = None,
offset: int | None = None,
Expand Down
Loading