modelcontextprotocol / modelcontextprotocol/python-sdk

Specifying capabilities w/ FastMCP Server

Open
#1,126 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

  • #1043 by @gspencergoog — closed without merging
enhancement needs decision P2 v2
Dominant language
Python
Stars
24.3k
Forks
4k
Avg merge
1d 1h
Merged PRs (30d)
31

Description

Question

I noticed that the FastMCP server does not have the options to manually specify the capabilities of the server, however it is possible to do so with the low-level server.

My current workaround to advertise the capabilities is like so:

mcp = FastMCP("test-server")

# Manually set notification options
lowlevel_server: Server = mcp._mcp_server
lowlevel_server.notification_options.resources_changed = True
lowlevel_server.notification_options.tools_changed = True

# Now, we override the mcp.run()
async def main():
    async with stdio_server() as (r, w):
        init_opts = lowlevel_server.create_initialization_options(
            lowlevel_server.notification_options,
            {}
        )
        await lowlevel_server.run(r, w, init_opts)

if __name__ == "__main__":
    anyio.run(main)

Is there any other way to specify the capabilities of the FastMCP server? Is there a reason not to?

Thanks!

Additional Context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the FastMCP entry point and the low-level Server methods shown in the report: notification_options, create_initialization_options, and run. Determine how FastMCP initialization currently exposes capabilities and define done as allowing those capabilities to be specified without overriding mcp.run().

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.