Skip to content

Commit b29a0c8

Browse files
committed
Initial commit
0 parents  commit b29a0c8

29 files changed

Lines changed: 1926 additions & 0 deletions

‎.DS_Store‎

6 KB
Binary file not shown.

‎Dockerfile‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
FROM python:3.12-slim
2+
3+
WORKDIR /app
4+
5+
# Install dependencies
6+
COPY requirements.txt .
7+
RUN pip install --no-cache-dir -r requirements.txt
8+
9+
# Copy source
10+
COPY . .
11+
12+
# Create reports directory
13+
RUN mkdir -p /app/reports
14+
15+
# Environment — override these at runtime
16+
ENV ANTHROPIC_API_KEY=""
17+
ENV TAVILY_API_KEY=""
18+
ENV GITHUB_TOKEN=""
19+
ENV THINKMCP_REPORTS_DIR="/app/reports"
20+
21+
# Default: expose Streamlit UI on 8501
22+
EXPOSE 8501
23+
24+
# MCP HTTP server on 8000 (used when running as a remote MCP server)
25+
EXPOSE 8000
26+
27+
# Default command: Streamlit UI
28+
# Override with: docker run ... python server/mcp_server.py --http --port 8000
29+
CMD ["streamlit", "run", "app.py", \
30+
"--server.port=8501", \
31+
"--server.address=0.0.0.0", \
32+
"--server.headless=true"]

‎README.md‎

