Pydantic MCP Agent with Chainlit
About
This repo makes use of MCP servers to seamlessly integrate multiple tools for the agent.
Explore
- Web browsing capabilities with automated interactions
- Integration with Ollama for local LLM support
- Chainlit-based interactive chat interface
- Pydantic models for type-safe data handling
- Configurable MCP server integration
Setting up with Highlight
This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:
- Download and install Highlight from highlightai.com/download
- Navigate to the plugins tab and select "Add Custom Plugin"
-
Configure the plugin with the settings below
Plugin Name
Pydantic MCP Agent with ChainlitCommand (node, npx, python, etc.)Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.
- Enable "Start Automatically" if you want the plugin to start when Highlight launches
From the repository
- Python 3.8+
- Node.js and npm (for MCP server)
- Ollama installed locally
- MCP server access
``bash`
chainlit run pydantic_mcp_chainlit.py
bash
python pydantic_mcp_agent.py
The following environment variables can be set in your .env file:EXA_API_KEY
- : Your MCP API keyOLLAMA_HOST`: Ollama host address (default: http://localhost:11434)
-
Claude Desktop / Cursor
Paste into your MCP client config file to install this server.
{
"mcpServers": {
"pydantic mcp agent with chainlit": {
"pydantic-ai-mcp-agent-with-chainlit": {
"command": "python",
"args": [
"pydantic_mcp_agent.py"
]
}
}
}
}
McpServers
{
"pydantic-ai-mcp-agent-with-chainlit": {
"command": "python",
"args": [
"pydantic_mcp_agent.py"
]
}
}
Features
- Web browsing capabilities with automated interactions - Integration with Ollama for local LLM support - Chainlit-based interactive chat interface - Pydantic models for type-safe data handling - Configurable MCP server integrationPrerequisites
- Python 3.8+ - Node.js and npm (for MCP server) - Ollama installed locally - MCP server accessInstallation
1. Clone the repository: ``bash
git clone https://github.com/RyanNg1403/pydantic-ai-mcp-agent-with-chainlit.git
cd pydantic-ai-mcp-agent-with-chainlit
`
2. Install Python dependencies:
`bash
pip install -r requirements.txt
`
3. Install Node.js dependencies:
`bash
npm install
`
Configuration
1. Copy the template configuration file:
`bash
cp mcp_config.template.json mcp_config.json
`
2. Edit mcp_config.json with your configuration settings. The file is ignored by git for security.
Usage
Running the Chainlit Interface
`bash
chainlit run pydantic_mcp_chainlit.py
`
Running the Agent Directly
`bash
python pydantic_mcp_agent.py
`
Project Structure
- pydantic_mcp_agent.py: Core agent implementation
- pydantic_mcp_chainlit.py: Chainlit interface implementation
- mcp_client.py: MCP client implementation
- requirements.txt: Python dependencies
- mcp_config.template.json: Template for configuration
- .gitignore: Specifies which files git should ignore
Environment Variables
The following environment variables can be set in your .env file:
- EXA_API_KEY: Your MCP API key
- OLLAMA_HOST: Ollama host address (default: http://localhost:11434)
Contributing
1. Fork the repository
2. Create your feature branch (git checkout -b feature/amazing-feature)
3. Commit your changes (git commit -m 'Add some amazing feature')
4. Push to the branch (git push origin feature/amazing-feature`)
5. Open a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.Acknowledgments
- Thanks to the Chainlit team for their excellent chat interface - Thanks to the Ollama team for their local LLM solution - Thanks to the MCP team for their browser automation capabilitiesSign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.



