MCP Server App
This MCP server exposes tools for web search, dice rolling, content/image generation, and GitHub exploration.
Search the web for a query.
Roll dice using D&D-style notation, optionally multiple times.
Generate a social media post with text and an image for a topic/style.
Get presentation-ready slide images for a topic and size.
Create a quote card with inspirational text and a background image for a theme.
Search public GitHub repositories by query.
Get detailed info for a GitHub repository.
Read a specific file from a GitHub repo by owner, repo, path, and branch.
List files and directories in a GitHub repo path.
Check GitHub authentication status and rate limits.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@MCP Server App roll a d20"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MCP Server App
A Model Context Protocol server, a LangGraph agent that can call it, and a browser chat so you can use both without a terminal.
Roll dice, search the web, draft a social post, pull a slide image, mint a quote card, or browse public GitHub repos. With an OpenAI key, a ReAct agent decides which tools to call. Without one, the same UI still runs the tools it can recognize (dice works immediately).
Business case
Every AI assistant a company builds needs the same tools, and wiring them into each assistant separately repeats the work. This repo puts those tools behind one Model Context Protocol server and shows a LangGraph agent and web chat using them, so a tool is written once and reused everywhere. The payoff grows with the number of assistants. docs/BUSINESS_CASE.md sets out where that pays and where it doesn't.
Related MCP server: mcp-server
Demo
Start the stack with docker compose up --build, then open http://localhost:3000. This is the walkthrough, in order:
The chat page lists every MCP tool in the sidebar and offers a few prompts. The status pill says Local tools until
OPENAI_API_KEYis a real key.Choose Roll 2d6 and press Send. The reply includes the roll (
ROLLS: … -> RETURNS: …). Open the Tool: roll_dice trace to see the notation and the same result.In the sidebar, Run tool calls
roll_dicewith the JSON arguments and prints the roll under the form. No model is involved.The API reference is at http://localhost:8000/docs.
POST /api/chatis the route the page uses.
./scripts/verify_docker.sh checks that same dice path without opening a browser.
Architecture
Two processes, one conversation.
flowchart LR
subgraph browser [Browser]
UI["Next.js chat"]
end
subgraph webbox [web container :3000]
Proxy["/backend proxy"]
end
subgraph apibox [api container :8000]
API["FastAPI"]
Local["Local tool router"]
Agent["LangGraph agent"]
Child["MCP server over stdio"]
end
subgraph tools [Tools]
Dice["Dice"]
Web["Web search"]
Social["Social, slides, quotes"]
Hub["GitHub"]
end
subgraph outside [External APIs]
OpenAI["OpenAI"]
Tavily["Tavily"]
Pics["Unsplash or Picsum"]
GitHub["GitHub API"]
end
UI --> Proxy --> API
API --> Local
API --> Agent
Local --> Dice
Local --> Web
Local --> Social
Local --> Hub
Agent --> Child
Agent --> OpenAI
Child --> Dice
Child --> Web
Child --> Social
Child --> Hub
Web --> Tavily
Social --> Pics
Hub --> GitHubThe browser never talks to OpenAI or to the MCP server directly. It calls the Next.js app, which proxies to FastAPI. FastAPI either routes the message itself (local mode) or hands it to the LangGraph agent. The agent spawns run_server.py and speaks MCP over stdin/stdout, which is the same transport Cursor uses.
What happens when you hit Send
sequenceDiagram
participant Person
participant Next as Next.js /backend
participant API as FastAPI
participant Backend as Local router or LangGraph
participant MCP as MCP tools
Person->>Next: POST /backend/api/chat
Next->>API: POST /api/chat
API->>API: Load session history
API->>Backend: chat(message, history)
alt AGENT_MODE=auto and OPENAI_API_KEY is real
Backend->>MCP: stdio tool calls chosen by the model
else No usable OpenAI key
Backend->>MCP: in-process calls from the phrase router
end
MCP-->>Backend: tool text
Backend-->>API: reply and tool traces
API->>API: Append the turn to the session
API-->>Next: JSON
Next-->>Person: Render the reply and tracesLocal mode is a small phrase router, not a model. "Roll 2d6" calls roll_dice. "Create a quote card about shipping" calls create_quote_card. Anything it does not recognize gets a short explanation of what to try. Set a real OPENAI_API_KEY and the LangGraph agent takes over, history included.
Direct tool runs from the sidebar skip the model entirely. POST /api/tools/call executes one registered tool and returns the text.
What you can ask for
Tool | What it does | Something to type |
| D&D-style notation, including keep-highest ( | Roll 2d6 |
| Live search through Tavily | Search the web for AI news |
| Post copy plus an image | Create a LinkedIn post about Python |
| A presentation-sized image | Get a slide image about robots |
| A quote and a background | Create a quote card about shipping |
| Search public GitHub repos | Search GitHub for langgraph |
| Details for | Used by the agent |
| Read a file from a repo | Used by the agent |
| List a directory in a repo | Used by the agent |
| Token and rate-limit status | Used by the agent |
Web search needs TAVILY_API_KEY. Image tools use Unsplash when UNSPLASH_ACCESS_KEY is set, and Lorem Picsum otherwise. GitHub's public API works without a token. A token raises the rate limit and unlocks private repos.
Project layout
.
├── server/ # FastMCP tools
│ ├── main.py # Tool registration and stdio entry
│ ├── dice_roller.py
│ ├── social_content_creator.py
│ └── github_tool.py
├── client/
│ └── langgraph_agent.py # ReAct agent, StateGraph, stdio config
├── api/ # Thin FastAPI layer for the browser
│ ├── app.py # Routes
│ ├── backends.py # Local router and OpenAI agent
│ ├── routing.py # Phrase router used when no model is configured
│ ├── catalog.py # In-process tool calls
│ └── sessions.py # In-memory transcripts
├── web/ # Next.js chat UI
│ ├── app/ # Page, styles, /backend proxy
│ └── components/ # Chat and tool runner
├── tests/ # Pytest, including API and stdio coverage
├── examples/ # Terminal demos
├── run_server.py # MCP server (stdio)
├── run_client.py # Terminal menu for the agent
├── run_api.py # Chat API
├── Dockerfile # API image
├── web/Dockerfile # UI image
├── docker-compose.yml
├── .env.sample # Placeholders only. Copy to .env.
└── PRODUCTIONIZING.md # What to do before this faces the public internetRun it with Docker
This is the path to click around in a browser. You need Docker with Compose. You do not need Python or Node installed on the host.
1. Configure keys
cp .env.sample .envEdit .env if you have keys. The file is gitignored. Placeholder values are safe to leave in place: the app treats your_... as "not configured" and starts in local tool mode.
2. Start the stack
docker compose up --build3. Open the chat
The API is on http://localhost:8000. Interactive docs live at http://localhost:8000/docs.
4. Prove the stack
In another terminal, from the repo root:
./scripts/verify_docker.shThat builds the images, waits until both health checks pass, rolls dice through the API, loads the chat page, calls the UI proxy, and runs pytest inside the API container. It forces AGENT_MODE=local so the check does not spend OpenAI credit.
Stop the stack with docker compose down.
What the containers are doing
apirunsrun_api.pyas a non-root user. On the first LangGraph chat it startspython run_server.pyin the same container and talks MCP over stdio. The child inherits the container environment, including your API keys.webserves the Next.js app. Server-side requests to/backend/*go tohttp://api:8000. Your browser only talks to port 3000, so there is no CORS puzzle for the UI.
AGENT_MODE chooses the brain:
Value | Behavior |
| LangGraph when |
| Always the local router |
| LangGraph only. Chat returns 503 until a real key is set |
Run it without Docker
Python 3.13 or newer, uv, and Node 22.
1. Keys
cp .env.sample .env2. API
uv sync
uv run python run_api.pyThe API listens on port 8000.
3. UI
cd web
npm install
npm run devAPI_INTERNAL_URL in .env defaults to http://127.0.0.1:8000, which is what the Next.js dev server proxies to. Open http://localhost:3000.
Production mode for the UI, still on your machine:
cd web
npm run build
API_INTERNAL_URL=http://127.0.0.1:8000 npm run start4. Tests
uv run pytest tests/ -vTests that call OpenAI are skipped unless OPENAI_API_KEY is a real key. Dice, the HTTP API, the phrase router, and a real stdio MCP session run without any keys.
The original terminal client
Still there, still useful when you want the agent without a browser:
uv run run_server.py # stdio MCP server, for Cursor or a client
uv run run_client.py # menu: examples, interactive chat, ReAct vs StateGraph
uv run pytest tests/ -vrun_client.py needs a real OPENAI_API_KEY. The browser's local mode does not.
How the pieces are built
Tools. Each tool is a function in server/ with an @mcp.tool() decorator in server/main.py. FastMCP publishes them over stdio when you run run_server.py. Tavily and GitHub clients are created only when a call needs them, and placeholder keys from .env.sample are ignored, so importing the server does not crash a fresh clone.
Agent. MCPLangGraphAgent in client/langgraph_agent.py builds a stdio connection, loads the tools through langchain-mcp-adapters, and wraps them in a ReAct agent and a StateGraph. build_mcp_config() is the one place that decides the command. Locally that is uv run run_server.py. In Docker it is python run_server.py, set with MCP_COMMAND and MCP_ARGS. The parent environment is forwarded on purpose: this version of the adapter would otherwise hand the child a process environment that only contains PATH, and the tools would not see your keys.
API. api/app.py exposes:
Method | Path | Purpose |
GET |
| Backend name, readiness, tool count. No secrets. |
GET |
| Names and descriptions for the sidebar |
POST |
| Run one tool with a JSON object of arguments |
POST |
| One user turn. Returns a session id, the reply, and tool traces |
GET |
| Transcript |
DELETE |
| Forget a transcript ("New chat") |
Sessions live in memory inside one process. Restarting the API forgets them. That is called out in PRODUCTIONIZING.md because it is the wrong store for more than one replica.
UI. web/components/chat-app.tsx is the page. It loads health and the tool list together, sends chat through /backend/api/chat, and can run a tool from the sidebar with raw JSON arguments. web/app/backend/[...path]/route.ts proxies those calls. The browser bundle does not contain the API hostname, so changing API_INTERNAL_URL does not require a rebuild.
Add a tool
Write the function under
server/.Register it in
server/main.py:
@mcp.tool()
def my_custom_tool(param: str) -> str:
"""Say what the tool does. The agent reads this."""
return f"Processed: {param}"Teach the local router in
api/routing.pyif the tool should work with no OpenAI key. The LangGraph agent picks up new tools on its next startup without a router change.Add a test in
tests/.The sidebar lists whatever
list_tools()returns, so the UI follows along.
Use it from Cursor
Add this to ~/.cursor/mcp.json and fix the path:
{
"mcpServers": {
"mcp-server": {
"command": "uv",
"args": ["--directory", "/absolute/path/to/this/repo", "run", "run_server.py"]
}
}
}Restart Cursor after saving. The chat UI and Cursor can both use the same server code. They are separate processes.
Call the agent from Python
import asyncio
from client.langgraph_agent import MCPLangGraphAgent
async def main():
agent = MCPLangGraphAgent()
await agent.initialize()
print(await agent.chat("Roll 2d20 and tell me if that is a good omen"))
print(await agent.chat_with_state_graph(
"Research machine learning trends and prepare presentation materials"
))
await agent.close()
asyncio.run(main())chat_detailed() returns the reply plus the tool names, arguments, and results. The HTTP API uses that for the trace panel.
Configuration
.env.sample lists every variable. The ones that matter day to day:
OPENAI_API_KEY=your_openai_api_key_here
TAVILY_API_KEY=your_tavily_api_key_here
UNSPLASH_ACCESS_KEY=your_unsplash_access_key_here
GITHUB_TOKEN=ghp_your_github_personal_access_token_here
AGENT_MODE=auto
OPENAI_MODEL=gpt-4o-mini
API_INTERNAL_URL=http://127.0.0.1:8000GitHub token scopes, if you create one: repo for private repositories, public_repo for public ones. A missing token still allows public reads, within GitHub's unauthenticated rate limit.
Do not commit .env. The sample file is the only env file in git, and its values are placeholders.
Tests
uv run pytest tests/ -vThe suite covers:
Tool registration, dice notation, GitHub responses, and a missing Tavily key (
tests/test_server.py)The phrase router (
tests/test_local_routing.py)HTTP chat, sessions, direct tool calls, and the OpenAI-key fallback (
tests/test_api.py)stdio command construction and tool-trace parsing (
tests/test_agent_config.py)A live stdio child that lists tools and rolls a die (
tests/test_stdio_mcp.py)LangGraph initialization, skipped unless an OpenAI key is present (
tests/test_mcp_integration.py)
./scripts/verify_docker.sh repeats the pytest run inside the API image after the HTTP checks.
Troubleshooting
The chat page says the API is not reachable.
The Next.js process proxies to API_INTERNAL_URL. For npm run dev that should be http://127.0.0.1:8000 and run_api.py should be running. In Compose it is http://api:8000 and it is set for you. Check docker compose ps and docker compose logs api.
Every reply says local mode.
OPENAI_API_KEY is missing or still the placeholder from .env.sample. Put a real key in .env and recreate the container (docker compose up --build) so the API process sees it. GET /health shows "backend": "openai" when the agent path is armed. The first real chat is what opens the connection.
AGENT_MODE=openai and chat returns 503.
That mode refuses to fall back. Either set a real key or switch the mode to auto or local.
Web search says it is unavailable.
Expected without TAVILY_API_KEY. Dice, quotes, slides, and public GitHub search do not need that key. Quotes fall back to a built-in list if the quote service is down.
Docker says the port is in use.
Something else is bound to 3000 or 8000. Stop it, or change the host side of the ports: mapping in docker-compose.yml ("3001:3000" leaves the container port alone).
Cursor does not see the server.
Use an absolute path in mcp.json, confirm uv is on the PATH Cursor inherits, and reload the window. The server speaks stdio, so it will look idle in a terminal until a client connects.
Where this should go next
The Compose file is a local workshop, not a deployment. Sessions are in memory, the tool runner has no auth, and the MCP server is a child process of the API. PRODUCTIONIZING.md is the concrete list: CI, auth, hosting, observability, and how to scale the agent and the tools apart.
License
This project has been described as MIT, and there is no LICENSE file in the tree yet. Add one before you publish a package or image.
Available Tools
10 toolscreate_quote_cardC
Generate a quote card with inspirational text and background image
Inputs: theme. Returns: result
create_social_postB
Generate a social media post with image and text for any topic
Inputs: topic (required), style. Returns: result
get_slide_imageC
Get presentation-ready images for slides and presentations
Inputs: topic (required), size. Returns: result
github_auth_statusA
Check GitHub authentication status and rate limits
Inputs: no named parameters. Returns: result
github_get_file_contentB
Get the content of a specific file from a GitHub repository
Inputs: repo (required), owner (required), file_path (required), branch. Returns: result
github_get_repository_infoC
Get detailed information about a specific GitHub repository
Inputs: repo (required), owner (required). Returns: result
github_list_filesB
List files and directories in a GitHub repository path
Inputs: repo (required), owner (required), path, branch. Returns: result
github_search_repositoriesB
Search for GitHub repositories by query (e.g., 'python machine learning', 'user:microsoft')
Inputs: query (required), limit. Returns: result
roll_diceC
Roll the dice with the given notation
Inputs: notation (required), num_rolls. Returns: result
web_searchC
Search the web for information about the given query
Inputs: query (required). Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 10 tools
Each tool targets a distinct purpose: web search, dice rolling, social post creation, slide image generation, quote card creation, and five distinct GitHub operations (search, repo info, file content, file listing, auth status). No two tools have overlapping functionality, and the GitHub prefix clearly separates those tools from the general utilities.
All tools use lowercase snake_case with a clear verb_noun pattern (e.g., web_search, roll_dice, create_social_post) and GitHub tools consistently use a github_ prefix followed by a verb_noun structure (e.g., github_search_repositories, github_get_file_content). The naming is highly predictable and conventional.
With 10 tools, the server sits comfortably in the ideal 3-15 range. Each tool contributes a unique capability, and the mix of 5 general content/search utilities and 5 GitHub utilities feels reasonably scoped for a multi-purpose server.
The GitHub toolset covers read-only operations and search, but lacks common write operations such as creating issues or pull requests, making it incomplete for full repository management. The general tools are a mixed bag without a coherent domain, leaving obvious gaps (e.g., no generic image generation beyond slides/quote cards). However, the existing tools do cover their immediate stated purposes.
Maintenance
Related MCP Connectors
MCP server connecting AI agents to 100+ apps (Gmail, Slack, Notion, GitHub) via one-click OAuth.
MCP server for building and testing AI agents with multi-model experimentation and insights.
The Remote MCP server acts as a standardized bridge between LLM applications (like Claude, ChatGPT, and Cursor) and external services, enabling AI agents to access external tools and resources. Its primary capability is providing a centralized search tool to discover other MCP servers and their respective tools. Unlike local implementations, it runs remotely with OAuth authentication and permission controls for security.
MCP server for your apps' tools and custom tools, plus hosted AI agents and approval-gated workflows
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceA simple MCP server combining FastMCP and LangGraph that enables AI agent interactions through tools for asking questions to an OpenAI-powered agent and receiving personalized greetings.-
- FlicenseNot gradedqualityDmaintenanceAn MCP server that provides weather and web search tools, orchestrated by a LangGraph agent with OpenAI for natural language interaction.8-
- AlicenseBqualityDmaintenanceExperimental MCP server built with NestJS and LangGraph, enabling tool execution and agent workflows via stdio transport. Supports OpenAI and Ollama models for flexible agent orchestration.4ISC
- FlicenseNot gradedqualityNot gradedmaintenanceAn MCP server integrating LangChain, RAG, and Agent to provide knowledge retrieval and tool invocation through natural language.-