phone-a-friend-mcp-server 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,174 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py,cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # UV
98
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ #uv.lock
102
+
103
+ # poetry
104
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
106
+ # commonly ignored for libraries.
107
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108
+ #poetry.lock
109
+
110
+ # pdm
111
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
112
+ #pdm.lock
113
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
114
+ # in version control.
115
+ # https://pdm.fming.dev/latest/usage/project/#working-with-version-control
116
+ .pdm.toml
117
+ .pdm-python
118
+ .pdm-build/
119
+
120
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
121
+ __pypackages__/
122
+
123
+ # Celery stuff
124
+ celerybeat-schedule
125
+ celerybeat.pid
126
+
127
+ # SageMath parsed files
128
+ *.sage.py
129
+
130
+ # Environments
131
+ .env
132
+ .venv
133
+ env/
134
+ venv/
135
+ ENV/
136
+ env.bak/
137
+ venv.bak/
138
+
139
+ # Spyder project settings
140
+ .spyderproject
141
+ .spyproject
142
+
143
+ # Rope project settings
144
+ .ropeproject
145
+
146
+ # mkdocs documentation
147
+ /site
148
+
149
+ # mypy
150
+ .mypy_cache/
151
+ .dmypy.json
152
+ dmypy.json
153
+
154
+ # Pyre type checker
155
+ .pyre/
156
+
157
+ # pytype static type analyzer
158
+ .pytype/
159
+
160
+ # Cython debug symbols
161
+ cython_debug/
162
+
163
+ # PyCharm
164
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
165
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
166
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
167
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
168
+ #.idea/
169
+
170
+ # Ruff stuff:
171
+ .ruff_cache/
172
+
173
+ # PyPI configuration file
174
+ .pypirc
@@ -0,0 +1,15 @@
1
+ repos:
2
+ - repo: https://github.com/astral-sh/ruff-pre-commit
3
+ rev: v0.11.8
4
+ hooks:
5
+ - id: ruff
6
+ args: [--fix]
7
+ - id: ruff-format
8
+
9
+ - repo: https://github.com/pre-commit/pre-commit-hooks
10
+ rev: v5.0.0
11
+ hooks:
12
+ - id: trailing-whitespace
13
+ - id: end-of-file-fixer
14
+ - id: check-yaml
15
+ - id: check-added-large-files
@@ -0,0 +1,27 @@
1
+ # Use a Python image with uv pre-installed
2
+ FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim AS uv
3
+
4
+ WORKDIR /app
5
+
6
+ ENV UV_COMPILE_BYTECODE=1
7
+ ENV UV_LINK_MODE=copy
8
+
9
+ RUN --mount=type=cache,target=/root/.cache/uv \
10
+ --mount=type=bind,source=uv.lock,target=uv.lock \
11
+ --mount=type=bind,source=pyproject.toml,target=pyproject.toml \
12
+ uv sync --frozen --no-install-project --no-dev --no-editable
13
+
14
+ ADD . /app
15
+ RUN --mount=type=cache,target=/root/.cache/uv \
16
+ uv sync --frozen --no-dev --no-editable
17
+
18
+ FROM python:3.12-slim-bookworm
19
+
20
+ WORKDIR /app
21
+
22
+ COPY --from=uv /root/.local /root/.local
23
+ COPY --from=uv --chown=app:app /app/.venv /app/.venv
24
+
25
+ ENV PATH="/app/.venv/bin:$PATH"
26
+
27
+ ENTRYPOINT ["python", "-m", "phone_a_friend_mcp_server"]
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Abhishek
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,320 @@
1
+ Metadata-Version: 2.4
2
+ Name: phone-a-friend-mcp-server
3
+ Version: 0.1.0
4
+ Summary: MCP Server for Phone-a-Friend assistance
5
+ Project-URL: GitHub, https://github.com/abhishekbhakat/phone-a-friend-mcp-server
6
+ Project-URL: Issues, https://github.com/abhishekbhakat/phone-a-friend-mcp-server/issues
7
+ Author-email: Abhishek Bhakat <abhishek.bhakat@hotmail.com>
8
+ License-Expression: MIT
9
+ License-File: LICENSE
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Operating System :: OS Independent
12
+ Classifier: Programming Language :: Python :: 3.10
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Requires-Python: >=3.11
16
+ Requires-Dist: aiofiles>=24.1.0
17
+ Requires-Dist: aiohttp>=3.12.7
18
+ Requires-Dist: click>=8.2.1
19
+ Requires-Dist: mcp>=1.9.2
20
+ Requires-Dist: pydantic-ai-slim[anthropic,google,openai]>=0.2.14
21
+ Requires-Dist: pydantic>=2.11.5
22
+ Requires-Dist: pyyaml>=6.0.0
23
+ Provides-Extra: dev
24
+ Requires-Dist: build>=1.2.2.post1; extra == 'dev'
25
+ Requires-Dist: pre-commit>=4.2.0; extra == 'dev'
26
+ Requires-Dist: pytest-asyncio>=0.26.0; extra == 'dev'
27
+ Requires-Dist: pytest-mock>=3.14.1; extra == 'dev'
28
+ Requires-Dist: pytest>=8.3.4; extra == 'dev'
29
+ Requires-Dist: ruff>=0.11.12; extra == 'dev'
30
+ Description-Content-Type: text/markdown
31
+
32
+ # Phone-a-Friend MCP Server 🧠📞
33
+
34
+ An AI-to-AI consultation system that enables one AI to "phone a friend" (another AI) for critical thinking, long context reasoning, and complex problem solving via OpenRouter.
35
+
36
+ ## The Problem 🤔
37
+
38
+ Sometimes an AI encounters complex problems that require:
39
+ - **Deep critical thinking** beyond immediate capabilities
40
+ - **Long context reasoning** with extensive information
41
+ - **Multi-step analysis** that benefits from external perspective
42
+ - **Specialized expertise** from different AI models
43
+
44
+ ## The Solution �
45
+
46
+ Phone-a-Friend MCP Server creates a **two-step consultation process**:
47
+
48
+ 1. **Context + Reasoning**: Package all relevant context and send to external AI for deep analysis
49
+ 2. **Extract Actionable Insights**: Process the reasoning response into usable format for the primary AI
50
+
51
+ This enables AI systems to leverage other AI models as "consultants" for complex reasoning tasks.
52
+
53
+ ## Architecture 🏗️
54
+
55
+ ```
56
+ Primary AI → Phone-a-Friend MCP → OpenRouter → External AI (GPT-4, Claude, etc.) → Processed Response → Primary AI
57
+ ```
58
+
59
+ **Sequential Workflow:**
60
+ 1. `analyze_context` - Gather and structure all relevant context
61
+ 2. `get_critical_thinking` - Send context to external AI via OpenRouter for reasoning
62
+ 3. `extract_actionable_insights` - Process response into actionable format
63
+
64
+ ## When to Use 🎯
65
+
66
+ **Ideal for:**
67
+ - Complex multi-step problems requiring deep analysis
68
+ - Situations needing long context reasoning (>100k tokens)
69
+ - Cross-domain expertise consultation
70
+ - Critical decision-making with high stakes
71
+ - Problems requiring multiple perspectives
72
+
73
+ **Not needed for:**
74
+ - Simple factual questions
75
+ - Basic reasoning tasks
76
+ - Quick responses
77
+ - Well-defined procedural tasks
78
+
79
+ ## Installation 🚀
80
+
81
+ 1. Clone the repository:
82
+ ```bash
83
+ git clone https://github.com/abhishekbhakat/phone-a-friend-mcp-server.git
84
+ cd phone-a-friend-mcp-server
85
+ ```
86
+
87
+ 2. Install dependencies:
88
+ ```bash
89
+ uv pip install -e .
90
+ ```
91
+
92
+ 3. Configure your preferred AI provider:
93
+
94
+ **OpenRouter (recommended - access to multiple models):**
95
+ ```bash
96
+ export OPENROUTER_API_KEY="your-openrouter-key"
97
+ # Model will auto-select based on provider
98
+ ```
99
+
100
+ **OpenAI:**
101
+ ```bash
102
+ export OPENAI_API_KEY="your-openai-key"
103
+ # Uses latest available model by default
104
+ ```
105
+
106
+ **Anthropic:**
107
+ ```bash
108
+ export ANTHROPIC_API_KEY="your-anthropic-key"
109
+ # Uses latest available model by default
110
+ ```
111
+
112
+ **Google/Gemini:**
113
+ ```bash
114
+ export GOOGLE_API_KEY="your-google-key" # or GEMINI_API_KEY
115
+ # Uses latest available model by default
116
+ ```
117
+
118
+ ## Usage 💡
119
+
120
+ ### Command Line
121
+ ```bash
122
+ # Start the server
123
+ phone-a-friend-mcp-server
124
+
125
+ # With verbose logging
126
+ phone-a-friend-mcp-server -v
127
+
128
+ # With specific provider (uses optimal model automatically)
129
+ phone-a-friend-mcp-server --provider anthropic
130
+ phone-a-friend-mcp-server --provider google
131
+
132
+ # Override with custom model if needed
133
+ phone-a-friend-mcp-server --provider anthropic --model "your-preferred-model"
134
+ ```
135
+
136
+ ### Environment Variables
137
+ ```bash
138
+ # Auto-detects provider based on available API keys
139
+ export OPENROUTER_API_KEY="your-openrouter-key" # Preferred
140
+ export OPENAI_API_KEY="your-openai-key" # Default fallback
141
+ export ANTHROPIC_API_KEY="your-anthropic-key" # Direct Anthropic
142
+ export GOOGLE_API_KEY="your-google-key" # Google/Gemini
143
+
144
+ # Optional overrides (only if you want to override auto-selection)
145
+ export PHONE_A_FRIEND_MODEL="your-preferred-model"
146
+ export PHONE_A_FRIEND_PROVIDER="your-preferred-provider"
147
+ ```
148
+
149
+ ## Model Selection 🤖
150
+
151
+ The system automatically selects the most capable model for each provider:
152
+ - **OpenAI**: Latest reasoning model
153
+ - **Anthropic**: Latest Claude model
154
+ - **Google**: Latest Gemini Pro model
155
+ - **OpenRouter**: Access to latest models from all providers
156
+
157
+ You can override the auto-selection by setting `PHONE_A_FRIEND_MODEL` environment variable or using the `--model` CLI option.
158
+
159
+ ## Available Tools 🛠️
160
+
161
+ ### phone_a_friend
162
+ Consult an external AI for critical thinking and complex reasoning via OpenRouter.
163
+
164
+ **IMPORTANT:** The external AI is very smart but has NO MEMORY of previous conversations.
165
+ The quality of the response depends ENTIRELY on the quality and completeness of the context you provide.
166
+
167
+ **Parameters:**
168
+ - `all_related_context` (required): ALL context directly related to the problem. Include:
169
+ - Background information and history
170
+ - Previous attempts and their outcomes
171
+ - Stakeholders and their perspectives
172
+ - Constraints, requirements, and limitations
173
+ - Current situation and circumstances
174
+ - Any relevant data, metrics, or examples
175
+ - Timeline and deadlines
176
+ - Success criteria and goals
177
+
178
+ - `any_additional_context` (optional): ANY additional context that might be helpful. Include:
179
+ - Relevant documentation, specifications, or guidelines
180
+ - Industry standards or best practices
181
+ - Similar cases or precedents
182
+ - Technical details or domain knowledge
183
+ - Regulatory or compliance requirements
184
+ - Tools, resources, or technologies available
185
+ - Budget or resource constraints
186
+ - Organizational context or culture
187
+
188
+ - `task` (required): The specific task or question for the external AI. Be clear about:
189
+ - What exactly you need help with
190
+ - What type of analysis or reasoning you want
191
+ - What format you prefer for the response
192
+ - What decisions need to be made
193
+ - What problems need to be solved
194
+
195
+ **Example Usage:**
196
+ ```
197
+ all_related_context: "We're a SaaS startup with 50 employees. Our customer churn rate increased from 5% to 12% over the last quarter. We recently changed our pricing model and added new features. Customer support tickets increased 40%. Our main competitors are offering similar features at lower prices."
198
+
199
+ any_additional_context: "Industry benchmark for SaaS churn is 6-8%. Our pricing increased by 30%. New features include AI analytics and advanced reporting. Customer feedback mentions complexity and cost concerns."
200
+
201
+ task: "Analyze the churn increase and provide a comprehensive action plan to reduce it back to 5% within 6 months. Include specific strategies, timeline, and success metrics."
202
+ ```
203
+
204
+ The system will automatically route this to the most capable AI model available based on your configured provider.
205
+
206
+ ## Claude Desktop Configuration 🖥️
207
+
208
+ To use Phone-a-Friend MCP server with Claude Desktop, add this configuration to your `claude_desktop_config.json` file:
209
+
210
+ ### Configuration File Location
211
+ - **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
212
+ - **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
213
+
214
+ ### Configuration
215
+
216
+ **Option 1: Using uv (Recommended)**
217
+ ```json
218
+ {
219
+ "mcpServers": {
220
+ "phone-a-friend": {
221
+ "command": "uvx",
222
+ "args": [
223
+ "run",
224
+ "--refresh",
225
+ "phone-a-friend-mcp-server",
226
+ ],
227
+ "env": {
228
+ "OPENROUTER_API_KEY": "your-openrouter-api-key",
229
+ "PHONE_A_FRIEND_MODEL": "anthropic/claude-4-opus"
230
+ }
231
+ }
232
+ }
233
+ }
234
+ ```
235
+
236
+ ### Environment Variables in Configuration
237
+
238
+ You can configure different AI providers directly in the Claude Desktop config:
239
+
240
+ ```json
241
+ {
242
+ "mcpServers": {
243
+ "phone-a-friend": {
244
+ "command": "phone-a-friend-mcp-server",
245
+ "env": {
246
+ "OPENROUTER_API_KEY": "your-openrouter-api-key",
247
+ "PHONE_A_FRIEND_MODEL": "anthropic/claude-4-opus"
248
+ }
249
+ }
250
+ }
251
+ }
252
+ ```
253
+
254
+ **Alternative Providers:**
255
+ ```json
256
+ {
257
+ "mcpServers": {
258
+ "phone-a-friend-openai": {
259
+ "command": "phone-a-friend-mcp-server",
260
+ "env": {
261
+ "OPENAI_API_KEY": "your-openai-api-key"
262
+ }
263
+ },
264
+ "phone-a-friend-anthropic": {
265
+ "command": "phone-a-friend-mcp-server",
266
+ "env": {
267
+ "ANTHROPIC_API_KEY": "your-anthropic-api-key"
268
+ }
269
+ },
270
+ "phone-a-friend-google": {
271
+ "command": "phone-a-friend-mcp-server",
272
+ "env": {
273
+ "GOOGLE_API_KEY": "your-google-api-key"
274
+ }
275
+ }
276
+ }
277
+ }
278
+ ```
279
+
280
+ ### Setup Steps
281
+
282
+ 1. **Install Phone-a-Friend MCP Server** (see Installation section above)
283
+ 2. **Open Claude Desktop Settings** → Developer → Edit Config
284
+ 3. **Add the configuration** (choose one of the options above)
285
+ 4. **Replace paths and API keys** with your actual values
286
+ 5. **Restart Claude Desktop**
287
+ 6. **Look for the 🔨 hammer icon** in the input box to confirm the server is connected
288
+
289
+ ### Troubleshooting
290
+
291
+ If the server doesn't appear in Claude Desktop:
292
+
293
+ 1. **Check logs**:
294
+ - macOS: `~/Library/Logs/Claude/mcp*.log`
295
+ - Windows: `%APPDATA%\Claude\logs\mcp*.log`
296
+
297
+ 2. **Verify paths** are absolute and correct
298
+ 3. **Test manually** in terminal:
299
+ ```bash
300
+ phone-a-friend-mcp-server -v
301
+ ```
302
+ 4. **Restart Claude Desktop** completely
303
+ 5. **Check API keys** are valid and have sufficient credits
304
+
305
+ ## Development 🔧
306
+
307
+ ### Running Tests
308
+ ```bash
309
+ pytest
310
+ ```
311
+
312
+ ### Code Formatting
313
+ ```bash
314
+ ruff format .
315
+ ruff check .
316
+ ```
317
+
318
+ ## License 📄
319
+
320
+ MIT License - see LICENSE file for details.