Small Python workspace for experimenting with Model Context Protocol (MCP) servers, clients, gateways, and third-party MCP integrations.
The repository contains examples for:
- Creating a local MCP server with
FastMCP - Connecting to an MCP server over
stdio - Running an MCP server over streamable HTTP
- Loading MCP tools through LangChain MCP adapters
- Trying community/third-party MCP servers such as DuckDuckGo, Tavily, and AWS ECS
- Mounting/proxying external MCP servers behind a FastMCP gateway
.
|-- create_mcp/
| |-- first_mcp_server_stdio.py # Local stdio FastMCP server
| |-- python_client.py # Native MCP stdio client
| `-- langchain_client.py # LangChain MCP client for stdio server
|-- http_mcp/
| |-- http_mcp.py # FastMCP HTTP server on port 8050
| `-- langchain_client.py # LangChain client for stdio + HTTP MCP servers
|-- 3rd party mcp/
| |-- community_mcp.py # DuckDuckGo MCP server example
| |-- tavily_mcp.py # Tavily remote MCP example
| |-- aws.py # AWS ECS MCP + Groq model example
| `-- aws_tools_llm.py # AWS ECS MCP + LangGraph/Gemini example
|-- 4th_mcp_gateway/
| `-- mcp.py # FastMCP gateway/proxy example
|-- main.py # Minimal Python entry point
|-- pyproject.toml # Python project metadata and dependencies
|-- package.json # Basic Node package metadata
`-- uv.lock # uv lockfile
- Python
>=3.14as configured inpyproject.toml uvfor dependency installation and running scriptsuvxfor examples that launch third-party MCP servers- API keys for examples that call hosted LLMs or remote MCP services
- AWS credentials/profile for AWS ECS MCP examples
Install dependencies:
uv syncActivate the virtual environment if you want to run Python directly:
.\.venv\Scripts\Activate.ps1Or run scripts through uv run, which uses the project environment automatically.
Create a local .env file for secrets used by remote examples. This file is ignored by git and should stay only on your machine.
TAVILY_API_KEY="your-tavily-api-key"
GROQ_API_KEY="your-groq-api-key"
GOOGLE_API_KEY="your-google-api-key"
AWS_REGION="ap-south-1"Do not commit real API keys. If you want to share required environment variables with other developers, create an .env.example file with placeholder values. .env.example is allowed by .gitignore, while .env and .env.* remain ignored.
Some prototype scripts currently contain hard-coded local paths or credentials; replace those with environment variables before sharing or using the project beyond local testing.
uv run python main.pyStart the server:
uv run python .\create_mcp\first_mcp_server_stdio.pyThe server exposes two tools:
fetchprocess
This client starts first_mcp_server_stdio.py, initializes an MCP session, and prints the available tools.
uv run python .\create_mcp\python_client.pyuv run python .\create_mcp\langchain_client.pyBefore running, update the hard-coded Python executable and script paths in the file so they match your local checkout.
Start the HTTP server:
uv run python .\http_mcp\http_mcp.pyThe server listens on:
http://localhost:8050/mcp
It exposes:
http_fetchhttp_process
In another terminal, after starting the HTTP server:
uv run python .\http_mcp\langchain_client.pyThis example loads tools from both the local stdio server and the HTTP MCP server.
uv run python '.\3rd party mcp\community_mcp.py'This uses uvx duckduckgo-mcp-server, loads the exposed tools, and invokes the first search tool.
Set TAVILY_API_KEY in .env, then run:
uv run python '.\3rd party mcp\tavily_mcp.py'This connects to Tavily's remote MCP endpoint and lists available tools.
These examples launch the AWS Labs ECS MCP server through uvx:
uv run python '.\3rd party mcp\aws.py'
uv run python '.\3rd party mcp\aws_tools_llm.py'You need valid AWS configuration before running them. The Groq example reads GROQ_API_KEY from .env, and the Gemini/LangGraph example reads GOOGLE_API_KEY from .env.
For write-capable operations, review the AWS ECS MCP server settings carefully before enabling any write or sensitive-data options.
uv run python .\4th_mcp_gateway\mcp.pyThis starts a FastMCP HTTP server on port 8050 and mounts a proxied external MCP server.
create_mcp/langchain_client.pyandhttp_mcp/langchain_client.pyinclude absolute Windows paths from the original local environment. Update them to use your current project path before running.3rd party mcp/tavily_mcp.pyexpectsTAVILY_API_KEYfrom.env.3rd party mcp/aws.pyexpectsGROQ_API_KEYfrom.env.3rd party mcp/aws_tools_llm.pyexpectsGOOGLE_API_KEYfrom.env.- Some scripts reference packages such as
python-dotenvorlanggraph; install them if your current lockfile does not include them. package.jsonis present, but the working examples in this repository are Python based.
- Keep
.envout of git. - Use
.env.examplefor non-secret placeholders when documenting required variables. - Replace hard-coded API keys with environment variables.
- Avoid committing local machine paths.
- Review third-party MCP tool permissions before connecting them to an LLM agent.