This project is a Next.js 15 (React 19, TypeScript, Tailwind CSS) frontend located in the mcp-agent-messenger directory. The root is set up as a monorepo for easy workspace management.
- Node.js (v18+ recommended)
- pnpm (preferred) or npm
- Next.js (15.x)
- React (19.x)
- TypeScript
- Tailwind CSS
All other dependencies are managed in mcp-agent-messenger/package.json.
git clone <repo-url>
cd mcp-hackathonnpm install -g pnpmpnpm installCreate a file named .env inside the mcp-agent-messenger directory:
COTEXT_ANTHROPIC_KEY_TEST=your_anthropic_api_key_here
- Replace
your_anthropic_api_key_herewith your actual API key. - Do not commit your
.envfile! It is gitignored by default.
From the root directory, run:
npm run dev- This will start the Next.js dev server on port 3000 (or the next available port).
- Access the app at http://localhost:3000
This file defines the AgentGroup interface and the agentGroups constant, which holds the configuration for each agent persona.
export interface AgentGroup {
id: string; // Unique identifier for the agent group (e.g., "wifey", "friends")
name: string; // Display name (e.g., "Wifey", "Friends")
emoji: string; // Emoji for UI representation
systemPrompt: string; // Base instructions for the LLM defining personality and core tasks
privateInfo: {
content: string; // The actual piece of private information (e.g., a safeword, an account number)
mcp: string; // Name of the MCP service this info belongs to (e.g., "Notion MCP")
tool: string; // Specific tool within the MCP that handles this info (e.g., "list_notion_pages")
resource: string; // Specific resource/document/page this info is tied to (e.g., "Health Tracker")
}[];
mcpIntegrations: {
name: string; // Name of the integrated service (e.g., "Notion", "Google Calendar")
mcp: string; // Name of the corresponding MCP service (e.g., "Notion MCP")
tools: {
name: string; // Name of the tool/action (e.g., "list_calendar_events")
access: "read" | "write" | "read-write"; // Access level for this tool
}[];
resources: string[];// List of resources this integration has access to (e.g., ["Family Calendar"])
}[];
}Important Note on privateInfo:
The privateInfo array currently contains hardcoded content for demonstration. The end goal is for this content to be dynamically fetched from the corresponding MCP service.
When the agent needs a piece of private information, it should:
- Identify the relevant
privateInfoentry. - Use the
mcp,tool, andresourcefields to make a call to the appropriate MCP server. - The MCP server would then return the actual
contentfor that piece of data. This allows private data to be securely stored and managed by MCPs, rather than being hardcoded in the frontend.
- Input: A message from a connection (e.g., SMS) arrives at a chat endpoint (e.g.,
/chats/[id]). - Group Identification: The system identifies the
groupId(e.g.,wifey) for this connection. - API Call: The frontend calls
sendMessageToAnthropic(groupId, message)(inmcp-agent-messenger/actions/anthropic-api.ts). - System Prompt Construction (
anthropic-api.ts):- Retrieves
agentDatafor thegroupIdfromagent-groups.ts. - Constructs a
systemPromptfor the LLM:- Base personality:
agentData.systemPrompt. - Private Data:
agentData.privateInfo.map(info => info.content).join("\n"). Note: This currently uses the hardcodedcontent. In a production system, this step would involve fetching thecontentfrom the relevant MCPs based oninfo.mcp,info.tool, andinfo.resource. - Refusal Style Guidance: Tailored instructions for out-of-scope requests.
- Base personality:
- Retrieves
- Anthropic API Request: Sends the user's message and the constructed
systemPromptto the Anthropic API. - Response Handling: The LLM generates a response.
- UI Update: The frontend displays the response in the chat interface.
- Input: The user messages their Personal Agent via the
MeScreen. - API Call: The frontend calls
sendMessageToPersonalAgent(message)(inmcp-agent-messenger/actions/personal-agent-api.ts). - Global System Prompt Construction (
personal-agent-api.ts):- A broad
systemPromptis created, granting access to all agent groups. - It includes
JSON.stringify(agentGroups, null, 2), giving the LLM the entireagent-groups.tsdata (including allprivateInfoobjects with theirmcp,tool, andresourcedetails). - Note: The Personal Agent receives the structure of where data lives. In a production system, if the Personal Agent needs specific
contentfrom aprivateInfoentry, it would conceptually need to trigger a fetch from the relevant MCP.
- A broad
- Anthropic API Request: Sends the user's message and this global prompt to Anthropic.
- Response Handling: The LLM responds, potentially drawing from data across all groups.
- UI Update: The
MeScreendisplays the response.
mcp-agent-messenger/
├── .env # API keys and environment variables
├── package.json # Monorepo & dependencies
├── actions/
│ ├── anthropic-api.ts # Sends messages to agents on behalf of other people
│ └── personal-agent-api.ts # Sends messages to user's own personal agent (full context)
├── data/
│ └── agent-groups.ts # Static JSON config (systemPrompt, privateInfo, MCP tools/resources)
├── app/
│ ├── chats/
│ │ ├── [id]/page.tsx # Chat UI for others messaging a specific agent
│ │ └── page.tsx # Admin view of all agent message threads
│ ├── me/page.tsx # User’s personal agent UI (cross-group context)
│ ├── layout.tsx # Shared layout
│ └── globals.css # Tailwind setup (base, components, utilities)
- API Key Not Found: Ensure
mcp-agent-messenger/.envexists andCOTEXT_ANTHROPIC_KEY_TESTis set. Restart the dev server. - Dependency Issues: Run
pnpm installfrom the root. - Prompt Issues: In
actions/anthropic-api.ts, ensureprivateInfois correctly processed (e.g.,privateInfo.map(info => info.content).join("\n")) to avoid sending[object Object]to the LLM for the hardcoded content.
npm run dev: Starts the dev server (from root).pnpm install: Installs dependencies (from root).
For any issues, reach out to the project maintainer or open an issue in the repository.