Skip to content

Commit 309870e

Browse files
committed
fix (mcp-enhancement): fixes to merged code for gdocs, gmail and notion mcp servers
1 parent 16801dd commit 309870e

3 files changed

Lines changed: 7 additions & 19 deletions

File tree

src/server/mcp_hub/gdocs/main.py

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,27 @@
11
import os
22
import asyncio
3+
import json
34
from typing import Dict, Any, Optional, List
4-
from qwen_agent.agents import Assistant
5-
from .tools import register_tools
6-
from . import auth, prompts, utils
5+
76
from dotenv import load_dotenv
87
from fastmcp import FastMCP, Context
98
from googleapiclient.errors import HttpError
109

1110

11+
from . import auth, prompts
12+
1213
# --- LLM and Environment Configuration ---
1314
ENVIRONMENT = os.getenv('ENVIRONMENT', 'dev-local')
1415
if ENVIRONMENT == 'dev-local':
1516
dotenv_path = os.path.join(os.path.dirname(__file__), '..', '..', '.env')
1617
if os.path.exists(dotenv_path):
1718
load_dotenv(dotenv_path=dotenv_path)
1819

19-
OPENAI_API_BASE_URL = os.getenv("OPENAI_API_BASE_URL", "http://localhost:11434")
20-
OPENAI_MODEL_NAME = os.getenv("OPENAI_MODEL_NAME", "qwen3:4b")
21-
OPENAI_API_KEY = os.getenv("OPENAI_API_KEY", "ollama")
22-
23-
def get_generator_agent():
24-
"""Initializes a Qwen agent specifically for generating JSON outlines internally."""
25-
llm_cfg = {
26-
'model': OPENAI_MODEL_NAME,
27-
'model_server': f"{OPENAI_API_BASE_URL.rstrip('/')}/v1",
28-
'api_key': OPENAI_API_KEY,
29-
}
30-
return Assistant(llm=llm_cfg, system_message=prompts.JSON_GENERATOR_SYSTEM_PROMPT, function_list=[])
31-
3220
mcp = FastMCP(
3321
name="GDocsServer",
3422
instructions="This server provides tools to create and manage Google Docs.",
3523
)
3624

37-
register_tools(mcp)
38-
3925
@mcp.resource("prompt://gdocs-agent-system")
4026
def get_gdocs_system_prompt() -> str:
4127
"""Provides the system prompt that instructs the main orchestrator agent on how to use the gdocs tools."""

src/server/mcp_hub/gmail/utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,3 +94,4 @@ async def summarize_emails_with_gemini(emails: List[Dict]) -> str:
9494
response = client.generate_content(prompt)
9595
return response.text
9696
except Exception as e:
97+
return {"status": "failure", "error": str(e)}

src/server/mcp_hub/notion/main.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
from typing import Dict, Any, Optional, List
44

55
from dotenv import load_dotenv
6-
from fastmcp import FastMCP, Context, ToolError
6+
from fastmcp import FastMCP, Context
7+
from fastmcp.exceptions import ToolError
78
from fastmcp.prompts.prompt import Message
89
from notion_client.helpers import is_full_page_or_database
910

0 commit comments

Comments
 (0)