Lines changed: 193 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,193 @@
1+
# ThinkMCP
2+
3+
A thinking-augmented MCP (Model Context Protocol) server that gives Claude deep research and reasoning tools. When connected, Claude can search the web, read URLs, find academic papers, search GitHub, plan multi-step tasks, record thoughts, manage in-session memory, and write reports — all while exposing its reasoning trace.
4+
5+
## What It Is
6+
7+
ThinkMCP wraps 13 tools across four categories into a single MCP server:
8+
9+
| Category | Tools |
10+
|-----------|-------|
11+
| Research | `web_search`, `fetch_url`, `search_papers`, `search_code` |
12+
| Reasoning | `think`, `critique`, `plan` |
13+
| Memory | `remember`, `recall`, `list_memory` |
14+
| Actions | `write_report`, `create_summary`, `compare` |
15+
16+
It ships with two interfaces:
17+
- **Streamlit UI** (`app.py`) — interactive research assistant with visible thinking trace, tool call log, and markdown export
18+
- **MCP server** (`server/mcp_server.py`) — connects directly to Claude Desktop, Cursor, VS Code, or any MCP-compatible host
19+
20+
## Requirements
21+
22+
- Python 3.12+
23+
- `ANTHROPIC_API_KEY` — [console.anthropic.com](https://console.anthropic.com)
24+
- `TAVILY_API_KEY` — [tavily.com](https://tavily.com) (web search)
25+
- `GITHUB_TOKEN` — optional, raises GitHub API rate limits for code search
26+
27+
## Install
28+
29+
```bash
30+
git clone https://github.com/yourname/thinkmcp
31+
cd thinkmcp
32+
python -m venv .venv && source .venv/bin/activate
33+
pip install -r requirements.txt
34+
```
35+
36+
Set your keys:
37+
38+
```bash
39+
export ANTHROPIC_API_KEY="sk-ant-..."
40+
export TAVILY_API_KEY="tvly-..."
41+
export GITHUB_TOKEN="ghp_..." # optional
42+
```
43+
44+
## Run the Streamlit UI
45+
46+
```bash
47+
streamlit run app.py
48+
```
49+
50+
Opens at `http://localhost:8501`. Enter a query, watch thinking steps and tool calls stream in real time, then export the session as markdown or JSON.
51+
52+
## Add to Claude Desktop
53+
54+
1. Find your config file:
55+
- **macOS:** `~/Library/Application Support/Claude/claude_desktop_config.json`
56+
- **Windows:** `%APPDATA%\Claude\claude_desktop_config.json`
57+
58+
2. Add the server block (replace the paths and keys):
59+
60+
```json
61+
{
62+
"mcpServers": {
63+
"thinkmcp": {
64+
"command": "python",
65+
"args": ["/absolute/path/to/thinkmcp/server/mcp_server.py"],
66+
"env": {
67+
"ANTHROPIC_API_KEY": "sk-ant-...",
68+
"TAVILY_API_KEY": "tvly-...",
69+
"GITHUB_TOKEN": "ghp_...",
70+
"THINKMCP_REPORTS_DIR": "/absolute/path/to/thinkmcp/reports"
71+
}
72+
}
73+
}
74+
}
75+
```
76+
77+
3. Restart Claude Desktop. You'll see ThinkMCP listed under connected servers.
78+
79+
## Add to Cursor
80+
81+
1. Open **Cursor Settings** → **MCP** → **Add MCP Server**
82+
2. Paste this config:
83+
84+
```json
85+
{
86+
"mcpServers": {
87+
"thinkmcp": {
88+
"command": "python",
89+
"args": ["/absolute/path/to/thinkmcp/server/mcp_server.py"],
90+
"env": {
91+
"ANTHROPIC_API_KEY": "sk-ant-...",
92+
"TAVILY_API_KEY": "tvly-...",
93+
"GITHUB_TOKEN": "ghp_...",
94+
"THINKMCP_REPORTS_DIR": "/absolute/path/to/thinkmcp/reports"
95+
}
96+
}
97+
}
98+
}
99+
```
100+
101+
3. Save and reload the window.
102+
103+
## Add to VS Code (Copilot / MCP extension)
104+
105+
With the [MCP extension](https://marketplace.visualstudio.com/items?itemName=anthropics.claude-vscode) or a compatible client, add to your `.vscode/mcp.json`:
106+
107+
```json
108+
{
109+
"servers": {
110+
"thinkmcp": {
111+
"type": "stdio",
112+
"command": "python",
113+
"args": ["/absolute/path/to/thinkmcp/server/mcp_server.py"],
114+
"env": {
115+
"ANTHROPIC_API_KEY": "sk-ant-...",
116+
"TAVILY_API_KEY": "tvly-...",
117+
"GITHUB_TOKEN": "ghp_...",
118+
"THINKMCP_REPORTS_DIR": "/absolute/path/to/thinkmcp/reports"
119+
}
120+
}
121+
}
122+
}
123+
```
124+
125+
## Run as Remote HTTP Server
126+
127+
For cloud deployments or multi-client setups, run the Streamable HTTP transport:
128+
129+
```bash
130+
python -m transport.http_transport --host 0.0.0.0 --port 8000
131+
```
132+
133+
The MCP endpoint is at `http://your-host:8000/mcp`.
134+
135+
Then configure your client with type `http` and URL `http://your-host:8000/mcp`.
136+
137+
## Docker
138+
139+
```bash
140+
docker build -t thinkmcp .
141+
```
142+
143+
Run the Streamlit UI:
144+
145+
```bash
146+
docker run -p 8501:8501 \
147+
-e ANTHROPIC_API_KEY="sk-ant-..." \
148+
-e TAVILY_API_KEY="tvly-..." \
149+
-e GITHUB_TOKEN="ghp_..." \
150+
thinkmcp
151+
```
152+
153+
Run the MCP HTTP server instead:
154+
155+
```bash
156+
docker run -p 8000:8000 \
157+
-e ANTHROPIC_API_KEY="sk-ant-..." \
158+
-e TAVILY_API_KEY="tvly-..." \
159+
thinkmcp \
160+
python -m transport.http_transport --port 8000
161+
```
162+
163+
## Project Layout
164+
165+
```
166+
thinkmcp/
167+
├── server/
168+
│ ├── mcp_server.py # FastMCP server, all 13 tools registered
169+
│ └── tools/
170+
│ ├── research.py # web_search, fetch_url, search_papers, search_code
171+
│ ├── reasoning.py # think, critique, plan
172+
│ ├── memory.py # remember, recall, list_memory
173+
│ └── actions.py # write_report, create_summary, compare
174+
├── agent/
175+
│ ├── thinking_agent.py # agentic loop with adaptive thinking
176+
│ ├── tool_executor.py # in-process tool dispatch
177+
│ └── trace_parser.py # extracts thinking/tool blocks from responses
178+
├── transport/
179+
│ ├── stdio_transport.py # stdio launcher (Claude Desktop)
180+
│ └── http_transport.py # Streamable HTTP launcher (remote)
181+
├── app.py # Streamlit UI
182+
├── requirements.txt
183+
├── mcp_config.json # template config for MCP clients
184+
└── Dockerfile
185+
```
186+
187+
## Reports
188+
189+
`write_report` saves markdown files to `THINKMCP_REPORTS_DIR` (default: `./reports/`). Files are timestamped: `report_my_topic_20240507_143022.md`.
190+
191+
## License
192+
193+
MIT

‎agent/__init__.py‎

Whitespace-only changes.
145 Bytes
Binary file not shown.
9.54 KB
Binary file not shown.
3.92 KB
Binary file not shown.
4.96 KB
Binary file not shown.

0 commit comments

Comments
 (0)