CreateMCPServer["name"]
creates an MCP server based on the current $LLMEvaluator.
CreateMCPServer["name",config]
creates an MCP server from the LLMConfiguration specified by config.
CreateMCPServer
CreateMCPServer["name"]
creates an MCP server based on the current $LLMEvaluator.
CreateMCPServer["name",config]
creates an MCP server from the LLMConfiguration specified by config.
Details
- CreateMCPServer gives an MCPServerObject.
- To use the created MCP server in an external application, use InstallMCPServer.
- CreateMCPServer accepts the following options:
-
OverwriteTarget False whether to overwrite a server of the same name if it exists IncludeDefinitions True whether to automatically include dependencies Initialization None an expression to evaluate when the MCP server starts up
Examples
open all close allNeeds["Wolfram`AgentTools`"]Basic Examples (1)
Create an MCP server from an LLMConfiguration:
config = LLMConfiguration[<|"Tools" -> {LLMTool["PrimeFinder", {"n" -> "Integer"}, Prime[#n]&]}|>]server = CreateMCPServer["My MCP Server", config]Install the server for use in Claude desktop:
InstallMCPServer["ClaudeDesktop", server]Restart Claude desktop and then your tools will now be usable by Claude:
[image]Deleting the server will also automatically uninstall it from Claude desktop:
DeleteObject[server]Options (2)
OverwriteTarget (1)
By default, CreateMCPServer will fail if a server of the same name already exists:
CreateMCPServer["MyServer", <|"Tools" -> {"WolframLanguageEvaluator"}|>]CreateMCPServer["MyServer", <|"Tools" -> {"WolframAlpha"}|>]The existing server is unchanged:
MCPServerObject["MyServer"]["Tools"]Overwrite the existing server with the new one:
CreateMCPServer["MyServer", <|"Tools" -> {"WolframAlpha"}|>, OverwriteTarget -> True]The previous server has been replaced by the new one:
MCPServerObject["MyServer"]["Tools"]DeleteObject[MCPServerObject["MyServer"]]Initialization (1)
Here is a tool that depends on definitions from a paclet:
config = <|"Tools" -> {LLMTool["AddOne", {"n" -> "Integer"}, SamplePublisher`SamplePaclet`AddOne[#n]&]}|>Ensure the paclet is installed and loaded when the server starts:
CreateMCPServer["InitializationTest", config, Initialization :> (
PacletInstall["SamplePublisher/SamplePaclet"]; Needs["SamplePublisher`SamplePaclet`"]
)]DeleteObject[MCPServerObject["InitializationTest"]]Applications (1)
Create a custom MCP server using some of the available predefined tools:
Keys[$DefaultMCPTools]server = CreateMCPServer["WolframNotebooks", <|"Tools" -> {"ReadNotebook", "WriteNotebook"}|>]server["Tools"]DeleteObject[server]