Skip to content

Conversation

@lukasdotcom
Copy link
Member

@lukasdotcom lukasdotcom commented Jul 31, 2025

Exposes an MCP server with all tools that are a function on the route /index.php/apps/app_api/proxy/context_agent/mcp/ when exposed through app api proxy

Notes/WIP

  • This doesn't have auth implemented correctly right now it just trust the user to put the username into the Bearer header. Will change to use app password.
  • Also hope that there is a better way to get the correct nc object for the tools than what is currently in the calendar and files tools otherwise that would need to be copied to all the other tools.
  • Add guide on how to use this (docs) feat: mcp server docs documentation#13491
  • Need to wait for the next release of fastmcp as this uses features that haven't been released yet (Middleware and context).

Have been using https://github.com/modelcontextprotocol/inspector to test it.

Signed-off-by: Lukas Schaefer <[email protected]>
Signed-off-by: Lukas Schaefer <[email protected]>
Signed-off-by: Lukas Schaefer <[email protected]>
@lukasdotcom lukasdotcom marked this pull request as ready for review August 4, 2025 19:00
@lukasdotcom lukasdotcom requested a review from marcelklehr August 5, 2025 12:01
Signed-off-by: Lukas Schaefer <[email protected]>
@lukasdotcom lukasdotcom requested a review from Copilot August 13, 2025 20:04
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds Model Context Protocol (MCP) server functionality to the Nextcloud Context Agent, exposing available tools through a standardized MCP interface for external AI systems to consume.

Key changes:

  • Integrates FastMCP library to create an MCP server with user authentication and dynamic tool loading
  • Adds MCP server routing configuration to expose the server at /mcp endpoint
  • Implements middleware for user authentication and dynamic tool registration

Reviewed Changes

Copilot reviewed 7 out of 9 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
pyproject.toml Adds fastmcp dependency for MCP server functionality
ex_app/lib/mcp_server.py Core MCP server implementation with authentication and tool management
ex_app/lib/main.py Integrates MCP server into main FastAPI application with proper lifecycle management
appinfo/info.xml Configures routing for MCP endpoints through app API proxy
ex_app/lib/tools.py Removes unused import that is no longer needed
ex_app/lib/all_tools/calendar.py Minor formatting change (empty line addition)
ex_app/lib/all_tools/audio2text.py Minor formatting change (empty line addition)

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

Signed-off-by: Lukas Schaefer <[email protected]>
@lukasdotcom lukasdotcom merged commit 49c1df9 into main Aug 25, 2025
4 checks passed
@lukasdotcom lukasdotcom deleted the feat/mcp-server branch August 25, 2025 12:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants