MCP Function: how can the documentation can found?

rolsch 2 months ago

From the blog:

MCP service that you can use in ChatGPT and other AI assistants.
For now the only available function is querying the current device position.
This is a very experimental feature.
Please provide feedback on how useful this is and what tools you would like to be available via MCP.

Yes, maybe i search the doc for this feature :-)

rolsch 2 months ago

...and Feedback for MCP:

The possibility for an MCP Service:

Historical routes:
“Show me the trip of device xy on exact date or week or month or last trip...”
"When was my vehicle in city xy"
"When was my vehicle in country xy""

Actual route
"When will vehicle xy reach its home base"
...

Anton Tananaev 2 months ago

The URL for MCP is:

{baseUrl}/api/mcp
SwayDev 2 months ago

Hope its okay to add the question here, in terms of how to configure it.

In ChatGPT while adding a connector after authentication it redirects to this URI.

http://127.0.1.1:8082/api/oidc/authorize?response_type=code&client_id=a

Why is it redirecting a 127.0.1.1,

The configuration is enabled: <entry key='web.mcp.enable'>true</entry>

However, is there something else that needs to be configured as well for the authentication to work, what am I missing please advise.

Anton Tananaev 2 months ago

Probably because you haven't set web.url.

Anton Tananaev 2 months ago

For OAuth to work, you also need to configure client id and client secret. Check config documentation.

Thatguy 23 days ago

Have we got any documentation on how to implement this please?

Anton Tananaev 23 days ago

Which part?

Thatguy 23 days ago

All of it - to make sure I am following it correctly.

I have made changes to the XML by adding.

<entry key='web.mcp.enable'>true</entry>
<entry key='web.url'>https://myurlhere.co.uk</entry>

I have gone to chatgpt and added in the basic details using my actual URL but all I seem to get it a blank white page on the webgui

{baseUrl}/api/mcp

Kind Regards

Anton Tananaev 23 days ago

What is the real URL you're using in ChatGPT?

Thatguy 23 days ago

I am using https://locate.mydomain.co.uk/api/mcp and selecting no auth.

I get the error below but I don't get what authentication it needs as I haven't specified any authentication in the XML file or the chatgpt connector settings just to prove it works

Client error '401 Unauthorized' for url 'https://mydomain.co.uk/api/mcp' For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/401
Anton Tananaev 23 days ago

Why would you select no auth?

Thatguy 23 days ago

I was looking to test it with minimal security which would not be the long term.

So reading above I need to set up using oauth? Have you got a summary of steps to follow to get it working?

Kind Regards

Anton Tananaev 23 days ago

You have to set up oauth. There's no dedicated documentation beyond what you see in this thread and the config doc.

Tronio 17 days ago

If it helps anyone but my setup to try it out with chatGPT was basically this:

in the traccar config have at least this:

<entry key='web.url'>https://someurl.com</entry>
<entry key='openid.clients'>chatgpt-traccar-mcp:secret_to_generate</entry>
<entry key='web.mcp.enable'>true</entry>

and then replace:
https://someurl.com
chatgpt-traccar-mcp:secret_to_generate

with your actual url and then generate a secret to replace secret_to_generate I used this command on my linux machine: openssl rand -hex 32 to generate a random secret

then you input into chatgpt (probably similar with any other mcp setup) the following:

  1. MCP Server URL the url of your traccar server with /api/mcp at the end, example: https://someurl.com/api/mcp
  2. then in the oauth fields put the same as is above in <entry key='openid.clients'>chatgpt-traccar-mcp:secret_to_generate</entry> so as an example put chatgpt-traccar-mcp as the OAuth Client ID and secret_to_generate in OAuth Client Secret field in chatgpt

and here is the thing I was troubleshooting the whole day and is a complete oversight on my part but maybe a friendly suggestion for the future, but you need to be logged into traccar in the same browser session as where you are setting up the mcp in chatgpt. If you are not then it will just return a 401 error.

the suggestions I have for improvement would be:

  1. Some solution if you are not logged into traccar that it will prompt you to log in when setting up
  2. Be able to ask the location of a device with the name and not only the device id
  3. The ability to ask about any reports, maybe summary to start with?
  4. Ask where a device was at a certain point in time