Add MCP (Model Context Protocol) server support for external tool use#243
Add MCP (Model Context Protocol) server support for external tool use#243aditya-pandey-dev wants to merge 21 commits into
Conversation
|
Really like the direction here, I've been thinking about MCP integration too. One concern though — Concordia already has a Also wondering if this belongs in Would love to see this land either way, just flagging the integration questions. |
|
Hi Aditya! I would also ask you to move the code into the contrib and use the existing tool abstraction (concordia/document/tool.py) . The notebook is fine in the in the examples, but tools, components and the prefab should go into contrib. Once the code is moved, I'll be happy to accept the PR. Thank you for your contribution! |
|
Hi @vezhnick and @manaspros, I've addressed both review comments: |
|
@vezhnick Regarding the use case — the GM-based approach is intentional here. The goal is to model scenarios where an agent explicitly spends a turn to access external information (e.g., reading a file, querying an API), making the tool use visible and traceable in the simulation log. I'll look at interactive_document_tools.py as well — happy to align with that approach if you think it's more suitable. |
|
Great. I think your use-case is valid and interesting, let's go with it. Thanks again! |
Implements issue google-deepmind#240 - enables Concordia agents to use external tools via the Model Context Protocol. Added: - MCP client wrapper with async/sync support - File reader MCP server with security restrictions - GameMaster tool executor component - Tool-use GameMaster prefab - Complete example notebook - Documentation Impact: Researchers can now run simulations where agents access real external data sources during runtime. Closes google-deepmind#240
…traction Addresses review from @vezhnick and @manaspros: - Moved all MCP code to concordia/contrib/ (tools, components, prefab) - Created MCPTool wrapper implementing concordia.document.tool.Tool - Notebook stays in examples/ as approved - Updated README
62ce0cf to
76e0b3b
Compare
|
@vezhnick can you please review now i made some changes as you said! and sorry for the late reply |
|
Great, almost there. And the last thing we need is for you to make contributor license agreement: https://cla.developers.google.com/ |
bb100e1 to
03e36a0
Compare
|
@vezhnick I made the changes as you said. Can you please re-review it |
|
Linter is still complaining: |
|
Hi @vezhnick, all CI checks are now passing. The notebook has been updated with correct imports and type signatures. Ready for re-review! |
|
Hi @vezhnick, just following up on this PR. Let me know if anything else is needed — happy to address any further feedback. Thanks |
Closes #240
Overview
This PR implements MCP (Model Context Protocol) integration for Concordia, enabling agents to use external tools during simulations.
What's Added
Core Infrastructure
MCP Client Wrapper (
concordia/tools/mcp_client.py)run_synchelperMCPClientManagerfor multiple serversFile Reader MCP Server (
concordia/tools/mcp_servers/file_reader_server.py)read_file,list_directory,get_file_info/tmpand current working directoryConcordia Integration
Tool Executor Component (
concordia/components/game_master/mcp_tool_executor.py)Tool-Use GameMaster Prefab (
concordia/prefabs/game_master/tool_use_gm.py)Documentation & Examples
Example Notebook (
examples/mcp_tool_use_example.ipynb)README (
concordia/tools/README.md)Testing
Future Enhancements
As mentioned in the README, potential extensions include: