This is a C1 by Thesys project that demonstrates MCP (Model Context Protocol) server integration with streaming chat capabilities.
- C1 Chat Integration: Powered by Thesys C1 for intelligent conversations
- MCP Server Support: Connects to MCP servers to extend AI capabilities with tools
- Tool Integration: Automatically lists and calls tools from connected MCP servers
- Streaming Responses: Real-time streaming of AI responses
- Thinking States: Visual indicators showing what the AI is doing
- File System Operations: Built-in filesystem access via MCP (no authentication required)
You'll need:
- Thesys API: Get your key from Thesys Console
- Node.js/pnpm: For running the development server
Set up your environment variables:
export THESYS_API_KEY=<your-thesys-api-key>Install dependencies using pnpm:
pnpm installRun the development server:
pnpm devOpen http://localhost:3000 with your browser to see the result.
Once the app is running, you can ask the AI to help with various file system tasks. Here are some examples:
"What files are in this project?"
"Show me the project structure"
"List all TypeScript files in the src directory"
"What's in the components folder?"
"Find all configuration files in this project"
"Read and explain the package.json file"
"What dependencies does this project use?"
"Show me the TypeScript configuration"
"What's in the README file?"
"Analyze the main route file"
"Explain what the MCP client does"
"How does the chat route work?"
"What components are in the app directory?"
"Show me the API structure"
"What styling files are used?"
"Help me understand this Next.js project structure"
"What environment variables does this app need?"
"Explain the MCP integration implementation"
"Show me how thinking states are implemented"
"What's the difference between route.ts and mcp.ts?"
"How many lines of code are in the main files?"
"What external packages does this project depend on?"
"Show me all the import statements in the chat route"
"What API endpoints are available?"
"Analyze the project's architecture"
"Check if there are any TODO comments in the code"
"Show me error handling patterns used"
"What logging is implemented?"
"Find all console.log statements"
"Check for any hardcoded values"
"What CSS/styling approach is used?"
"Show me the Tailwind configuration"
"What UI components are imported?"
"How is the layout structured?"
"What fonts and themes are configured?"
This project demonstrates how to integrate MCP servers with C1 chat:
-
MCP Client: The
MCPClientclass (src/app/api/chat/mcp.ts) handles:- Connecting to MCP servers
- Listing available tools via
mcp.listTools() - Running tool calls via
runTools()
-
Chat Route: The API route (
src/app/api/chat/route.ts) integrates MCP tools:- Connects to MCP server on startup
- Passes MCP tools to the OpenAI completion request
- Handles tool calls seamlessly with thinking states
-
Tool Execution: When the AI needs to use tools, the system:
- Receives tool calls from the AI model
- Executes them via the MCP server
- Returns results back to the conversation
- Shows thinking states during execution
Currently configured for:
- Filesystem Server: File system operations (read, write, list files) - no authentication required
- Fallback Server: Alternative MCP server if filesystem fails
The filesystem MCP server provides these tools:
read_file- Read contents of a specific filelist_directory- List files and directoriesget_file_info- Get metadata about filessearch_files- Search for files by name or content
The system includes visual thinking states that show users:
- 💭 "Processing your request..." - Initial analysis
- 💭 "Using tool: read_file" - When accessing files
- 💭 "Processing results..." - Analyzing tool results
- Be Specific: Instead of "show me files", try "list all TypeScript files in the src/app directory"
- Ask for Analysis: Request explanations like "explain what this configuration does"
- Combine Requests: "Read package.json and explain the main dependencies"
- Request Comparisons: "Compare the structure of route.ts and mcp.ts"
- Ask for Help: "Help me understand how the MCP integration works"
- C1 Documentation - Learn about Thesys C1
- Thinking States Guide - Visual progress indicators
- MCP Specification - Model Context Protocol details
- MCP SDK - TypeScript SDK for MCP
Runware Pokemon Generator
|
Elastic Path API
|
Travel Web-Application
|
